Last active
April 4, 2022 19:26
-
-
Save FlorianHeigl/17e23b3324763cfe34a7f2ff47b1e4da to your computer and use it in GitHub Desktop.
textfsm-aos example alcatel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from textfsm_aos.parser import parse | |
import re | |
sample_data = """ | |
Local Chassis ID 1 (Master) | |
Model Name: OS6860E-24, | |
Module Type: 0x6062203, | |
Description: Chassis, | |
Part Number: 903708-90, | |
Hardware Revision: 15, | |
Serial Number: U0483299, | |
Manufacture Date: Jan 23 2016, | |
Admin Status: POWER ON, | |
Operational Status: UP, | |
Number Of Resets: 13, | |
MAC Address: 2c:fa:a2:36:0e:17 | |
""" | |
aa=parse("ale_aos8", "show chassis", sample_data) | |
model = aa[0]['model_name'] | |
if not re.match("OS[0-9]{4,5}[A-Z]?-[A-Z]?[0-9]{1,2}", model): | |
print("keine Alcatel Modellnummer erkannt") | |
if re.match("OS[0-9]{4,5}E", model): | |
print("Enhanced Security erkannt") | |
if re.match("OS[0-9]{4,5}[A-Z]-P[0-9]{1,2}", model): | |
print("PoE Modell erkannt") | |
num_ports=re.split("OS[0-9]{4,5}[A-Z]?-[A-Z]?", model) | |
print("Switch hat %d Ports" % int(num_ports[1])) | |
base_series=re.split("[0-9]{2}[A-Z]?-[A-Z]?[0-9]{1,2}", model)[0] | |
print(base_series) | |
if base_series in [ "OS68", "OS69" ]: | |
print("Switch hat LACP extended hash policy support...") | |
elif base_series in [ "OS63" ]: | |
print("Switch hat keinen LACP extended hash policy support...") | |
else: | |
print("Switchmodell nicht bekannt, LACP hash policy support nicht aktivieren...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment