-
+from sfa.util.sfalogging import logger
from sfa.util.xml import XpathFilter
from sfa.util.plxrn import PlXrn, xrn_to_hostname
from sfa.util.xrn import Xrn
location_elems = Element.add_elements(node_elem, 'location',
node.get('location', []), Location.fields)
interface_elems = Element.add_elements(node_elem, 'interface',
- node.get('interfaces', []), Interface.fields)
+ node.get('interfaces', []), ['component_id', 'client_id', 'ipv4'])
#if 'bw_unallocated' in node and node['bw_unallocated']:
# bw_unallocated = etree.SubElement(node_elem, 'bw_unallocated', units='kbps').text = str(int(node['bw_unallocated'])/1000)
node_elems = xml.xpath(xpath)
return SFAv1Node.get_node_objs(node_elems)
+ # xxx Thierry : an ugly hack to get the tests to pass again
+ # probably this needs to be trashed
+ # the original code returned the <sliver /> tag,
+ # but we prefer the <node> father node instead as it already holds data
+ # initially this was to preserve the nodename...
+ # xxx I don't get the ' | //default:node/default:sliver' ...
+ @staticmethod
+ def get_nodes_with_slivers_thierry(xml):
+ # dropping the ''
+ xpath = '//node[count (sliver)>0]'
+ node_elems = xml.xpath(xpath)
+ # we need to check/recompute the node data
+
+ return node_elems
+
@staticmethod
def get_nodes_with_slivers(xml):
xpath = '//node/sliver | //default:node/default:sliver'