diff options
-rw-r--r-- | data/templates/pppoe/ip-down.script.tmpl | 2 | ||||
-rw-r--r-- | data/templates/pppoe/peer.tmpl | 4 | ||||
-rw-r--r-- | interface-definitions/interfaces-pppoe.xml.in | 6 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_pppoe.py | 2 | ||||
-rwxr-xr-x | src/migration-scripts/interfaces/15-to-16 | 50 |
5 files changed, 55 insertions, 9 deletions
diff --git a/data/templates/pppoe/ip-down.script.tmpl b/data/templates/pppoe/ip-down.script.tmpl index c2d0cd09a..5e119f796 100644 --- a/data/templates/pppoe/ip-down.script.tmpl +++ b/data/templates/pppoe/ip-down.script.tmpl @@ -25,7 +25,7 @@ fi # Always delete default route when interface goes down vtysh -c "conf t" ${VRF_NAME} -c "no ip route 0.0.0.0/0 {{ ifname }} ${VRF_NAME}" -{% if ipv6_enable %} +{% if ipv6 is defined and ipv6.address is defined and ipv6.address.autoconf is defined %} vtysh -c "conf t" ${VRF_NAME} -c "no ipv6 route ::/0 {{ ifname }} ${VRF_NAME}" {% endif %} {% endif %} diff --git a/data/templates/pppoe/peer.tmpl b/data/templates/pppoe/peer.tmpl index dd4272a98..db2cc6188 100644 --- a/data/templates/pppoe/peer.tmpl +++ b/data/templates/pppoe/peer.tmpl @@ -53,9 +53,11 @@ mru {{ mtu }} {{ "usepeerdns" if no_peer_dns is not defined }} -{% if ipv6 is defined and ipv6.enable is defined %} +{% if ipv6 is defined %} +ipv6 +{% if ipv6.address is defined and ipv6.address.autoconf is defined %} ipv6cp-use-ipaddr +{% endif %} {% endif %} {% if service_name is defined %} diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in index 38c01d434..7dccfbc9c 100644 --- a/interface-definitions/interfaces-pppoe.xml.in +++ b/interface-definitions/interfaces-pppoe.xml.in @@ -102,12 +102,6 @@ #include <include/ipv6-address-autoconf.xml.i> </children> </node> - <leafNode name="enable"> - <properties> - <help>Activate IPv6 support on this connection</help> - <valueless/> - </properties> - </leafNode> </children> </node> <leafNode name="source-interface"> diff --git a/smoketest/scripts/cli/test_interfaces_pppoe.py b/smoketest/scripts/cli/test_interfaces_pppoe.py index 822f05de6..ec256cb43 100755 --- a/smoketest/scripts/cli/test_interfaces_pppoe.py +++ b/smoketest/scripts/cli/test_interfaces_pppoe.py @@ -108,7 +108,7 @@ class PPPoEInterfaceTest(unittest.TestCase): self.session.set(base_path + [interface, 'default-route', 'none']) self.session.set(base_path + [interface, 'no-peer-dns']) self.session.set(base_path + [interface, 'source-interface', self._source_interface]) - self.session.set(base_path + [interface, 'ipv6', 'enable']) + self.session.set(base_path + [interface, 'ipv6', 'address', 'autoconf']) # prefix delegation stuff dhcpv6_pd_base = base_path + [interface, 'dhcpv6-options', 'pd', '0'] diff --git a/src/migration-scripts/interfaces/15-to-16 b/src/migration-scripts/interfaces/15-to-16 new file mode 100755 index 000000000..126911ccd --- /dev/null +++ b/src/migration-scripts/interfaces/15-to-16 @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2020 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# remove pppoe "ipv6 enable" option + +import os + +from sys import exit, argv +from vyos.configtree import ConfigTree + +if __name__ == '__main__': + if (len(argv) < 1): + print("Must specify file name!") + exit(1) + + file_name = argv[1] + with open(file_name, 'r') as f: + config_file = f.read() + + config = ConfigTree(config_file) + base = ['interfaces', 'pppoe'] + + if not config.exists(base): + # Nothing to do + exit(0) + + for interface in config.list_nodes(base): + ipv6_enable = base + [interface, 'ipv6', 'enable'] + if config.exists(ipv6_enable): + config.delete(ipv6_enable) + + try: + with open(file_name, 'w') as f: + f.write(config.to_string()) + except OSError as e: + print("Failed to save the modified config: {}".format(e)) + exit(1) |