summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/interface.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-12-19 16:59:10 +0100
committerGitHub <noreply@github.com>2024-12-19 16:59:10 +0100
commitccb260c0971f1621a581158e4933727edfea034a (patch)
tree301f4fd6aa4669adcd3bcdc5cadb4e4aacc5e5a4 /python/vyos/ifconfig/interface.py
parentfdb9ce311ae485bcdaa59c5653c631df7efd3e29 (diff)
parentd2a7584a6d5cc3fcd01471b9cfd45735b5458724 (diff)
downloadveeos-1x-ccb260c0971f1621a581158e4933727edfea034a.tar.gz
veeos-1x-ccb260c0971f1621a581158e4933727edfea034a.zip
Merge pull request #4243 from c-po/frr-10
frrender: T6746: runtime improvements
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
-rw-r--r--python/vyos/ifconfig/interface.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index cd562e1fe..eac9f61f5 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -26,8 +26,9 @@ from netifaces import ifaddresses
# this is not the same as socket.AF_INET/INET6
from netifaces import AF_INET
from netifaces import AF_INET6
+from netaddr import EUI
+from netaddr import mac_unix_expanded
-from vyos import ConfigError
from vyos.configdict import list_diff
from vyos.configdict import dict_merge
from vyos.configdict import get_vlan_ids
@@ -61,9 +62,7 @@ from vyos.ifconfig.control import Control
from vyos.ifconfig.vrrp import VRRP
from vyos.ifconfig.operational import Operational
from vyos.ifconfig import Section
-
-from netaddr import EUI
-from netaddr import mac_unix_expanded
+from vyos import ConfigError
link_local_prefix = 'fe80::/64'
@@ -339,8 +338,8 @@ class Interface(Control):
# Any instance of Interface, such as Interface('eth0') can be used
# safely to access the generic function in this class as 'type' is
# unset, the class can not be created
- if not self.iftype:
- raise Exception(f'interface "{ifname}" not found')
+ if not hasattr(self, 'iftype'):
+ raise ConfigError(f'Interface "{ifname}" has no "iftype" attribute defined!')
self.config['type'] = self.iftype
# Should an Instance of a child class (EthernetIf, DummyIf, ..)