Reputation: 1
I can't seem to get all the links by calling get_link in Ryu Some links I can't get why is that?
@set_ev_cls(event.EventSwitchEnter)
def get_topology(self,ev):
switch_list = get_switch(self.topology_api_app,None)
switches = [switch.dp.id for switch in switch_list]
self.network.add_nodes_from(switches)
link_list = get_link(self.topology_api_app,None)
links = [(link.src.dpid,link.dst.dpid,{'port': link.src.port_no}) for link in link_list]
print(links)
self.network.add_edges_from(links) # 添加正向边
links = [(link.dst.dpid,link.src.dpid,{'port': link.dst.port_no}) for link in link_list]
self.network.add_edges_from(links) # 添加反向边
@set_ev_cls(event.EventHostAdd)
def _host_add_handler(self,ev):
host_list = get_host(self.topology_api_app,None)
links = [(host.mac,host.port.dpid,{'port': host.port.port_no}) for host in host_list]
self.network.add_edges_from(links)
links = [(host.port.dpid,host.mac, {'port': host.port.port_no}) for host in host_list]
self.network.add_edges_from(links)
I've tried to look at the source code for get_links but I'm not getting a solution.
Upvotes: 0
Views: 36