Merge branch 'master' of git.onelab.eu:/git/sface
[sface.git] / sface / sfahelper.py
1
2 # These functions are going to be merged in sfa and we'll get rid of
3 # this sfahelper module. - baris
4
5 from sfa.util.rspecHelper import RSpec
6
7     
8 # TODO: already merged in sfa-trunk. Use the one there
9 def rspec_get_networks(rspec_string):
10     rspec = RSpec (rspec_string)
11     return rspec.rspec.xpath("./network[@name]/@name")
12
13
14 # TODO: already merged in sfa-trunk. Use the one there
15 def rspec_get_nodes_from_network(rspec_string, network):
16     rspec = RSpec (rspec_string)
17     return rspec.rspec.xpath("./network[@name='%s']/site/node/hostname/text()" % network)
18
19
20 def rspec_get_sliver_nodes_from_network(rspec_string, network):
21     rspec = RSpec (rspec_string)
22     return rspec.rspec.xpath("./network[@name='%s']/site/node[sliver]/hostname/text()" % network)
23
24 def rspec_get_other_nodes_from_network(rspec_string, network):
25     rspec = RSpec (rspec_string)
26     # xxx todo - could not find the xpath syntax for 'does not have the sliver attribute'
27     return rspec.rspec.xpath("./network[@name='%s']/site/node[~sliver]/hostname/text()" % network)