From 0ad41a72bde1f1a6fc538b6785ec5307a38c0233 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Sun, 8 Mar 2020 17:32:11 +0100
Subject: ifconfig: T1557: reorder calling order to support non q-in-q
 interfaces

---
 python/vyos/ifconfig_vlan.py | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/python/vyos/ifconfig_vlan.py b/python/vyos/ifconfig_vlan.py
index 1fe955b56..1d57283ac 100644
--- a/python/vyos/ifconfig_vlan.py
+++ b/python/vyos/ifconfig_vlan.py
@@ -98,6 +98,20 @@ def verify_vlan_config(config):
     implementing this function in multiple places use single source \o/
     """
 
+    for vif in config['vif']:
+        # DHCPv6 parameters-only and temporary address are mutually exclusive
+        if vif['dhcpv6_prm_only'] and vif['dhcpv6_temporary']:
+            raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
+
+        vrf_name = vif['vrf']
+        if vrf_name and vrf_name not in interfaces():
+            raise ConfigError(f'VRF "{vrf_name}" does not exist')
+
+    # e.g. wireless interface has no vif_s support
+    # thus we bail out eraly.
+    if 'vif_s' not in config.keys():
+        return
+
     for vif_s in config['vif_s']:
         for vif in config['vif']:
             if vif['id'] == vif_s['id']:
@@ -120,11 +134,4 @@ def verify_vlan_config(config):
             if vrf_name and vrf_name not in interfaces():
                 raise ConfigError(f'VRF "{vrf_name}" does not exist')
 
-    for vif in config['vif']:
-        # DHCPv6 parameters-only and temporary address are mutually exclusive
-        if vif['dhcpv6_prm_only'] and vif['dhcpv6_temporary']:
-            raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
 
-        vrf_name = vif['vrf']
-        if vrf_name and vrf_name not in interfaces():
-            raise ConfigError(f'VRF "{vrf_name}" does not exist')
-- 
cgit v1.2.3