Tofino auto setup script

Infra

.
├── 37-port-config.txt  # port configs
├── 38-port-config.txt
├── 39-port-config.txt
├── 40-port-config.txt
├── README              # this file
├── pm.py               # port manager main program
├── ports-32x.txt       # ports information dump from switches
├── ports-65x.txt
├── ports.json          # ports/channels to device port mapping file
├── push-all-port-configs.sh  # demo script
└── thrift              # thrift folder
    ├── gen-py          # generated from pltfm_pm_rpc.thrift wtih thrift compiler
    │   ├── __init__.py
    │   └── pltfm_pm_rpc
    │       ├── __init__.py
    │       ├── constants.py
    │       ├── pltfm_pm_rpc-remote
    │       ├── pltfm_pm_rpc.py
    │       ├── ttypes.py
    └── pltfm_pm_rpc.thrift  # thrift definition for port manager RPC

Usage

pm.py [-h] [--port PORT] [--ports-file PORTS_FILE] ip port_config

Tofino port manager tool

positional arguments:
  ip                    IP of BF-Platfrom
  port_config           Port configuration

optional arguments:
  -h, --help            show this help message and exit
  --port PORT           Port of BF-Platfrom
  --ports-file PORTS_FILE
                        A json file which defines ports

Port config file example

1/0 BF_SPEED_100G BF_FEC_TYP_NONE
2/0 BF_SPEED_100G BF_FEC_TYP_NONE
3/0 BF_SPEED_40G BF_FEC_TYP_NONE

ports.json

{
	"board_type": [
		[],
		[PORT1_CHNL0_DP, PORT1_CHNL1_DP, PORT1_CHNL2_DP, PORT1_CHNL3_DP],
		[PORT2_CHNL0_DP, PORT2_CHNL1_DP, PORT2_CHNL2_DP, PORT2_CHNL3_DP],
		.........
	],
	......
}