add oxiApi

This commit is contained in:
IluaAir
2025-06-25 10:32:51 +03:00
parent 009f007a38
commit 1eb0ff1eca
11 changed files with 129 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
import re
from abc import ABC
from dataclasses import dataclass
from typing import Protocol
@dataclass
@@ -25,7 +25,7 @@ class ParsedDeviceData:
vlans: list[Vlan]
class BaseDevice(ABC):
class BaseDevice(Protocol):
anchor_pattern: str = '!'
hostname_pattern: str = 'hostname'
@@ -81,7 +81,7 @@ class BaseDevice(ABC):
ip_address_match = re.search(r'\s?ip address\s(.+)$', interface_block, re.MULTILINE)
if not description_match and not ip_address_match:
continue
ip_address = ip_address_match.group(1) if ip_address_match else None
ip_address = ip_address_match.group(1).replace(' ', '/') if ip_address_match else None
description = description_match.group(1) if description_match else None
interfaces.append(L3Interface(
interface=interface_name,