Project

General

Profile

Actions

Bug #7726

closed

Import Casablanca network as an externally updated feed

Added by Pavel Kácha 8 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Development - Tools
Target version:
Start date:
04/10/2024
Due date:
% Done:

90%

Estimated time:
To be discussed:
No

Description

Currently we have manual group , which is horribly outdated. Casablanca is not a Cesnet customer/member, but we provide them reports on a mutually beneficial basis.

We could get RIPE data for them automatically, translate them into mentat-netmgr JSON and import as new regularly updated feed (similar to #7725).

Target IPs are: ,


Related issues

Related to Mentat - Feature #7725: Import Metacentrum networks as an externally updated feedClosedRajmund Hruška04/10/2024

Actions
Actions #1

Updated by Jakub Judiny 8 months ago

  • Related to Feature #7725: Import Metacentrum networks as an externally updated feed added
Actions #2

Updated by Pavel Kácha 7 months ago

Drobnost.

Seznam rozsahů Casablanky lze vytáhnout z RIPE reverzním query:

whois h whois.ripe.net - -r -Troute,route6 -i origin AS15685

Případně přes RIPE API:

wget --header 'Accept: application/json' 'https://rest.db.ripe.net/search?query-string=AS15685&type-filter=route,route6&inverse-attribute=origin'

Actions #3

Updated by Rajmund Hruška 7 months ago

I briefly checked the reports sent to and the reported addresses seem to be totally unrelated to casablanca and they aren't in their data from RIPE. They never complained about our reports?

When this is finished, maybe it would be a good idea to also write them and tell them that they will be receiving relevant reports in the future.

Actions #4

Updated by Pavel Kácha 7 months ago

They actually did, they know what's happening (at least what are our plans) and I'm in contact with them, so all fine, Monča will manage.

Actions #5

Updated by Rajmund Hruška 7 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Resolved in 32eb2971.

Actions #6

Updated by Pavel Kácha 7 months ago

Simple and to the point.

Just a couple of notes:

Shouldn't the netmngr --command be update?

I'd decouple both scripts and spawn them both from cronjob.

  • Simpler debugging, one could run them separately and inspect intermediate data
  • mentat-netmngr.py path wouldn't be hardcoded in update-casablanca.py
  • One argument shell=True Popen form is generally frowned upon exactly because of the intermediate shell process
10 6 * * *   mentat /etc/mentat/scripts/update-casablanca.py && /var/mentat/venv/bin/mentat-netmngr.py --regular --command update --whois-file /var/mentat/casablanca.json --source ripe

And I wouldn't even hardwire the output filename in update-casablanca.py, we can just spit it to sys.stdout and leave the rest on the shell.
(We could [ab]use cron variables to stay DRY. And maybe even to make it more readable.)

outf = /var/mentat/casablanca.json
update = /etc/mentat/scripts/update-casablanca.py
netmngr = /var/mentat/venv/bin/mentat-netmngr.py

10 6 * * *   mentat "$update" > "$outf" && "$netmngr" --regular --command update --whois-file "$outf" --source ripe

Also, thinking of it, it might come handy to keep the "ok" version intact in case of an error, and maybe even leave it aside on success.

10 6 * * *   "$update" > "$outf".tmp && "$netmngr" --regular --command update --whois-file "$outf".tmp --source ripe && mv -f "$outf" "$outf".backup && mv -f "$outf".tmp "$outf" 

Or maybe even:

10 6 * * *   "$update" | tee "$outf".$(date +"%Y-%m-%dT%H:%M:%S") | "$netmngr" --regular --command update --whois-file /dev/stdin --source ripe
Actions #7

Updated by Rajmund Hruška 7 months ago

  • Status changed from Resolved to In Review
Actions #8

Updated by Rajmund Hruška 6 months ago

  • Status changed from In Review to In Progress
  • % Done changed from 100 to 90
Actions #9

Updated by Rajmund Hruška 6 months ago

  • Status changed from In Progress to Resolved
Actions #10

Updated by Rajmund Hruška 6 months ago

  • Status changed from Resolved to In Review
Actions #11

Updated by Rajmund Hruška 5 months ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF