Skip to content

[LLDP] Add lldpmgrd Daemon to Manage LLDP Configuration#1428

Merged
jleveque merged 7 commits intosonic-net:masterfrom
jleveque:lldpmgrd
Mar 3, 2018
Merged

[LLDP] Add lldpmgrd Daemon to Manage LLDP Configuration#1428
jleveque merged 7 commits intosonic-net:masterfrom
jleveque:lldpmgrd

Conversation

@jleveque
Copy link
Contributor

  • New lldpmgrd solution replaces previous reconfigure.sh script, which had two known issues:
    • reconfigure.sh would occasionally crash due to call to sonic-cfggen crashing with the exception jinja2.exceptions.UndefinedError: 'PORT' is undefined if PORT table wasn't available at the time
    • reconfigure.sh would wait for all interfaces to exist, reconfigure all interfaces, then wait for all interfaces to go away before repeating the process. However, this only worked if ALL interfaces were destoyed and then recreated. If any number of interfaces less than the total number of interfaces were destroyed and recreated, their LLDP configuration would never be updated.
  • New lldpmgrd solution subscribes to notifications in the PORT table of the Redis State database and applies LLDP configuration on an interface-by-interface basis when interfaces are created.
  • Also clean up and refactor Dockerfile Jinja2 template
  • One minor issue with the lldpmgrd implementation is that sel.select() blocks and is not interrupted by signals, therefore calling docker stop lldp will not return until it times out after 10 seconds.

Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

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

As commented

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need LIBSWSSCOMMON here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it uses python-binding of libswsscommon for getting table notification from redis db.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

Choose a reason for hiding this comment

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

What about removing of an interface. Do you catch such case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. We decided this was unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

probably it's better to get exit code from the command too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm already checking the return code from the command on line 145 (if proc.returncode != 0:)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think 'if not status' would be better here

Copy link
Contributor

Choose a reason for hiding this comment

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

'if not status'

@pavel-shirshov
Copy link
Contributor

therefore calling docker stop lldp will not return until it times out after 10 seconds.
After 10 seconds docker just kill -9 everything in the container.

@jleveque
Copy link
Contributor Author

@pavel-shirshov: I understand that Docker sends a SIGKILL after 10 seconds, I'm just stating that with the current implementation of this daemon, the LLDP docker will always take the full 10 seconds to stop.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you always have "state" in fvp_dict?
Probably better

"state" in fvp_dict and fvp_dict["state"] == "ok"

?

Copy link
Contributor Author

@jleveque jleveque Feb 28, 2018

Choose a reason for hiding this comment

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

It should always be there, but it can't hurt to check. Will update shortly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

to be complete, we should also listen to CFG_DEVICE_NEIGHBOR_TABLE_NAME change, since if user configure this table, we may need to update the message we send out. I understand this is not an issue now, but we should add an comment to mark as TODO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not think we should return here, in case there is no description, we should send "ldpcli configure ports {0} lldp portidsubtype local {1}". this will ensure we send out the correct port name instead of mac address.

Copy link
Collaborator

Choose a reason for hiding this comment

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

to be complete, we should also listen to PORT_TABLE_NAME change, same reason as above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In case there is no alias, then we should use port name to send out.

Copy link
Collaborator

@lguohan lguohan left a comment

Choose a reason for hiding this comment

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

need to handle no alias case, need to handle no neighbor description case.

of the Redis State database. When we are notified of the creation of an
interface, update LLDP configuration accordingly.
"""
# Subscribe to PORT table notifications in the State DB
Copy link
Collaborator

Choose a reason for hiding this comment

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

as I noted in my previous comments, we should also listen CFG_PORT_TABLE and CFG_NEIGBHRO_TABLE in case port alias change or neighbor info change, then we can send updated information to the neighbor. We do not need to do this now, but we should mark it as TODO in the comment.

Copy link
Contributor Author

@jleveque jleveque Mar 2, 2018

Choose a reason for hiding this comment

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

I added a TODO in the file header comment (lines 12-13). I think you missed it.

@lguohan
Copy link
Collaborator

lguohan commented Mar 2, 2018

as I noted in my previous comments, we should also listen CFG_PORT_TABLE and CFG_NEIGBHRO_TABLE in case port alias change or neighbor info change, then we can send updated information to the neighbor. We do not need to do this now, but we should mark it as TODO in the comment.

@jleveque jleveque merged commit c689253 into sonic-net:master Mar 3, 2018
@jleveque jleveque deleted the lldpmgrd branch March 3, 2018 00:46
lguohan pushed a commit that referenced this pull request Feb 14, 2021
Commits include:

* src/sonic-utilities c7e46c9...42cab68 (3):
  > [consutil] Look for udevprefix.conf file under platform dir, not plugins (#1431)
  > [ci]: download from sonic-buildimage.vs artifact (#1428)
  > [storyteller] sort output by time and improve lag support (#1430)
stepanblyschak pushed a commit to stepanblyschak/sonic-buildimage that referenced this pull request May 10, 2021
sonic-net#6768 change
the kvm artifact name from kvm to vs

Signed-off-by: Guohan Lu <[email protected]>
taras-keryk pushed a commit to taras-keryk/sonic-buildimage that referenced this pull request Jul 22, 2022
Update SAI submodule v1.9 with the following fixes

7594e53 (HEAD, origin/v1.9) Skip brcm teardown assertion (sonic-net#1423) (sonic-net#1428)
0c33f4a [FIX]Fix the circular reference issue when build sai header py (sonic-net#1427)
7e0fc24 Add support for building under Doxygen 1.9.1 (sonic-net#1414) (sonic-net#1424)
8ecf3ef [Fix]Correct enum check on branch 1.9 (sonic-net#1418)
e2b2f39 Add Thrift 0.14.1 compatibility (sonic-net#1403) (sonic-net#1416)
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.

3 participants