4 from sfa.client.sfi_commands import Commands
5 from sfa.rspecs.rspec import RSpec
6 from sfa.util.plxrn import xrn_to_hostname
8 command = Commands(usage="%prog [options]",
9 description="List all slivers in the RSpec. " +
10 "Use this to display the list of nodes belonging to " +
12 command.add_show_attributes_option()
15 if command.opts.infile:
16 rspec = RSpec(command.opts.infile)
17 nodes = rspec.version.get_nodes_with_slivers()
19 if command.opts.showatt:
20 defaults = rspec.version.get_default_sliver_attributes()
23 for (name, value) in defaults:
24 print " %s: %s" % (name, value)
28 if node.get('component_id'):
29 hostname = xrn_to_hostname(node['component_id'])
32 if command.opts.showatt:
33 atts = rspec.version.get_sliver_attributes(hostname)
34 for (name, value) in atts:
35 print " %s: %s" % (name, value)