Adding destroy method for pim, needed for resource=absent #222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Adding destroy method for pim, needed for resource=absent
Resource Testing:
———————————
site.pp:
node default {
cisco_pim { 'ipv4' :
ensure => present,
vrf => 'default',
ssm_range => '224.0.0.0/8 225.0.0.0/8'
}
}
root@agent-lab11-nx#puppet agent -t --trace
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for agent-lab11-nx.cisco.com
Info: Applying configuration version '1455193624'
Notice: /Stage[main]/Main/Node[default]/Cisco_pim[ipv4]/ensure: created
Notice: Applied catalog in 0.51 seconds
site.pp:
node default {
cisco_pim { 'ipv4' :
ensure => absent,
vrf => 'default',
ssm_range => '224.0.0.0/8 225.0.0.0/8'
}
}
root@agent-lab11-nx#puppet agent -t --trace
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for agent-lab11-nx.cisco.com
Info: Applying configuration version '1455193650'
Notice: /Stage[main]/Main/Node[default]/Cisco_pim[ipv4]/ensure: removed
Notice: Applied catalog in 1.00 seconds
root@agent-lab11-nx#
Rubocop:
——————
rtpfe1@agent-lab11-ws:~/smigopal/feb_pim/cisco-network-node-utils$ rubocop lib/cisco_node_utils/pim.rb
warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2.3-compliant syntax, but you are running 2.2.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Inspecting 1 file
.
1 file inspected, no offenses detected
Minitests:
——————
rtpfe1@agent-lab11-ws:~/smigopal/feb_pim/cisco-network-node-utils$ ruby tests/test_pim.rb -v -- 10.122.197.125 admin admin
Run options: -v -- --seed 23435
Running:
Node under test:
conf : ["feature pim"]
conf : [" ip pim ssm range 1.1.1.1/8"]
TestPim#test_single_invalid_ssm_range_single_vrf = 2.72 s = .
conf : ["feature pim"]
conf : ["feature pim"]
conf : ["feature pim"]
conf : [" ip pim ssm range 229.0.0.0/8 225.0.0.0/8 224.0.0.0/8"]
conf : ["vrf context red", " ip pim ssm range 230.0.0.0/8 228.0.0.0/8 224.0.0.0/8"]
conf : ["vrf context black", " ip pim ssm range none"]
TestPim#test_multiple_ssm_range_multiple_vrfs = 1.99 s = .
conf : ["feature pim"]
conf : ["feature pim"]
conf : [" ip pim ssm range 229.0.0.0/8 225.0.0.0/8 224.0.0.0/8"]
conf : ["vrf context red", " ip pim ssm range 230.0.0.0/8 228.0.0.0/8 224.0.0.0/8"]
conf : ["vrf context red", " ip pim ssm range none"]
TestPim#test_multiple_ssm_range_overwrite_multiple_vrfs = 2.14 s = .
conf : ["feature pim"]
conf : [" ip pim ssm range none"]
TestPim#test_single_ssm_range_none_single_vrf = 1.81 s = .
conf : ["feature pim"]
conf : [" ip pim ssm range 229.0.0.0/8"]
TestPim#test_single_ssm_range_single_vrf = 1.72 s = .
Finished in 10.379273s, 0.4817 runs/s, 0.8671 assertions/s.
5 runs, 9 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to /home/rtpfe1/smigopal/feb_pim/cisco-network-node-utils/coverage. 590 / 1161 LOC (50.82%) covered.
rtpfe1@agent-lab11-ws:~/smigopal/feb_pim/cisco-network-node-utils$