This repository has been archived by the owner. It is now read-only.
forked from InCommon/inc-meta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helper for charting registrar breakdown in UKf and eduGAIN.
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| ''' | ||
| Analyse a SAML metadata file and build a histogram of entities binned against | ||
| their registrar. | ||
| ''' | ||
|
|
||
| from xml.dom.minidom import parse | ||
| from urllib import urlopen | ||
| from datetime import date | ||
|
|
||
| REGISTRAR_NAME = { | ||
|
|
||
| # eduGAIN participants | ||
| "http://eduid.at": "AT", | ||
| "http://federation.belnet.be/": "BE", | ||
| "http://cafe.rnp.br": "BR", | ||
| "http://www.canarie.ca": "CA", | ||
| "http://cofre.reuna.cl/": "CL", | ||
| "http://www.srce.hr": "HR", | ||
| "http://www.eduid.cz/": "CZ", | ||
| "https://www.wayf.dk": "DK", | ||
| "http://www.csc.fi/haka": "FI", | ||
| "https://federation.renater.fr/": "FR", | ||
| "https://www.aai.dfn.de": "DE", | ||
| "http://aai.grnet.gr/": "GR", | ||
| "http://eduid.hu": "HU", | ||
| "http://www.heanet.ie": "IE", | ||
| "http://www.idem.garr.it/": "IT", | ||
| "http://laife.lanet.lv/": "LV", | ||
| "http://feide.no/": "NO", | ||
| "http://aai.arnes.si": "SI", | ||
| "http://www.rediris.es/": "ES", | ||
| "http://www.swamid.se/": "SE", | ||
| "http://rr.aai.switch.ch/": "CH", | ||
| "http://www.surfconext.nl/": "NL", | ||
| "http://ukfederation.org.uk": "UK", | ||
|
|
||
| # Joining eduGAIN | ||
| "http://aai.pionier.net.pl": "PL", | ||
|
|
||
| # not yet eduGAIN members | ||
| "https://incommon.org": "US", | ||
| } | ||
|
|
||
| def regAuth(uri): | ||
| ''' | ||
| Returns a short registrar code, or the long authority URI if none is available. | ||
| ''' | ||
| try: | ||
| return REGISTRAR_NAME[uri] | ||
| except KeyError: | ||
| return uri | ||
|
|
||
| def display(infile, split): | ||
| doc = parse(infile) | ||
|
|
||
| # Pull out all of the RegistrationInfo elements, one per entity | ||
| registrationInfos = doc.getElementsByTagNameNS("urn:oasis:names:tc:SAML:metadata:rpi", | ||
| "RegistrationInfo") | ||
|
|
||
| counts = dict(); | ||
|
|
||
| for info in registrationInfos: | ||
| auth = regAuth(info.getAttribute("registrationAuthority")) | ||
| try: | ||
| counts[auth] += 1 | ||
| except KeyError: | ||
| counts[auth] = 1 | ||
|
|
||
| counts = sorted(counts.items(), key=lambda item: item[1], reverse=True) | ||
|
|
||
| first_counts = counts[0:split] | ||
| rest_counts = counts[split:] | ||
| for e in first_counts: | ||
| print "%10s: %d" % (e[0], e[1]) | ||
| print "%10s: %d" % ("other", sum([e[1] for e in rest_counts])) | ||
|
|
||
| cache_file = date.today().strftime("cache/%Y-%m.xml") | ||
| print "Most recent monthly UK federation production aggregate (%s):" % (cache_file) | ||
| display(cache_file, 9) | ||
|
|
||
|
|
||
| print "Current eduGAIN production aggregate:" | ||
| display(urlopen("http://mds.edugain.org/"), 9) |