X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfahelper.py;fp=sface%2Fsfahelper.py;h=53cf35164fd0d03d1009d398173ce14a3f202453;hp=0000000000000000000000000000000000000000;hb=ec32b764aaea2419c6e43cca236aa7f91e5b6de1;hpb=e095c7423002644d129cef273f3a63646903b788 diff --git a/sface/sfahelper.py b/sface/sfahelper.py new file mode 100644 index 0000000..53cf351 --- /dev/null +++ b/sface/sfahelper.py @@ -0,0 +1,27 @@ + +# These functions are going to be merged in sfa and we'll get rid of +# this sfahelper module. - baris + +from sfa.util.rspecHelper import RSpec + + +# TODO: already merged in sfa-trunk. Use the one there +def rspec_get_networks(self, rspec_string): + rspec = RSpec (rspec_string) + return rspec.rspec.xpath("./network[@name]/@name") + + +# TODO: already merged in sfa-trunk. Use the one there +def rspec_get_xml_nodes_from_network(self, rspec_string, network): + rspec = RSpec (rspec_string) + return rspec.rspec.xpath("./network[@name='%s']/site/node" % network) + + +def rspec_get_sliver_nodes_from_network(self, rspec_string, network): + rspec = RSpec (rspec_string) + return rspec.rspec.xpath("./network[@name='%s']/site/node[sliver]/hostname/text()" % network) + +def rspec_get_other_nodes_from_network(self, rspec_string, network): + rspec = RSpec (rspec_string) + # xxx todo - could not find the xpath syntax for 'does not have the sliver attribute' + return rspec.rspec.xpath("./network[@name='%s']/site/node[~sliver]/hostname/text()" % network)