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

provide delete_link function #79

Open
ghost opened this issue Oct 19, 2020 · 2 comments
Open

provide delete_link function #79

ghost opened this issue Oct 19, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 19, 2020

It would be nice to have a delete_link function (analog to the create_link funcrton) which takes the same parameters (node_a, port_a, node_b, port_b).

Internaly it would need to find the link ID used for that connection and then call the delete() method of the link object.

This would be usefull in updating existing topologies (e.g. when using the ansible modules) in order to not only add missing links, but also remove not needed links from topolgies without the need to remove/delete the complete topology.

We might have a go on that soon, for now this shall serve as a feature request :)

@davidban77
Copy link
Owner

Don't have enough cycles to give this a spin for the time being, it is a good idea to have that method implemented.

Feel free to give it a shot? I can later help on moving this functionality to the ansible modules

@Krlosromero
Copy link
Collaborator

Krlosromero commented Nov 3, 2020

Hello all,

I had created the project function to delete the links as required, running on my local lab for now

n [7]: print(tabulate(links_summary, headers=["Node A", "Port A", "Node B", "Port B"]))                                                                                                                                        
Node A            Port A       Node B            Port B
----------------  -----------  ----------------  -----------
PC-1              Ethernet0    Ethernetswitch-1  Ethernet0
Ethernetswitch-1  Ethernet1    PC-2              Ethernet0
Ethernetswitch-1  Ethernet5    vEOS-4.21.5F-2    Management
IOU1              Ethernet0/0  Ethernetswitch-1  Ethernet2
inet0-VMNET1      eth0         Ethernetswitch-1  Ethernet3
switch2           Ethernet1    IOU2              Ethernet0/0
switch2           Ethernet0    Ethernetswitch-1  Ethernet4

In [8]: first_lab.delete_link('switch2','Ethernet0','Ethernetswitch-1','Ethernet4')                                                                                                                                             
Deleted Link-ID: 45d4d13d-d333-4e9b-a193-d50898847c4b from node switch2, port: Ethernet0 <--> node Ethernetswitch-1, port: Ethernet4 

In [9]: first_lab.get()                                                                                                                                                                                                         

In [10]: links_summary = first_lab.links_summary(is_print=False)                                                                                                                                                                

In [11]: print(tabulate(links_summary, headers=["Node A", "Port A", "Node B", "Port B"]))                                                                                                                                       
Node A            Port A       Node B            Port B
----------------  -----------  ----------------  -----------
PC-1              Ethernet0    Ethernetswitch-1  Ethernet0
Ethernetswitch-1  Ethernet1    PC-2              Ethernet0
Ethernetswitch-1  Ethernet5    vEOS-4.21.5F-2    Management
IOU1              Ethernet0/0  Ethernetswitch-1  Ethernet2
inet0-VMNET1      eth0         Ethernetswitch-1  Ethernet3
switch2           Ethernet1    IOU2              Ethernet0/0

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

No branches or pull requests

2 participants