Task update commercial peer prefix limits
Task workflow that updates Commercial Peer prefix limits from PeeringDB.
ResolvedLimits
Bases: BaseModel
Resolved prefix limits after comparing PeeringDB data with existing values.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
needs_update
property
Check if any limit changed.
is_valid
property
Check if both limits are set (required for workflow).
PeerProcessResult
dataclass
Result of processing a single commercial peer subscription.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
SyncRunSummary
dataclass
Summary of a complete PeeringDB prefix limit sync run.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
planned_results
property
Peers planned for update (before bulk execution).
success_results
property
Peers that were successfully updated.
skipped_results
property
Peers that were skipped due to errors or missing data.
significant_changes
property
Peers with changes >10% that warrant notification.
EmailSummaryCounters
dataclass
Summary counters for email reporting.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
compute_new_limit(peeringdb_value)
Compute new prefix limit with safety factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peeringdb_value
|
int | None
|
The prefix count from PeeringDB, or None if not available. |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
Ceiling of (peeringdb_value * 1.5) as an integer, or None if input is None. |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
should_notify(old, new)
Determine if the change warrants a notification (>10% delta).
Notification rules: - If old is None and new is not None: notify (first-time limit) - If old == 0 and new != 0: notify - If old > 0: notify if delta > 10%
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
int | None
|
The current/old prefix limit value |
required |
new
|
int | None
|
The new prefix limit value to be set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the change should trigger a notification, False otherwise. |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
format_change_display(old, new)
Format a limit change for display in notifications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
int | None
|
Old/current limit value |
required |
new
|
int | None
|
New limit value |
required |
Returns:
| Type | Description |
|---|---|
str
|
Human-readable change string (e.g., "+15.0%" or "None -> 100") |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
resolve_new_limits(old_v4, old_v6, peeringdb_info)
Resolve new prefix limits based on PeeringDB data and existing values.
If PeeringDB returns None for a family, the existing value is kept. Both limits must be non-None for the result to be valid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_v4
|
int | None
|
Current IPv4 limit |
required |
old_v6
|
int | None
|
Current IPv6 limit |
required |
peeringdb_info
|
PeeringDBPrefixInfo | None
|
PeeringDB data, or None if lookup failed |
required |
Returns:
| Type | Description |
|---|---|
ResolvedLimits
|
ResolvedLimits with new values and change flags |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
process_peer(sub_data, session)
Process a single commercial peer subscription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sub_data
|
dict
|
Subscription dict with subscription_id and description |
required |
session
|
Session
|
Requests session for PeeringDB API calls |
required |
Returns:
| Type | Description |
|---|---|
PeerProcessResult
|
PeerProcessResult with outcome of processing this peer |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
compute_email_counters(summary)
Compute all email summary counters from sync results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
SyncRunSummary
|
Sync run summary with results |
required |
Returns:
| Type | Description |
|---|---|
EmailSummaryCounters
|
EmailSummaryCounters with all computed values |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
_build_successful_significant_changes_section(successful_significant)
Build email section for successfully applied significant changes.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
_build_failed_significant_changes_section(failed_significant)
Build email section for failed updates with significant changes detected.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
_build_other_failures_section(non_significant_failures)
Build email section for other failures/skipped peers (without significant changes).
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
_build_started_workflows_section(success_with_process)
Build email section for started modify_prefix_limit workflows.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
build_email_content(summary)
Build email subject and body for sync run summary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
SyncRunSummary
|
Sync run summary with results |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, str]
|
Tuple of (subject, body) |
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
collect_cp_subscriptions()
Collect all active Commercial Peer subscriptions.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
plan_peer_updates(subscriptions)
Process all peers: fetch PeeringDB data and plan updates.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
start_modify_workflows_staggered(callback_route, summary_results)
Start modify_prefix_limit workflows for planned updates using staggered bulk execution.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
evaluate_bulk_results(callback_result, summary_scanned, summary_skipped, summary_results)
Evaluate results from bulk modify_prefix_limit workflows and update summary.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
send_summary_notification(summary_scanned, summary_changed, summary_skipped, summary_results)
Send email notification with summary of sync run, including significant changes and failures.
Source code in gso/workflows/tasks/task_update_commercial_peer_prefix_limits.py
task_update_commercial_peer_prefix_limits()
Update Commercial Peer prefix limits from PeeringDB.
This task workflow: 1. Collects all active Commercial Peer subscriptions 2. Fetches prefix info from PeeringDB for each peer's ASN 3. Computes new limits with 1.5x safety factor (ceiling) 4. Starts modify_prefix_limit workflows using staggered bulk execution 5. Evaluates bulk execution results 6. Sends email notification for significant changes (>10%) or errors