Example #1
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
Example #2
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)
Example #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)
Example #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