nsg-ethz/p4-learning

Some questions about cpu-port

ls760008979 opened this issue · 13 comments

I want to know why when i add a cpu-port to all switch the program in" https://github.com/nsg-ethz/p4-learning/tree/master/exercises/08-Simple_Routing " doesn't work?

I believe this is because when we add the cpu ports an extra switch is added to the topology and then the shortest path algorithm uses that switch. You can verify that by checking at the controllers code how do the shorter paths look like.

If that is the case, I will either remove that switch from the topology that gets automatically built or i will find a way to fix that. The easier thing you can do for this to work is to modify the controller: After the Topology is loaded remove the cpu switch node from the networkx object.

In any case when I have time I will try to modify https://github.com/nsg-ethz/p4-utils such that this does not happen, but I need to find a good way that does not break other things.

Yeah,it has a 'sw-cpu' switch in the paths,but does it influence 'copy to cpu' function if i remove the 'sw-cpu' switch?

or is it a better way to remove the paths that conclude the 'sw-cpu' switch

I would have to check if removing the node has any impact. I believe that removing it from the networkx should not affect the high level methods like getting cpu port.

If you are not in a rush I will have a look at this end of tomorrow or during the weekend.

I would have to check if removing the node has any impact. I believe that removing it from the networkx should not affect the high level methods like getting cpu port.

If you are not in a rush I will have a look at this end of tomorrow or during the weekend.

ok,thanks a lot!

I believe this is because when we add the cpu ports an extra switch is added to the topology and then the shortest path algorithm uses that switch. You can verify that by checking at the controllers code how do the shorter paths look like.

If that is the case, I will either remove that switch from the topology that gets automatically built or i will find a way to fix that. The easier thing you can do for this to work is to modify the controller: After the Topology is loaded remove the cpu switch node from the networkx object.

In any case when I have time I will try to modify https://github.com/nsg-ethz/p4-utils such that this does not happen, but I need to find a good way that does not break other things.

Emmm,how can i remove that switch in the 'Topology'?I haven't found an effective way in the p4util,can you give me some advise?Thank you!

Hi sorry for the late response.

The Topology class https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/topology.py has an attribute that is the underlaying networkx object (self.network_graph) what you can do self.network_graph.remove_node("sw-cpu") this should be enough.

Tell me if it works!

Hi sorry for the late response.

The Topology class https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/topology.py has an attribute that is the underlaying networkx object (self.network_graph) what you can do self.network_graph.remove_node("sw-cpu") this should be enough.

Tell me if it works!

It seems doesn't work,maybe there should define a function "remove_node" in https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/utils/topology.py,because i have not found this attribute in the 'NetworkGraph( )'
sw-cpu

It works when use 'self.topo.network_graph',but does not works for fattree-4 topology,i have check those paths are without "sw-cpu"switch
ping

Well i do not know exactly what your code does, if you want to privately share with me i could check.

Meanwhile I will check what can go wrong when removing "sw-cpu".

fattree.zip
Oh,that's great! Here is the code,with the p4src file the same as packet-loss dectection('https://github.com/nsg-ethz/p4-learning/tree/master/exercises/11-Packet-Loss-Detection/solution') but add some action ,metadata and table that RoutingController need, and the p4app.json file have change the topology and use 'exec_scripts' attribute, finally, the routing-controller file just add removing "sw-cpu" when it start config flow table.

Oh,i have got the answer,for there have define a 'remove_loss_header'table,but without running the control program to configure the table,so there is no way to match the table,maybe that is the reason.Everything goes well after running the control program.Thanks anyway!

@ls760008979 Hi! I face the problem. So just want to ask that how you really solve this problem although it's been one year before.

So first you add self.network_graph.remove_node("sw-cpu") in controller.py,
and then you also add remove_loss_header table in .p4 file .

Are these two steps your method?

Thank you in advance!!