X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=bin%2Fplc-kml.py;h=5096a799c16bf50f19187596e0fe466b13a649cf;hb=d954c58ba83857391a19b8f4e109af4869634ae7;hp=edcf035175d5de8f14412a6eac447f770ebd11fc;hpb=b447876db614bf111b212aa8b45f69b8e41665de;p=myplc.git
diff --git a/bin/plc-kml.py b/bin/plc-kml.py
index edcf035..5096a79 100755
--- a/bin/plc-kml.py
+++ b/bin/plc-kml.py
@@ -17,6 +17,12 @@ default_foreign_icon = "sites/google-foreign.png"
default_local_builtin = "palette-4.png"
default_foreign_builtin = "palette-3.png"
+# cosmetic - peername cannot be easily changed on the PLC-PLE link...
+def render_public_name (peername):
+ if peername=='PlanetLab': return "PlanetLab Central"
+ elif peername == 'PlanetLabEurope': return "PlanetLab Europe"
+ else: return peername
+
class KmlMap:
def __init__ (self,outputname,options):
@@ -34,32 +40,19 @@ class KmlMap:
def write(self,string):
self.output.write(string.encode("UTF-8"))
- # mention local last
- @staticmethod
- def site_compare (s1,s2):
- p1 = p2 = 0
- if s1['peer_id']: p1=s1['peer_id']
- if s2['peer_id']: p2=s2['peer_id']
- return p2-p1
-
- def refresh (self):
- self.open()
- self.write_header()
- # cache peers
- peers = GetPeers()
- all_sites = GetSites({'enabled':True,'is_public':True})
- all_sites.sort(KmlMap.site_compare)
- for site in all_sites:
- self.write_site(site,peers)
- self.write_footer()
- self.close()
-
# initial placement is for europe - dunno how to tune that yet
def write_header (self):
+ if not self.options.nodegroup:
+ local_peername=render_public_name(api.config.PLC_NAME)
+ title="%s sites"%local_peername
+ detailed="All the sites known to the %s testbed"%local_peername
+ else:
+ title="Nodegroup %s"%self.options.nodegroup
+ detailed="All sites involved in nodegroup %s"%self.options.nodegroup
self.write("""
" - description += "Testbed" - description += " | " + description += " | |||||||||||||||
Testbed | " (peername,peerurl) = self.peer_info (site,peers) - description += " %(peername)s "%locals() - #description += "[description]"%locals() - description += "" - description += ""%locals() - description += " | "
+ description += " "%locals() + description += " %(peername)s "%locals() + description += " | "
# URL
if site['url']:
site_url=site['url']
- description += "||||||||||||||
" - description += "Website" - description += " | " + description += " | |||||||||||||||
Website | " + description += "" description += " %(site_url)s "%locals() - description += " | |||||||||||||||
Nodegroup | " + description += "" + description += " %(nodegroup)s "%locals() + description += " | " + description += "|||||||||||||||
Usage details: | ||||||||||||||||
%(title)s | "%locals() + + # encapsulate usage in a table of its own + description += ""
+ description += "
|