예제 #1
0
파일: lib.py 프로젝트: HalasNet/felix
def addAdDevice (rspec, dpid, active=True):
  switch_urn = generateSwitchComponentID(dpid)

  od = ET.SubElement(rspec, "{%s}datapath" % (OFNSv3))
  od.attrib["component_id"] = switch_urn
  od.attrib["component_manager_id"] = getManagerID()
  od.attrib["dpid"] = dpid

  locdata = GeniDB.getLocationData(dpid, switch_urn)
  if locdata:
    ET.SubElement(od, "{%s}location" % (OFNSv3), country=locdata.country, latitude=locdata.lat, longitude=locdata.long)

  attachments = TopoDB.getDPIDAttachments(dpid)

  if active:
    ports = FV.getDevicePorts(dpid)
    for port in ports:
      if (port.features == None):
        p = ET.SubElement(od, "{%s}port" % (OFNSv3), num=str(port.num), name=port.name)
      else:
        p = ET.SubElement(od, "{%s}port" % (OFNSv3), num=str(port.num), name=port.name, features=port.features)
      for info in attachments.setdefault(port.name, []):
        a = ET.SubElement(p, "{%s}attachment" % (OFNSv3))
        a.attrib["remote_component_id"] = info.remote_component_id
        a.attrib["remote_port"] = info.remote_port
        a.attrib["desc"] = info.desc
예제 #2
0
파일: lib.py 프로젝트: HalasNet/felix
def addAdDevice (rspec, dpid, active=True):
  switch_urn = generateSwitchComponentID(dpid)

  od = ET.SubElement(rspec, "{%s}datapath" % (OFNSv3))
  od.attrib["component_id"] = switch_urn
  od.attrib["component_manager_id"] = "urn:publicid:IDN+foam:%s+authority+am" % ('ocf.ofelia.i2cat.ofam')
  od.attrib["dpid"] = dpid

  #locdata = GeniDB.getLocationData(dpid, switch_urn)
  #if locdata:
  #  ET.SubElement(od, "{%s}location" % (OFNSv3), country=locdata.country, latitude=locdata.lat, longitude=locdata.long)

  #attachments = TopoDB.getDPIDAttachments(dpid)

  if active:
    ports = FV.getDevicePorts(dpid)
    for port in ports:
      p = ET.SubElement(od, "{%s}port" % (OFNSv3), num=str(port.num), name=port.name)
예제 #3
0
def addAdDevice(rspec, dpid, active=True):
    switch_urn = generateSwitchComponentID(dpid)

    od = ET.SubElement(rspec, "{%s}datapath" % (OFNSv3))
    od.attrib["component_id"] = switch_urn
    od.attrib[
        "component_manager_id"] = "urn:publicid:IDN+foam:%s+authority+am" % (
            'ocf.ofelia.i2cat.ofam')
    od.attrib["dpid"] = dpid

    #locdata = GeniDB.getLocationData(dpid, switch_urn)
    #if locdata:
    #  ET.SubElement(od, "{%s}location" % (OFNSv3), country=locdata.country, latitude=locdata.lat, longitude=locdata.long)

    #attachments = TopoDB.getDPIDAttachments(dpid)

    if active:
        ports = FV.getDevicePorts(dpid)
        for port in ports:
            p = ET.SubElement(od,
                              "{%s}port" % (OFNSv3),
                              num=str(port.num),
                              name=port.name)
예제 #4
0
def addAdDevice(rspec, dpid, active=True):
    switch_urn = generateSwitchComponentID(dpid)

    od = ET.SubElement(rspec, "{%s}datapath" % (OFNSv3))
    od.attrib["component_id"] = switch_urn
    od.attrib["component_manager_id"] = getManagerID()
    od.attrib["dpid"] = dpid

    locdata = GeniDB.getLocationData(dpid, switch_urn)
    if locdata:
        ET.SubElement(od,
                      "{%s}location" % (OFNSv3),
                      country=locdata.country,
                      latitude=locdata.lat,
                      longitude=locdata.long)

    attachments = TopoDB.getDPIDAttachments(dpid)

    if active:
        ports = FV.getDevicePorts(dpid)
        for port in ports:
            if (port.features == None):
                p = ET.SubElement(od,
                                  "{%s}port" % (OFNSv3),
                                  num=str(port.num),
                                  name=port.name)
            else:
                p = ET.SubElement(od,
                                  "{%s}port" % (OFNSv3),
                                  num=str(port.num),
                                  name=port.name,
                                  features=port.features)
            for info in attachments.setdefault(port.name, []):
                a = ET.SubElement(p, "{%s}attachment" % (OFNSv3))
                a.attrib["remote_component_id"] = info.remote_component_id
                a.attrib["remote_port"] = info.remote_port
                a.attrib["desc"] = info.desc