# recompute the SFA graphs from different locations
+# AMs, at least MyPLC AMs, are boring
#BUNDLES += http://planet-lab.eu:12346/@auto-ple-am
BUNDLES += http://planet-lab.eu:12345/@auto-ple-reg
BUNDLES += http://planet-lab.eu:12347/@auto-ple-sa
BUNDLES += http://planet-lab.org:12347/@auto-plc-sa
BUNDLES += http://planet-lab.kr:12345/@auto-ppk-reg
BUNDLES += http://planet-lab.kr:12347/@auto-ppk-sa
-BUNDLES += http://www.emulab.net:443/protogeni/xmlrpc/am/@auto-emulab-am
BUNDLES += http://geni-myvini.umkc.gpeni.net:12345/@auto-gpeni-reg
BUNDLES += http://geni-myvini.umkc.gpeni.net:12347/@auto-gpeni-sa
BUNDLES += http://198.248.241.100:12345/@auto-glc-reg
BUNDLES += http://www.emanicslab.org:12345/@auto-elc-reg
BUNDLES += http://www.emanicslab.org:12347/@auto-elc-sa
-# dont output svg yet
-#EXTENSIONS := png svg
-EXTENSIONS := png
+# left to right
+BUNDLES-LR += http://www.emulab.net:443/protogeni/xmlrpc/am/@auto-emulab-am
+BUNDLES-LR += http://planet-lab.eu:12345/@auto-ple-reg
+BUNDLES-LR += http://planet-lab.eu:12347/@auto-ple-sa
+BUNDLES-LR += http://planet-lab.org:12345/@auto-plc-reg
+BUNDLES-LR += http://planet-lab.org:12347/@auto-plc-sa
+BUNDLES-LR += http://planet-lab.kr:12345/@auto-ppk-reg
+#BUNDLES-LR += http://planet-lab.kr:12347/@auto-ppk-sa
+BUNDLES-LR += http://geni-myvini.umkc.gpeni.net:12345/@auto-gpeni-reg
+BUNDLES-LR += http://geni-myvini.umkc.gpeni.net:12347/@auto-gpeni-sa
+BUNDLES-LR += http://198.248.241.100:12345/@auto-glc-reg
+BUNDLES-LR += http://198.248.241.100:12347/@auto-glc-sa
+BUNDLES-LR += http://vini-veritas.net:12345/@auto-vini-reg
+BUNDLES-LR += http://vini-veritas.net:12347/@auto-vini-sa
+BUNDLES-LR += http://www.planet-lab.jp:12345/@auto-plj-reg
+BUNDLES-LR += http://www.planet-lab.jp:12347/@auto-plj-sa
+BUNDLES-LR += http://www.emanicslab.org:12345/@auto-elc-reg
+BUNDLES-LR += http://www.emanicslab.org:12347/@auto-elc-sa
+EXTENSIONS := png svg
+
+####################
+ALL += $(foreach bundle,$(BUNDLES),$(word 2,$(subst @, ,$(bundle))))
+ALL += $(foreach bundle,$(BUNDLES-LR),$(word 2,$(subst @, ,$(bundle)))-lr)
+
+all: $(ALL)
+
+####################
define bundle_scan_target
$(word 2,$(subst @, ,$(1))):
./sfascan.py $(foreach extension,$(EXTENSIONS),-o $(word 2,$(subst @, ,$(1))).$(extension)) $(word 1,$(subst @, ,$(1))) >& $(word 2,$(subst @, ,$(1))).out
.PHONY: $(word 2,$(subst @, ,$(1)))
endef
-ALL := $(foreach bundle,$(BUNDLES),$(word 2,$(subst @, ,$(bundle))))
+# the actual targets
+$(foreach bundle,$(BUNDLES),$(eval $(call bundle_scan_target,$(bundle))))
-all: $(ALL)
+#################### same but left-to-right
+define bundle_scan_target_lr
+$(word 2,$(subst @, ,$(1)))-lr:
+ ./sfascan.py -l $(foreach extension,$(EXTENSIONS),-o $(word 2,$(subst @, ,$(1)))-lr.$(extension)) $(word 1,$(subst @, ,$(1))) >& $(word 2,$(subst @, ,$(1)))-lr.out
+.PHONY: $(word 2,$(subst @, ,$(1)))-lr
+endef
# the actual targets
-$(foreach bundle,$(BUNDLES),$(eval $(call bundle_scan_target,$(bundle))))
+$(foreach bundle,$(BUNDLES-LR),$(eval $(call bundle_scan_target_lr,$(bundle))))
####################
+versions: $(VERSIONS)
+clean-versions:
+ rm -f $(VERSIONS)
+#################### make name.version
define bundle_version_target
$(word 2,$(subst @, ,$(1))).version:
-./sfi.py -s $(word 1,$(subst @, ,$(1))) version >& $$@
VERSIONS := $(foreach bundle,$(BUNDLES),$(word 2,$(subst @, ,$(bundle))).version)
-versions: $(VERSIONS)
-clean-versions:
- rm -f $(VERSIONS)
-
# the actual targets
$(foreach bundle,$(BUNDLES),$(eval $(call bundle_version_target,$(bundle))))
+####################
clean:
rm -f auto-*.{out,version}
$(foreach extension,$(EXTENSIONS),rm -rf auto-*.$(extension);)
def url_hostname_port (url):
if url.find("://")<0:
url="http://"+url
+ parsed_url=urlparse(url)
+ # 0(scheme) returns protocol
+ default_port='80'
+ if parsed_url[0]=='https': default_port='443'
# 1(netloc) returns the hostname+port part
- parts=urlparse(url)[1].split(":")
+ parts=parsed_url[1].split(":")
# just a hostname
if len(parts)==1:
- return (url,parts[0],'80')
+ return (url,parts[0],default_port)
else:
return (url,parts[0],parts[1])
class SfaScan:
# provide the entry points (a list of interfaces)
- def __init__ (self):
- pass
+ def __init__ (self, left_to_right=False, verbose=False):
+ self.verbose=verbose
+ self.left_to_right=left_to_right
def graph (self,entry_points):
graph=pygraphviz.AGraph(directed=True)
+ if self.left_to_right:
+ graph.graph_attr['rankdir']='LR'
self.scan(entry_points,graph)
return graph
for interface in to_scan:
# performing xmlrpc call
version=interface.get_version()
- # 'sfa' is expected if the call succeeded at all
+ if self.verbose:
+ sfa_logger().info("GetVersion at interface %s"%interface.url())
+ if not version:
+ sfa_logger().info("<EMPTY GetVersion(); offline or cannot authenticate>")
+ else:
+ for (k,v) in version.iteritems():
+ if not isinstance(v,dict):
+ sfa_logger().info("\r\t%s:%s"%(k,v))
+ else:
+ sfa_logger().info(k)
+ for (k1,v1) in v.iteritems():
+ sfa_logger().info("\r\t\t%s:%s"%(k1,v1))
+ # 'geni_api' is expected if the call succeeded at all
# 'peers' is needed as well as AMs typically don't have peers
- if 'sfa' in version and 'peers' in version:
+ if 'geni_api' in version and 'peers' in version:
# proceed with neighbours
for (next_name,next_url) in version['peers'].items():
next_interface=Interface(next_url)
parser=OptionParser(usage=usage)
parser.add_option("-o","--output",action='append',dest='outfiles',default=[],
help="output filenames (cumulative) - defaults are %r"%default_outfiles)
+ parser.add_option("-l","--left-to-right",action="store_true",dest="left_to_right",default=False,
+ help="instead of top-to-bottom")
+ parser.add_option("-v","--verbose",action='store_true',dest='verbose',default=False,
+ help="verbose")
(options,args)=parser.parse_args()
if not args:
parser.print_help()
sys.exit(1)
if not options.outfiles:
options.outfiles=default_outfiles
- scanner=SfaScan()
+ scanner=SfaScan(left_to_right=options.left_to_right, verbose=options.verbose)
entries = [ Interface(entry) for entry in args ]
g=scanner.graph(entries)
sfa_logger().info("creating layout")