diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2021-05-20 23:01:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 22:01:30 +0200 |
commit | 8fdebbe140bdd92d3c3086ac90a3f869f740b74d (patch) | |
tree | c070d5eba75806d5643a4204b305eb31ffffb589 | |
parent | 9197a409876f9943032ac19834b5f04bdac6e00a (diff) | |
download | vyos-1x-8fdebbe140bdd92d3c3086ac90a3f869f740b74d.tar.gz vyos-1x-8fdebbe140bdd92d3c3086ac90a3f869f740b74d.zip |
vyos.util: T3532: Replace func get_interface_config
Replace function get_interface_config to
function get_interface_config, as we have
in 1.4 branch.
It need after this cherry-picked commit edcdea8
-rw-r--r-- | python/vyos/util.py | 2 | ||||
-rw-r--r-- | smoketest/scripts/cli/base_interfaces_test.py | 4 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_bonding.py | 6 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_macsec.py | 4 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_tunnel.py | 12 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-tunnel.py | 4 |
6 files changed, 16 insertions, 16 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py index f9b10c57f..c1644247f 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -651,7 +651,7 @@ def dict_search(path, dict): c = c.get(p, {}) return c.get(parts[-1], None) -def get_json_iface_options(interface): +def get_interface_config(interface): """ Returns the used encapsulation protocol for given interface. If interface does not exist, None is returned. """ diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index 4e11c193a..87a572a56 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -29,7 +29,7 @@ from vyos.util import read_file from vyos.util import cmd from vyos.util import dict_search from vyos.util import process_named_running -from vyos.util import get_json_iface_options +from vyos.util import get_interface_config from vyos.validate import is_intf_addr_assigned from vyos.validate import is_ipv6_link_local @@ -353,7 +353,7 @@ class BasicInterfaceTest: for interface in self._interfaces: for vif_s in self._qinq_range: - tmp = get_json_iface_options(f'{interface}.{vif_s}') + tmp = get_interface_config(f'{interface}.{vif_s}') self.assertEqual(dict_search('linkinfo.info_data.protocol', tmp), '802.1ad') for vif_c in self._vlan_range: diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py index 9480263d8..4771eb6b6 100755 --- a/smoketest/scripts/cli/test_interfaces_bonding.py +++ b/smoketest/scripts/cli/test_interfaces_bonding.py @@ -22,7 +22,7 @@ from base_interfaces_test import BasicInterfaceTest from vyos.ifconfig import Section from vyos.ifconfig.interface import Interface from vyos.configsession import ConfigSessionError -from vyos.util import get_json_iface_options +from vyos.util import get_interface_config from vyos.util import read_file class BondingInterfaceTest(BasicInterfaceTest.BaseTest): @@ -105,7 +105,7 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest): # verify config for interface in self._interfaces: - tmp = get_json_iface_options(interface) + tmp = get_interface_config(interface) self.assertEqual(min_links, tmp['linkinfo']['info_data']['min_links']) # check LACP default rate @@ -124,7 +124,7 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest): # verify config for interface in self._interfaces: - tmp = get_json_iface_options(interface) + tmp = get_interface_config(interface) # check LACP minimum links (default value) self.assertEqual(0, tmp['linkinfo']['info_data']['min_links']) diff --git a/smoketest/scripts/cli/test_interfaces_macsec.py b/smoketest/scripts/cli/test_interfaces_macsec.py index 2f1898b6f..31071a0f7 100755 --- a/smoketest/scripts/cli/test_interfaces_macsec.py +++ b/smoketest/scripts/cli/test_interfaces_macsec.py @@ -25,7 +25,7 @@ from vyos.configsession import ConfigSessionError from vyos.ifconfig import Section from vyos.util import cmd from vyos.util import read_file -from vyos.util import get_json_iface_options +from vyos.util import get_interface_config from vyos.util import process_named_running def get_config_value(interface, key): @@ -34,7 +34,7 @@ def get_config_value(interface, key): return tmp[0] def get_cipher(interface): - tmp = get_json_iface_options(interface) + tmp = get_interface_config(interface) return tmp['linkinfo']['info_data']['cipher_suite'].lower() class MACsecInterfaceTest(BasicInterfaceTest.BaseTest): diff --git a/smoketest/scripts/cli/test_interfaces_tunnel.py b/smoketest/scripts/cli/test_interfaces_tunnel.py index 5ed2c924d..0c562b7d9 100755 --- a/smoketest/scripts/cli/test_interfaces_tunnel.py +++ b/smoketest/scripts/cli/test_interfaces_tunnel.py @@ -18,7 +18,7 @@ import unittest from vyos.configsession import ConfigSession from vyos.configsession import ConfigSessionError -from vyos.util import get_json_iface_options +from vyos.util import get_interface_config from vyos.template import inc_ip from vyos.util import cmd @@ -87,7 +87,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): # Check if commit is ok self.session.commit() - conf = get_json_iface_options(interface) + conf = get_interface_config(interface) if encapsulation not in ['sit', 'gre-bridge']: self.assertEqual(source_if, conf['link']) @@ -128,7 +128,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): # Check if commit is ok self.session.commit() - conf = get_json_iface_options(interface) + conf = get_interface_config(interface) self.assertEqual(interface, conf['ifname']) self.assertEqual(mtu, conf['mtu']) self.assertEqual(source_if, conf['link']) @@ -185,7 +185,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): # Check if commit is ok self.session.commit() - conf = get_json_iface_options(interface) + conf = get_interface_config(interface) self.assertEqual(mtu, conf['mtu']) self.assertEqual(interface, conf['ifname']) self.assertEqual(encapsulation, conf['linkinfo']['info_kind']) @@ -206,7 +206,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): # Check if commit is ok self.session.commit() - conf = get_json_iface_options(interface) + conf = get_interface_config(interface) self.assertEqual(mtu, conf['mtu']) self.assertEqual(interface, conf['ifname']) self.assertEqual('gretap', conf['linkinfo']['info_kind']) @@ -220,7 +220,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): # Check if commit is ok self.session.commit() - conf = get_json_iface_options(interface) + conf = get_interface_config(interface) self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote']) if __name__ == '__main__': diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py index e73c2b811..3a497bade 100755 --- a/src/conf_mode/interfaces-tunnel.py +++ b/src/conf_mode/interfaces-tunnel.py @@ -40,7 +40,7 @@ from vyos.ifconfig import SitIf from vyos.ifconfig import Sit6RDIf from vyos.template import is_ipv4 from vyos.template import is_ipv6 -from vyos.util import get_json_iface_options +from vyos.util import get_interface_config from vyos.util import dict_search from vyos import ConfigError from vyos import airbag @@ -131,7 +131,7 @@ def apply(tunnel): # There is no other solution to destroy and recreate the tunnel. encap = '' remote = '' - tmp = get_json_iface_options(interface) + tmp = get_interface_config(interface) if tmp: encap = dict_search('linkinfo.info_kind', tmp) remote = dict_search('linkinfo.info_data.remote', tmp) |