Commit 7b2de7e5 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'fix-avs-eltex-woplr' into 'master'

Eltex.WOPLR. Add get_interface_type method to profile.

See merge request !4272
parents d0fca0ec 73bd9887
Pipeline #26403 passed with stages
in 27 minutes and 58 seconds
......@@ -2,11 +2,14 @@
# Vendor: Eltex
# OS: WOPLR
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
import re
# NOC modules
from noc.core.profile.base import BaseProfile
......@@ -15,3 +18,14 @@ class Profile(BaseProfile):
pattern_prompt = r"^(?P<hostname>\S+)\s*#|~ #"
command_exit = "exit"
pattern_syntax_error = r"Invalid command\."
rx_physical = re.compile(r"^(wlan|eth|br|tun|gre)\d+$")
@classmethod
def get_interface_type(cls, name):
match = cls.rx_physical.match(name)
if match and match.group(1) in {"eth", "wlan"}:
return "physical"
elif match and match.group(1) in {"br", "tun", "gre"}:
return "SVI"
return "other"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment