Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format for providing launch options for a P4 switch #70

Open
IamAdiSri opened this issue Mar 8, 2024 · 3 comments
Open

Format for providing launch options for a P4 switch #70

IamAdiSri opened this issue Mar 8, 2024 · 3 comments

Comments

@IamAdiSri
Copy link

As far as I understand, when declaring a switch with the addP4Switch or addP4RuntimeSwitch methods, I'm supposed to be able to provide the same flags as the with the simple_switch or simple_switch_grpc CLI commands.

I'm specifically interested in being able to set the --cpu-port 510 flag, however I've tried every combination of arguments to the addP4Switch method and it doesn't seem to work, and the cpu port seems to be getting assigned the value 4.

None of these seem to work, even though they raise no errors:

net.addP4Switch(s, cpu_port=510) 
net.addP4Switch(s, cpu_port_num=510)
net.addP4Switch(s, **{"--cpu-port": 510})
net.addP4Switch(s, **{"--cpu-port-num": 510})

I run net.enableCpuPortAll() after I initialize all my switches, and yet the cpu port is mapped to the number 4. What am I doing wrong?

@IamAdiSri
Copy link
Author

On further investigation, I realize that on running net.enableCpuPortAll() the cpu_port key gets overwritten with True, and the cpu_port_num key gets overwritten with the value 4 (the next available port on the switch) in the topology.json file. I also noticed that you can set the cpu port for both runtime switches and regular p4 switches in p4utils, however in the command line, the simple_switch command does not support cpu ports. Not sure if this is a bug in p4utils.

I'm not entirely sure if I'm supposed to enable to the cpu port with the arguments to addP4RuntimeSwitch or with the enableCpuPortAll command. If anyone has a simple set of steps to follow for me, I'd appreciate that.

@edgar-costa
Copy link
Collaborator

Hi @IamAdiSri,

I think you are right. I would have to investigate this, and I wont have time in the next weeks.

Does it make any difference if you can not set the CPU port to 510 and you just use whatever gets assigned?

@IamAdiSri
Copy link
Author

It doesn't matter if its 510, but I do need to be able to set the CPU port to a chosen value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants