Benutzer-Werkzeuge

Webseiten-Werkzeuge


aos-r8-omniswitch-event-action-nach-neustart

Skript nach Kalt- oder Warmstart ausführen um administrative Aktion auszuführen

In seltenen Fällen kann es notwendig sein nach einem Kalt- oder Warmstart des OmniSwitch eine Route zu entfernen und neu zu konfigurieren um z.B. L2GRE Tunneln zu helfen. Dieser Artikel beschreibt exemplarisch, wie dies per event-action möglich ist.

Exemplarisches Python Skript um Route zu entfernen/hinzuzufügen

restore-route.py
#!/usr/bin/env python3
import subprocess
import time
import sys
 
# This script removes a route and adds it again to address a timing issue
# for L2GRE tunnels
 
#
# Adapt to your needs
# -Benny 
 
# Destination
destination = "1.1.1.1"
 
# Mask e.g. /32
mask = "32"
 
# Gateway
gateway = "192.168.2.1"
 
# Maximum uptime until which this script will run after a coldStart/warmStart trap
# This avoids running on "trap-replay" situations, sometimes triggered by NMS
# Make sure to specify this as a float 300.0 for 5 minutes
max_uptime = 300.0
 
#
# Do not modify below this line
#
print("restore-route.py: Script was started via event-action following a reboot, resetting route to help L2GRE tunnels")
uptime = time.clock_gettime(time.CLOCK_BOOTTIME)
print(f"restore-route.py: System uptime is at {uptime} seconds")
if uptime > max_uptime:
    sys.exit("restore-route.py: Reached maximum uptime to apply this workaround.")
 
subprocess.run(['no', 'ip', 'static-route', f'{destination}/{mask}', 'gateway', f'{gateway}'], capture_output=False)
print(f"restore-route.py: Removed route to {destination}/{mask} via {gateway}")
 
subprocess.run(['ip', 'static-route', f'{destination}/{mask}', 'gateway', f'{gateway}'], capture_output=False)
print(f"restore-route.py: Added route to {destination}/{mask} via {gateway}")

Konfiguration von event-action

Ich habe aktuell noch Schwierigkeiten dass die Traps gesendet werden bevor das System fertig ist mit dem Start.

-> event-action trap coldStart script /flash/python/restore-route.py
-> event-action trap warmStart script /flash/python/restore-route.py
-> ls -l /flash/python
total 36
-rwxrwx---    1 root     admins       20228 Jul 19 16:33 default_broker_vso.py
-rw-r--r--    1 admin    user          8423 Jul 19 16:33 iec_config.py
-rw-rw-rw-    1 admin    user          1302 Jul 19 16:52 restore-route.py
-> ls -l /flash/python
total 36
-rwxrwx---    1 root     admins       20228 Jul 19 16:33 default_broker_vso.py
-rw-r--r--    1 admin    user          8423 Jul 19 16:33 iec_config.py
-rwxrwx---    1 root     admins        1302 Jul 19 16:52 restore-route.py
-> show event-action 
Script Time Limit (seconds): 60

 Type                   Name                      Script (/flash/python/...)    
------+---------------------------------------+----------------------------------
trap   coldStart                                restore-route.py
trap   warmStart                                restore-route.py
trap   alaDhcpVsoBrokerIpAddress                default_broker_vso.py
OS6465 login:
Fri Jul 19 17:05:19 : ChassisSupervisor Power Mgr INFO message:
+++ Power Supply 1 Inserted
+++ Power Supply 1 Up
Alcatel-Lucent Enterprise OS6465T-P12 8.9.96.R04 Service Release, April 05, 2024.
chassis mode is
2
chassis mode is
2

Fri Jul 19 17:06:34 : lpNi LanNi INFO message:
+++ HW Ver  0 SW Ver  211 Param #26 ProdNum 23

Fri Jul 19 17:06:36 : dafcCmm cmm INFO message:
+++ afd_cmm_mip_handle_eoic: EOIC received once again

Fri Jul 19 17:06:36 : vcmNi thread INFO message:
+++ NI:thread_main@3179: NI 1 connecting to VC-ISIS (0/65)

Fri Jul 19 17:06:37 : qosNi Info INFO message:
+++ VC Takeover in progress.
+++ VC Takeover complete.
Chassis Supervision: CMM has reached the ready state [L8]

Fri Jul 19 17:06:38 : lpNi LanNi INFO message:
+++ lpStartNi 7119:Starting NI

Fri Jul 19 17:06:40 : ChassisSupervisor reloadMgr INFO message:
+++ Redundancy time expired - updating next running to working

Fri Jul 19 17:06:40 : intfCmm Mgr INFO message:
+++ Link 1/1/1 operationally up
aos-r8-omniswitch-event-action-nach-neustart.txt · Zuletzt geändert: 2024/07/19 15:20 von benny

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki