+ @staticmethod
+ def multi_lines_label(*lines):
+ result='<<TABLE BORDER="0" CELLBORDER="0"><TR><TD>' + \
+ '</TD></TR><TR><TD>'.join(lines) + \
+ '</TD></TR></TABLE>>'
+# print 'multilines=',result
+ return result
+
+ # default is for when we can't determine the type of the service
+ # typically the server is down, or we can't authenticate, or it's too old code
+ shapes = {"registry": "diamond", "slicemgr":"ellipse", "aggregate":"box", 'default':'plaintext'}
+ abbrevs = {"registry": "REG", "slicemgr":"SA", "aggregate":"AM", 'default':'[unknown interface]'}
+
+ # return a dictionary that translates into the node's attr
+ def get_layout (self):
+ layout={}
+ ### retrieve cached GetVersion
+ version=self.get_version()
+ # set the href; xxx would make sense to try and 'guess' the web URL, not the API's one...
+ layout['href']=self.url()
+ ### set html-style label
+ ### see http://www.graphviz.org/doc/info/shapes.html#html
+ # if empty the service is unreachable
+ if not version:
+ label="offline"
+ else:
+ label=''
+ try: abbrev=Interface.abbrevs[version['interface']]
+ except: abbrev=Interface.abbrevs['default']
+ label += abbrev
+ if 'hrn' in version: label += " %s"%version['hrn']
+ else: label += "[no hrn]"
+ if 'code_tag' in version:
+ label += " %s"%version['code_tag']
+ if 'testbed' in version:
+ label += " (%s)"%version['testbed']
+ layout['label']=Interface.multi_lines_label(self.url(),label)
+ ### set shape
+ try: shape=Interface.shapes[version['interface']]
+ except: shape=Interface.shapes['default']
+ layout['shape']=shape
+ ### fill color to outline wrongly configured bodies
+ if 'geni_api' not in version and 'sfa' not in version:
+ layout['style']='filled'
+ layout['fillcolor']='gray'
+ return layout
+