git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bbfa9aa
)
add_nodes() tries to add location details
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Wed, 11 May 2011 20:01:17 +0000
(16:01 -0400)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Wed, 11 May 2011 20:01:17 +0000
(16:01 -0400)
sfa/rspecs/sfa_rspec.py
patch
|
blob
|
history
diff --git
a/sfa/rspecs/sfa_rspec.py
b/sfa/rspecs/sfa_rspec.py
index
50d42bd
..
ea4544e
100755
(executable)
--- a/
sfa/rspecs/sfa_rspec.py
+++ b/
sfa/rspecs/sfa_rspec.py
@@
-31,8
+31,11
@@
class SfaRSpec(RSpec):
return name.getparent()
return None
return name.getparent()
return None
- def get_node_elements(self):
- return self.xml.xpath('//node')
+ def get_node_elements(self, network=None):
+ if network:
+ return self.xml.xpath('//network[@name="%s"]//node' % network)
+ else:
+ return self.xml.xpath('//node')
def get_nodes(self, network=None):
if network == None:
def get_nodes(self, network=None):
if network == None:
@@
-194,7
+197,13
@@
class SfaRSpec(RSpec):
for tag in node['tags']:
# expose this hard wired list of tags, plus the ones that are marked 'sfa' in their category
if tag['tagname'] in ['fcdistro', 'arch'] or 'sfa' in tag['category'].split('/'):
for tag in node['tags']:
# expose this hard wired list of tags, plus the ones that are marked 'sfa' in their category
if tag['tagname'] in ['fcdistro', 'arch'] or 'sfa' in tag['category'].split('/'):
- tag_element = etree.SubElement(node_tag, tag['tagname'], value=tag['value'])
+ tag_element = etree.SubElement(node_tag, tag['tagname'], value=tag['value'])
+
+ if 'site' in node:
+ longitude = str(node['site']['longitude'])
+ latitude = str(node['site']['latitude'])
+ location = etree.SubElement(node_tag, 'location', country='unknown', \
+ longitude=longitude, latitude=latitude)
def add_interfaces(self, interfaces):
pass
def add_interfaces(self, interfaces):
pass