Skip to content

Added Sonic CLI commands to configure VxLAN ports#4467

Draft
aakashtiwari2630-max wants to merge 1 commit intosonic-net:masterfrom
aakashtiwari2630-max:aaktiwar/vxlan_port_cli
Draft

Added Sonic CLI commands to configure VxLAN ports#4467
aakashtiwari2630-max wants to merge 1 commit intosonic-net:masterfrom
aakashtiwari2630-max:aaktiwar/vxlan_port_cli

Conversation

@aakashtiwari2630-max
Copy link
Copy Markdown

@aakashtiwari2630-max aakashtiwari2630-max commented Apr 17, 2026

What I did

Added three new Sonic CLI commands to configure VxLAN ports:

  1. configure vxlan destination-port
  2. configure vxlan source-port
  3. configure vxlan source-port-mask

After configuring these commands, SWITCH_TABLE in APP_DB will be updated dynamically so that the VxLAN port values are active for installed VxLAN tunnels.

Also, after configuring these commands, the port values will be stored in DEVICE_METADATA, so that in case of config reload or reboot, the same values are replayed using vxlanmgrd. Refer to:
sonic-net/sonic-swss#4492

Please note: After configuring these commands, config save is necessary for the port settings saved under DEVICE_METADATA to persist.

How I did it

How to verify it

Added 3 new tests.
tests/vxlan_test.py::TestVxlan::test_config_vxlan_destination_port PASSED [ 91%]
tests/vxlan_test.py::TestVxlan::test_config_vxlan_source_port PASSED [ 95%]
tests/vxlan_test.py::TestVxlan::test_config_vxlan_source_port_mask PASSED [100%]

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

root@sonic:/home/admin# config vxlan destination-port 51234
VXLAN destination port set to 51234
root@sonic:/home/admin# config vxlan source-port 1234
VXLAN source port set to 1234
root@sonic:/home/admin# config vxlan source-port-mask 7
VXLAN source port mask set to 7

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Apr 17, 2026

I dont think DEVICE_METADATA is the right place to save this vxlan configs

@aakashtiwari2630-max
Copy link
Copy Markdown
Author

aakashtiwari2630-max commented Apr 17, 2026

I dont think DEVICE_METADATA is the right place to save this vxlan configs

I followed the example of other similar SWITCH_TABLE properties like ecmp_hash_offset and ecmp_hash_seed for this. But let me know if you can think of any other option.

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

Successfully merging this pull request may close these issues.

3 participants