Deploying the working code on mininet on Fabric Testbed

Dear Community,

I changed the basic.p4 (tutorials/basic.p4 at master · p4lang/tutorials · GitHub) file and patched (As an example I hardcoded consecutive numbers)

enq_timestamp 10
enq_depth 11
deq_timedelta 12
deq_depth 13

values onto the header.
As you see in the picture the code works on mininet and I can get the INT data on the host2.

.

Now I am deployin the same code on Fabric testbed using the same architecture, but after deployment, I am getting this error on switch 1 and 2:

Could not connect to any of [('127.0.0.1', 9090), ('127.0.0.1', 9090)]
Could not connect to thrift client on port 9090
Make sure the switch is running and that you have the right port

and getting :

OCI runtime exec failed: exec failed: unable to start container process: chdir to cwd ("/root/p4_tutorials/pl_basic") set in config.json failed: no such file or directory: unknown

on switch3.
See below for the error messages on Fabric_testbed deployment.

Any advice is welcome. What may be the issue?

Kind regards,
Nagmat

Hi @nagmat,

Could you share with us the github link to the Fabric testbed ?
Are you sure that you are running simple_switch bmv2? maybe you are running simple_switch_grpc and I think that by default it does not have thrift server. I said that because from your mininet seems that you are running “grpc switches”.

1 Like

Dear Davide,

Thanks for the response.

Github link to Fabric testbed complex recipes : jupyter-examples/fabric_examples/complex_recipes at master · fabric-testbed/jupyter-examples · GitHub

I am running bmv2 simple_switch. The code I execute as follows :

docker exec -w /root/p4_tutorials/pl_basic fabric_p4 sh -c 'p4c --p4runtime-files basic.txt --target bmv2 --arch v1model basic.p4'

Kind regards,
Nagmat

Hi but the command that you are running -c 'p4c --p4runtime-files basic.txt --target bmv2 --arch v1model basic.p4' is used by the p4 compile to compile the p4 code.
This hsould be the code for running the switch docker exec -d -it fabric_p4 sh -c 'simple_switch --interface 1@'${port1_iface}' --interface 2@'${port2_iface}' --interface 3@'${port3_iface}' /root/tutorials/exercises/basic_tunnel/basic_tunnel.json'

Hi,

Yeah, I am running that command too.

#!/bin/bash

#{
#port1_iface=$1
#port2_iface=$2
#port3_iface=$3
#ip_type=$4

ip_type=$1
#args="${@:2:2}"
ifaces="${@:2}"


# export http_proxy=socks5h://localhost:4567
# export https_proxy=socks5h://localhost:4567

echo Hello, FABRIC. From node `hostname -s`
sudo apt-get update
sudo apt-get install -y docker.io

if [ $ip_type = 'IPv4' ]
then
  docker run -d -v /home/ubuntu/p4_tutorials:/root/p4_tutorials -it --cap-add=NET_ADMIN --privileged --name fabric_p4 registry.ipv4.docker.com/pruth/fabric-images:0.0.2j
else
  docker run -d -v /home/ubuntu/p4_tutorials:/root/p4_tutorials -it --cap-add=NET_ADMIN --privileged --name fabric_p4 registry.ipv6.docker.com/pruth/fabric-images:0.0.2j
  sed -i '/nameserver/d' /etc/resolv.conf
  echo nameserver 2a00:1098:2c::1 >> /etc/resolv.conf
  echo nameserver 2a01:4f8:c2c:123f::1 >> /etc/resolv.conf
  echo nameserver 2a00:1098:2b::1 >> /etc/resolv.conf
fi

sleep 10
NSPID=$(docker inspect --format='{{ .State.Pid }}' fabric_p4)
echo NSPID $NSPID

switch_interface_args=""
swtich_port=0
for iface in $ifaces; do
  ip link set dev $iface promisc on
  ip link set $iface netns $NSPID
  docker exec fabric_p4 ip link set dev $iface up
  docker exec fabric_p4 ip link set dev $iface promisc on
  docker exec fabric_p4 sysctl net.ipv6.conf.${iface}.disable_ipv6=1

  switch_interface_args="${switch_interface_args} --interface ${swtich_port}@${iface}"
  swtich_port=$((swtich_port+1))
done



echo Starting switch

docker exec -w /root/p4_tutorials/pl_basic fabric_p4 sh -c 'p4c --p4runtime-files basic.txt --target bmv2 --arch v1model basic.p4'
docker exec -d -it fabric_p4 sh -c 'simple_switch --interface 1@'${port1_iface}' --interface 2@'${port2_iface}' --interface 3@'${port3_iface}' /root/p4_tutorials/pl_basic/pod-topo/topology.json'

echo done!

I included the script here.

You can try to run the switch with this flag --thrift-port portnumber and then
./runtime_CLI.py --thrift-port portnumber

1 Like

I have tried but no luck. I am getting the same error :

root@9d3ec55cdce2:~# ./tools/behavioral-model/tools/runtime_CLI.py --thrift-port 9090
Could not connect to any of [('127.0.0.1', 9090), ('127.0.0.1', 9090)]
Could not connect to thrift client on port 9090
Make sure the switch is running and that you have the right port

whta you get if you do ps -aux | grep simple_switch ?

1 Like

I am getting :

root         116  0.0  0.0   3304   660 pts/1    S+   15:21   0:00 grep --color=auto simple_switch

ok so this means that you are not running any process simple_switch, so in other word your are not running any switch.

The one where basic_tunnel is running I can see that simple_switch is running.

root          99  0.0  0.0   2608   596 pts/1    Ss+  15:39   0:00 sh -c simple_switch --interface 1@ --interface 2@ --interface 3@ /root/tutorials/exercises/basic_tunnel/basic_tunnel.json
root         105  0.0  0.1 722712 25428 pts/1    Sl+  15:39   0:00 simple_switch --interface 1@ --interface 2@ --interface 3@ /root/tutorials/exercises/basic_tunnel/basic_tunnel.json
root         201  0.0  0.0   3304   660 pts/5    S+   16:13   0:00 grep --color=auto simple_switch

What may be triggering simple_switch not to run on my example?

I resolved the issue :

It can be found here : P4_experiment_Fabric/mri.MD at main · nagmat1/P4_experiment_Fabric · GitHub

I killed existing processes on the p4 switch, recompiled the program again and reloaded the switch.

Kind regards,
Nagmat