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)
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)
def get_nodes(xml, filter={}): xpath = '//node%s | //default:node%s' % (XpathFilter.xpath(filter), XpathFilter.xpath(filter)) node_elems = xml.xpath(xpath) return NITOSv1Node.get_node_objs(node_elems)
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)
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)