Open italovalcy opened 3 years ago
When Kytos receives a port down event, it deactivates any possible link using that interface, however it does not deactivate the interface itself.
Steps to reproduce:
kytosd -E
mn --topo linear,2 --controller=remote,ip=127.0.0.1
mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/interfaces | jq -r '.interfaces[].active' true true true true true true mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/links | jq -r '.links[].active' true
mininet> sh ip link set down s1-eth2
mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/links | jq -r '.links[].active' mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/interfaces | jq -r '.interfaces[].active'
Expected output:
mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/links | jq -r '.links[].active' false mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/interfaces | jq -r '.interfaces[].active' true false true true false true
Actual output:
mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/links | jq -r '.links[].active' false mininet> sh curl -s http://127.0.0.1:8181/api/kytos/topology/v3/interfaces | jq -r '.interfaces[].active' true true true true true true
I believe there are missing calls to activate / deactivate methods on interface.link_up./ interface.link_down events:
diff --git a/main.py b/main.py index 70c7f28..9a2b8e2 100644 --- a/main.py +++ b/main.py @@ -589,6 +589,7 @@ class Main(KytosNApp): # pylint: disable=too-many-public-methods The event notifies that an interface's link was changed to 'up'. """ interface = event.content['interface'] + interface.activate() self.handle_link_up(interface) @listen_to('kytos/maintenance.end_switch') @@ -638,6 +639,7 @@ class Main(KytosNApp): # pylint: disable=too-many-public-methods """ interface = event.content['interface'] self.handle_link_down(interface) + interface.deactivate() @listen_to('kytos/maintenance.start_switch') def handle_switch_maintenance_start(self, event):
When Kytos receives a port down event, it deactivates any possible link using that interface, however it does not deactivate the interface itself.
Steps to reproduce:
kytosd -E
mn --topo linear,2 --controller=remote,ip=127.0.0.1
Expected output:
Actual output:
I believe there are missing calls to activate / deactivate methods on interface.link_up./ interface.link_down events: