From 9c3593558cf4b3be9d4171ac780ea4f1acf0cd15 Mon Sep 17 00:00:00 2001 From: sai chintalapudi Date: Fri, 24 Aug 2018 10:24:50 -0700 Subject: [PATCH 1/3] fix cisco-77 --- lib/cisco_node_utils/cmd_ref/interface.yaml | 7 +++++++ lib/cisco_node_utils/interface.rb | 15 +++++++++++++++ tests/test_interface.rb | 21 +++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/lib/cisco_node_utils/cmd_ref/interface.yaml b/lib/cisco_node_utils/cmd_ref/interface.yaml index 3d7c9698..aacab245 100644 --- a/lib/cisco_node_utils/cmd_ref/interface.yaml +++ b/lib/cisco_node_utils/cmd_ref/interface.yaml @@ -306,6 +306,13 @@ ipv6_dhcp_relay_src_intf: set_value: " ipv6 dhcp relay source-interface " default_value: false +ipv6_redirects: + _exclude: [ios_xr] + kind: boolean + get_value: '/^((?:no )?ipv6 redirects)$/' + set_value: " ipv6 redirects" + default_value: true + load_interval_counter_1_delay: _exclude: [ios_xr] kind: int diff --git a/lib/cisco_node_utils/interface.rb b/lib/cisco_node_utils/interface.rb index a25d8e1a..f7787295 100644 --- a/lib/cisco_node_utils/interface.rb +++ b/lib/cisco_node_utils/interface.rb @@ -834,6 +834,21 @@ def default_ipv6_dhcp_relay_src_intf config_get_default('interface', 'ipv6_dhcp_relay_src_intf') end + def ipv6_redirects + config_get('interface', 'ipv6_redirects', name: @name) + end + + def ipv6_redirects=(redirects) + check_switchport(:disabled) + no_cmd = (redirects ? '' : 'no') + config_set('interface', 'ipv6_redirects', + name: @name, state: no_cmd) + end + + def default_ipv6_redirects + config_get_default('interface', 'ipv6_redirects') + end + def feature_lacp? config_get('interface', 'feature_lacp') end diff --git a/tests/test_interface.rb b/tests/test_interface.rb index 73457173..14d53b31 100755 --- a/tests/test_interface.rb +++ b/tests/test_interface.rb @@ -1250,6 +1250,27 @@ def test_ipv4_redirects 'Error: ip redirects default get value mismatch') end + def test_ipv6_redirects + interface = create_interface + interface.switchport_mode = :disabled if platform == :nexus + + # check default value + assert_equal(interface.default_ipv6_redirects, interface.ipv6_redirects, + 'Error: ipv6 redirects default get value mismatch') + + # set with value false + interface.ipv6_redirects = false + assert_equal(interface.ipv6_redirects, false) + + # set with value true + interface.ipv6_redirects = true + assert_equal(interface.ipv6_redirects, true) + + # get default and set + interface.ipv6_redirects = interface.default_ipv6_redirects + assert_equal(interface.ipv6_redirects, interface.default_ipv6_redirects) + end + def config_from_hash(inttype_h) inttype_h.each do |k, v| config('feature interface-vlan') if (/^Vlan\d./).match(k.to_s) From a6c4c623870aa3d3137942b814e341e03d7a5f6d Mon Sep 17 00:00:00 2001 From: sai chintalapudi Date: Fri, 24 Aug 2018 10:27:14 -0700 Subject: [PATCH 2/3] doc --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b48c3db..4591feef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Changelog * `level` * Extend syslog_server with attribute: * `facility` +* Extend interface with attributes: + * `ipv6_redirects` ### Changed From d3a3e81ebed6c1c3995c76aea82468d0b2269cd5 Mon Sep 17 00:00:00 2001 From: sai chintalapudi Date: Fri, 24 Aug 2018 10:29:35 -0700 Subject: [PATCH 3/3] copyright --- lib/cisco_node_utils/interface.rb | 2 +- tests/test_interface.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cisco_node_utils/interface.rb b/lib/cisco_node_utils/interface.rb index f7787295..f4fb7719 100644 --- a/lib/cisco_node_utils/interface.rb +++ b/lib/cisco_node_utils/interface.rb @@ -1,6 +1,6 @@ # November 2015, Chris Van Heuveln # -# Copyright (c) 2015-2017 Cisco and/or its affiliates. +# Copyright (c) 2015-2018 Cisco and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/test_interface.rb b/tests/test_interface.rb index 14d53b31..8966b449 100755 --- a/tests/test_interface.rb +++ b/tests/test_interface.rb @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2017 Cisco and/or its affiliates. +# Copyright (c) 2013-2018 Cisco and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.