Example #1
0
def getAdvertisement ():
  NSMAP = {None: "%s" % (PGNS),
          "xs" : "%s" % (XSNS),
          "openflow" : "%s" % (OFNSv3)}

  rspec = ET.Element("rspec", nsmap = NSMAP)
  rspec.attrib["{%s}schemaLocation" % (XSNS)] = PGNS + " " \
              "http://www.geni.net/resources/rspec/3/ad.xsd " + \
              OFNSv3 + " " \
              "http://www.geni.net/resources/rspec/ext/openflow/3/of-ad.xsd"
  rspec.attrib["type"] = "advertisement"

  links = FV.getLinkList()
  devices = FV.getDeviceList()
  fvversion = FV.getFVVersion()
  db_devices = GeniDB.getDeviceSet()
  GeniDB.refreshDevices(devices)

  for dpid in devices:
    db_devices.discard(dpid)
    addAdDevice(rspec, dpid)

  for dpid in db_devices:
    addAdDevice(rspec, dpid, False)
 
#getLinks START    
  for link in links:
    addAdLink(rspec, link)
#getLinks END 
    
  xml = StringIO()
  ET.ElementTree(rspec).write(xml)
  return xml.getvalue()
 def pub_get_links(self, **kwargs):
     '''
 Return the links that the FlowVisor gives. Change to CH format.
 '''
     complete_list = []
     try:
         links = [(l.pop("srcDPID"), l.pop("srcPort"), l.pop("dstDPID"),
                   l.pop("dstPort"), l) for l in FV.getLinkList()]
     except Exception, e:
         import traceback
         traceback.print_exc()
         raise e
Example #3
0
 def pub_get_links(self, **kwargs):
   '''
   Return the links that the FlowVisor gives. Change to CH format.
   '''
   complete_list = []
   try:
     links = [(l.pop("srcDPID"),
               l.pop("srcPort"),
               l.pop("dstDPID"),
               l.pop("dstPort"),
               l) for l in FV.getLinkList()]
   except Exception,e:
     import traceback
     traceback.print_exc()
     raise e 
Example #4
0
def getAdvertisement():
    NSMAP = {
        None: "%s" % (PGNS),
        "xs": "%s" % (XSNS),
        "openflow": "%s" % (OFNSv3)
    }

    rspec = ET.Element("rspec", nsmap=NSMAP)
    rspec.attrib["{%s}schemaLocation" % (XSNS)] = PGNS + " " \
                "http://www.geni.net/resources/rspec/3/ad.xsd " + \
                OFNSv3 + " " \
                "http://www.geni.net/resources/rspec/ext/openflow/3/of-ad.xsd"
    rspec.attrib["type"] = "advertisement"

    links = FV.getLinkList()
    devices = FV.getDeviceList()
    fvversion = FV.getFVVersion()
    db_devices = GeniDB.getDeviceSet()
    GeniDB.refreshDevices(devices)

    for dpid in devices:
        db_devices.discard(dpid)
        addAdDevice(rspec, dpid)

    for dpid in db_devices:
        addAdDevice(rspec, dpid, False)

#getLinks START
    for link in links:
        addAdLink(rspec, link)


#getLinks END

    xml = StringIO()
    ET.ElementTree(rspec).write(xml)
    return xml.getvalue()