Skip to content

Validate interface name length in CLI#3580

Merged
qiluo-msft merged 14 commits intosonic-net:masterfrom
stepanblyschak:master_validate_interface_name_length-new
Dec 2, 2024
Merged

Validate interface name length in CLI#3580
qiluo-msft merged 14 commits intosonic-net:masterfrom
stepanblyschak:master_validate_interface_name_length-new

Conversation

@stepanblyschak
Copy link
Copy Markdown
Contributor

@stepanblyschak stepanblyschak commented Oct 21, 2024

This PR is accompanied by sonic-net/sonic-swss-common#931 and sonic-net/sonic-buildimage#20108

What I did

Validate interface name length does not exceed the limitation of IFNAMSIZ to align to kernel restrictions.

How I did it

Add validation checks in the relevant config functions for the following interface types:

vxlan
vlan
vrf
loopback
subinterface
portchannel

How to verify it

UT tests added

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)

@stepanblyschak stepanblyschak changed the title Master validate interface name length new Validate interface name length in CLI Oct 21, 2024
@qiluo-msft
Copy link
Copy Markdown
Contributor

/azp run Azure.sonic-utilities

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak stepanblyschak force-pushed the master_validate_interface_name_length-new branch from dc09bad to 6be74f7 Compare October 30, 2024 16:13
@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

Some git failure:

fatal: couldn't find remote ref refs/pull/3580/merge
##[warning]Git fetch failed with exit code 128, back off 2.513 seconds before retry.
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin   +refs/heads/*:refs/remotes/origin/* +refs/pull/3580/merge:refs/remotes/pull/3580/merge
fatal: couldn't find remote ref refs/pull/3580/merge
##[warning]Git fetch failed with exit code 128, back off 5.95 seconds before retry.
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin   +refs/heads/*:refs/remotes/origin/* +refs/pull/3580/merge:refs/remotes/pull/3580/merge
fatal: couldn't find remote ref refs/pull/3580/merge
##[error]Git fetch failed with exit code: 128

Will restart

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

qiluo-msft
qiluo-msft previously approved these changes Nov 22, 2024
@wangxin
Copy link
Copy Markdown
Contributor

wangxin commented Nov 26, 2024

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@stepanblyschak
Copy link
Copy Markdown
Contributor Author

@qiluo-msft @wangxin Could you please help with static analysis? Static analysis fails but I do not see a problem:

config/main.py:7937:21: E128 continuation line under-indented for visual indent

But line 7937 is not even in the diff.

And here I do not see any tabs on those lines in my diff:

tests/vxlan_test.py:374:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:375:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:376:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:378:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:379:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:380:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:384:1: E101 indentation contains mixed spaces and tabs
tests/vxlan_test.py:385:1: E101 indentation contains mixed spaces and tabs

image

@qiluo-msft qiluo-msft merged commit f705c45 into sonic-net:master Dec 2, 2024
nmoray pushed a commit to nmoray/sonic-utilities that referenced this pull request Jun 25, 2025
This PR is accompanied by sonic-net/sonic-swss-common#931 and sonic-net/sonic-buildimage#20108

What I did
Validate interface name length does not exceed the limitation of IFNAMSIZ to align to kernel restrictions.

How I did it
Add validation checks in the relevant config functions for the following interface types:

vxlan
vlan
vrf
loopback
subinterface
portchannel

How to verify it
UT tests added

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)
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.

5 participants