@@ 378-404 (lines=27) @@ | ||
375 | f"Analyze the error and you'll need to redeploy EVC {evc_id} later" |
|
376 | ) |
|
377 | ||
378 | @alisten_to("kytos/mef_eline.error_redeploy_link_down") |
|
379 | async def on_evc_error_redeployed_link_down(self, event: KytosEvent) -> None: |
|
380 | """On EVC error_redeploy_link_down, this is supposed to happen when |
|
381 | a path isn't when mef_eline handles a link down.""" |
|
382 | content = event.content |
|
383 | if ( |
|
384 | content["enabled"] |
|
385 | and "metadata" in content |
|
386 | and "telemetry" in content["metadata"] |
|
387 | and content["metadata"]["telemetry"]["enabled"] |
|
388 | ): |
|
389 | metadata = { |
|
390 | "telemetry": { |
|
391 | "enabled": True, |
|
392 | "status": "DOWN", |
|
393 | "status_reason": ["redeployed_link_down_no_path"], |
|
394 | "status_updated_at": datetime.utcnow().strftime( |
|
395 | "%Y-%m-%dT%H:%M:%S" |
|
396 | ), |
|
397 | } |
|
398 | } |
|
399 | evc_id = content["evc_id"] |
|
400 | evcs = {evc_id: content} |
|
401 | log.info( |
|
402 | f"Handling mef_eline.redeployed_link_down_no_path on EVC id: {evc_id}" |
|
403 | ) |
|
404 | await self.int_manager.remove_int_flows(evcs, metadata, force=True) |
|
405 | ||
406 | @alisten_to("kytos/topology.link_down") |
|
407 | async def on_link_down(self, event): |
|
@@ 331-354 (lines=24) @@ | ||
328 | log.info(f"Handling mef_eline.deleted on EVC id: {evc_id}") |
|
329 | await self.int_manager.disable_int({evc_id: content}, force=True) |
|
330 | ||
331 | @alisten_to("kytos/mef_eline.undeployed") |
|
332 | async def on_evc_undeployed(self, event: KytosEvent) -> None: |
|
333 | """On EVC undeployed.""" |
|
334 | content = event.content |
|
335 | if ( |
|
336 | not content["enabled"] |
|
337 | and "metadata" in content |
|
338 | and "telemetry" in content["metadata"] |
|
339 | and content["metadata"]["telemetry"]["enabled"] |
|
340 | ): |
|
341 | metadata = { |
|
342 | "telemetry": { |
|
343 | "enabled": True, |
|
344 | "status": "DOWN", |
|
345 | "status_reason": ["undeployed"], |
|
346 | "status_updated_at": datetime.utcnow().strftime( |
|
347 | "%Y-%m-%dT%H:%M:%S" |
|
348 | ), |
|
349 | } |
|
350 | } |
|
351 | evc_id = content["evc_id"] |
|
352 | evcs = {evc_id: content} |
|
353 | log.info(f"Handling mef_eline.undeployed on EVC id: {evc_id}") |
|
354 | await self.int_manager.remove_int_flows(evcs, metadata, force=True) |
|
355 | ||
356 | @alisten_to("kytos/mef_eline.(redeployed_link_down|redeployed_link_up)") |
|
357 | async def on_evc_redeployed_link(self, event: KytosEvent) -> None: |