Beispiel #1
0
 def get_elements(self, element_type, filter={}):
     """
     search for a registered element
     """
     if element_type not in self.elements:
         msg = "Unable to search for element %s in rspec, expath expression not found." % \
                element_type
         raise InvalidRSpecElement(element_type, extra=msg)
     rspec_element = self.get_rspec_element(element_type)
     xpath = rspec_element.path + XpathFilter.xpath(filter)
     return self.xml.xpath(xpath)
Beispiel #2
0
 def get_nodes(xml, filter={}):
     xpath = '//node%s | //default:node%s' % (XpathFilter.xpath(filter), XpathFilter.xpath(filter))
     node_elems = xml.xpath(xpath)
     return PGv2Node.get_node_objs(node_elems)
Beispiel #3
0
 def get_leases(xml, filter={}):
     xpath = '//lease%s | //default:lease%s' % (XpathFilter.xpath(filter), XpathFilter.xpath(filter))
     lease_elems = xml.xpath(xpath)
     return SFAv1Lease.get_lease_objs(lease_elems)
Beispiel #4
0
 def get_channels(xml, filter={}):
     xpath = '//channel%s | //default:channel%s' % (XpathFilter.xpath(filter), XpathFilter.xpath(filter))
     channel_elems = xml.xpath(xpath)
     return NITOSv1Channel.get_channel_objs(channel_elems)