p4lang/p4ofagent

Add openflow controller to my mininet demo

chenxiang2019 opened this issue · 4 comments

Hi, Antonin @antoninbas and other seniors :).

Thanks for your help. My process goes well. But I still have some problem about adding openflow controller to my mininet demo based on bmv2.

I refered the message on P4-dev:

I learned a lot from your words. Then I started my work.

First I overrided the method "start" of the "OpenFlowEnabledP4Switch" class in the topo.py. Sencond, I installed the repo p4ofagent and p4-build successfully, generated and compiled the PD library for my P4 program named 'sw' using p4-build:

./configure --with-bmv2 P4_NAME=switch_bmv2 P4_PATH=/home/wasdns/sw/p4src/switch_bmv2.p4

Then I write a main.c file. Based on my understanding about p4ofagent, I have to open p4ofagent process for each switch in my topo. I referenced the main.c here: main.c bmv2_init.c
, and my idea is, call the function p4_pd_switch_bmv2_assign_device in pd.h with right notification socket for each switch in my topo, like this:

p4_pd_switch_bmv2_assign_device(0, "ipc:///tmp/bmv2-0-notifications.ipc", 22222);
p4_pd_switch_bmv2_assign_device(1, "ipc:///tmp/bmv2-1-notifications.ipc", 22223);
···

Is it right?

By the way, could you give me some advice about my next step? I have a little confused with the Makefile writing because of lacking experience. I refered the Makefile of 'switch' repo. I'm not sure if I should link the libs(eg. simple_switch.lo) of bmv2/targets/simple_switch in Makefile.

Thank you very much!

Best regards,
Chen.

Add:

One more question is, I didn't generate the the libof.a library either. Then I followed the advice in mail and took a look on both the file .travis.yml and p4c-bm/main.py. I set the P4C_BM_FLAGS when configured the p4-build and offered the dir sw/openflow_mapping to --openflow-mapping-dir, which like this: ./configure ... P4C_BM_FLAGS="--plugin of --openflow-mapping-dir /home/wasdns/sw/openflow_mapping --openflow-mapping-mod ..."

However, what confused me is the openflow mapping mod, I am not sure what it means. Thank you!

Is the ofagent submodule script working for you?
I had the permission issue for bigcode:

Cloning into 'submodules/bigcode'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Clone of 'git@github.com:floodlight/bigcode' into submodule path 'submodules/bigcode' failed
Failed to recurse into submodule path 'submodules/indigo'

Thanks, Antoni. I am using the VM and forget to add the git username.