#panos: a new option to define the type of information about resources a user is interested in
parser.add_option("-i", "--info", dest="info",
help="optional component information", default=None)
- # a new option to retreive or not reservation-oriented RSpecs (leases)
+ # a new option to retrieve or not reservation-oriented RSpecs (leases)
parser.add_option("-l", "--list_leases", dest="list_leases", type="choice",
- help="Retreive or not reservation-oriented RSpecs ([resources]|leases|all )",
+ help="Retrieve or not reservation-oriented RSpecs ([resources]|leases|all)",
choices=("all", "resources", "leases"), default="resources")
options['geni_rspec_version'] = options['rspec_version']
else:
raise SfaInvalidArgument('Must specify an rspec version option. geni_rspec_version cannot be null')
- valid_creds = self.api.auth.checkCredentialsSpeaksFor(creds, 'listnodes', urns,
- check_sliver_callback = self.api.driver.check_sliver_credentials,
- options=options)
+ valid_creds = self.api.auth.checkCredentialsSpeaksFor(
+ creds, 'listnodes', urns,
+ check_sliver_callback = self.api.driver.check_sliver_credentials,
+ options=options)
# get hrn of the original caller
origin_hrn = options.get('origin_hrn', None)
rspec_node['slivers'] = [rspec_sliver]
# slivers always provide the ssh service
- login = Login({'authentication': 'ssh-keys',
- 'hostname': sliver['hostname'],
+ login = Login({'authentication': 'ssh-keys',
+ 'hostname': sliver['hostname'],
'port':'22',
'username': sliver['name'],
'login': sliver['name']
})
service = ServicesElement({'login': login,
- 'services_user': sliver['services_user']})
- rspec_node['services'] = [service]
- return rspec_node
+ 'services_user': sliver['services_user']})
+ rspec_node['services'] = [service]
+ return rspec_node
def get_slice_tags(self, slice):
slice_tag_ids = []
elif hasattr(self.element, name):
return getattr(self.element, name)
else:
- raise AttributeError, "class Element has no attribute %s" % name
+ raise AttributeError("class Element of type {} has no attribute {}"
+ .format(self.__class__.__name__, name))
attrib_elem = xml.add_element('{%s}info' % self.namespaces['flack'])
attrib_dict = eval(tag['value'])
for (key, value) in attrib_dict.items():
- attrib_elem.set(key, value)
+ attrib_elem.set(key, value)
@staticmethod
def get_slivers(xml, filter=None):
if filter is None: filter={}
# Networks
def get_networks(self):
network_names = set()
- nodes = self.xml.xpath('//default:node[@component_manager_id] | //node[@component_manager_id]', namespaces=self.namespaces)
+ nodes = self.xml.xpath('//default:node[@component_manager_id] | //node[@component_manager_id]',
+ namespaces=self.namespaces)
for node in nodes:
if 'component_manager_id' in node.attrib:
network_urn = node.get('component_manager_id')