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

Cleanup connection after switch deletion #445

Open
Alopalao opened this issue Feb 5, 2024 · 1 comment
Open

Cleanup connection after switch deletion #445

Alopalao opened this issue Feb 5, 2024 · 1 comment
Labels
priority_low Low priority

Comments

@Alopalao
Copy link

Alopalao commented Feb 5, 2024

After a switch is deleted, there is a leftover data in controller.connections (switch 00:00:00:00:00:00:00:01 was deleted):

kytos $> controller.connections
Out[3]: 
{('127.0.0.1',
  33734): Connection('127.0.0.1', 33734, None, Switch('00:00:00:00:00:00:00:01'), <ConnectionState.FINISHED: 4>),
 ('127.0.0.1',
  33744): Connection('127.0.0.1', 33744, <asyncio.TransportSocket fd=116, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 6653), raddr=('127.0.0.1', 33744)>, Switch('00:00:00:00:00:00:00:03'), <ConnectionState.ESTABLISHED: 2>),
 ('127.0.0.1',
  33750): Connection('127.0.0.1', 33750, <asyncio.TransportSocket fd=117, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 6653), raddr=('127.0.0.1', 33750)>, Switch('00:00:00:00:00:00:00:02'), <ConnectionState.ESTABLISHED: 2>)}

It is not a problem to keep this data, it is just a leftover.
From PR comment.

@Alopalao Alopalao added the priority_low Low priority label Feb 5, 2024
@viniarck
Copy link
Member

viniarck commented Feb 5, 2024

Good one. Future note and requirement to be aware:

The main gotcha to be aware though is that it's not desirable to close the socket if a deleted switch conn is still ESTABLISHED, otherwise it'd close the connection with that switch, which in turn, if the network operator hand't remove the controller tcp connection there yet, it would reconnect again, leading to another (undesired) rediscovery.

Ideally, this needs to be clean up but only for non existing switches when they disconnect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority_low Low priority
Projects
None yet
Development

No branches or pull requests

2 participants