-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Org name RIPE-NCC-END-MNT for new networks #1455 (#46)
* Org name RIPE-NCC-END-MNT for new networks #1455 * Specify the org entity by kind is "org" * update rdap autnum test data & implement script for automated update * Update latest autnum test data
- Loading branch information
Showing
27 changed files
with
5,965 additions
and
870 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
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,64 @@ | ||
import argparse | ||
import json | ||
import os | ||
import sys | ||
|
||
from rdap import RdapClient | ||
|
||
|
||
def rdap_autnum_file_list(directory): | ||
input_file_list = [] | ||
expected_file_list = [] | ||
for filename in os.listdir(directory): | ||
if os.path.isfile(os.path.join(directory, filename)) and filename.endswith( | ||
".input" | ||
): | ||
input_file_list.append(filename) | ||
elif os.path.isfile(os.path.join(directory, filename)) and filename.endswith( | ||
".expected" | ||
): | ||
expected_file_list.append(filename) | ||
return input_file_list, expected_file_list | ||
|
||
|
||
def update_autnum_entries(rdapc, file_name, filepath): | ||
asn = int(file_name.split(".")[0]) | ||
rdap_data = rdapc.get_asn(asn) | ||
full_filepath = os.path.join(filepath, file_name) | ||
|
||
with open(full_filepath, "w") as output_file: | ||
if file_name.split(".")[-1] == "input": | ||
formatted_data = json.dumps(rdap_data.data, indent=2) | ||
output_file.write(str(formatted_data)) | ||
else: | ||
formatted_parsed = json.dumps(rdap_data.parsed(), indent=2) | ||
output_file.write(str(formatted_parsed)) | ||
|
||
print(f"RDAP data for ASN {asn} written to {full_filepath}") | ||
|
||
|
||
def main(include_expected=False): | ||
path_autnum = "./tests/data/rdap/autnum/" | ||
input_file_list, expected_file_list = rdap_autnum_file_list(path_autnum) | ||
rdapc = RdapClient() | ||
for file in input_file_list: | ||
update_autnum_entries(rdapc, file, path_autnum) | ||
if include_expected: | ||
for file in expected_file_list: | ||
update_autnum_entries(rdapc, file, path_autnum) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Script Description") | ||
|
||
# Add the --include-expected option | ||
parser.add_argument( | ||
"--include-expected", action="store_true", help="Include expected" | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
# Call the main function with the value of --include-expected | ||
main(include_expected=args.include_expected) | ||
|
||
sys.exit() |
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"description":"RDAP bootstrap file for Autonomous System Number allocations","publication":"2023-05-10T22:00:02Z","services":[[["36864-37887","327680-328703","328704-329727"],["https://rdap.afrinic.net/rdap/","http://rdap.afrinic.net/rdap/"]],[["4608-4865","7467-7722","9216-10239","17408-18431","23552-24575","37888-38911","45056-46079","55296-56319","58368-59391","63488-63999","64000-64098","64297-64395","131072-132095","132096-133119","133120-133631","133632-134556","134557-135580","135581-136505","136506-137529","137530-138553","138554-139577","139578-140601","140602-141625","141626-142649","142650-143673","143674-144697","144698-145721","145722-146745","146746-147769","147770-148793","148794-149817","149818-150841","150842-151865","151866-152889","152890-153913"],["https://rdap.apnic.net/"]],[["1-1876","1902-2042","2044-2046","2048-2106","2137-2584","2615-2772","2823-2829","2880-3153","3354-4607","4866-5376","5632-6655","6912-7466","7723-8191","10240-12287","13312-15359","16384-17407","18432-20479","21504-23455","23457-23551","25600-26623","26624-27647","29696-30719","31744-32767","32768-33791","35840-36863","39936-40959","46080-47103","53248-54271","54272-55295","62464-63487","64198-64296","393216-394239","394240-395164","395165-396188","396189-397212","397213-398236","398237-399260","399261-400284","400285-401308"],["https://rdap.arin.net/registry/","http://rdap.arin.net/registry/"]],[["1877-1901","2043","2047","2107-2136","2585-2614","2773-2822","2830-2879","3154-3353","5377-5631","6656-6911","8192-9215","12288-13311","15360-16383","20480-21503","24576-25599","28672-29695","30720-31743","33792-34815","34816-35839","38912-39935","40960-41983","41984-43007","43008-44031","44032-45055","47104-48127","48128-49151","49152-50175","50176-51199","51200-52223","56320-57343","57344-58367","59392-60415","60416-61439","61952-62463","64396-64495","196608-197631","197632-198655","198656-199679","199680-200191","200192-201215","201216-202239","202240-203263","203264-204287","204288-205211","205212-206235","206236-207259","207260-208283","208284-209307","209308-210331","210332-211355","211356-212379","212380-213403"],["https://rdap.db.ripe.net/"]],[["27648-28671","52224-53247","61440-61951","64099-64197","262144-263167","263168-263679","263680-264604","264605-265628","265629-266652","266653-267676","267677-268700","268701-269724","269725-270748","270749-271772","271773-272796","272797-273820"],["https://rdap.lacnic.net/rdap/"]]],"version":"1.0"} | ||
{"description":"RDAP bootstrap file for Autonomous System Number allocations","publication":"2023-08-10T17:00:03Z","services":[[["36864-37887","327680-328703","328704-329727"],["https://rdap.afrinic.net/rdap/","http://rdap.afrinic.net/rdap/"]],[["4608-4865","7467-7722","9216-10239","17408-18431","23552-24575","37888-38911","45056-46079","55296-56319","58368-59391","63488-63999","64000-64098","64297-64395","131072-132095","132096-133119","133120-133631","133632-134556","134557-135580","135581-136505","136506-137529","137530-138553","138554-139577","139578-140601","140602-141625","141626-142649","142650-143673","143674-144697","144698-145721","145722-146745","146746-147769","147770-148793","148794-149817","149818-150841","150842-151865","151866-152889","152890-153913"],["https://rdap.apnic.net/"]],[["1-1876","1902-2042","2044-2046","2048-2106","2137-2584","2615-2772","2823-2829","2880-3153","3354-4607","4866-5376","5632-6655","6912-7466","7723-8191","10240-12287","13312-15359","16384-17407","18432-20479","21504-23455","23457-23551","25600-26623","26624-27647","29696-30719","31744-32767","32768-33791","35840-36863","39936-40959","46080-47103","53248-54271","54272-55295","62464-63487","64198-64296","393216-394239","394240-395164","395165-396188","396189-397212","397213-398236","398237-399260","399261-400284","400285-401308"],["https://rdap.arin.net/registry/","http://rdap.arin.net/registry/"]],[["1877-1901","2043","2047","2107-2136","2585-2614","2773-2822","2830-2879","3154-3353","5377-5631","6656-6911","8192-9215","12288-13311","15360-16383","20480-21503","24576-25599","28672-29695","30720-31743","33792-34815","34816-35839","38912-39935","40960-41983","41984-43007","43008-44031","44032-45055","47104-48127","48128-49151","49152-50175","50176-51199","51200-52223","56320-57343","57344-58367","59392-60415","60416-61439","61952-62463","64396-64495","196608-197631","197632-198655","198656-199679","199680-200191","200192-201215","201216-202239","202240-203263","203264-204287","204288-205211","205212-206235","206236-207259","207260-208283","208284-209307","209308-210331","210332-211355","211356-212379","212380-213403","213404-214427","214428-215451","215452-216475"],["https://rdap.db.ripe.net/"]],[["27648-28671","52224-53247","61440-61951","64099-64197","262144-263167","263168-263679","263680-264604","264605-265628","265629-266652","266653-267676","267677-268700","268701-269724","269725-270748","270749-271772","271773-272796","272797-273820"],["https://rdap.lacnic.net/rdap/"]]],"version":"1.0"} |
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 |
---|---|---|
@@ -1 +1,9 @@ | ||
{"org_address": "", "org_name": "", "emails": ["abuse@alojalia.com", "angel@alojalia.com"], "name": "ALOJALIA"} | ||
{ | ||
"name": "ALOJALIA", | ||
"emails": [ | ||
"alejandro@alojalia.com", | ||
"angel@alojalia.com" | ||
], | ||
"org_name": "ALOJALIA CLOUD S.L., ================================", | ||
"org_address": "Avd. Federico Anaya, 52 3C\n37004\nSalamanca\nSPAIN" | ||
} |
Oops, something went wrong.