Closed job closed 6 years ago
here is some python code I use to parse this file:
#!/usr/bin/env python3
import csv
import datetime
import fileinput
import ipaddress as ip
import sys
import unicodedata
today = datetime.date.today()
records = {}
data = csv.reader(fileinput.input(mode='r'), delimiter='|')
for row in data:
asn, org, orgid = row[:3]
if not 0 < int(asn[2:]) < 4294967295:
print("error")
sys.exit(2)
# attempt to make clean 7 bit data
org = unicodedata.normalize('NFD', org).encode('ascii', 'ignore')
org = str(org, 'ascii')
prefixes = row[3:]
for prefix in prefixes:
ip.ip_network(prefix)
records[asn] = {'org': org, 'orgid': orgid, 'prefixes': prefixes}
WIP - see the dev branch. Tests on BIRD are fine; still need to test it on the OpenBGPD side.
The Brazil NIR "NIC.BR" (the exclusive source for resources in Brazil, by delegation from LACNIC) does not have a traditional IRR. Instead a WHOIS database is used which in concept is similar to ARIN-WHOIS, but in terms of quality seems to be more accurate.
Registro.br (under the umbrella of NIC.BR) publishes a computer parse-able dump of the WHOIS registry which can be consumed to construct BGP filters.
The dump is published every weekday here:
ftp://ftp.registro.br/pub/numeracao/origin/nicbr-asn-blk-latest.txt
the format is as following, a like like this:
can be transformed to the following IRR format: