Hi Mahmoud,
To solve this issue, we need to fix this bug.
For the quick patch, the following corrects this behavior?
$ git diff
diff --git a/ryu/topology/event.py b/ryu/topology/event.py
index e7b682c..5b776dc 100644
--- a/ryu/topology/event.py
+++ b/ryu/topology/event.py
@@ -170,4 +170,10 @@ class EventHostAdd(EventHostBase):
def __init__(self, host):
super(EventHostAdd, self).__init__(host)
+
+class EventHostDelete(EventHostBase):
+ def __init__(self, host):
+ super(EventHostDelete, self).__init__(host)
+
+
handler.register_service('ryu.topology.switches')
diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 7264075..5b0415b 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -868,6 +868,14 @@ class Switches(app_manager.RyuApp):
self.hosts.add(host)
ev = event.EventHostAdd(host)
self.send_event_to_observers(ev)
+ elif self.hosts[host_mac].port != port:
+ # Case of the host is moved to another port
+ ev = event.EventHostDelete(self.hosts[host_mac])
+ self.send_event_to_observers(ev)
+ # Register the moved host with the new location
+ self.hosts[host_mac] = host
+ ev = event.EventHostAdd(host)
+ self.send_event_to_observers(ev)
# arp packet, update ip address
if eth.ethertype == ether_types.ETH_TYPE_ARP:
Please note that the above does not handle the host deletion at the topology
app side, the host
might be duplicated in the REST response...
(Sorry, I couldn't reproduce the host migration on my environment, I haven't
test it enough)
Thanks,
Iwase
On 2017年11月24日 17:40, Mahmoud Elzoghbi wrote:
when i call (http//localhost:8080/v1.0/topology/hosts) API it discovers hosts's macs and which port
these hosts connected,but when host move from port to another,it discover the old position of host
what should i do to solve this problem??
thnx
mahmoud
On Fri, Nov 24, 2017 at 9:16 AM, Iwase Yusuke <iwase.yusu...@gmail.com
<mailto:iwase.yusu...@gmail.com>> wrote:
Hi Mahmoud,
When Ryu detects the new host connection, it only checks if the host is
known not not at here.
https://github.com/osrg/ryu/blob/ed2c6eca2227c9efb3c7e51cdd6db6bf578ec609/ryu/topology/switches.py#L867-L870
<https://github.com/osrg/ryu/blob/ed2c6eca2227c9efb3c7e51cdd6db6bf578ec609/ryu/topology/switches.py#L867-L870>
So, as your situation, when the host moves from a port to another, even if
Ryu detects it, the
new connection to that host seems to be ignored...
It seems that we need to store which port connecting to the host (not just
known or not).
Thanks,
Iwase
On 2017年11月24日 00:36, Mahmoud Elzoghbi wrote:
Hello to everyone,
I used Rest_topology.py to discover hosts in my topology, but when any
host moves from Port
1 to port 5 for example Rest_topology.py discover this host in port 1
also , it doesn't
sense the movement of host
What is the problem?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net <mailto:Ryu-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/ryu-devel
<https://lists.sourceforge.net/lists/listinfo/ryu-devel>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel