diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-25 09:57:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 09:57:21 +0100 |
commit | 6e7739e0b69e1d3371ebe36218604cbb1aca18b1 (patch) | |
tree | c745b79a378c75e928931073bfddbf8cc76ca730 /src/migration-scripts | |
parent | 7c4d21639d9594ba4a0d96a5d6d90f25189c2817 (diff) | |
parent | bbea850ea5f8ff0402cd276ab63963ece7e0c763 (diff) | |
download | vyos-1x-6e7739e0b69e1d3371ebe36218604cbb1aca18b1.tar.gz vyos-1x-6e7739e0b69e1d3371ebe36218604cbb1aca18b1.zip |
Merge pull request #265 from thomas-mangin/2057-dhcp-vlan
ifconfig: T2057: break down DHCP, add register, STP and VLAN as adapters
Diffstat (limited to 'src/migration-scripts')
-rwxr-xr-x | src/migration-scripts/dns-forwarding/1-to-2 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/migration-scripts/dns-forwarding/1-to-2 b/src/migration-scripts/dns-forwarding/1-to-2 index 31ba5573f..9a50b6aa3 100755 --- a/src/migration-scripts/dns-forwarding/1-to-2 +++ b/src/migration-scripts/dns-forwarding/1-to-2 @@ -23,8 +23,8 @@ import sys from ipaddress import ip_interface +from vyos.ifconfig import Interface from vyos.configtree import ConfigTree -from vyos.interfaces import get_type_of_interface if (len(sys.argv) < 1): print("Must specify file name!") @@ -41,7 +41,10 @@ base = ['service', 'dns', 'forwarding'] if not config.exists(base): # Nothing to do sys.exit(0) + else: + # XXX: we can remove the else and un-indent this whole block + if config.exists(base + ['listen-on']): listen_intf = config.return_values(base + ['listen-on']) # Delete node with abandoned command @@ -60,7 +63,10 @@ else: # this is a QinQ VLAN interface intf = intf.split('.')[0] + ' vif-s ' + intf.split('.')[1] + ' vif-c ' + intf.split('.')[2] - path = ['interfaces', get_type_of_interface(intf), intf, 'address'] + section = Interface.section(intf) + if not section: + raise ValueError(f'Invalid interface name {intf}') + path = ['interfaces', section, intf, 'address'] # retrieve corresponding interface addresses in CIDR format # those need to be converted in pure IP addresses without network information |