git://git.onelab.eu
/
nodemanager-topo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f36c891
)
Update for PL4.3
author
Andy Bavier
<acb@cs.princeton.edu>
Thu, 21 May 2009 14:19:07 +0000
(14:19 +0000)
committer
Andy Bavier
<acb@cs.princeton.edu>
Thu, 21 May 2009 14:19:07 +0000
(14:19 +0000)
create-topo-attributes.py
patch
|
blob
|
history
diff --git
a/create-topo-attributes.py
b/create-topo-attributes.py
index
ab4680e
..
b9536eb
100755
(executable)
--- a/
create-topo-attributes.py
+++ b/
create-topo-attributes.py
@@
-2,7
+2,7
@@
# $URL$
"""
# $URL$
"""
-Scan the VINI Central database and create topology "rspec"
attribute
s for
+Scan the VINI Central database and create topology "rspec"
tag
s for
slices that have an EGRE key. This script to be run from a cron job.
"""
slices that have an EGRE key. This script to be run from a cron job.
"""
@@
-110,13
+110,13
@@
nodes = get_nodes()
adj_matrix = get_adjacency_matrix(links)
for slice in GetSlices():
adj_matrix = get_adjacency_matrix(links)
for slice in GetSlices():
- # Create dictionary of the slice's
attribute
s
+ # Create dictionary of the slice's
tag
s
attrs ={}
topo_attr = {}
attrs ={}
topo_attr = {}
- for
attribute in GetSliceAttributes(slice['slice_attribute
_ids']):
- attrs[
attribute['name']] = attribute['slice_attribute
_id']
- if
attribute['name'] == 'topo_rspec' and attribute
['node_id']:
- topo_attr[
attribute['node_id']] = attribute['slice_attribute
_id']
+ for
tag in GetSliceTags(slice['slice_tag
_ids']):
+ attrs[
tag['tagname']] = tag['slice_tag
_id']
+ if
tag['tagname'] == 'topo_rspec' and tag
['node_id']:
+ topo_attr[
tag['node_id']] = tag['slice_tag
_id']
if dryrun and slice['name'] == 'pl_trellis':
attrs['egre_key'] = 101
if dryrun and slice['name'] == 'pl_trellis':
attrs['egre_key'] = 101
@@
-149,19
+149,19
@@
for slice in GetSlices():
if dryrun:
print node, topo_str
elif node in topo_attr:
if dryrun:
print node, topo_str
elif node in topo_attr:
- UpdateSlice
Attribute
(topo_attr[node], topo_str)
+ UpdateSlice
Tag
(topo_attr[node], topo_str)
del topo_attr[node]
else:
id = slice['slice_id']
del topo_attr[node]
else:
id = slice['slice_id']
- AddSlice
Attribute
(id, 'topo_rspec', topo_str, node)
+ AddSlice
Tag
(id, 'topo_rspec', topo_str, node)
if dryrun:
print hosts
elif 'hosts' in attrs:
if dryrun:
print hosts
elif 'hosts' in attrs:
- UpdateSlice
Attribute
(attrs['hosts'], hosts)
+ UpdateSlice
Tag
(attrs['hosts'], hosts)
else:
id = slice['slice_id']
else:
id = slice['slice_id']
- AddSlice
Attribute
(id, 'hosts', hosts)
+ AddSlice
Tag
(id, 'hosts', hosts)
else:
if dryrun:
print "No EGRE key for %s" % slice['name']
else:
if dryrun:
print "No EGRE key for %s" % slice['name']
@@
-170,6
+170,6
@@
for slice in GetSlices():
if not dryrun:
for node in topo_attr:
if not dryrun:
for node in topo_attr:
- DeleteSlice
Attribute
(topo_attr[node])
+ DeleteSlice
Tag
(topo_attr[node])