Pox/Mininet: learning location of hosts

你说的曾经没有我的故事 提交于 2019-12-11 02:45:21

问题


My question might be a little vague as I clearly misunderstand a lot, but I'll give it a try anyway: Suppose I have 7 switches in a Fat Tree topology, and the bottom four are each connected to two hosts. When I start the controller I instructs the switches to send LLDP packets and this is how I learn the topology. Also I calculate a Spanning Tree to use when I flood packets like ARP requests.

My problem: how do I learn which switch a certain host is connected to? If h1 sends a layer 3 packet to h3, I know how to route the packets because I have a spanning tree, but this might not be the shortests route. I use Dijkstra to compute shortest routes from each switch to all others, but if I want to send a message to h3, I don't know what switch is directly connected to it.

Any ideas?


回答1:


The component responsible for do it is the Host_tracker. You need listen the Host_tracker event in your code, just like this:

from pox.core import core
import pox
import pox.lib.packet as pkt
from pox.lib.revent import *
from pox.openflow.discovery import Discovery
from pox.host_tracker import host_tracker
import pox.openflow.libopenflow_01 as of

class YourController(EventMixin):
  def __init__ (self):
    def startup ():
      core.openflow.addListeners(self, priority=0)
      core.openflow_discovery.addListeners(self)
      core.host_tracker.addListeners(self)
      """ Here is the place where is created the listener"""
    core.call_when_ready(startup, ('openflow','openflow_discovery', 'host_tracker'))


  def _handle_HostEvent (self, event):
    """ Here is the place where is used the listener"""
    print "Host, switchport and switch...", event.entry

  def _handle_PacketIn(self, event):
    """ Packet processing """
def launch():
  from host_tracker import launch
  launch()
  core.registerNew(YourController)


来源:https://stackoverflow.com/questions/26066259/pox-mininet-learning-location-of-hosts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!