Problems when instantiating a stratum_bmv2 switch within mininet

7 views
Skip to first unread message

Sergio Gutierrez

unread,
Oct 4, 2022, 6:24:23 PM10/4/22
to p4-...@lists.p4.org
Hello all.

I am having an issue when trying to integrate a stratum bmv2 switch within mininet. I am taking as starting point the bmv2.py file available in the onos git repository,

In this file, I modify the specific patterns to my switch. That is, including the json file, and defining the path to the stratum_bmv2 binary.

Then, in my mininet topology file, I just create a wrapper class to pass some parameters via the constructor. However, when starting the topology I get the following error:

root@p4tutorial:/home/p4/ejemplo_gita/mininet# python2.7 topo.py
*** Creating network
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(s1, h1) (s1, h2)
*** Configuring hosts
h1 h2
*** Starting controller

*** Starting 1 switches
s1 ...................................................................................................................................................................................................................................................................................................................................................................................................--------------------------------------------------------------------------------
s1 log (from /tmp/bmv2-s1-log):
...
I20221004 22:14:30.519244 65909 bmv2_chassis_manager.cc:453] State of port 1 in node 1: UP.
I20221004 22:14:30.519280 65909 bmv2_chassis_manager.cc:453] State of port 2 in node 1: UP.
I20221004 22:14:50.349836 65906 hal.cc:231] Received signal: Terminated
I20221004 22:14:50.350443 65888 hal.cc:164] Shutting down HAL...
I20221004 22:14:50.350965 65888 main.cc:173] See you later!
Traceback (most recent call last):
  File "topo.py", line 86, in <module>
    main()
  File "topo.py", line 68, in main
    net.start()
  File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 491, in start
    switch.start( self.controllers )
  File "/home/p4/ejemplo_gita/mininet/bmv2.py", line 343, in start
    self.waitBmv2Start()
  File "/home/p4/ejemplo_gita/mininet/bmv2.py", line 429, in waitBmv2Start
    raise Exception("Switch did not start before timeout")
Exception: Switch did not start before timeout


When checking the switch log, I see the following:

root@p4tutorial:/home/p4/ejemplo_gita/p4src# more /tmp/bmv2-s1-log
/usr/bin/stratum_bmv2 -device_id=1 -chassis_config_file=/tmp/bmv2-s1-chassis-config.txt -forwarding_pipeline_configs_file=/tmp/bmv2-s1-stratum
/pipeline_config.txt -persistent_config_dir=/tmp/bmv2-s1-stratum -initial_pipeline=/home/p4/ejemplo_gita/p4src/sw_gita.json -cpu_port=255 -ext
ernal_stratum_urls=0.0.0.0:54827 -local_stratum_url=localhost:57561 -max_num_controllers_per_node=10 -logtosyslog=false -logtostderr=true

--------------------------------------------------------------------------------

I20221004 22:14:30.312778 65888 logging.cc:72] Stratum version: not stamped.
E20221004 22:14:30.313212 65888 main.cc:124] Starting bmv2 simple_switch and waiting for P4 pipeline
W20221004 22:14:30.318930 65888 credentials_manager.cc:59] No key files provided, using insecure server credentials!
W20221004 22:14:30.319190 65888 credentials_manager.cc:78] No key files provided, using insecure client credentials!
I20221004 22:14:30.319427 65888 hal.cc:127] Setting up HAL in COLDBOOT mode...
I20221004 22:14:30.319473 65888 config_monitoring_service.cc:94] Pushing the saved chassis config read from /tmp/bmv2-s1-chassis-config.txt...
I20221004 22:14:30.324271 65888 bmv2_chassis_manager.cc:519] Registered port status callbacks successfully for node 1.
I20221004 22:14:30.324292 65888 bmv2_chassis_manager.cc:61] Adding port 1 to node 1
I20221004 22:14:30.346447 65888 bmv2_chassis_manager.cc:61] Adding port 2 to node 1
I20221004 22:14:30.380221 65888 p4_service.cc:121] Pushing the saved forwarding pipeline configs read from /tmp/bmv2-s1-stratum/pipeline_confi
g.txt...
E20221004 22:14:30.380257 65888 utils.cc:112] StratumErrorSpace::ERR_FILE_NOT_FOUND: /tmp/bmv2-s1-stratum/pipeline_config.txt not found.
E20221004 22:14:30.380446 65888 utils.cc:68] Return Error: ReadFileToString(filename, &text) failed with StratumErrorSpace::ERR_FILE_N
OT_FOUND: /tmp/bmv2-s1-stratum/pipeline_config.txt not found.
W20221004 22:14:30.380455 65888 p4_service.cc:130] No saved forwarding pipeline config found at /tmp/bmv2-s1-stratum/pipeline_config.t
xt. This is normal when the switch is just installed and no master controller is connected yet.
E20221004 22:14:30.380954 65888 hal.cc:220] Stratum external facing services are listening to 0.0.0.0:54827, localhost:57561...
I20221004 22:14:30.519244 65909 bmv2_chassis_manager.cc:453] State of port 1 in node 1: UP.
I20221004 22:14:30.519280 65909 bmv2_chassis_manager.cc:453] State of port 2 in node 1: UP.
I20221004 22:14:50.349836 65906 hal.cc:231] Received signal: Terminated
I20221004 22:14:50.350443 65888 hal.cc:164] Shutting down HAL...
I20221004 22:14:50.350965 65888 main.cc:173] See you later!


It is important to remark that when I check the open ports (netstat command), I see the switch is not opening any socket.

Is there something I might be forgetting or any misconfiguration I might be introducing?

Thanks in advance for your attention




--
Sergio Gutiérrez

Davide Scano

unread,
Oct 5, 2022, 3:04:06 AM10/5/22
to Sergio Gutierrez, p4-...@lists.p4.org
Hi Sergio,

Here you can find the updated set-up for stratum+bmv2 in mining https://github.com/stratum/stratum/tree/main/tools/mininet.

Have a nice day!
Davide

--
You received this message because you are subscribed to the Google Groups "p4-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p4-dev+un...@lists.p4.org.
To view this discussion on the web visit https://groups.google.com/a/lists.p4.org/d/msgid/p4-dev/CAO7Dj-eGdOLcRgKcPdg7VKZnngkc_Ze6tSZ6W7eXL-xaRhVV8A%40mail.gmail.com.

Sergio Gutierrez

unread,
Oct 5, 2022, 8:14:56 AM10/5/22
to Davide Scano, p4-...@lists.p4.org
Hello Davide.

Thanks for your reply. 

I was wondering if it is also possible to perform this scenario without resorting to the docker image. 

Best regards.

Sergio 

Davide Scano

unread,
Oct 5, 2022, 8:17:48 AM10/5/22
to Sergio Gutierrez, p4-...@lists.p4.org
Hi Sergio,

Yes, but I suppose that the bmv2.py script , in the ONOS folder is old. My suggestion is do reverse engineering on this one.

Have a nice day!
Davide

Sergio Gutierrez

unread,
Oct 5, 2022, 10:35:50 AM10/5/22
to Davide Scano, p4-...@lists.p4.org
Hello Davide.

I will follow your advice.

Thanks again.

Best regards,
--
Sergio Gutiérrez
Reply all
Reply to author
Forward
0 new messages