facebook / fboss

Facebook Open Switching System Software for controlling network switches.
Other
866 stars 301 forks source link

Port numbering in FBOSS Python Tool output #72

Open ggiamarchi opened 6 years ago

ggiamarchi commented 6 years ago

Hello,

On a Wedge 16x I'm running FBOSS version a376ab2 compiled from sources and running ONL-DEB8 with kernel 3.16.53. I'm using the configuration fboss/agent/configs/sample1.json.

When running the command fboss_route.py list_ports, I see that port numbers in the output does not match the actual port numbers of the switch. In the output logical ports 1, 2, 3, 4 matches physical port 2, Ports 5, 6, 7, 8 matches physical port 1. Ports 3 and 4 are swapped as well and so on.

fboss_route.py list_ports output Actual Wedge Port Breakout Cable number
Port 1: [enabled=True, up=False, present=None] 2 1
Port 2: [enabled=True, up=False, present=None] 2 2
Port 3: [enabled=True, up=False, present=None] 2 3
Port 4: [enabled=True, up=False, present=None] 2 4
Port 5: [enabled=True, up=False, present=None] 1 1
Port 6: [enabled=True, up=False, present=None] 1 2
Port 7: [enabled=True, up=False, present=None] 1 3
Port 8: [enabled=True, up=False, present=None] 1 4
Port 9: [enabled=True, up=False, present=None] 4 1
Port 10: [enabled=True, up=False, present=None] 4 2
Port 11: [enabled=True, up=False, present=None] 4 3
Port 12: [enabled=True, up=False, present=None] 4 4
Port 13: [enabled=True, up=False, present=None] 3 1
Port 14: [enabled=True, up=False, present=None] 3 2
Port 15: [enabled=True, up=False, present=None] 3 3
Port 16: [enabled=True, up=False, present=None] 3 4
Port 17: [enabled=True, up=False, present=None] 6 1
Port 18: [enabled=True, up=False, present=None] 6 2
Port 19: [enabled=True, up=False, present=None] 6 3
Port 20: [enabled=True, up=False, present=None] 6 4
Port 21: [enabled=True, up=False, present=None] 5 1
Port 22: [enabled=True, up=False, present=None] 5 2
Port 23: [enabled=True, up=False, present=None] 5 3
Port 24: [enabled=True, up=False, present=None] 5 4
Port 25: [enabled=True, up=False, present=None] 8 1
Port 26: [enabled=True, up=False, present=None] 8 2
Port 27: [enabled=True, up=False, present=None] 8 3
Port 28: [enabled=True, up=False, present=None] 8 4
Port 29: [enabled=True, up=False, present=None] 7 1
Port 30: [enabled=True, up=False, present=None] 7 2
Port 31: [enabled=True, up=False, present=None] 7 3
Port 32: [enabled=True, up=False, present=None] 7 4
Port 33: [enabled=True, up=False, present=None] 10 1
Port 34: [enabled=True, up=False, present=None] 10 2
Port 35: [enabled=True, up=False, present=None] 10 3
Port 36: [enabled=True, up=False, present=None] 10 4
Port 37: [enabled=True, up=False, present=None] 9 1
Port 38: [enabled=True, up=False, present=None] 9 2
Port 39: [enabled=True, up=False, present=None] 9 3
Port 40: [enabled=True, up=False, present=None] 9 4
Port 41: [enabled=True, up=False, present=None] 12 1
Port 42: [enabled=True, up=False, present=None] 12 2
Port 43: [enabled=True, up=False, present=None] 12 3
Port 44: [enabled=True, up=False, present=None] 12 4
Port 45: [enabled=True, up=False, present=None] 11 1
Port 46: [enabled=True, up=False, present=None] 11 2
Port 47: [enabled=True, up=False, present=None] 11 3
Port 48: [enabled=True, up=False, present=None] 11 4
Port 49: [enabled=True, up=False, present=None] 14 1
Port 50: [enabled=True, up=False, present=None] 14 2
Port 51: [enabled=True, up=False, present=None] 14 3
Port 52: [enabled=True, up=False, present=None] 14 4
Port 53: [enabled=True, up=False, present=None] 13 1
Port 54: [enabled=True, up=False, present=None] 13 2
Port 55: [enabled=True, up=False, present=None] 13 3
Port 56: [enabled=True, up=False, present=None] 13 4
Port 57: [enabled=True, up=False, present=None] 16 1
Port 58: [enabled=True, up=False, present=None] 16 2
Port 59: [enabled=True, up=False, present=None] 16 3
Port 60: [enabled=True, up=False, present=None] 16 4
Port 61: [enabled=True, up=False, present=None] 15 1
Port 62: [enabled=True, up=False, present=None] 15 2
Port 63: [enabled=True, up=False, present=None] 15 3
Port 64: [enabled=True, up=False, present=None] 15 4

Does someone have an explanation for that ? Is it configurable somewhere ?

Of course I could implement the mapping on the client side. But if there is a better solution I would prefer to do it in a clean way.

capveg commented 6 years ago

Hi and thanks for the feedback.

A little bit of context first:

There are really two sets of port numbers - the numbers on the front panel ports (which you're looking for) and the numbers on the Broadcom chip. Unfortunately, on most platforms due to the way they optimize board layout (e.g., to minimize trace lengths, minimize EMF interference, etc.), the front panel ports do not map 1:1 with the Broadcom chip ports.

If you look at the portId field in the PortInfoThrift structure (which is what's being read by the list_ports command), that's reporting the Broadcom port Ids. The name, however (e.g., eth1/1/1), should match the port you care about.

Does that help?

FYI: https://github.com/facebook/fboss/blob/master/fboss/agent/if/ctrl.thrift#L262

ggiamarchi commented 6 years ago

Of course it helps. Thank you for your response, that makes sense. I was expecting this kind of explanation.

By the way, in my case the field name is always empty. How it is supposed to be populated ?

bluecmd commented 6 years ago

@ggiamarchi I cannot answer authoritively, but when making LLDP output useful stuff we had to set a port name ourselves and we resorted to this: https://github.com/dhtech/fboss/blob/f8c87a0d2855acdcf92e358bc900200cfa1a31bf/etc/wedge.json#L57. Maybe that works here as well?

ggiamarchi commented 6 years ago

Yes it works, thank you @bluecmd. I didn't pay attention to this attribute in the configuration spec...