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

[docker-fpm-frr/bgpcfgd]: Update interface of bgpcfgd from swsssdk to swsscommon #3264

Merged
merged 6 commits into from
Aug 29, 2019

Conversation

Pterosaur
Copy link
Contributor

@Pterosaur Pterosaur commented Aug 1, 2019

Update interfaces of bgpcfd from swsssdk to swsscommon to unify a suit of interface with other component. Meanwhile, we can listen multiple tables at one thread under swsscommon interface.
Signed-off-by: Ze Gan ganze718@gmail.com

- What I did
Move the interface of bgpcfgd from swsssdk to swsscommon. Because bgpcfgd need to listen more events in the future and we want to maintain one kind of APIs, swsscommon is more suitable than swsssdk.

- How I did it
Refactor the BGPConfigDaemon to two components, Daemon and BGPConfigManager. We can register new managers to the Daemon object if we want to listen more events.

- How to verify it
If it can pass all existing test cases, which means this update is success.

- Description for the changelog
Update interface of bgpcfgd from swsssdk to swsscommon

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

swsscommon

Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur Pterosaur changed the title [docker-fpm-frr/bgpcfgd]: Update interface of bgpcfgd from swsssdk to [docker-fpm-frr/bgpcfgd]: Update interface of bgpcfgd from swsssdk to swsscommon Aug 1, 2019
@lguohan lguohan requested a review from stcheng August 1, 2019 17:13
dockers/docker-fpm-frr/bgpcfgd Outdated Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Outdated Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Outdated Show resolved Hide resolved
@lguohan
Copy link
Collaborator

lguohan commented Aug 2, 2019

have we installed python-swss-common in frr docker if not then you need to install it.

Signed-off-by: Ze Gan <ganze718@gmail.com>
If the metadata update message is after all of bgp update message,
we will lose the update of bgp. So we need check the bgp meesage cache
when we update the ASN.

Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur
Copy link
Contributor Author

have we installed python-swss-common in frr docker if not then you need to install it.

I think it has been installed. I try to run the following command at bgp container.

root@sonic:~# apt list --installed | grep swss

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libswsscommon/now 1.0.0 amd64 [installed,local]
python-swsscommon/now 1.0.0 amd64 [installed,local]
swss/now 1.0.0 amd64 [installed,local]

Signed-off-by: Ze Gan <ganze718@gmail.com>
dockers/docker-fpm-frr/bgpcfgd Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Outdated Show resolved Hide resolved
dockers/docker-fpm-frr/bgpcfgd Outdated Show resolved Hide resolved
run_command(command)
if "name" in data:
command = "vtysh -c 'configure terminal' -c 'router bgp {}' -c 'neighbor {} description {}'".format(self.bgp_asn, key, data['name'])
run_command(command)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The warning does nothing to handle the failure case. This is inherently problematic because it allows for DB to be out of sync with running config of the routing application. The config event will be lost and the only way to recover this (since it's not saved in startup config either) is to restart bgpcfgd. In general this code doesn't seem to be robust and the requirements are not well defined/clear.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a configuration, if the command is not correct it means the configuration is incorrect. what do you mean by robust? Since it is configuration issue, the issue is outside this program, the right thing to do for this program is to log error. If you have better suggestion, we would appreciate to hear.

Copy link
Collaborator

@nikos-github nikos-github Aug 16, 2019

Choose a reason for hiding this comment

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

If for whatever reason BGP is restarting or is not running, I doubt the command will go through even if correct. Basically there are race conditions where the command may be correct, but there will be a failure that is not handled and will leave the system in an inconsistent state. The only way to recover would be to restart bgpcfgd. In order to provide a suggestion, can you please explain what is the purpose of bgpcfgd?

In comparison to what the jinja templates have, its functionality seems very incomplete overall for anyone in actual deployments and can not possibly work the same way with the templates when BGP restarts because of the missing functionality the templates provide and bgpcfgd doesn't.

If it is for unit testing purposes, then it shouldn't be part of the image.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what you suggest is valid concern, but it is out of scope of this refactoring. the bgpcfgd allow us to shutdown/enable bgp session.

Signed-off-by: Ze Gan <ganze718@gmail.com>
@Pterosaur
Copy link
Contributor Author

retest this please

1 similar comment
@lguohan
Copy link
Collaborator

lguohan commented Aug 29, 2019

retest this please

@lguohan lguohan merged commit be3cbdb into sonic-net:master Aug 29, 2019
wangshengjun pushed a commit to wangshengjun/sonic-buildimage that referenced this pull request Nov 16, 2020
… swsscommon (sonic-net#3264)

Update interfaces of bgpcfd from swsssdk to swsscommon to unify a suit of interface with other component. Meanwhile, we can listen multiple tables at one thread under swsscommon interface.

Signed-off-by: Ze Gan ganze718@gmail.com

- What I did
Move the interface of bgpcfgd from swsssdk to swsscommon. Because bgpcfgd need to listen more events in the future and we want to maintain one kind of APIs, swsscommon is more suitable than swsssdk.

- How I did it
Refactor the BGPConfigDaemon to two components, Daemon and BGPConfigManager. We can register new managers to the Daemon object if we want to listen more events.
mssonicbld added a commit that referenced this pull request Apr 19, 2024
…atically (#18708)

#### Why I did it
src/sonic-utilities
```
* ad464a9f - (HEAD -> master, origin/master, origin/HEAD) [Mellanox] Support new platform SN5400 in generic configuration update (#3272) (19 hours ago) [DavidZagury]
* 29d4e88f - Add multi ASIC support for syslog rate limit feature (#3235) (21 hours ago) [Junchao-Mellanox]
* f81317c3 - [Mellanox] added component versions to techsupport (#3264) (2 days ago) [sophiek]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants