Browse Source

Add settings file
Get the IRR record from PeeringDB

McKay1717 6 years ago
parent
commit
215ed9e806
7 changed files with 98 additions and 500 deletions
  1. 69 0
      config/settings.yml
  2. 29 30
      generate_peers.py
  3. 0 149
      peers/amsix.yml
  4. 0 16
      peers/decix.yml
  5. 0 102
      peers/equinix.yml
  6. 0 123
      peers/franceix.yml
  7. 0 80
      peers/sfinx.yml

+ 69 - 0
config/settings.yml

@@ -0,0 +1,69 @@
+ASN: 20766
+PEERS:
+  - 6777
+  - 1200
+  - 6805
+  - 46489
+  - 12414
+  - 20940
+  - 8365
+  - 16298
+  - 20562
+  - 12041
+  - 21478
+  - 15133
+  - 34019
+  - 26496
+  - 41692
+  - 51752
+  - 36944
+  - 42473
+  - 42
+  - 1304
+  - 3856
+  - 39405
+  - 13335
+  - 24115
+  - 21502
+  - 6695
+  - 6939
+  - 9036
+  - 24990
+  - 29608
+  - 2486
+  - 43142
+  - 49463
+  - 29467
+  - 197422
+  - 197692
+  - 198507
+  - 2484
+  - 16276
+  - 200780
+  - 51706
+  - 4651
+  - 714
+  - 13768
+  - 8359
+  - 2119
+  - 36236
+  - 36692
+  - 14340
+  - 2635
+  - 19679
+  - 6507
+  - 3265
+  - 14413
+  - 36459
+  - 25459
+  - 39386
+  - 29686
+  - 55818
+  - 3262
+  - 42459
+  - 7500
+  - 200020
+  - 13193
+  - 50620
+  - 8784
+  - 6730

+ 29 - 30
generate_peers.py

@@ -1,36 +1,22 @@
 import requests
 import yaml
 
-GITOYEN_ASN = 20766
-PEER_ASN_LIST = [20940,
-                 26496,
-                 714,
-                 13768,
-                 8359,
-                 2119,
-                 36236,
-                 36692,
-                 14340,
-                 2635,
-                 19679,
-                 6507,
-                 3265,
-                 14413,
-                 36459,
-                 25459,
-                 39386,
-                 29686,
-                 55818,
-                 3262,
-                 42459,
-                 7500,
-                 200020
-                 ]
+GITOYEN_ASN = 0
+PEER_ASN_LIST = []
 
 gitoyen_peering_factory = []
 ses = requests.session()
 peer = dict()
 
+# Load config
+try:
+    config = yaml.load(open('config/settings.yml'))
+    GITOYEN_ASN = config['ASN']
+    PEER_ASN_LIST = config['PEERS']
+except:
+    print("Failed to load config exiting..")
+    exit(1)
+
 # List Gitoyen Factory with IPv6 avaidable
 factory_request = ses.get("https://peeringdb.com//api/netixlan?asn=" + str(GITOYEN_ASN))
 for factory in factory_request.json()['data']:
@@ -45,23 +31,36 @@ for factory in gitoyen_peering_factory:
         info_request = ses.get(
             "https://peeringdb.com/api/netixlan?asn=" + str(asn) + "&ix_id=" + str(factory['ix_id']))
         result = info_request.json()['data']
-        name_request = ses.get('https://peeringdb.com/api/net?asn=' + str(asn))
+        name_request = ses.get('https://peeringdb.com/api/net?asn=' + str(asn)).json()
         peer[name][asn] = dict()
-        peer[name][asn]['description'] = name_request.json()['data'][0]['name']
-        peer[name][asn]['import'] = "AS" + str(asn)
-        peer[name][asn]['export'] =  "AS-GITOYEN"
+        peer[name][asn]['description'] = name_request['data'][0]['name']
+        if name_request['data'][0]['irr_as_set'] is not None:
+            peer[name][asn]['import'] = name_request['data'][0]['irr_as_set']
+        else:
+            peer[name][asn]['import'] = "AS" + str(asn)
+        peer[name][asn]['export'] = "AS-GITOYEN"
         peer[name][asn]['peerings'] = []
+        if name_request['data'][0]['info_prefixes4'] is not None:
+            peer[name][asn]['limit_ipv4'] = int(name_request['data'][0]['info_prefixes4'])
+        if name_request['data'][0]['info_prefixes6'] is not None:
+            peer[name][asn]['limit_ipv6'] = int(name_request['data'][0]['info_prefixes6'])
         delete = True
         for routeur in result:
             if routeur['ipaddr4'] is not None:
                 peer[name][asn]['peerings'].append(routeur['ipaddr4'])
+                print(
+                    "Generating configuration at " + name + "for the router " + str(routeur['ipaddr4']) + " of the AS " + str(
+                        asn) + " " + peer[name][asn]['description'])
             if routeur['ipaddr6'] is not None:
                 peer[name][asn]['peerings'].append(routeur['ipaddr6'])
+                print(
+                    "Generating configuration at " + name + " for the router " + str(routeur['ipaddr6']) + " of the AS " + str(
+                        asn) + " " + peer[name][asn]['description'])
             delete = False
         if delete:
             peer[name].pop(asn, None)
 
 for gix in peer:
-    with open("peers/"+gix+'.yml', 'w') as outfile:
+    with open("peers/" + gix + '.yml', 'w') as outfile:
         yaml.dump(peer[gix], outfile, default_flow_style=False)
         outfile.close()

+ 0 - 149
peers/amsix.yml

@@ -1,149 +0,0 @@
----
-6777:
-  description: AMS-IX Route Servers
-  import: AS6777
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.255
-    - 80.249.209.0
-    - 2001:7f8:1::a500:6777:1
-    - 2001:7f8:1::a500:6777:2
-
-1200:
-  description: AMS-IX-MON
-  import: AS1200
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.1
-    - 80.249.209.1
-    - 2001:7f8:1::a500:1200:1
-    - 2001:7f8:1::a500:1200:2
-
-6805:
-  description: Telefonica
-  import: AS-TDDE
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.91
-    - 80.249.208.199
-    - 2001:7f8:1::a500:6805:1
-    - 2001:7f8:1::a500:6805:2
-
-46489:
-  description: Twitch
-  import: AS46489
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.210.197
-    - 80.249.211.27
-
-714:
-  description: Apple
-  import: AS714
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.211.160
-    - 80.249.211.183
-    - 2001:7f8:1::a500:714:1
-    - 2001:7f8:1::a500:714:2
-
-12414:
-  description: Solcon
-  import: AS-SOLCON
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.165
-    - 80.249.209.165
-    - 2001:7f8:1::a501:2414:1
-    - 2001:7f8:1::a501:2414:2
-
-20940:
-  description: Akamai
-  import: AS-AKAMAI
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.168
-    - 80.249.209.208
-    - 2001:7f8:1::a502:940:1
-    - 2001:7f8:1::a502:940:2
-
-16298:
-  description: Interbox
-  import: AS-INTERBOX
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.183
-    - 2001:7f8:1::a501:6298:1
-
-20562:
-  description: OpenPeering
-  import: AS-OPENPEERING
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.189
-    - 80.249.209.197
-    - 2001:7f8:1::a502:562:1
-    - 2001:7f8:1::a502:562:2
-
-12041:
-  description: Afilias
-  import: AS12041
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.190
-    - 2001:7f8:1::a501:2041:1
-
-21478:
-  description: Plex
-  import: AS-PLEX
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.208.216
-
-15133:
-  description: EdgeCast
-  import: AS15133
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.209.162
-    - 2001:7f8:1::a501:5133:1
-
-41692:
-  description: OpenCarrier
-  import: AS-OPENCARRIER
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.209.221
-    - 2001:7f8:1::a504:1692:1
-
-51752:
-  description: Wachttoren
-  import: AS51752
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.210.105
-    - 2001:7f8:1::a505:1752:1
-
-36944:
-  description: Ubuntunet
-  import: AS36944
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.210.204
-    - 2001:7f8:1::a503:6944:1
-
-42473:
-  description: Anexia
-  import: AS-ANEXIA
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.211.58
-    - 2001:7f8:1::a504:2473:1
-
-13335:
-  description: Cloudfare
-  import: AS13335
-  export: AS-GITOYEN
-  peerings:
-    - 80.249.211.140
-    - 2001:7f8:1::a501:3335:1

+ 0 - 16
peers/decix.yml

@@ -1,16 +0,0 @@
----
-6695:
-  description: DE-CIX Route Servers v4
-  import: AS-DECIX
-  export: AS-GITOYEN
-  peerings:
-    - 80.81.192.157
-    - 80.81.193.157
-
-6695:
-  description: DE-CIX Route Servers v6
-  import: AS-DECIX-V6
-  export: AS-GITOYEN
-  peerings:
-    - 2001:7f8::1a27:5051:c09d
-    - 2001:7f8::1a27:5051:c19d

+ 0 - 102
peers/equinix.yml

@@ -1,102 +0,0 @@
----
-24115:
-  description: EquinIX Route Servers
-  import: AS24115
-  export: AS-GITOYEN
-  peerings:
-    - 195.42.144.98
-    - 195.42.144.99
-    - 2001:7f8:43:0:ffff:ffff:ffff:1
-    - 2001:7f8:43:0:ffff:ffff:ffff:2
-
-6939:
-  description: Huricane Electric
-  import: AS-HURRICANE
-  export: AS-GITOYEN
-  limit_ipv4: 106000
-  limit_ipv6: 26000
-  peerings:
-    - 195.42.144.104
-    - 2001:7f8:43::6939:1
-
-24990:
-  description: EquinIX Europe
-  import: AS24990
-  export: AS-GITOYEN
-  limit_ipv4: 500
-  limit_ipv6: 100
-  peerings:
-    - 195.42.144.2
-    - 195.42.145.2
-    - 2001:07f8:43::2:1371:1
-    - 2001:07f8:43::2:1371:2
-
-198507:
-  description: Quantic Telecom
-  import: AS198507
-  export: AS-GITOYEN
-  limit_ipv4: 50
-  limit_ipv6: 50
-  peerings:
-    - 195.42.144.192
-    - 2001:7f8:43::19:8507:1
-
-2486:
-  description: Afnic
-  import: AS2486
-  export: AS-GITOYEN
-  limit_ipv4: 50
-  limit_ipv6: 50
-  peerings:
-    - 195.42.144.153
-    - 2001:7f8:43::2486:1
-
-43142:
-  description: Adelinovius
-  import: AS43142
-  export: AS-GITOYEN
-  limit_ipv4: 150
-  limit_ipv6: 150
-  peerings:
-    - 195.42.144.219
-    - 2001:7f8:43::4:3142:1
-
-49463:
-  description: AS-LNCSA
-  import: AS49463
-  export: AS-GITOYEN
-  limit_ipv4: 50
-  limit_ipv6: 25
-  peerings:
-    - 195.42.145.115
-    - 2001:7f8:43::4:9463:1
-
-16276:
-  description: AS-OVH
-  import: AS16276
-  export: AS-GITOYEN
-  limit_ipv4: 200
-  limit_ipv6: 200
-  peerings:
-    - 195.42.144.186
-    - 2001:7F8:43::1:6276:1
-
-4651:
-  description: CAT Telecom THIX
-  import: AS4651
-  export: AS-GITOYEN
-  limit_ipv4: 5000
-  limit_ipv6: 1000
-  peerings:
-    - 195.42.144.36
-    - 2001:7f8:43::4651:1
-
-200780:
-  description: APPLIWAVE
-  import: AS200780
-  export: AS-GITOYEN
-  limit_ipv4: 25
-  limit_ipv6: 25
-  peerings:
-    - 195.42.145.110
-    - 2001:7f8:43::20:780:1

+ 0 - 123
peers/franceix.yml

@@ -1,123 +0,0 @@
----
-51706:
-  description: FranceIX Route Servers
-  import: AS51706
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.250
-    - 37.49.236.251
-    - 2001:7f8:54::250
-    - 2001:7f8:54::251
-
-6939:
-  description: Huricane Electric
-  import: AS-HURRICANE
-  export: AS-GITOYEN
-  limit_ipv4: 100000
-  limit_ipv6: 50000
-  peerings:
-    - 37.49.236.10
-    - 2001:7f8:54::10
-
-20562:
-  description: OpenPeering Europe
-  import: AS-OPENPEERING
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.68
-    - 2001:7f8:54::68
-
-34019:
-  description: Hivane
-  import: AS-HIVANE
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.71
-    - 2001:7f8:54::71
-
-42473:
-  description: Anexia
-  import: AS-ANEXIA
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.85
-    - 2001:7f8:54::85
-
-197692:
-  description: Conostix
-  import: AS197692
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.133
-    - 2001:7f8:54::133
-
-29467:
-  description: LuxNetwork
-  import: AS29467
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.227
-    - 2001:7f8:54::227
-
-197422:
-  description: Tetaneutral.net
-  import: AS197422
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.233
-    - 2001:7f8:54::233
-
-13335:
-  description: CloudFare
-  import: AS13335
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.237.49
-    - 2001:7f8:54::1:49
-
-2484:
-  description: Afnic
-  import: AS2484
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.20
-    - 2001:7f8:54::20
-
-46489:
-  description: Twitch
-  import: AS46489
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.237.25
-    - 37.49.237.26
-
-42:
-  description: PCH
-  import: AS42
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.92
-    - 2001:7f8:54::92
-
-3856:
-  description: PCH
-  import: AS3856
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.91
-    - 2001:7f8:54::91
-
-39405:
-  description: FullSave
-  import: AS39405
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.220
-    - 2001:7f8:54::220
-
-21502:
-  description: Numericable
-  import: AS21502
-  export: AS-GITOYEN
-  peerings:
-    - 37.49.236.7

+ 0 - 80
peers/sfinx.yml

@@ -1,80 +0,0 @@
----
-1304:
-  description: SFINX Route Servers
-  import: AS1304
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.100
-
-9036:
-  description: Neuronnexion
-  import: AS-NEURONNEXION
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.111
-
-29608:
-  description: Absolight
-  import: AS-ABSOLIGHT
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.121
-
-34019:
-  description: Association Hivane
-  import: AS-HIVANE
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.123
-    - 2001:7f8:4e:2::123
-
-7500:
-  description: M-Root
-  import: AS7500
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.148
-
-50620:
-  description: Bluenetwork
-  import: AS50620
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.175
-
-13193:
-  description: Nerim
-  import: AS13193
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.181
-
-2484:
-  description: Afnic
-  import: AS2484
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.193
-    - 2001:7f8:4e:2::193
-
-8784:
-  description: Mgn
-  import: AS-MGN
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.196
-
-6730:
-  description: Sunrise
-  import: AS-GLOBAL
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.213
-
-2486:
-  description: Afnic
-  import: AS2486
-  export: AS-GITOYEN
-  peerings:
-    - 194.68.129.238
-    - 2001:7f8:4e:2::238