Пример #1
0
  def up (event):
    devs = pxpcap.PCap.get_devices()
    ports = _ports.split(",")
    phys = []
    portnum = 1
    if len(ports) == 1 and ports[0] == '': ports = []
    for p in list(ports):
      if p not in devs:
        log.error("Device %s not available -- ignoring", p)
        continue
      dev = devs[p]
      if dev.get('addrs',{}).get('ethernet',{}).get('addr') is None:
        log.error("Device %s has no ethernet address -- ignoring", p)
        continue
      if dev.get('addrs',{}).get('AF_INET') != None:
        log.error("Device %s has an IP address -- ignoring", p)
        continue
      phy = of.ofp_phy_port()
      phy.port_no = portnum
      portnum += 1
      phy.hw_addr = dev['addrs']['ethernet']['addr']
      phy.name = p
      # Fill in features sort of arbitrarily
      phy.curr = of.OFPPF_10MB_HD
      phy.advertised = of.OFPPF_10MB_HD
      phy.supported = of.OFPPF_10MB_HD
      phy.peer = of.OFPPF_10MB_HD
      phys.append(phy)

    do_launch(PCapSwitch, addr, port, max_retry_delay, dpid, ports=phys)
Пример #2
0
  def up (event):
    devs = pxpcap.PCap.get_devices()
    ports = _ports.split(",")
    phys = []
    portnum = 1
    if len(ports) == 1 and ports[0] == '': ports = []
    for p in list(ports):
      if p not in devs:
        log.error("Device %s not available -- ignoring", p)
        continue
      dev = devs[p]
      if dev.get('addrs',{}).get('ethernet',{}).get('addr') is None:
        log.error("Device %s has no ethernet address -- ignoring", p)
        continue
      if dev.get('addrs',{}).get('AF_INET') != None:
        log.error("Device %s has an IP address -- ignoring", p)
        continue
      phy = of.ofp_phy_port()
      phy.port_no = portnum
      portnum += 1
      phy.hw_addr = dev['addrs']['ethernet']['addr']
      phy.name = p
      # Fill in features sort of arbitrarily
      phy.curr = of.OFPPF_10MB_HD
      phy.advertised = of.OFPPF_10MB_HD
      phy.supported = of.OFPPF_10MB_HD
      phy.peer = of.OFPPF_10MB_HD
      phys.append(phy)

    do_launch(PCapSwitch, address, port, max_retry_delay, dpid, ports=phys,
              extra_args=extra)
Пример #3
0
    def up(event):
        ports = [p for p in _ports.split(",") if p]

        sw = do_launch(PCapSwitch,
                       address,
                       port,
                       max_retry_delay,
                       dpid,
                       ports=ports,
                       extra_args=extra)
        _switches[sw.name] = sw
Пример #4
0
  def up (event):
    ports = [p for p in _ports.split(",") if p]

    sw = do_launch(PCapSwitch, address, port, max_retry_delay, dpid,
                   ports=ports, extra_args=extra)
    _switches[sw.name] = sw