diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-22 11:12:16 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-23 14:36:56 +0100 |
commit | c0a4166db01f7c9fa64e04eea8bd603c3e1a0922 (patch) | |
tree | cce6fdf676ffdcac9a8f84d3b0f85ff0f40929d0 /src/migration-scripts/interfaces | |
parent | 4f8e30dec96c906ca32b1ab9b48ff70fc3564a61 (diff) | |
download | vyos-1x-c0a4166db01f7c9fa64e04eea8bd603c3e1a0922.tar.gz vyos-1x-c0a4166db01f7c9fa64e04eea8bd603c3e1a0922.zip |
pppoe: T1318: extend migrator for firewall, qos and ip routing nodes
Diffstat (limited to 'src/migration-scripts/interfaces')
-rwxr-xr-x | src/migration-scripts/interfaces/4-to-5 | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index 2db9958d3..db2be4a66 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -14,7 +14,42 @@ def migrate_dialer(config, tree, intf): # format as tag node to avoid loading problems config.set_tag(['interfaces', 'pppoe']) - # We need to assign a real interface to our dialer + # + # 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'] @@ -47,6 +82,7 @@ def migrate_dialer(config, tree, intf): tmp = config.return_value(userid) config.set(new_base + ['user-id'], value=tmp) + # 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']) @@ -55,9 +91,6 @@ def migrate_dialer(config, tree, intf): if config.exists(ipv6_slaac): config.set(new_base + ['ipv6', 'address', 'autoconf']) - # Firewall migrieren - # QoS migrieren - # Quagga migrieren if __name__ == '__main__': @@ -79,7 +112,8 @@ if __name__ == '__main__': for interface in config.list_nodes(['interfaces', link_type]): # check if PPPoE exists - pppoe_if = ['interfaces', link_type, interface, 'pppoe'] + base_if = ['interfaces', link_type, interface] + pppoe_if = base_if + ['pppoe'] if config.exists(pppoe_if): for dialer in config.list_nodes(pppoe_if): migrate_dialer(config, pppoe_if, interface) @@ -87,12 +121,14 @@ if __name__ == '__main__': # Delete old PPPoE interface config.delete(pppoe_if) - # also migrate VLANs - if not config.exists(['interfaces', link_type, interface, 'vif']): + # bail out early if there are no VLAN interfaces to migrate + if not config.exists(base_if + ['vif']): continue - for vlan in config.list_nodes(['interfaces', link_type, interface, 'vif']): - pppoe_if = ['interfaces', link_type, interface, 'vif', vlan, 'pppoe'] + # Migrate PPPoE interfaces attached to a VLAN + for vlan in config.list_nodes(base_if + ['vif']): + vlan_if = base_if + ['vif', vlan] + pppoe_if = vlan_if + ['pppoe'] if config.exists(pppoe_if): for dialer in config.list_nodes(pppoe_if): intf = "{}.{}".format(interface, vlan) @@ -101,6 +137,10 @@ if __name__ == '__main__': # Delete old PPPoE interface config.delete(pppoe_if) + # Add interface description that this is required for PPPoE + if not config.exists(vlan_if + ['description']): + config.set(vlan_if + ['description'], value='PPPoE link interface') + try: with open(file_name, 'w') as f: f.write(config.to_string()) |