24 lines
527 B
Python
24 lines
527 B
Python
import re
|
|
|
|
from oxi.models.base import BaseDevice
|
|
|
|
|
|
class Qtech(BaseDevice):
|
|
|
|
def __init__(self, config):
|
|
self.config: str = self._fix_config(config)
|
|
|
|
def _fix_config(self, config):
|
|
pattern = r"Pending configurations.*"
|
|
cleaned_text = re.sub(pattern, "", config, flags=re.DOTALL)
|
|
return cleaned_text
|
|
|
|
|
|
with open('../../core_switch.txt', 'r') as file:
|
|
data = file.read()
|
|
|
|
result = Qtech(data).parse_config()
|
|
print(result.vlans)
|
|
print(result.l3interfaces)
|
|
print(result.vlaninterfaces)
|