How to run Stratum natively on the host (not in Docker containers)?

105 views
Skip to first unread message

Xiaochou Chen

unread,
Mar 31, 2022, 7:11:50 AM3/31/22
to stratum-dev
Hi all,

I have 2 question:

1、How to run Stratum natively on the host (not in Docker containers)?


2、Cannot Access Stratum_Switch BfRt Python CLI Through bfshell

***run tofino-modle***

docker run --rm -it --privileged -v /usr/lib:/usr/lib  --network=host   stratumproject/tofino-model:latest-9.7.0

****run stratum *****
PLATFORM=barefoot-tofino-model ./start-stratum-container.sh   -bf_switchd_background=false   -enable_onlp=false -experimental_enable_p4runtime_translation  -incompatible_enable_bfrt_legacy_bytestring_responses

****The Docks ps***
 docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED          STATUS          PORTS     NAMES
8130881e47d8   stratumproject/stratum-bfrt:latest-9.7.0   "start-stratum.sh -b…"   31 minutes ago   Up 31 minutes             lucid_curran
335e4b07a04b   stratumproject/tofino-model:latest-9.7.0   "start-tofino-model.…"   32 minutes ago   Up 32 minutes             compassionate_cori
854b2146c678   opennetworking/sdfabric-onos:master        "./bin/onos-service …"   4 weeks ago      Up 4 weeks                onos


**** then, run bf-shells.sh **********

cxc@u18:~/mysde/bf-sde-9.7.0$ ./run_bfshell.sh --status-port 9559
Using SDE /home/cxc/mysde/bf-sde-9.7.0
Using SDE_INSTALL /home/cxc/mysde/bf-sde-9.7.0/install
Connecting to localhost port 9559 to check status on these devices: [0]
Waiting for device 0 to be ready

Timeout or error while waiting for devices to be ready
/home/cxc/mysde/bf-sde-9.7.0/install/bin/bfshell


        ********************************************
        *      WARNING: Authorised Access Only     *
        ********************************************
   

bfshell>
bfshell> bfrt_python
bfrt_cli_cmd:203 could not initialize bf_rt for the cli. err: 1
bfshell>

will encounter the error above "bfrt_cli_cmd:203 could not initialize bf_rt for the cli. err: 1",
Also, a prompt will appear at the stratum switch as following:


bf-sde> Python path configuration:
  PYTHONHOME = '/usr/'
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = ''
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = ''
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/python3.8/lib-dynload',
  ]
ModuleNotFoundError: No module named 'bfrtcli'
Failed to load bfrtcli python library



Edit file start-stratum-container.sh ,And add the line to it .
-v /home/cxc/mysde/bf-sde-9.7.0/install/lib/python3.8:/usr/lib/python3.8

Now when lanunch the command bfrt_python, we get the new error on stratum switch:

ERROR:root:code for hash blake2b was not found.
Traceback (most recent call last):
  File "/usr/lib/python3.8/hashlib.py", line 251, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python3.8/hashlib.py", line 120, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2b
ERROR:root:code for hash blake2s was not found.
Traceback (most recent call last):
  File "/usr/lib/python3.8/hashlib.py", line 251, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python3.8/hashlib.py", line 120, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2s
*** Aborted at 1648715916 (unix time) try "date -d @1648715916" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGSEGV (@0x38) received by PID 1 (TID 0x7f8e989b7700) from PID 56; stack trace: ***
    @     0x7f8eab6a10e0 (unknown)
    @     0x7f8ebd5e2c7c (unknown)
    @     0x7f8ebd5eade1 (unknown)
    @     0x7f8ebd5e6644 (unknown)
    @     0x7f8ebd5ea609 (unknown)
    @     0x7f8eab48cee9 (unknown)
    @     0x7f8ebd5e6644 (unknown)
    @     0x7f8eab48d531 (unknown)
    @     0x7f8eab48cf82 dlopen
    @     0x7f8e95c87266 py_dl_open
    @     0x7f8eabb4d1fa PyCFunction_Call
    @     0x7f8eabb4b0a1 _PyObject_MakeTpCall
    @     0x7f8eabb21217 _PyEval_EvalFrameDefault
    @     0x7f8eabc42f39 _PyEval_EvalCodeWithName
    @     0x7f8eabb4ae98 _PyFunction_Vectorcall
    @     0x7f8eabb4cb82 _PyObject_FastCallDict
    @     0x7f8eabb4cced _PyObject_Call_Prepend
    @     0x7f8eabbbe4d9 (unknown)
    @     0x7f8eabbb8412 (unknown)
    @     0x7f8eabb4b0a1 _PyObject_MakeTpCall
    @     0x7f8eabb215e7 _PyEval_EvalFrameDefault
    @     0x7f8eabb1a620 (unknown)
    @     0x7f8eabb4cc0f _PyObject_FastCallDict
    @     0x7f8eabb4cced _PyObject_Call_Prepend
    @     0x7f8eabbbe4d9 (unknown)
    @     0x7f8eabbb8412 (unknown)
    @     0x7f8eabb4b0a1 _PyObject_MakeTpCall
    @     0x7f8eabb21217 _PyEval_EvalFrameDefault
    @     0x7f8eabb1a620 (unknown)
    @     0x7f8eabb210b7 _PyEval_EvalFrameDefault
    @     0x7f8eabb1a620 (unknown)
    @     0x7f8eabb210b7 _PyEval_EvalFrameDefault
   
How to fix the problem ?


Best Rgds
Chen

A Sydney

unread,
Mar 31, 2022, 1:51:57 PM3/31/22
to Xiaochou Chen, stratum-dev
Inline...

On Thu, Mar 31, 2022 at 7:11 AM Xiaochou Chen <xcc...@xmu.edu.my> wrote:
Hi all,

I have 2 question:

1、How to run Stratum natively on the host (not in Docker containers)?
Not sure what exactly is meant by "...natively on the host..." but perhaps the following thread may help. To summarize, stratum was packaged as a VM as opposed to a container:


-Cheers!
-Syd 

Maximilian Pudelko

unread,
Mar 31, 2022, 2:58:18 PM3/31/22
to stratum-dev, asydn...@gmail.com, stratum-dev, xcc...@xmu.edu.my
Hi Chen,

> 1、How to run Stratum natively on the host (not in Docker containers)?

You can try the Debian packages (.deb) we publish. Check the "Assets" section here: https://github.com/stratum/stratum/releases


> 2、Cannot Access Stratum_Switch BfRt Python CLI Through bfshell

Best,
Max
Reply all
Reply to author
Forward
0 new messages