Small edit in order to test the git repo. NT.
[sfa.git] / sfa / client / sfiListSlivers.py
1 #! /usr/bin/env python
2
3 import sys
4 from sfa.client.sfi_commands import Commands
5 from sfa.rspecs.rspec_parser import parse_rspec
6
7 command = Commands(usage="%prog [options]",
8                    description="List all slivers in the RSpec. " + 
9                    "Use this to display the list of nodes belonging to " + 
10                    "the slice.")
11 command.add_show_attributes_option()
12 command.prep()
13
14 if command.opts.infile:
15     rspec = parse_rspec(command.opts.infile)
16     nodes = rspec.get_nodes_with_slivers()
17     
18     if command.opts.showatt:
19         defaults = rspec.get_default_sliver_attributes()
20         if defaults:
21             print "ALL NODES"
22             for (name, value) in defaults:
23                 print "  %s: %s" % (name, value)        
24
25     for node in nodes:
26         print node
27         if command.opts.showatt:
28             atts = rspec.get_sliver_attributes(node)
29             for (name, value) in atts:
30                 print "  %s: %s" % (name, value)
31
32