Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Move hostname, mgmt interface/vrf config to hostcfgd #10868

Closed
wants to merge 3 commits into from

Conversation

fastiuk
Copy link
Contributor

@fastiuk fastiuk commented May 18, 2022

This PR depends on sonic-net/sonic-utilities#2173

Why I did it

To be able to configure the management interface and hostname standalone by changing database config at runtime.
From the CLI perspective fo view, the following behavior is the same. But now you have two ways of configuring it: CLI, directly through the database.

How I did it

Moved configuration part of the interface and hostname to "hostcfgd".

How to verify it

  • Built an image
  • Flash it to the switch
  • Run CLI commands
# Set IP address: verify address is set on the iface
sudo config interface ip add eth0 10.210.25.127/22 10.210.24.1
ip address show eth0
# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
#     link/ether 98:03:9b:a2:be:80 brd ff:ff:ff:ff:ff:ff
#     inet 10.210.25.127/22 brd 10.210.27.255 scope global eth0
#        valid_lft forever preferred_lft forever
#     inet6 fe80::9a03:9bff:fea2:be80/64 scope link
#       valid_lft forever preferred_lft forever

# Remove IP address: verify you received address form DHCP
sudo config interface ip remove eth0 10.210.25.127/22
ip address show eth0
# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
#     link/ether 98:03:9b:a2:be:80 brd ff:ff:ff:ff:ff:ff
#     inet 10.210.25.127/22 brd 10.210.27.255 scope global eth0
#        valid_lft forever preferred_lft forever
#     inet6 fe80::9a03:9bff:fea2:be80/64 scope link
#       valid_lft forever preferred_lft forever

# Enable/disable mgmt VRF
ip address show mgmt
# Device "mgmt" does not exist.

sudo config vrf add mgmt
ip address show mgmt
# 72: mgmt: <NOARP,MASTER,UP,LOWER_UP> mtu 65575 qdisc noqueue state UP group default qlen 1000
#     link/ether fa:9b:ad:7b:1e:83 brd ff:ff:ff:ff:ff:ff

sudo config vrf del mgmt
ip address show mgmt
# Device "mgmt" does not exist.

# Setting the hostname
admin@r-anaconda-27:~$ sudo config hostname bla
# Login / Logout
admin@bla:~$

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

  • Moved management interface configuration to hostcfgd.
  • Moved management VRF configuration to hostcfgd.
  • Moved hostname configuration to hostcfgd.

Submodules PR's :

Repo PR title State
sonic-utilities [CLI] Move hostname, mgmt interface/vrf config to hostcfgd GitHub issue/pull request detail

A picture of a cute animal (not mandatory but encouraged)

1-46

fastiuk added 2 commits May 18, 2022 16:32
Signed-off-by: Yevhen Fastiuk <[email protected]>
@fastiuk fastiuk requested a review from lguohan as a code owner May 18, 2022 15:30
@ghost
Copy link

ghost commented May 18, 2022

CLA assistant check
All CLA requirements met.

@liat-grozovik
Copy link
Collaborator

liat-grozovik commented May 19, 2022

@fastiuk coulld you please edit the PR subject? can you make it clea what is moved? also please note that chnages under sonic-utilities should be placed as a PR aginst sonic-utiltiies repro and once merged you can have submoudle update PR on sonib-buildimage. If there is a dependcy on the PRs please add it to the description

@fastiuk fastiuk force-pushed the dev-move-cli-to-hostcfgd branch from d1d1162 to 88e348a Compare May 19, 2022 15:17
@fastiuk fastiuk changed the title Move cli to hostcfgd [CLI] Move hostname, mgmt interface/vrf config to hostcfgd May 19, 2022
Copy link
Collaborator

@dgsudharsan dgsudharsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add UT for mgmt interface/vrf

@liat-grozovik
Copy link
Collaborator

@fastiuk when do you think the UT can be added so hthis change can get in?

Signed-off-by: Yevhen Fastiuk <[email protected]>
@fastiuk fastiuk force-pushed the dev-move-cli-to-hostcfgd branch from 46adc4c to 5507998 Compare June 20, 2022 02:00
@fastiuk
Copy link
Contributor Author

fastiuk commented Jun 20, 2022

@fastiuk when do you think the UT can be added so hthis change can get in?

Done

@fastiuk
Copy link
Contributor Author

fastiuk commented Jun 20, 2022

@liat-grozovik By the way, since this MR depends on sonic-utilities, should it contain a submodule commit or I will need to update it later in the same way as without dependency?

@liat-grozovik
Copy link
Collaborator

@lguohan could you please help to review or assing someone to do so?

@qiluo-msft qiluo-msft requested a review from prsunny July 17, 2022 22:57
@fastiuk
Copy link
Contributor Author

fastiuk commented Jul 20, 2022

I think conflicts can't be resolved here anymore, cause the code was moved to the submodule.
Here is a new PR, I will close this one.
sonic-net/sonic-host-services#2

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.

4 participants