Skip to content

Commit

Permalink
Fix suppress-fib-pending lib and test code (#445)
Browse files Browse the repository at this point in the history
* Remove testing of vrf context and fix default test

* Fix broken yaml

* Merge default test code into main testcase
  • Loading branch information
robert-w-gries authored and chrisvanheuveln committed Jul 18, 2016
1 parent 6a6cf4b commit b7d91ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 37 deletions.
3 changes: 2 additions & 1 deletion lib/cisco_node_utils/bgp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,8 @@ def default_shutdown

# Supress Fib Pending (Getter/Setter/Default)
def suppress_fib_pending
config_get('bgp', 'suppress_fib_pending', @get_args)
val = config_get('bgp', 'suppress_fib_pending', @get_args)
val.nil? ? false : val
end

def suppress_fib_pending=(enable)
Expand Down
12 changes: 6 additions & 6 deletions lib/cisco_node_utils/cmd_ref/bgp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ shutdown:
default_value: false

suppress_fib_pending:
# Note: Does not exist in IOS XR
nexus:
kind: boolean
get_value: 'suppress-fib-pending'
set_value: '<state> suppress-fib-pending'
default_value: false
_exclude: [ios_xr]
kind: boolean
get_value: '/^(?:no )?suppress-fib-pending$/'
set_value: '<state> suppress-fib-pending'
default_value: true
auto_default: false

timer_bestpath_limit:
# Note: Does not exist in IOS XR
Expand Down
42 changes: 12 additions & 30 deletions tests/test_router_bgp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1155,39 +1155,21 @@ def test_default_shutdown
end

def test_suppress_fib_pending
%w(test_default test_vrf).each do |t|
if t == 'test_default'
bgp = setup_default
else
bgp = setup_vrf
end
if platform == :ios_xr
assert_raises(Cisco::UnsupportedError) do
bgp.suppress_fib_pending = true
end
else
bgp = setup_default
if validate_property_excluded?('bgp', 'suppress_fib_pending')
assert_raises(Cisco::UnsupportedError) do
bgp.suppress_fib_pending = true
assert(bgp.suppress_fib_pending,
"vrf #{@vrf}: bgp suppress_fib_pending should be enabled")
bgp.suppress_fib_pending = false
refute(bgp.suppress_fib_pending,
"vrf #{@vrf}: bgp suppress_fib_pending should be disabled")
end
bgp.destroy
else
bgp.suppress_fib_pending = true
assert(bgp.suppress_fib_pending,
'bgp suppress_fib_pending should be enabled')
bgp.suppress_fib_pending = false
refute(bgp.suppress_fib_pending,
'bgp suppress_fib_pending should be disabled')
bgp.suppress_fib_pending = bgp.default_suppress_fib_pending
assert_equal(bgp.default_suppress_fib_pending, bgp.suppress_fib_pending)
end
end

def test_suppress_fib_pending_not_configured
bgp = setup_default
refute(bgp.suppress_fib_pending,
'bgp suppress_fib_pending should be disabled')
bgp.destroy
end

def test_default_suppress_fib_pending
bgp = setup_default
refute(bgp.default_suppress_fib_pending,
'bgp suppress_fib_pending default value should be false')
bgp.destroy
end

Expand Down

0 comments on commit b7d91ac

Please sign in to comment.