This Python script is a simple CLI that captures user input through Python console/CLI. It issues OpenFlow commands to the Mellanox switch using its API on your behalf, so you don't need to know the exact syntax of the commands.
The script issues OpenFlow commands for IPv4 and IPv6 or custom commands.
python3 MellanoxScript.py
When prompted by the program, input your choice to the console:
- Adding IPv4 OpenFlow rule(s)
- Adding IPv6 OpenFlow rule(s)
- Adding a custom OpenFlow rule(s)
- Deleting specific rule(s)
- Deleting all rules
- Show current OpenFlow rules
- Import rules from a text file ; see the instructions below.
- Issue a custom CLI command
When trying to import multiple rules from file, the file should be formatted as:
priority=<priority>|in_port=Eth1/<port>|actions=push_vlan:0x8100,set_field:6395->vlan_vid,output:52,output:54
priority=<priority>|in_port=Eth1/<port>|nw_src=1.1.1.1|actions=output:1,output:10
priority=<priority>|in_port=Eth1/<port>|ipv6_src=2001:2000::|actions=output:1,output:10
or more generally
|attribute=value|...|actions=set_field:6395->vlan_vid,output:52,output:54