Giter VIP home page Giter VIP logo

ndn.p4's Introduction

Requirements
-----------------------------------------

- Minindn (The demo was tested on mininet ver 2.2.1 and mini-ndn version 0.1.1)
Download minindn at https://github.com/named-data/mini-ndn
You can follow the instructions in the INSTALL.md of the minindn package that lists all the required packages on your machine. Typically, you need to have a working NDN environment, e.g., NFD, NLSR and some ndn utilities (in particular, ndnpoke and ndnpeek must be installed in the system to run successfully our illustrative test. Those utilities are part of the NDN essential tools package).

- P4 bmv2 a.k.a. P4 software-switch
You may avoid downloading and running a P4 compiler for the bmv2 target, because a compiled version in json format of the ndn_router.p4 source files is shipped with this software. However, you need to download and compile the P4 bmv2.
Download the bmv2 at https://github.com/p4lang/behavioral-model and follow instructions therein.

- crcmod library: a pure-Python implementation of CRC32C
The createFIBrules.py python script computes crc32 sums of names and name components. The instructions to install the library depend on your operating systems. On Debian-based OSes, the following steps should do the job:
$ sudo apt-get install gcc python-dev python-setuptools
$ sudo easy_install -U pip
$ sudo pip install -U crcmod


Changes to mini-ndn
-----------------------------------------
Follows a quick description of the changes and adds applied to the minindn installation. Further explanation of the patch files is included in a README within the subdir mini-ndn.

The nlsr is commented out and not launched at boot on the ndn nodes.

Some settings imported from the p4_mininet test environemnt are applied to the ndn hosts in file in ndn_host.py

Those changes are included as two different patch files in NDN.p4 The file 'mini-ndn.patch' must be applied to the main dir of mini-ndn. While the file ndn_dir.patch must be applied to the ndn directory. This can be done as follows:
cd $MININDN_DIR; patch -p1 < $NDNP4_DIR/mini-ndn/mini-ndn.patch
cd $MININDN_DIR; patch -p1 < $NDNP4_DIR/mini-ndn/ndn_dir.patch

Additional files to be included in mini-ndn
------------------------------------------
The variable $MININDN_DIR is a placeholder for the mini-ndn home directory in your system.

- $MININDN_DIR/ndn/experiments/my_experiment.py : it describes a basic experiment to be run in the topology. The experiment consists of two nodes exchanging an Interest and a Data packet by using ndnpeek and ndnpoke application. The code is pretty easy to follow. It includes some set-up to be done for the first node, on which some routes need to be installed. Then, in the run method the ndnpeek and ndnpoke calls are instantiated on different host nodes.

- $MININDN_DIR/ndn/ndnP4_demo.py : this file is provided within the p4-lang repository by Barefoot Networks. It's not actually in use, but it has been included to track some code that has been leveraged in our mininet setup.

- $MININDN_DIR/ndn/p4_mininet.py : the template this file is based on is likely the bmv2/mininet/p4_mininet.py. However, it includes more things. First, there is a parseConfig method to read and parse the attributes specified in the p4-switch.conf. While in the original file, P4Switch's arguments were passed as parameters to the class constructor. Second, there is a method that fills the P4-switch's tables. Third, the original version of this file defined classes P4Host and P4Switch, now it defines only a custom version of P4Switch, since the ndn node class is used to instantiate hosts. 

- $MININDN_DIR/p4-switch.conf : it includes arguments that are usually passed to the switch executable as well as the path to the executable itself. The minindn bin script looks for this file in /usr/local/etc/mini-ndn/; so you must either copy the file in such directory or copy to a different directory and specify the absolute path of that directory through the "--p4-dir" optional argument.

P4 switch configuration file
-----------------------------------------
The "p4-switch.conf" file contains arguments loaded by the experiment at run-time that are used to tailor the p4-switch behavior. You MUST edit it in order to modify the paths to files on your file system. Every line contains a small comment after the semicolon explaining the field meaning.
You must either copy "p4-switch.conf" to "/usr/local/etc/mini-ndn/" or copy to a different directory and specify the absolute path of that directory through the "--p4-dir" optional argument.

IMPORTANT - MUST BE DONE: you must write the appropriate paths in your system for the following attributes: exe, cli, json, commands.


Experiment topology description
-----------------------------------------
The simple topology used for this experiment is described in the p4.ndn.basic.conf. It consists of two hosts running NFD and a switch connecting them which runs the ndn_router.p4 program.


Configuration file for NFD
----------------------------------------
The directory includes the configuration file used for the experiment, while it is not mandatory to use the same configuration file, it is recommended for people who don't know how to troubleshoot problems with the NFD. If there exists some configuration parameter which is not supported in your system, the NFD may crash and so the experiment fails.

Translate your own rule-set
---------------------------------------
Human-readable prefixes must be translated in p4-switch's rule by the createFIBrules.py script. As an example, we have included an incomplete "ndn_commands.partial.txt" rule-set that has all the forwarding plane rules except the FIB's ones. In addition to that, there is a bare simple illustrative file "fib.txt" that includes three rules (syntax: prefix output_interface). To convert those rules to commands that can be used to fill the p4-switch's FIB, you may proceed as follows:

python createFIBrules.py --fib fib.txt --cmd ndn_commands.partial.txt -c 5

The '-c' specifies what is the maximum number of name components the switch is able to parse in NDN packets. In our code this is a constant in the *.p4 files which is set to 5. If you want to change this value, you need to modify the source files and compile them again to generate a new json file to be loaded by the p4-switch.

The rules contained in fib.txt are translated into commands and appended to the ndn_commands.partial.txt. Then, this file has to be linked into the p4-switch.conf under the attribute "commands" as follows 

commands: $ABSOLUTE_PATH/ndn_commands.partial.txt ; Path to the control plane rules as to fill the switch's tables

Start the experiment
-----------------------------------------
1 - Generate ndn_router.json or copy the one provided with this software bundle in the directory specified in the p4-switch.conf.
2 - Write the right paths of tools and configuration files in your system
3 - Create the commands to fill the switch's tables as explained in the previous section "Translate your own rule-set"
4 - sudo minindn $MININDN/p4.ndn.basic.conf --experiment=P4_NDN_experiment --p4

Few seconds after the experiment is started, you are prompted to the mininet CLI. If the experiment was run successfully, you should have the content "Hello world" written in the file /tmp/a/packetPayload.txt. The text is the payload of the content object retrieved by node 'a' through the ndnpeek utility and provided by node 'b' through the ndnpoke utility.
You can check how NDN packets are processed by the p4 switch, which runs the ndn_router.p4 program, by looking at the log in 'p4s.s1.log'.

How to cite this work
-----------------------------------------
If you are referring to NDN.p4 in a published work, please cite the following paper, not just this github repository. Thank you!

Salvatore Signorello, Radu State, Jerome Francois, Olivier Festor, "NDN.p4: Programming Information-Centric Data-Planes", Proceedings of the IEEE International Workshop on Open-Source Software Networking at NetSoft2016, Jun 2016, Seoul, South Korea.

ndn.p4's People

Contributors

signorello avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ndn.p4's Issues

I don't understand the output of P4_NDN_experiment,help!

Hi,signorello .
Fortunately, I successfully installed the mini-ndn v0.1.1,and the next steps.
when I use: sudo minindn ~/bishe/mini-ndn/p4.ndn.basic.conf –experiment=P4_NDN_experiment --p4

the output as follows:
Parse of /home/zdd/bishe/mini-ndn/p4.ndn.basic.conf done.
*** Creating network
*** Adding controller
*** Adding hosts:
a b
*** Adding switches:
s1
*** Adding links:
(a, s1) (b, s1)
*** Configuring hosts
a b
Setup time: 0
Reading config file /usr/local/etc/mini-ndn//p4-switch.conf
/home/zdd/bishe/bmv2/targets/simple_switch/simple_switch /home/zdd/bishe/bmv2/targets/simple_switch/runtime_CLI /home/zdd/bishe/NDN.p4/p4src/ndn_router.json l3 9090 True True /home/zdd/bishe/NDN.p4/ndn_commands.partial.txt
P4 setting for host a
Starting NFD on host aa
P4 setting for host b
Starting NFD on host bb
*** Starting controller
c0
*** Starting 1 switches
s1 Starting P4 switch s1
/home/zdd/bishe/bmv2/targets/simple_switch/simple_switch -i 1@s1-eth1 -i 2@s1-eth2 --pcap --thrift-port 9090 --nanolog ipc:///tmp/bm-0-log.ipc --log-console --device-id 0 /home/zdd/bishe/NDN.p4/p4src/ndn_router.json
Disable IPv6 forwarding on the P4Switch
switch has been started
Filling switch tables using /home/zdd/bishe/NDN.p4/ndn_commands.partial.txt
Control utility for runtime P4 table manipulation
RuntimeCmd: Setting default action of count_table
action: storeNumOfComponents
runtime data: 00
RuntimeCmd: Adding entry to exact match table count_table
match key: VALID- VALID- VALID- VALID- VALID-
action: storeNumOfComponents
runtime data: 01
Entry has been added with handle 0
RuntimeCmd: Adding entry to exact match table count_table
match key: VALID- VALID- VALID- VALID- VALID-
action: storeNumOfComponents
runtime data: 02
Entry has been added with handle 1
RuntimeCmd: Adding entry to exact match table count_table
match key: VALID- VALID- VALID- VALID- VALID-
action: storeNumOfComponents
runtime data: 03
Entry has been added with handle 2
RuntimeCmd: Adding entry to exact match table count_table
match key: VALID- VALID- VALID- VALID- VALID-
action: storeNumOfComponents
runtime data: 04
Entry has been added with handle 3
RuntimeCmd: Adding entry to exact match table count_table
match key: VALID- VALID- VALID- VALID- VALID-
action: storeNumOfComponents
runtime data: 05
Entry has been added with handle 4
RuntimeCmd: Setting default action of hashName_table
action: computeStoreTablesIndex
runtime data:
RuntimeCmd: Adding entry to exact match table pit_table
match key: EXACT-05
action: readPitEntry
runtime data:
Entry has been added with handle 0
RuntimeCmd: Adding entry to exact match table pit_table
match key: EXACT-06
action: cleanPitEntry
runtime data:
Entry has been added with handle 1
RuntimeCmd: Setting default action of fib_table
action: _drop
runtime data:
RuntimeCmd: Adding entry to exact match table updatePit_table
match key: EXACT-01
action: updatePit_entry
runtime data:
Entry has been added with handle 0
RuntimeCmd: Adding entry to exact match table updatePit_table
match key: EXACT-00
action: _drop
runtime data:
Entry has been added with handle 1
RuntimeCmd: Adding entry to exact match table routeData_table
match key: EXACT-01
action: setOutputIface
runtime data: 00:00
Entry has been added with handle 0
RuntimeCmd: Adding entry to exact match table routeData_table
match key: EXACT-02
action: setOutputIface
runtime data: 00:01
Entry has been added with handle 1
RuntimeCmd: Setting default action of routeData_table
action: _drop
runtime data:
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-03 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00TERNARY-7e:de &&& ff:ff TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:02
Entry has been added with handle 0
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-04 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00TERNARY-7e:de &&& ff:ff TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:02
Entry has been added with handle 1
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-05 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00TERNARY-7e:de &&& ff:ff TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:02
Entry has been added with handle 2
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-02 TERNARY-00:00 &&& 00:00 TERNARY-e7:30 &&& ff:ffTERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:03
Entry has been added with handle 3
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-03 TERNARY-00:00 &&& 00:00 TERNARY-e7:30 &&& ff:ffTERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:03
Entry has been added with handle 4
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-04 TERNARY-00:00 &&& 00:00 TERNARY-e7:30 &&& ff:ffTERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:03
Entry has been added with handle 5
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-05 TERNARY-00:00 &&& 00:00 TERNARY-e7:30 &&& ff:ffTERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:03
Entry has been added with handle 6
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-01 TERNARY-9c:dd &&& ff:ff TERNARY-00:00 &&& 00:00TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:04
Entry has been added with handle 7
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-02 TERNARY-9c:dd &&& ff:ff TERNARY-00:00 &&& 00:00TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:04
Entry has been added with handle 8
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-03 TERNARY-9c:dd &&& ff:ff TERNARY-00:00 &&& 00:00TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:04
Entry has been added with handle 9
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-04 TERNARY-9c:dd &&& ff:ff TERNARY-00:00 &&& 00:00TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:04
Entry has been added with handle 10
RuntimeCmd: Adding entry to ternary match table fib_table
match key: EXACT-05 TERNARY-9c:dd &&& ff:ff TERNARY-00:00 &&& 00:00TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00 TERNARY-00:00 &&& 00:00
action: set_egr
runtime data: 00:04
Entry has been added with handle 11
RuntimeCmd:
I don't start the NLSR daemon on the host
I don't start the NLSR daemon on the host
*** Starting CLI:
mininet> exit
*** Stopping 1 controllers
c0
*** Stopping 2 links
..
*** Stopping 1 switches
s1 ..
*** Stopping 2 hosts
a b
*** Done

Does this means the experiment was successful ? I found the issue 3(#3) it mentioned:
!#
Hello Salvatore,
I applied the last changes and commits,
I removed mini-ndn and installed it again and applied the changed patch files and so the problem is solved and "Hello World" is printed in packetpayload.txt.
Thank you very much for your help
!#

what is packetpayload.txt? where can I find it ? If can't, Is there any other output of for this experiment?
looking forward to your reply,thanks.

I will post my experimental steps later,for other's reference.

Try to modify the topology of the experiment,help!

Hi,signorello.
I successfully run your experiment,and get the correct result:"Hello World " in the packetPayload.txt.
then I try to modify the topology of the experiment.
my ultimate goal is to add nodes in the experimental topology,and I start with the simple change.
simply change,I try to modify the name of host,change 'a' to 'c' ,change 'b' to 'd'. my step is as follows:
1)modify the topology of p4.ndn.basic.conf,change 'a' to 'c' ,change 'b' to 'd'.
2)modify the code of my_experiment.py,change 'a' to 'c' ,change 'b' to 'd'.
through those, but I can't get the correct result. packetPayload.txt does not exist.
and I also notice that when i change the name of host, the terminal output is different.and the difference is :
Loading experiment: P4_NDN_experiment
Printing eth0 faceID: 257

when i change the name of host ,Printing eth0 faceID: 257 is never shown.
just take a look at my next post which shows the terminal output.
can you tell me if I want to change the name of host and run experiment sucessfully,what else i should do ?please help me fix this.
thanks.

Index Error in p4src/includes/actions.p4

In p4src/includes/actions.p4,

action cleanPitEntry() {
    readPit();
    register_write (pit_r,0x00,name_metadata.name_hash);
}

it seems that it should be register_write (pit_r,name_metadata.name_hash,0x00);.

mini-ndn v0.1.1 install error

i notice the mini-ndn should be 0.1.1 of version ,and i follow the instruction from :https://github.com/named-data/mini-ndn/blob/v0.1.1/INSTALL.md to install mini-ndn v0.1.1.
my step is as follows:
(1)i clone the mini-ndn v0.1.1
(2)use the code : $ sudo ./install.sh -mrfti to install mini-ndn
(3)try to verficate the mini-ndn is well :
sudo minindn --pingall 50 --ctime 180 ndn_utils/hyperbolic_conf_file/minindn.caida.conf
but ,i got a lot of error.

the I change my step:
(1)i clone the mini-ndn v0.1.1
(2)i install the dependencies one by one,such as NFD,NLSR,ndn-tools
(3)use the code : $ sudo ./install.sh -i to install mini-ndn
(4)try to verficate the mini-ndn is well :
sudo minindn --pingall 50 --ctime 180 ndn_utils/hyperbolic_conf_file/minindn.caida.conf
also ,i got a lot of error.

can you help me to fix this ? i am a new fresh to this ,if you can help,i will really appreciate it.

thank you,sincerely!

minindn issue

Hello Salvatore,

(I found your posts in Issues #1 - #3 very useful. Thanks)
I could fortunately find/solve the thrift problem in "Issue 3", but still need your immediate help to fix the last-stage problems and run your experiment.
Actually, the problem with thrift is that it searches for file "ndn_router.json" which does not exist in your folder p4src. I have generated it using
p4c-bmv2 --json JSON ndn_router.p4
and the error has gone.

Now, to be on the same page, please first take a look at my next post which shows the terminal output.
As you can see, the current issue is that
...... "I don't start the application" ....
(I am not sure this shows a problem, or only a message that you simply print in the output)
I also tested ping in the command line; it is not working because "network is unreachable".
Moreover, the file /tmp/a/packetPayload.txt is empty, which shows that the experiment could not run completely and successfully.

As I checked, even from outside your experiment, nfd is working well (by nfd-start and nfd-stop), mininet is working well (by mn -c and mn --test=pingall), but minindn is not working if "I don't start the application" shows an issue (this surely happens after running your two patch files. ); if not, I have no idea how to test minindn and/or what the problem is.

For double-checking (and also help the others to run your experiment), I
1- installed Ubuntu 14.04.5 LTS, and full packages of NDN and P4 (while running minindn v0.1.1).
2- run your two patch files in my main minindn directory
cd $MININDN_DIR; patch -p1 < $NDNP4_DIR/mini-ndn/mini-ndn.patch
cd $MININDN_DIR; patch -p1 < $NDNP4_DIR/mini-ndn/ndn_dir.patch
I also copied all your minindn directory files ($NDNP4_DIR/mini-ndn) to my main mininndn directory (in both $MININDN_DIR and $MININDN_DIR/ndn)
and then reinstalled minindn by ./install.sh -i
3- modified the paths in "p4-switch.conf" and copied it to "/usr/local/etc/mini-ndn/"
4- run python createFIBrules.py --fib fib.txt --cmd ndn_commands.partial.txt -c 5
5- generated json file to fix the thrift error using p4c-bmv2 --json JSON ndn_router.p4
6- run your experiment by
sudo minindn $MININDN/p4.ndn.basic.conf --experiment=P4_NDN_experiment --p4
...

I'd really appreciate it if you could
1- check all the steps as well as my next post to verify them (and let me know if I missed something to do),
2- check that you have uploaded all the required files for running your experiment.
Moreover, please let me know
3- does that message show a minindn issue? if not, how can I test minindn, and what is the problem?
4- should I use your "nfd.conf" uploaded in your main folder in anyway? (I tried to copy it to /usr/local/etc/ndn, but as I checked, after this commands nfd-start/stop is not working! I also tried to copy to /usr/local/etc/mini-ndn, but I found that nfd.conf in this folder is always replaced by running minindn, so I could not use your nfd.conf in this way as well).
FYI, as you mentioned in Issue #1, I also disabled all 3 IPv6 lines in /usr/local/etc/ndn/nfd.config (by "enable_v6 no;"); nothing new happens and still packetPayload.txt is empty! Should I apply more changes?

and finally help me to find and fix the problem.

Thanks.
Hamed

Change to nfd.conf

I have noticed that the format may be evolving from one NFD to a next one, so it would be better to apply the necessary changes to that file by means of a simple script rather than keeping a config file in the repository. In fact, an older nfd.conf may cause the NFD to crash because of an unrecognized option not anymore supported and parsed.

版本

版本发生重大变化,请及时更新

Getting result of the p4.basic experiment

Hello,

I have exactly followed your instructions/steps in https://github.com/signorello/NDN.p4
and encountered two problems while using the following code:
sudo minindn $MININDN/p4.ndn.basic.conf --experiment=P4_NDN_experiment --p4

  1. I get the following error:
    minindn: error: unrecognized arguments: --p4

  2. and if I remove --p4 and use
    sudo minindn $MININDN/p4.ndn.basic.conf --experiment=P4_NDN_experiment
    the experiment does nothing and stays without any response; In other words, I don't see any result and it also doesn't finish (I was waiting for a long time).

What is the problem and how can I fix it?

Thanks.
Sepeh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.