sonata-nfv / son-emu

Attention! Legacy! This repo will be replaced with https://github.com/containernet/vim-emu
https://github.com/containernet/vim-emu
Apache License 2.0
36 stars 32 forks source link

Can't make flows work inside the emulator #266

Closed dang03 closed 6 years ago

dang03 commented 6 years ago

Hi, I've been playing with the son-emu, strictly following the steps shown in the Example 3 of the repository wiki (https://github.com/sonata-nfv/son-emu/wiki/Example-3) and I've been using the sonatanfv/son-emu:dev docker available at Docker Hub.

All runs fine until I try to add the proper flows for each client, server and snort: son-emu-cli network add -b -src client:client-eth0 -dst snort_vnf:input son-emu-cli network add -b -src snort_vnf:output -dst server:server-eth0

When I put this commands, I can see in terminal 1 (running containernet) this message, note the last line message:

DEBUG:dcemulator.net:call chainAddFlow vnf_src_name=u'server', vnf_src_interface=u'server-eth0', vnf_dst_name=u'client', vnf_dst_interface=u'client-eth0'
INFO:dcemulator.net:Path between server and client: ['dc1.s1']
INFO:dcemulator.net:end node reached: client
DEBUG:dcemulator.net:set vlan in switch: dc1.s1 in_port: dc1.s1-eth2 vlan tag: 4
INFO:dcemulator.net:url: http://localhost:8080/stats/flowentry/add
INFO:dcemulator.net:POST: {'actions': [{'type': 'OUTPUT', 'port': 1}], 'priority': 1000, 'table_id': 0, 'dpid': 1001, 'cookie': 10, 'match': {'in_port': 2}}
INFO:dcemulator.net:status: 404 reason: Not Found

Then, if I try to do a ping between client and server, it doesn't work. I have also tried to do it without snort, using just client and server connected to s1, add the proper flows, but with the same result. I've also tried different topology files from examples folder, with the same result.

If I do a request to http://127.0.0.1:8080/stats/switches to see added flows, i just get an empty list [].

Do you know which can be the cause of this issue, or there's something that am I doing wrong? Thank you and best regards.

stevenvanrossem commented 6 years ago

it seems that the rest API of the Ryu openflow controller is not found: http://localhost:8080/stats/flowentry/add However, you say that http://127.0.0.1:8080/stats/switches does return an empty list, so this rest call works, but there should be some switches in the returned list... I am not sure if everything works as expected when starting the emulator from sonatanfv/son-emu:dev docker, maybe @mpeuster has more experience with this? You could check with ovs-vsctl show if any openvswitches are indeed instantiated by the emulator? Or some other process is not at localhost:8080?

mpeuster commented 6 years ago

Good qustion @stevenvanrossem. I would suggest to build a new emulator container from code and try again. Just to be on the safe side.

I would also suggest to follow this example here: https://github.com/sonata-nfv/son-tutorials/tree/master/upb-containernet-emulator-summerschool-demo#son-emu-and-sonata-service-package

Not sure if Example 3 in the wiki is still working or outdated.

dang03 commented 6 years ago

Thank you for your help. I'll take note of all the suggestions and try the linked example. I'll update this issue on behalf the results.

Best regards.

mpeuster commented 6 years ago

Great! @dang03 let us know if you encounter further problems.