@@ 406-432 (lines=27) @@ | ||
403 | f"Analyze the error and you'll need to redeploy EVC {evc_id} later" |
|
404 | ) |
|
405 | ||
406 | @alisten_to("kytos/mef_eline.error_redeploy_link_down") |
|
407 | async def on_evc_error_redeployed_link_down(self, event: KytosEvent) -> None: |
|
408 | """On EVC error_redeploy_link_down, this is supposed to happen when |
|
409 | a path isn't when mef_eline handles a link down.""" |
|
410 | content = event.content |
|
411 | if ( |
|
412 | content["enabled"] |
|
413 | and "metadata" in content |
|
414 | and "telemetry" in content["metadata"] |
|
415 | and content["metadata"]["telemetry"]["enabled"] |
|
416 | ): |
|
417 | metadata = { |
|
418 | "telemetry": { |
|
419 | "enabled": True, |
|
420 | "status": "DOWN", |
|
421 | "status_reason": ["redeployed_link_down_no_path"], |
|
422 | "status_updated_at": datetime.utcnow().strftime( |
|
423 | "%Y-%m-%dT%H:%M:%S" |
|
424 | ), |
|
425 | } |
|
426 | } |
|
427 | evc_id = content["evc_id"] |
|
428 | evcs = {evc_id: content} |
|
429 | log.info( |
|
430 | f"Handling mef_eline.redeployed_link_down_no_path on EVC id: {evc_id}" |
|
431 | ) |
|
432 | await self.int_manager.remove_int_flows(evcs, metadata, force=True) |
|
433 | ||
434 | @alisten_to("kytos/topology.link_down") |
|
435 | async def on_link_down(self, event): |
|
@@ 359-382 (lines=24) @@ | ||
356 | f"and you'll need to enable or redeploy EVC {evc_id} later" |
|
357 | ) |
|
358 | ||
359 | @alisten_to("kytos/mef_eline.undeployed") |
|
360 | async def on_evc_undeployed(self, event: KytosEvent) -> None: |
|
361 | """On EVC undeployed.""" |
|
362 | content = event.content |
|
363 | if ( |
|
364 | not content["enabled"] |
|
365 | and "metadata" in content |
|
366 | and "telemetry" in content["metadata"] |
|
367 | and content["metadata"]["telemetry"]["enabled"] |
|
368 | ): |
|
369 | metadata = { |
|
370 | "telemetry": { |
|
371 | "enabled": True, |
|
372 | "status": "DOWN", |
|
373 | "status_reason": ["undeployed"], |
|
374 | "status_updated_at": datetime.utcnow().strftime( |
|
375 | "%Y-%m-%dT%H:%M:%S" |
|
376 | ), |
|
377 | } |
|
378 | } |
|
379 | evc_id = content["evc_id"] |
|
380 | evcs = {evc_id: content} |
|
381 | log.info(f"Handling mef_eline.undeployed on EVC id: {evc_id}") |
|
382 | await self.int_manager.remove_int_flows(evcs, metadata, force=True) |
|
383 | ||
384 | @alisten_to("kytos/mef_eline.(redeployed_link_down|redeployed_link_up)") |
|
385 | async def on_evc_redeployed_link(self, event: KytosEvent) -> None: |