Last active
February 17, 2016 01:34
-
-
Save mwhittaker/a8839c2663d3aa30dc25 to your computer and use it in GitHub Desktop.
NetKAT Encoded Topology Zoo
This file contains hidden or 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
for d in *.dot; do | |
echo $d; | |
cat $d \ | |
| sed 's/src_port=\([0-9]\+\)/label="\1"/' \ | |
| dot -Tpdf -o $(basename $d .dot).pdf; | |
done |
This file contains hidden or 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
import sys | |
import json | |
def fix_policy(pol): | |
switch, ip = pol['pols'][0]['pred']['preds'] | |
switch['value'] += 1 | |
addr = ip['value']['addr'].split('.') | |
addr[2] = str(int(addr[2]) + 1) | |
addr[3] = str(int(addr[3]) + 1) | |
ip['value']['addr'] = '.'.join(addr) | |
def fix_file(filename): | |
with open(filename) as f: | |
j = json.loads(f.read()) | |
for pol in j['pols']: | |
fix_policy(pol) | |
with open(filename, 'w') as f: | |
print "Dumping file: %s" % filename | |
json.dump(j, f) | |
if __name__ == "__main__": | |
for arg in sys.argv[1:]: | |
print "Fixing file: %s" % arg | |
fix_file(arg) |
This file contains hidden or 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
""" | |
Due to a (mininet?) bug, topology files cannot have switches numbered 0. This | |
script goes through line by line and (hackily) increments all switch ids, IP | |
addresses, and MAC addresses. It also fixes a bug where MAC addresses weren't | |
being expressed in hex. | |
""" | |
import re | |
import sys | |
def main(filenames): | |
if len(filenames) != 1: | |
print "usage: python fix_topology.py <topo.dot>" | |
sys.exit(-1) | |
with open(filenames[0], "r") as f: | |
for line in f: | |
r = "(s|h)([0-9]+)" | |
m = re.search(r, line) | |
if m: | |
new = lambda m: m.group(1) + str(int(m.group(2)) + 1) | |
line = re.sub(r, new, line) | |
if "id=" in line: | |
r = "(.*id=)([0-9]+)(,.*)" | |
m = re.search(r, line) | |
new_id = str(int(m.group(2)) + 1) | |
line = re.sub(r, r"\g<1>" + new_id + r"\g<3>", line) | |
elif "mac=" in line: | |
r = '(.*mac=")(.*)(",.*)' | |
m = re.search(r, line) | |
mac = [int(x) for x in m.group(2).split(":")] | |
mac = mac[:-2] + [mac[-2] + 1] + [mac[-1] + 1] | |
new_mac = ":".join("%02x" % x for x in mac) | |
line = re.sub(r, r"\g<1>" + new_mac + r"\g<3>", line) | |
elif "ip=" in line: | |
r = '(.*ip=")(.*)(",.*)' | |
m = re.search(r, line) | |
ip = [int(x) for x in m.group(2).split(".")] | |
ip = [ip[0], ip[1], ip[2] + 1, ip[3] + 1] | |
new_ip = ".".join(str(x) for x in ip) | |
line = re.sub(r, r"\g<1>" + new_ip + r"\g<3>", line) | |
print line, | |
if __name__ == "__main__": | |
main(sys.argv[1:]) |
This file contains hidden or 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
name | number of switches | policy term size | policy file size (KB) | |
---|---|---|---|---|
Aarnet | 19 | 10765 | 448 | |
Abilene | 11 | 2631 | 112 | |
Abvt | 23 | 15175 | 632 | |
Aconet | 23 | 12165 | 508 | |
Agis | 25 | 17555 | 732 | |
Ai3 | 10 | 1959 | 84 | |
Airtel | 16 | 5403 | 228 | |
Amres | 25 | 23043 | 960 | |
Ans | 18 | 8259 | 344 | |
Arnes | 30 | 34845 | 1452 | |
Arn | 34 | 22833 | 952 | |
Arpanet196912 | 4 | 195 | 12 | |
Arpanet19706 | 9 | 1665 | 72 | |
Arpanet19719 | 18 | 9253 | 388 | |
Arpanet19723 | 25 | 23421 | 976 | |
Arpanet19728 | 29 | 32311 | 1344 | |
AsnetAm | 65 | 139103 | 5796 | |
Atmnet | 21 | 15511 | 648 | |
AttMpls | 25 | 14209 | 592 | |
Azrena | 22 | 13943 | 580 | |
Bandcon | 22 | 11843 | 496 | |
Basnet | 7 | 797 | 36 | |
Bbnplanet | 27 | 22035 | 920 | |
Bellcanada | 48 | 99707 | 4156 | |
Bellsouth | 51 | 78007 | 3252 | |
Belnet2003 | 23 | 11227 | 468 | |
Belnet2004 | 23 | 11227 | 468 | |
Belnet2005 | 23 | 11143 | 464 | |
Belnet2006 | 23 | 11143 | 464 | |
Belnet2007 | 21 | 12963 | 540 | |
Belnet2008 | 21 | 12963 | 540 | |
Belnet2009 | 21 | 12963 | 540 | |
Belnet2010 | 22 | 14307 | 596 | |
BeyondTheNetwork | 53 | 94261 | 3928 | |
Bics | 33 | 34047 | 1420 | |
Biznet | 29 | 37435 | 1560 | |
Bren | 37 | 45219 | 1884 | |
BsonetEurope | 18 | 8035 | 336 | |
BtAsiaPac | 20 | 8833 | 368 | |
BtEurope | 24 | 12809 | 536 | |
BtLatinAmerica | 51 | 87583 | 3648 | |
BtNorthAmerica | 36 | 32829 | 1368 | |
Canerie | 32 | 32913 | 1372 | |
Carnet | 44 | 52905 | 2208 | |
Cernet | 41 | 45191 | 1884 | |
Cesnet1993 | 10 | 1931 | 80 | |
Cesnet1997 | 13 | 4255 | 180 | |
Cesnet1999 | 13 | 3443 | 144 | |
Cesnet2001 | 23 | 12809 | 536 | |
Cesnet200304 | 29 | 22511 | 940 | |
Cesnet200511 | 39 | 43217 | 1800 | |
Cesnet200603 | 39 | 43217 | 1800 | |
Cesnet200706 | 44 | 52233 | 2176 | |
Cesnet201006 | 52 | 75221 | 3136 | |
Chinanet | 42 | 42503 | 1772 | |
Claranet | 15 | 5081 | 212 | |
Cogentco | 197 | 3111079 | 130340 | |
Colt | 153 | 1521295 | 63684 | |
Columbus | 70 | 278585 | 11604 | |
Compuserve | 14 | 4199 | 176 | |
CrlNetworkServices | 33 | 42111 | 1752 | |
Cudi | 51 | 85273 | 3552 | |
Cwix | 36 | 41901 | 1744 | |
Cynet | 30 | 23743 | 988 | |
Darkstrand | 28 | 31023 | 1292 | |
Dataxchange | 6 | 475 | 20 | |
Deltacom | 113 | 722931 | 30176 | |
DeutscheTelekom | 39 | 25087 | 1044 | |
Dfn | 58 | 96781 | 4036 | |
DialtelecomCz | 193 | 1818025 | 76184 | |
Digex | 31 | 37505 | 1560 | |
Easynet | 19 | 9715 | 404 | |
Eenet | 13 | 3821 | 160 | |
EliBackbone | 20 | 10247 | 428 | |
Epoch | 6 | 559 | 24 | |
Ernet | 30 | 25115 | 1048 | |
Esnet | 68 | 169763 | 7076 | |
Eunetworks | 15 | 4815 | 200 | |
Evolink | 37 | 43581 | 1816 | |
Fatman | 17 | 6915 | 288 | |
Fccn | 23 | 13341 | 556 | |
Forthnet | 62 | 113189 | 4716 | |
Funet | 26 | 24331 | 1012 | |
Gambia | 28 | 22539 | 940 | |
Garr199901 | 16 | 5529 | 232 | |
Garr199904 | 23 | 12151 | 508 | |
Garr199905 | 23 | 12151 | 508 | |
Garr200109 | 22 | 11003 | 460 | |
Garr200112 | 24 | 13271 | 552 | |
Garr200212 | 27 | 17345 | 724 | |
Garr200404 | 22 | 11045 | 460 | |
Garr200902 | 54 | 90621 | 3776 | |
Garr200908 | 54 | 90621 | 3776 | |
Garr200909 | 55 | 94359 | 3932 | |
Garr200912 | 54 | 91167 | 3800 | |
Garr201001 | 54 | 91167 | 3800 | |
Garr201003 | 54 | 91167 | 3800 | |
Garr201004 | 54 | 91167 | 3800 | |
Garr201005 | 55 | 94359 | 3932 | |
Garr201007 | 55 | 94359 | 3932 | |
Garr201008 | 55 | 94359 | 3932 | |
Garr201010 | 56 | 98139 | 4092 | |
Garr201012 | 56 | 98139 | 4092 | |
Garr201101 | 56 | 98139 | 4092 | |
Garr201102 | 57 | 103011 | 4296 | |
Garr201103 | 58 | 106945 | 4460 | |
Garr201104 | 59 | 110235 | 4596 | |
Garr201105 | 59 | 110571 | 4608 | |
Garr201107 | 59 | 110571 | 4608 | |
Garr201108 | 59 | 110571 | 4608 | |
Garr201109 | 59 | 110123 | 4592 | |
Garr201110 | 59 | 110123 | 4592 | |
Garr201111 | 60 | 114225 | 4764 | |
Garr201112 | 61 | 118341 | 4932 | |
Garr201201 | 61 | 118341 | 4932 | |
Gblnet | 8 | 1259 | 56 | |
Geant2001 | 27 | 19347 | 808 | |
Geant2009 | 34 | 33893 | 1412 | |
Geant2010 | 37 | 41621 | 1732 | |
Geant2012 | 40 | 49447 | 2060 | |
Getnet | 7 | 825 | 36 | |
Globalcenter | 9 | 1007 | 44 | |
Globenet | 67 | 192891 | 8040 | |
Goodnet | 17 | 5949 | 248 | |
Grena | 16 | 8595 | 360 | |
Gridnet | 9 | 1231 | 52 | |
Grnet | 37 | 41327 | 1720 | |
GtsCe | 149 | 1517333 | 63504 | |
GtsCzechRepublic | 32 | 37645 | 1568 | |
GtsHungary | 30 | 25479 | 1064 | |
GtsPoland | 33 | 39759 | 1656 | |
GtsRomania | 21 | 10555 | 440 | |
GtsSlovakia | 35 | 31485 | 1312 | |
Harnet | 21 | 11927 | 496 | |
Heanet | 7 | 727 | 32 | |
HiberniaCanada | 13 | 4353 | 184 | |
HiberniaGlobal | 55 | 142757 | 5948 | |
HiberniaIreland | 8 | 1203 | 52 | |
HiberniaNireland | 18 | 9505 | 396 | |
HiberniaUk | 15 | 6873 | 288 | |
HiberniaUs | 22 | 16015 | 668 | |
Highwinds | 18 | 7937 | 332 | |
HostwayInternational | 16 | 7195 | 300 | |
HurricaneElectric | 24 | 14531 | 604 | |
Ibm | 18 | 7923 | 332 | |
Iij | 37 | 33221 | 1384 | |
Iinet | 31 | 24877 | 1036 | |
Ilan | 14 | 4297 | 180 | |
Integra | 27 | 21125 | 880 | |
Intellifiber | 73 | 269555 | 11228 | |
Internetmci | 19 | 8119 | 340 | |
Internode | 66 | 138123 | 5752 | |
Interoute | 110 | 723575 | 30188 | |
Intranetwork | 39 | 75585 | 3148 | |
Ion | 125 | 1208353 | 50484 | |
IowaStatewideFiberMap | 33 | 37743 | 1572 | |
Iris | 51 | 105167 | 4380 | |
Istar | 23 | 15413 | 644 | |
Itnet | 11 | 2169 | 92 | |
Janetbackbone | 29 | 20943 | 872 | |
JanetExternal | 12 | 2113 | 88 | |
Janetlense | 20 | 8175 | 340 | |
Jgn2Plus | 18 | 9337 | 388 | |
Karen | 25 | 18549 | 772 | |
KentmanApr2007 | 23 | 12767 | 532 | |
KentmanAug2005 | 28 | 21839 | 912 | |
KentmanFeb2008 | 26 | 18325 | 764 | |
KentmanJan2011 | 38 | 42055 | 1752 | |
KentmanJul2005 | 16 | 6537 | 272 | |
Kreonet | 13 | 3499 | 148 | |
LambdaNet | 42 | 87961 | 3664 | |
Latnet | 69 | 162889 | 6792 | |
Layer42 | 6 | 559 | 24 | |
Litnet | 43 | 50217 | 2092 | |
Marnet | 20 | 7937 | 332 | |
Marwan | 16 | 6817 | 284 | |
Missouri | 67 | 223719 | 9324 | |
Mren | 6 | 559 | 24 | |
Myren | 37 | 34201 | 1428 | |
Napnet | 6 | 531 | 24 | |
Navigata | 13 | 3611 | 152 | |
Netrail | 7 | 741 | 32 | |
NetworkUsa | 35 | 51211 | 2132 | |
Nextgen | 17 | 9435 | 392 | |
Niif | 36 | 36539 | 1524 | |
Noel | 19 | 9379 | 392 | |
Nordu1989 | 7 | 853 | 36 | |
Nordu1997 | 14 | 4017 | 168 | |
Nordu2005 | 9 | 1455 | 64 | |
Nordu2010 | 18 | 5193 | 216 | |
Nsfcnet | 10 | 1511 | 64 | |
Nsfnet | 13 | 3737 | 156 | |
Ntelos | 48 | 107967 | 4496 | |
Ntt | 47 | 25591 | 1068 | |
Oteglobe | 93 | 358595 | 14948 | |
Oxford | 20 | 11437 | 476 | |
Pacificwave | 18 | 7069 | 296 | |
Packetexchange | 21 | 13649 | 568 | |
Padi | 15 | 797 | 36 | |
Palmetto | 45 | 79939 | 3328 | |
Peer1 | 16 | 6313 | 264 | |
Pern | 127 | 621249 | 25980 | |
PionierL1 | 36 | 51001 | 2124 | |
PionierL3 | 38 | 52121 | 2172 | |
Psinet | 24 | 22189 | 924 | |
Quest | 20 | 9827 | 412 | |
RedBestel | 84 | 565571 | 23564 | |
Rediris | 19 | 7825 | 328 | |
Renam | 5 | 363 | 16 | |
Renater1999 | 24 | 16141 | 672 | |
Renater2001 | 24 | 15119 | 632 | |
Renater2004 | 30 | 23085 | 964 | |
Renater2006 | 33 | 30323 | 1264 | |
Renater2008 | 33 | 30323 | 1264 | |
Renater2010 | 43 | 62327 | 2596 | |
Restena | 19 | 8847 | 368 | |
Reuna | 37 | 54487 | 2268 | |
Rhnet | 16 | 7461 | 312 | |
Rnp | 31 | 35419 | 1476 | |
RoedunetFibre | 42 | 98013 | 4084 | |
Roedunet | 48 | 46143 | 1924 | |
Sago | 18 | 13691 | 572 | |
Sanet | 43 | 86309 | 3596 | |
Sanren | 7 | 881 | 40 | |
Savvis | 19 | 11591 | 484 | |
Shentel | 28 | 30365 | 1264 | |
Sinet | 74 | 186451 | 7772 | |
Singaren | 11 | 2169 | 92 | |
Spiralight | 15 | 6481 | 272 | |
Sprint | 11 | 2225 | 96 | |
Sunet | 26 | 25115 | 1048 | |
Surfnet | 50 | 92007 | 3832 | |
Switch | 74 | 268183 | 11176 | |
SwitchL3 | 42 | 51211 | 2132 | |
Syringa | 74 | 489775 | 20404 | |
TataNld | 145 | 1585793 | 66324 | |
Telcove | 73 | 156169 | 6512 | |
Telecomserbia | 6 | 587 | 28 | |
Tinet | 53 | 101275 | 4220 | |
TLex | 12 | 2841 | 120 | |
Twaren | 20 | 9659 | 404 | |
Tw | 76 | 166403 | 6936 | |
Ulaknet | 82 | 159949 | 6672 | |
UniC | 25 | 23337 | 972 | |
Uninet | 13 | 3695 | 156 | |
Uninett2010 | 74 | 211119 | 8796 | |
Uninett2011 | 69 | 172479 | 7184 | |
Uran | 24 | 17821 | 744 | |
UsCarrier | 158 | 2273025 | 95120 | |
UsSignal | 63 | 179997 | 7500 | |
Uunet | 49 | 70573 | 2940 | |
Vinaren | 25 | 17709 | 736 | |
VisionNet | 24 | 25339 | 1056 | |
VtlWavenet2008 | 88 | 745107 | 31052 | |
VtlWavenet2011 | 92 | 824683 | 34368 | |
WideJpn | 30 | 25815 | 1076 | |
Xeex | 24 | 15245 | 636 | |
Xspedius | 34 | 33837 | 1408 | |
York | 23 | 22021 | 916 | |
Zamren | 36 | 52569 | 2192 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment