diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-23 12:22:34 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-23 14:36:56 +0100 |
commit | 07273632fcf59d04be988f2c43fe53e7bec8d46a (patch) | |
tree | 9a552078dd3db9932b101871d275137822622226 /src/migration-scripts/interfaces/4-to-5 | |
parent | daca2a39b4d0f4ebdf07463679b9465c64886763 (diff) | |
download | vyos-1x-07273632fcf59d04be988f2c43fe53e7bec8d46a.tar.gz vyos-1x-07273632fcf59d04be988f2c43fe53e7bec8d46a.zip |
pppoe: T1318: rename link to source-interface
Diffstat (limited to 'src/migration-scripts/interfaces/4-to-5')
-rwxr-xr-x | src/migration-scripts/interfaces/4-to-5 | 91 |
1 files changed, 14 insertions, 77 deletions
diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index db2be4a66..0683861f2 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -9,91 +9,28 @@ from vyos.configtree import ConfigTree def migrate_dialer(config, tree, intf): for pppoe in config.list_nodes(tree): # assemble string, 0 -> pppoe0 - new_base = ['interfaces', 'pppoe', 'pppoe' + pppoe] + new_base = ['interfaces', 'pppoe'] + pppoe_base = new_base + ['pppoe' + pppoe] config.set(new_base) # format as tag node to avoid loading problems - config.set_tag(['interfaces', 'pppoe']) - - # - # Firewall migrieren - # - firewall = tree + [pppoe, 'firewall'] - if config.exists(firewall): - config.copy(firewall, new_base + ['firewall']) - - policy = tree + [pppoe, 'policy'] - if config.exists(policy): - config.copy(policy, new_base + ['policy']) - - # - # QoS migrieren - # - redirect = tree + [pppoe, 'redirect'] - if config.exists(redirect): - config.copy(redirect, new_base + ['redirect']) - - traffic_policy = tree + [pppoe, 'traffic-policy'] - if config.exists(traffic_policy): - config.copy(traffic_policy, new_base + ['traffic-policy']) - - # - # Quagga migrieren - # - ip = tree + [pppoe, 'ip'] - if config.exists(ip): - config.copy(ip, new_base + ['ip']) - - ipv6 = tree + [pppoe, 'ipv6'] - if config.exists(ipv6): - config.copy(ipv6, new_base + ['ipv6']) - - # - # Interface migration - # - config.set(new_base + ['link'], value=intf) - - default_route = tree + [pppoe, 'default-route'] - if config.exists(default_route): - tmp = config.return_value(default_route) - config.set(new_base + ['default-route'], value=tmp) - - disable = tree + [pppoe, 'disable'] - if config.exists(disable): - tmp = config.return_value(disable) - config.set(new_base + ['disable'], value=tmp) - - mtu = tree + [pppoe, 'mtu'] - if config.exists(mtu): - tmp = config.return_value(mtu) - config.set(new_base + ['mtu'], value=tmp) - - nameserver = tree + [pppoe, 'name-server'] - if config.exists(nameserver): - tmp = config.return_value(nameserver) - config.set(new_base + ['name-server'], value=tmp) - - password = tree + [pppoe, 'password'] - if config.exists(password): - tmp = config.return_value(password) - config.set(new_base + ['password'], value=tmp) - - userid = tree + [pppoe, 'user-id'] - if config.exists(userid): - tmp = config.return_value(userid) - config.set(new_base + ['user-id'], value=tmp) + config.set_tag(new_base) + + # Copy the entire old node to the new one before migrating individual + # parts + config.copy(tree + [pppoe], pppoe_base) + # remove enable-ipv6 node and rather place it under ipv6 node - ipv6_enable = tree + [pppoe, 'enable-ipv6'] - if config.exists(ipv6_enable): - config.set(new_base + ['ipv6', 'enable']) + if config.exists(pppoe_base + ['enable-ipv6']): + config.set(pppoe_base + ['ipv6', 'enable']) + config.delete(pppoe_base + ['enable-ipv6']) - ipv6_slaac = tree + [pppoe, 'ipv6', 'address', 'autoconf'] - if config.exists(ipv6_slaac): - config.set(new_base + ['ipv6', 'address', 'autoconf']) + # Source interface migration + config.set(pppoe_base + ['source-interface'], value=intf) -if __name__ == '__main__': +if __name__ == '__main__': if (len(sys.argv) < 1): print("Must specify file name!") exit(1) |