site = {}
site['site_id'] = 0
- site['name'] = 'geni.%s' % hrn_auth
+ site['name'] = 'geni.%s' % hrn_auth[:20]
site['enabled'] = True
site['max_slices'] = 100
# Note:
# Is it okay if this login base is the same as one already at this myplc site?
# Do we need uniqueness? Should use hrn_auth instead of just the leaf perhaps?
- site['login_base'] = get_leaf(hrn_auth)
- site['abbreviated_name'] = hrn
+ site['login_base'] = hrn_auth[:20]
+ site['abbreviated_name'] = hrn_auth[:20]
site['max_slivers'] = 1000
reg_objects['site'] = site
# add nodes from rspec
added_nodes = list(set(request).difference(current))
-
- if peer:
- api.plshell.UnBindObjectFromPeer(api.plauth, 'slice', slice.id, peer)
- api.plshell.AddSliceToNodes(user_plauth, slice.name, added_nodes)
- api.plshell.DeleteSliceFromNodes(user_plauth, slice.name, deleted_nodes)
+ try:
+ if peer:
+ api.plshell.UnBindObjectFromPeer(api.plauth, 'slice', slice.id, peer)
+
+ api.plshell.AddSliceToNodes(user_plauth, slice.name, added_nodes)
+ api.plshell.DeleteSliceFromNodes(user_plauth, slice.name, deleted_nodes)
- network.updateSliceTags()
+ network.updateSliceTags()
- if peer:
- api.plshell.BindObjectToPeer(api.plauth, 'slice', slice.id, peer,
- slice.peer_id)
+ finally:
+ if peer:
+ api.plshell.BindObjectToPeer(api.plauth, 'slice', slice.id, peer,
+ slice.peer_id)
# print network.toxml()
return True
# determine if this is a peer slice
peer = peers.get_peer(api, hrn)
- if peer:
- api.plshell.UnBindObjectFromPeer(api.plauth, 'slice', slice['slice_id'], peer)
- api.plshell.DeleteSliceFromNodes(api.plauth, slicename, slice['node_ids'])
- if peer:
- api.plshell.BindObjectToPeer(api.plauth, 'slice', slice['slice_id'], peer, slice['peer_slice_id'])
+ try:
+ if peer:
+ api.plshell.UnBindObjectFromPeer(api.plauth, 'slice', slice['slice_id'], peer)
+ api.plshell.DeleteSliceFromNodes(api.plauth, slicename, slice['node_ids'])
+ finally:
+ if peer:
+ api.plshell.BindObjectToPeer(api.plauth, 'slice', slice['slice_id'], peer, slice['peer_slice_id'])
return 1
def get_slices(api, creds):
xrn = options.get('geni_slice_urn', None)
hrn, type = urn_to_hrn(xrn)
- """
# look in cache first
if api.cache and not xrn:
rspec = api.cache.get('nodes')
if rspec:
return rspec
- """
registry = api.registries[api.hrn]
credential = api.getCredential()
rspec = network.toxml()
- """
# cache the result
if api.cache and not xrn:
api.cache.add('nodes', rspec)
- """
+
return rspec