Skip to content

Commit

Permalink
Release 1.4.1 (#494)
Browse files Browse the repository at this point in the history
* Modification of tacacs_server for tacacs_global

* Add README-pre-1.3.0.md

Save this for now since it has 8k/XR info.

* Add 8K to BGP wait_for_process_initialized()

* Add 8K to OSPF wait_for_process_initialized()

* ios xr implementation of snmpserver

snmp_server for IOS_XR, contact and location

* feature vfd

* changelog

* First commit

* remove new files

* first commit

* first commit

* test

* Review comments

* Fix few things

* testing

* fabricpath

* Collapse release_1.3.1 to develop

* more tests

* tested on platforms

* minitest complete

* remove exclude for echo_interface

* bfd_global

* Fix error in init

* review comments

* EXR support for snmp_community

* loopback added to echo intf

* implementing snmp_notification_receiver for XR

* bfd_global: Add remaining properties (#418)

* errors fixed

* interval array change

* missing ipv6 default

* remove name

* add exclude for interval

* Add comments

* Review comment fixes

* Bfd for bgp_neighbor (#419)

* errors fixed

* interval array change

* missing ipv6 default

* remove name

* add exclude for interval

* Add comments

* Review comment fixes

* bfd prop added to bgp_neighbor

* CHANGELOG

* review comment

* rview comments

* Update CHANGELOG.md

* version may be absent on 'snmp-server host' (#420)

* Ospf Area (#422)

* partial code commit, no test yet

* partial testing

* range added

*  fix range

* fix default cost

* Added comments

* other method add

* review comments

* partial review comments fixed

* partial review comments fixed

* fix auth and stub

* All review comments fixed

* bug ID added

* Switchport trunk allowed vlan now accepts 'vlan add' lines (#423)

* Fix regexp to only accept vlan ranges

* Trunk allowed vlan now handles 'vlan add' lines

* Condense vlan configuration and fix teardown error (#426)

* test_aaa*: shorten class & testcase names

* test_interface*: short class & testcase names

* modify/delete some repetitive tests

* tested on n9-i4

* Add feature ospf enable (#428)

* test_pim_group_list: class/testcase renaming

* Tested on n9-i4

* test_snmpcommunity: short class/testcase names

* snmpuser: dummy_user var does not exist

* YANG JSON support for gRPC client (#425)

* Added support for setting/getting YANG config

* revert

* skip all tests on nexus

* cleanup

* method name change

* fixed rubocop errors

* Changes based on feedback

* removed blank line

* test_snmpuser: shorten testcase names

* test_tacacs_server_host: class/testcase name changes

* minitest: shorten class / testcase names

* Added IOS XR support for snmp_user

* Refactored snmp_user

* Updated test_snmpuser.rb

* Fixed NXOS issue with snmp_user

* Updated test_snmpuser.rb for NXOS

* Update docs for XR + small fix (#431)

* Resurrected XR doc. Fixed constant reference.

* split line that was too long

* removed whitespace

* Fixed 6.0.0 version number.

* changes based on review

* Refactor test_snmpserver (#430)

* Refactor test_snmpcommunity

* Shortened class/testcase names
* Removed redundancy by combining several test sections into a single test
* Added validate_property checks

* Tested on n9-i4

* remove comment line

* implement tacacs_global to match radius_global (#429)

* Add nssa support to ospf_area (#432)

This PR is for router_ospf_area provider which includes nssa properties.
All tests pass on on platforms except on n8k.
On n8k, commands like "area nssa default-information-originate" and "area nssa default-information-originate route-map " are not getting configured properly after we reset nssa and due to this the relevant tests failed. Bug is filed on nxos platform and skipping these tests only on n8k.

* partial code commit, no test yet

* partial testing

* range added

*  fix range

* fix default cost

* Added comments

* other method add

* review comments

* partial review comments fixed

* partial review comments fixed

* fix auth and stub

* All review comments fixed

* bug ID added

* nssa translate added

* nssa properties added

* comments added

* route-map default is empty

* skip few tests for n8k due to bugs

* Review comments

* Added support for retrieving operational data via gRPC/YANG (#433)

* Added show_running_yang utility.  Allow retrieval of operational yang data.

* Added show_running_yang utility.  Allow retrieval of operational yang data.

* Updated changelog.  Fixed comment.

* Fixed rubocop error

* Removed extra space.

* ospf_area: Fix hash in nssa_set (#434)

This PR is for changing the nssa_set method in the ospf_area NU due to the review comments on the puppet side. This simplifies the previous version.

Also changed authentication 'clear_text' to 'cleartext' to keep consistency among all the other providers.
Chris has the context about this PR and so it is better if he reviews this.

* Add feature ospf enable

* review comments

* Add ospf_area_vlink (#436)

* partial code commit, no test yet

* partial testing

* range added

*  fix range

* fix default cost

* Added comments

* other method add

* review comments

* partial review comments fixed

* partial review comments fixed

* fix auth and stub

* All review comments fixed

* bug ID added

* nssa translate added

* nssa properties added

* comments added

* route-map default is empty

* skip few tests for n8k due to bugs

* Review comments

* first commit

* test code for vls

* test code for vls

* add more tests

* auth added

* cleartext added

* authentication_key_pw added

* message_digest_key added

* default for key_id

* comments add

* CHANGELOG fixed

* comment added

* review coments

* fixes to tacacs_global (#437)

* Rubocop fixes for PR 435 (#438)

* Fixed various XR minitest errors/failures.

* Rubocop fix for PR435

* pvlan_mapping fix for n8k (#439)

* partial code commit, no test yet

* partial testing

* range added

*  fix range

* fix default cost

* Added comments

* other method add

* review comments

* partial review comments fixed

* partial review comments fixed

* fix auth and stub

* All review comments fixed

* bug ID added

* nssa translate added

* nssa properties added

* comments added

* route-map default is empty

* skip few tests for n8k due to bugs

* Review comments

* first commit

* test code for vls

* test code for vls

* add more tests

* auth added

* cleartext added

* authentication_key_pw added

* message_digest_key added

* default for key_id

* comments add

* CHANGELOG fixed

* comment added

* review coments

* fix for pvlan_mapping for n8k

* interface_ospf NU fixes (#440)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* test_evpn_vni:route_target_both: I2 vs I3,I4,I4+ (#442)

Badcodefix: #287

* The previous fix should have limited route_target_both testing to just I2 images; instead it did the reverse.

* Tested on n9-i2,n9-i3,n9-i4,n9-i4+

* New default for vxlan_vtep: holddown (#448)

* Tested on n9k-e_dev
  * Minitest passes
  * Beaker passes

* Merge release_1.3.1 --> develop (#454)

* Add 8K to BGP wait_for_process_initialized()

* Add 8K to OSPF wait_for_process_initialized()

* Fix for n8k vrf context

* fix comment

* Remove skip for CSCuz44696

* fix vni for all supported platforms

* Fix minitest for aaa feature

* yaml fix

* Update version.rb

* Utils.normalize_range_array

* The motivation for this change was finding yet another array normalizer in the private vlan code so these changes are initially meant to address fixes there. IMO our range summarize methods were getting a bit long and difficult to maintain; these new methods will hopefully simplify things somewhat.

* The main problem these methods are trying to solve is reconciling manifest inputs with getter results when there are overlapping ranges; e.g.:
  * '2-5, 9, 4-6'     needs to be ['2-6', '9']
  * ['2', '3', '4-6'] needs to be ['2-6']
  * ['2', '3', '4']   needs to be ['2-4']

* It's fairly easy to merge the ranges if they are actual ruby ranges instead of the dash-syntax ranges, so the new methods just convert to ruby ranges, merge, and convert back.

* There's also a method that breaks the ranges down into individual elements so that delta_add_remove can add or remove specific elements on the switch.

* I have a related commit for Puppet on the way.

* Tested on n9k

* Property mapped_vni fix for n5|6k

* private_vlan_association minitest fix

* Updated result values to reflect that API now uses Utils.normalize_range_array, which summarizes the ranges.

* The rest is just cleanup, ie removed the else clause since the if block does a return.

* Tested on n3,n5,n6,n7,n8,n9-I3

* comment updates only

* Refactor yaml to use default_only

* Error condition for l2vpn added

* Minor test code cleanups

* Add basic filter to Interface.filter

* Get rid of interfaces_id method

* shorten test method names in test_interface_private_vlan

* tested on n9

* Simplified yaml entry

* process_initialized is included for n8k

* Fix negotiate auto invalid skips (#404)

* Condense negoitate test code and fix invalid skips

* Remove debug code

* Update aaa_authentication_login_service.rb

* interface: private_vlan refactor

* There were a few errors with the original implementation. As I worked through this I found that it made sense to rewrite many of the methods to use the new range conversion utilities, and with so many functional changes we decided to take the opportunity to shorten the property names. Since the original code was already released with 1.3.0 we decided to just deprecate them.

* Created `DEPRECATED.yaml` and `interface_DEPRECATED.rb` for the original code. The setters will raise a warning if used, which includes the name of the new property to use. I ran the original test_interface_private_vlan tests against the deprecated code and they still pass, but then updated the test file to use the new methods. This means that going forward the deprecated methods will not have any tests run, and any issues found will not be fixed.

* Related puppet fixes are in the works.

* Tested on n3-I4,n5,n6,n7,n8,n9-I2,n9-I3

* switchport_pvlan_mapping_trunk needs to be a multiple

* My first pass at this code missed that this property supported multiple occurrences
  * Added a delta_hash method for trunk
  * Changed `pvlan_range_delta` to a single-caller method for `switchport_pvlan_mapping` since it's no longer shared with the trunk method
  * Fixed the minitest

* Passes on n3-I4,n5,n6,n7,n8,n9-I2,n9-I3

* Move svi pvlan test into test_interface_svi.rb

* Tests pass on all NX platforms

* Move deprecated keys into own hash

* This is just a minor cleanup to make this simpler to remove later on

* Update comments in DEPRECATED.yaml

* change private_vlan to pvlan

* changelog

* fix for context

* Change deprecation warning msg

* Change deprecation warning msg

* pvlan_mapping should always return array

* This property allows input as string or array. The getter was returning default as [] and non-default as String - which forces special handling in puppet's insync? method - so I changed it to always return an array. This way we don't need to override insync? at all.

* Also moved the pvlan_mapping test out of the svi file. While it does only apply to svi interfaces it seems to fit better with the other interface-related private-vlan tests.

* Tested on n5,n7,n9-I3

* Add requires for DEPRECATED providers

* Symptom: Noticed a corner case where changing a deprecated file on the device but not changing the inheriting file (I updated interface_DEPRECATED.rb but not interface.rb) caused the following error:

```
Linux# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Facter: error while resolving custom fact "cisco_node_utils": uninitialized constant Cisco::NodeUtil
/opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems/cisco_node_utils-1.3.1/lib/cisco_node_utils/interface_DEPRECATED.rb:29: warning: already initialized constant Cisco::PVLAN_PROPERTY
/opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems/cisco_node_utils-1.3.1/lib/cisco_node_utils/interface_DEPRECATED.rb:29: warning: previous definition of PVLAN_PROPERTY was here
```

* Analysis: Looks like facter caches the provider files. I found that making a whitespace change in interface.rb was enough to trigger the cache clear for that file and it avoided the error. But the real problem is that the deprecated providers do not have a require for 'node_utils', so just needed to add those to avoid this problem.

* Also moved PVLAN_PROPERTY hash within the class to avoid the re-definition warning. This is probably not necessary but it's cleaner.

* Also found that `set_value` didn't get included for `switchport_mode_private_vlan_trunk_promiscuous` when I copied the file contents over to DEPRECATED.yaml, so it's there now.

* Tested on n9k-i3

* Update interface_DEPRECATED.rb

* Update vlan_DEPRECATED.rb

* virtual_service and system_image yaml fix

* Fix yaml validation error

* Addressed PR comments

* Remove hardcoded tacacs server reference

* Interface shutdown property fix

* Update test_interface.rb

* switchport disable is broken

* Broken by #406

* Tested on n9-i3

* test_interface_private_vlan.rb: /private_vlan/pvlan/

* The vlan object still referenced the old names

* Tested on n9-I3

* test_interface* minor cleanups

* method name changes only for the most part

* tested on n3-I4

* yum package manager fixes

* Removed debug

* Remove trailing whitespace

* Do not track tacacs server info

* Add full relative path to tacacs server info

* Test if tacacs server is valid

* Add relative path of yaml file

* Refined the error message for invalid server

* Pim.pims fix for feature disabled

* The global nature of the pim resource means that an object will be created for each vrf regardless of state; however, this meant that objects were getting created even when feature pim was disabled, causing puppet agent/resource to to raise an error whenever the getter was called.

* Tested on n7

* Add N8k references

* Handle no virtual-services installed case

* vxlan and pvlan fix

* Remove delta check for cpu utilization (#421)

* Add 8k support to CHANGELOG

* Switchport trunk allowed vlan now accepts 'vlan add' lines (#423) (#441)

* Fix regexp to only accept vlan ranges

* Trunk allowed vlan now handles 'vlan add' lines

* test_evpn_vni:route_target_both: I2 vs I3,I4,I4+ (#442)

Badcodefix: #287

* The previous fix should have limited route_target_both testing to just I2 images; instead it did the reverse.

* Tested on n9-i2,n9-i3,n9-i4,n9-i4+

* Fix error due to time zone difference (#443)

* Fix suppress-fib-pending lib and test code (#445)

* Remove testing of vrf context and fix default test

* Fix broken yaml

* Merge default test code into main testcase

* Snmp packet_size fixes (#446)

* Snmp packet_size fixes

* Add n8k

* Fix last_reset check for platform (#444)

* Fix cannot disable local issue (#447)

* New default for vxlan_vtep: holddown (#448)

* Tested on n9k-e_dev
  * Minitest passes
  * Beaker passes

* Fix auth method local cleanup (#449)

* Refactor aaa local auth removal (#450)

* Refactor aaa local auth removal

* Remove whitespace

* Remove unneeded test steps (#452)

* New overlay_global behaviors (#451)

* DME changes for l2rib properties resulted in removal of the 'default' keyword from the cli:

    `l2rib dup-host-mac-detection default`

* Prior to this change, 'default' was the only way to reset the host_moves & timeout properties back to default; there was/is no 'no' command, so the only way to reset it now is to re-enter the command with the default values.

* This change necessitates changes to the setter, minitest, and beaker. I also changed the default values to actual integer values instead of empty strings.

* Tested minitest & beaker for: n9-edev,n9-I4,n5,n6. Skips for n3 (normal) and n7 (requires F3 card).

* Prevent removal of method local on unsupported platforms (#453)

* Missed merge conflict

* Add noop test for CI dev use

* Munge 'no event-history events' to size_disable (#456)

Due to recent platform changes, the CLI for `event_history events
size disable` now results in the config `no event-history events`

This change munges the `no event-history events` to `size_disable`
in order to handle behavior changes between different nxos releases.
This code change should be backwards compatible.

* Remove broken xr snmpuser support (#459)

* Remove broken xr snmpuser support

* test_snmpuser: shorten testcase names

* Ospf bfd for interfaces (#457)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* add bfd to router ospf

* add p2p type to int ospf

* ad bfd to interface_ospf

* test file fix

* test file fix

* clean code

* bfd per_link added to int po

* bfd echo added to interface

* bfd echo added to interface

*  fix p2p

* test code enhanced

* changelog

* review comments

* Update CHANGELOG.md

* convert symbol to string

* bfd_echo similar to vtp

* review comment

* review comment

* Scrub XR references from doc. (#458)

* Scrub XR references from doc.

* Scrub XR references from doc.

* Ospf parameters for interfaces (#460)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* added pri, tx delay, shut and mtu to int ospf

* changelog

* test_vpc needs rescue for incompat intf

* test_vpc needs rescue for incompat intf (#461)

* Minitest bug fixes (#462)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* added pri, tx delay, shut and mtu to int ospf

* changelog

* bug fixes

* remove test_last_reset

* Fix remove aaa local on n3k (#464)

*  Minitest: Handle N7k F3-features w/o compat LCs (#463)

* test_vpc needs rescue for incompat intf

* Handle N7k F3-features w/o compat LCs

* The vrf_af route_target tests were failing because feature nv overlay failed - because our n7k does not have an F3 linecard:

```
 1) There are some features that refuse to load unless the VDC is
    limited to F3 only, but they will actually load if the config is
    present, despite the fact that there are no physical F3s.
 2) We have some tests that need these features but don't need interfaces.
```

* Solution: Enable the vdc config for F3 but don't fail if the physical LC is not present
  * Prior to this solution I had created a couple of methods to find an appropriate interface based on the feature-to-LC requirements. This works but is only useful for features that also require an interface (unlike the vrf_af test). Eventually I would like to remove the other one-off methods (e.g. `fabricpath_testenv_setup`, `vxlan_linecard?`, etc) that do similar functions and convert the callers to use this common one instead. Since there are no current callers for it I just commented it out.

* Tested on n7k (no F3 card) and N9K.

* /if-else/case/

* MT: Fix snmpuser teardown loop (#465)

* test_vpc needs rescue for incompat intf

* MT: Fix snmpuser teardown loop

* MT: portchannel: n3k_in_n3k bad pattern

* Fix half/full in test_duplex

* For some 3k, need to munge 'half/full' into csv-style 'half,full' to play nice with interface_capabilities

* Tested on n3048

* Fix half/full in test_duplex (#466)

* For some 3k, need to munge 'half/full' into csv-style 'half,full' to play nice with interface_capabilities

* Tested on n3048

* minitest fixes for vtp and resilient mode (#467)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* bug fix for vtp

* bug fix for resilient mode

* version number fix

* review comment

* fix for symmetry not supported on n3k (#468)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* bug fix for vtp

* bug fix for resilient mode

* version number fix

* review comment

* Fix for symmetry not supported

* review comments

* review comment

* test_interface_sw: check for fex compatibility (#469)

* f3 fix for test_feature

* Refactor yum patch test (#470)

* Refactor yum patch test

* Update failure message

* Update failure message

* Addressed review comment

* Rubocop fixes

* f3 after_tests for test_overlay_global

* Revert "f3 after_tests for test_overlay_global"

This reverts commit 612514e.

Bad codefix

* ciscotest: first_or_last_teardown (#471)

* f3 setup/teardown on N7k's can be very time consuming (60+ seconds) so it's expensive to do this for every testcase

* This hack limits the vdc teardowns to the first and last testcase (f3 setup is ignored if it's already set to f3)
  * We have to check for first because a test may use -n to limit the run to a single test

* Minitest.after_run is not really an option for this: it's designed to run at the end of an entire test suite and actually runs at_exit, at which point we no longer have access to our ciscotest methods.

* better teardown for test_feature

* f3 setup/teardown for test_vxlan_vtep_vni

* f3 setup/teardown test_bridge_domain_vni

* f3 setup/teardown for test_vxlan_vtep (#472)

* Also added a rescue/retry for vdc limit-resource

* setup/teardown cleanups for test_vlan

* narrowed the interfaces method in ciscotest to exclude dot1q sub-ints

* moved the mt-full test from test_vlan_mt_full.rb into vlan.rb and removed entire test file

* Tested on n5, n7, n9

* f3 setup/teardown test_encapsulation

* n7k f3 fix for test_router_bgp/route_distinguisher

* setup/teardown fix test_vlan_private

* test_yum: skip for no pkginfo filename

* assert for test_yang

* noop.rb: change skip to assert

* Rel140/refactor yum (#473)

* Refactor yum to cleanup patches properly

* Enable additional releases

* Add retry loop for Yum.remove

* Modify regexp

* Reduce tries from 50 to 20

* Refactor retry loop

* Unpdate n9k to allow local auth removal

* snmpuser minitest fix (#475)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* bug fix for vtp

* bug fix for resilient mode

* version number fix

* review comment

* Fix for symmetry not supported

* review comments

* review comment

* changelog

* revert Changelog

* fix for snmpuser 8 char limit

* test_fabricpath_global cleanup fixes

* Tested on n5,n7,n9-i2,n9-i5,n3

* test_vxlan* cleanup fixes

* tested on n3,n5,n7,n9-I2,n9-I5

* test_interface_switchport test cleanup

* test_interface_switchport test cleanups

* test_aaa_authentication_login cleanups

* Failing when stale configs present on testbed; this change should remove any leftovers

* Tested on n3-I2,n5,n7,n9-I5

* Add storm_control and dhcp relay props for interface (#474)

* Add feature ospf enable

* review comments

* Fix interface_ospf

* bug fix for vtp

* bug fix for resilient mode

* version number fix

* review comment

* Fix for symmetry not supported

* review comments

* review comment

* storm-control and dhcp relay for intf

* exclude 2 storm control props on n7k due to hw limitation

* comments added

* changelog

* typo correct

* cleanup unsupported tests

* review comments

* remove features added during the minitest

* Add tacacs-server key cleanup

* removing vlan name negative tests and fix dhcp relay munge (#476)

* removing vlan name negative tests

* munging issue fixed

* Add defect/image check to minitest (#477)

* Add defect/image check to minitest

* Bails out of testcase if image matches pattern; no skip, no assert
* Prints 'NOOP' message and any add'l helpful text, e.g.:

```
Node under test:
  - name  - n5k-136
  - type  - N5K-C56128P
  - image - bootflash:///n6000-uk9.7.3.0.N1.1.bin

TestVrf#test_name_zero_length = 4.88 s = .
TestVrf#test_route_distinguisher = 11.79 s = .
TestVrf#test_remote_route_filtering = 2.01 s = .
TestVrf#test_name_too_long = 1.93 s = .
TestVrf#test_vpn_id = 2.07 s = .
TestVrf#test_vni = 2.85 s = S
TestVrf#test_mhost = 1.96 s = .

TestVrf#test_description -> NOOP <- [CSCuy36637: Cannot remove description]
TestVrf#test_description = 2.91 s = .
TestVrf#test_collection_default = 1.01 s = .
TestVrf#test_create_and_destroy = 2.89 s = .
TestVrf#test_name_type_invalid = 1.05 s = .
TestVrf#test_shutdown = 26.73 s = .

Finished in 62.072465s, 0.1933 runs/s, 0.4189 assertions/s.
12 runs, 26 assertions, 0 failures, 0 errors, 1 skips
```

* /puts/Cisco::Logger/

* Remove timestamp noise from logger

* Enable nv_overlay_evpn fix (#478)

* skip_legacy_defect method

* Rework previous `defect?` method to do skip instead of return

* Tested on n3-I2, n5

* skip_legacy_defect for vtp

* Dhcp Relay Global (#481)

* removing vlan name negative tests

* munging issue fixed

* add dhcp relay global props

* added a new prop and cleaned up names of props

* add destroy method

* doc

* review comments

* test code cleanup

* skip_legacy_defect for snmpserver

* Dhcp Relay Global (#482)

* removing vlan name negative tests

* munging issue fixed

* add dhcp relay global props

* added a new prop and cleaned up names of props

* add destroy method

* doc

* review comments

* test code cleanup

* stop enabling dhcp feature

* Refactor test_snmpuser teardown

* portchannel_global n3k minitest fix (#483)

* removing vlan name negative tests

* munging issue fixed

* add dhcp relay global props

* added a new prop and cleaned up names of props

* add destroy method

* doc

* review comments

* test code cleanup

* stop enabling dhcp feature

* Fix minitest error

* Use valid type6 tacacs password

* Add skip_legacy_defect? for aaa, snmp and vlxan

* bgp event_history (#484)

* removing vlan name negative tests

* munging issue fixed

* add dhcp relay global props

* added a new prop and cleaned up names of props

* add destroy method

* doc

* review comments

* test code cleanup

* stop enabling dhcp feature

* Fix minitest error

* bgp event-history fixes

* review comments

* more review comments

* Remove require pry in test_snmpuser.rb

* Separate ace ipv4 and ipv6 ttl tests

* Update sample patch names for I5 images.

* bgp event_history (#486)

* bgp event-history

* fix event-history props

* doc

* Update expected error class in yum test

* bgp send-community fix (#487)

* fix for send_community

* fix bfd echo intermittent failure

* review comments

* review comment

* fail api raises RuntimeError, update test

* fix for send-community (#488)

* Fix test_lacp_suspend_individual to address behavior change (#489)

* Fix test_lacp_suspend_individual to address behavior change

* Remove pry debug

* Rel141/lacp suspend (#490)

* Fix test_lacp_suspend_individual to address behavior change

* Remove pry debug

* Refactor lacp_suspend_individual setter

* Addressed PR comments

* Update comment to be more accurate

* Update version information in CHANGELOG

* Remove n8k reference

* Remove old README file.

* Fix/command config issue (#491)

* Fix 'no' commands won't apply if defaults don't nvgen

* Add 'nvgen' key to scale test hash

* Add ability to define setup config in test yaml file

* Add setup yaml test key support

* Update all tests to use scalar designation

* Update CHANGELOG.md

* Update version from 1.4.0 -> 1.4.1

* Update CHANGELOG.md
  • Loading branch information
mikewiebe committed Nov 2, 2016
1 parent 81a01ee commit f8d1620
Show file tree
Hide file tree
Showing 19 changed files with 425 additions and 96 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

## [v1.4.1]

### Added

* Extend bgp with attributes:
* `event_history_errors`
* `event_history_objstore`
* Added support for Cisco NX-OS software release `7.3(0)I5(1)`

## [v1.4.0]

### New feature support
Expand Down Expand Up @@ -359,6 +368,7 @@ Changelog
[git-flow]: https://github.com/petervanderdoes/gitflow-avh
[SimpleCov]: https://github.com/colszowka/simplecov

[v1.4.1]: https://github.com/cisco/cisco-network-node-utils/compare/v1.4.0...v1.4.1
[v1.4.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.3.0...v1.4.0
[v1.3.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.2.0...v1.3.0
[v1.2.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.1.0...v1.2.0
Expand Down
102 changes: 90 additions & 12 deletions lib/cisco_node_utils/bgp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,16 @@ def event_history_cli
match = config_get('bgp', 'event_history_cli', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
if match[1]
return match[1] if match[1][/\A\d+\z/]
return 'size_' + match[1]
end
end
default_event_history_cli
end

def event_history_cli=(val)
size = val[/small|medium|large|disable/]
size = val[/small|medium|large|disable|\A\d+\z/]
@set_args[:size] = size.nil? ? '' : "size #{size}"
@set_args[:state] = val[/false/] ? 'no' : ''
config_set('bgp', 'event_history_cli', @set_args)
Expand All @@ -437,16 +440,19 @@ def default_event_history_cli
# Nvgen as True With optional 'size <size>
def event_history_detail
match = config_get('bgp', 'event_history_detail', @get_args)
# This property requires auto_default=false
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
if match[1]
return match[1] if match[1][/\A\d+\z/]
return 'size_' + match[1]
end
return 'true'
end
default_event_history_detail
end

def event_history_detail=(val)
size = val[/small|medium|large|disable/]
size = val[/small|medium|large|disable|\A\d+\z/]
@set_args[:size] = size.nil? ? '' : "size #{size}"
@set_args[:state] = val[/false/] ? 'no' : ''
config_set('bgp', 'event_history_detail', @set_args)
Expand All @@ -457,27 +463,88 @@ def default_event_history_detail
config_get_default('bgp', 'event_history_detail')
end

# event-history errors [ size <size> ]
# Nvgen as True With optional 'size <size>
def event_history_errors
match = config_get('bgp', 'event_history_errors', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
if match[1]
return match[1] if match[1][/\A\d+\z/]
return 'size_' + match[1]
end
end
default_event_history_errors
end

def event_history_errors=(val)
size = val[/small|medium|large|disable|\A\d+\z/]
@set_args[:size] = size.nil? ? '' : "size #{size}"
@set_args[:state] = val[/false/] ? 'no' : ''
config_set('bgp', 'event_history_errors', @set_args)
set_args_keys_default
end

def default_event_history_errors
config_get_default('bgp', 'event_history_errors')
end

# event-history events [ size <size> ]
# Nvgen as True With optional 'size <size>
def event_history_events
match = config_get('bgp', 'event_history_events', @get_args)
if match.is_a?(Array)
return 'size_disable' if match[0] == 'no '
return 'size_' + match[1] if match[1]
return 'false' if match[0] == 'no '
if match[1]
return match[1] if match[1][/\A\d+\z/]
return 'size_' + match[1]
end
end
default_event_history_events
end

def event_history_events=(val)
size = val[/small|medium|large|disable/]
size = val[/small|medium|large|disable|\A\d+\z/]
@set_args[:size] = size.nil? ? '' : "size #{size}"
@set_args[:state] = val[/false/] ? 'no' : ''
config_set('bgp', 'event_history_events', @set_args)
set_args_keys_default
end

def default_event_history_events
config_get_default('bgp', 'event_history_events')
if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
Utils.chassis_pid?(/N(5|6|7|8)/)
config_get_default('bgp', 'event_history_events')
else
config_get('bgp', 'event_history_events_bytes', @get_args)
end
end

# event-history objstore [ size <size> ]
# Nvgen as True With optional 'size <size>
def event_history_objstore
match = config_get('bgp', 'event_history_objstore', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
if match[1]
return match[1] if match[1][/\A\d+\z/]
return 'size_' + match[1]
end
return 'true'
end
default_event_history_objstore
end

def event_history_objstore=(val)
size = val[/small|medium|large|disable|\A\d+\z/]
@set_args[:size] = size.nil? ? '' : "size #{size}"
@set_args[:state] = val[/false/] ? 'no' : ''
config_set('bgp', 'event_history_objstore', @set_args)
set_args_keys_default
end

def default_event_history_objstore
config_get_default('bgp', 'event_history_objstore')
end

# event-history periodic [ size <size> ]
Expand All @@ -486,21 +553,32 @@ def event_history_periodic
match = config_get('bgp', 'event_history_periodic', @get_args)
if match.is_a?(Array)
return 'false' if match[0] == 'no '
return 'size_' + match[1] if match[1]
if match[1]
return match[1] if match[1][/\A\d+\z/]
return 'size_' + match[1]
end
else
return default_event_history_periodic
end
return 'true' unless default_event_history_periodic[/size/]
default_event_history_periodic
end

def event_history_periodic=(val)
size = val[/small|medium|large|disable/]
size = val[/small|medium|large|disable|\A\d+\z/] unless val[/false|true/]
@set_args[:size] = size.nil? ? '' : "size #{size}"
@set_args[:state] = val[/false/] ? 'no' : ''
config_set('bgp', 'event_history_periodic', @set_args)
set_args_keys_default
end

def default_event_history_periodic
config_get_default('bgp', 'event_history_periodic')
if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
Utils.chassis_pid?(/N(5|6|7|8)/)
config_get_default('bgp', 'event_history_periodic')
else
config_get('bgp', 'event_history_periodic_bytes', @get_args)
end
end

# Fast External fallover (Getter/Setter/Default)
Expand Down
6 changes: 4 additions & 2 deletions lib/cisco_node_utils/bgp_neighbor_af.rb
Original file line number Diff line number Diff line change
Expand Up @@ -565,15 +565,17 @@ def default_route_reflector_client
# sense to split up the individual methods to support them
def send_community
val = config_get('bgp_neighbor_af', 'send_community', @get_args)
return default_send_community if val.nil?
return default_send_community if val.nil? || val.empty?
platform == :nexus ? send_community_nexus(val) : send_community_xr(val)
end

# Nexus: <state> send-community [ both | extended | standard ]
# NOTE: 'standard' is default but does not nvgen on some platforms
# Returns: none, both, extended, or standard
def send_community_nexus(val)
val = val.split.last
reg = 'send-community extended|send-community standard|send-community'
return 'both' if val.grep(/#{reg}/).size == 2
val = val[0].split.last
return 'standard' if val[/send-community/] # Workaround
val
end
Expand Down
10 changes: 10 additions & 0 deletions lib/cisco_node_utils/cisco_cmn_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ def self.nexus_i2_image
true if Platform.image_version[/7.0.3.I2/]
end

def self.image_version?(ver_regexp)
require_relative 'platform'
return true if Platform.image_version[ver_regexp]
end

def self.chassis_pid?(ver_regexp)
require_relative 'platform'
return true if Platform.chassis['pid'][ver_regexp]
end

# Helper utility method for ip/prefix format networks.
# For ip/prefix format '1.1.1.1/24' or '2000:123:38::34/64',
# we need to mask the address using the prefix length so that they
Expand Down
21 changes: 19 additions & 2 deletions lib/cisco_node_utils/cmd_ref/bgp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,38 @@ event_history_detail:
_exclude: [ios_xr]
get_value: '/^(no )?event-history detail(?: size (\S+))?$/'
set_value: '<state> event-history detail <size>'
auto_default: false
default_value: 'size_disable'
default_value: 'false'

event_history_errors:
_exclude: [ios_xr]
get_value: '/^(no )?event-history errors(?: size (\S+))?$/'
set_value: '<state> event-history errors <size>'
default_value: 'size_medium'

event_history_events:
_exclude: [ios_xr]
get_value: '/^(no )?event-history events(?: size (\S+))?$/'
set_value: '<state> event-history events <size>'
default_value: 'size_small'

event_history_events_bytes:
default_only: 'size_large'

event_history_objstore:
_exclude: [ios_xr]
get_value: '/^(no )?event-history objstore(?: size (\S+))?$/'
set_value: '<state> event-history objstore <size>'
default_value: 'false'

event_history_periodic:
_exclude: [ios_xr]
get_value: '/^(no )?event-history periodic(?: size (\S+))?$/'
set_value: '<state> event-history periodic <size>'
default_value: 'size_small'

event_history_periodic_bytes:
default_only: 'false'

fast_external_fallover:
kind: boolean
default_value: true
Expand Down
2 changes: 1 addition & 1 deletion lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ route_reflector_client:
default_value: false

send_community:
multiple:
auto_default: false
default_value: 'none'
nexus:
get_value: '/^send-community(?: .*)?/'
set_value: '<state> send-community <attr>'
ios_xr:
multiple:
# XR three seperate commands: send-community-ebgp send-community-gshut-ebgp
# and send-extended-community-ebgp
# send-community-ebgp' and 'send-extended-community-ebgp' are the equivalents
Expand Down
16 changes: 14 additions & 2 deletions lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,22 @@ lacp_min_links:

lacp_suspend_individual:
kind: boolean
auto_default: false
get_value: '/^lacp suspend.individual$/'
set_value: "%s lacp suspend-individual"
default_value: true
N3k:
default_value: false
else:
auto_default: false
default_value: true

lacp_suspend_shut_needed:
# This is used to determine if the port-channel interface
# must be shutdown before setting lacp_suspend_individual
kind: boolean
N9k:
default_only: true
else:
default_only: false

port_hash_distribution:
_exclude: [N6k, N5k]
Expand Down
6 changes: 0 additions & 6 deletions lib/cisco_node_utils/configparser_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ def compare_with(config)
existing << submode.compare_with(config_submode)
next
end # if

prefix, base = base_commands(command)
if prefix != '' && !config.include_command?(base)
existing << config_line
next
end
end
existing
end # compare_with
Expand Down
15 changes: 15 additions & 0 deletions lib/cisco_node_utils/interface_portchannel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,29 @@ def default_lacp_min_links
config_get_default('interface_portchannel', 'lacp_min_links')
end

def lacp_suspend_shut_needed?
config_get('interface_portchannel', 'lacp_suspend_shut_needed')
end

def lacp_suspend_individual
config_get('interface_portchannel', 'lacp_suspend_individual', @name)
end

def lacp_suspend_individual=(state)
no_cmd = (state ? '' : 'no')
# This property can only be set if the port-channel is shutdown on
# some platforms.
# This setter will:
# 1) Query the current state of the port-channel interface.
# 2) Shutdown the port-channel interface if needed.
# 3) Set the lacp_suspend_individual property.
# 4) Restore the original state of the port-channel interface if needed.
int = Interface.new(@name, false)
current_state = int.shutdown
int.shutdown = true if lacp_suspend_shut_needed? && !current_state
config_set('interface_portchannel',
'lacp_suspend_individual', @name, no_cmd)
int.shutdown = current_state unless current_state == int.shutdown
end

def default_lacp_suspend_individual
Expand Down
2 changes: 1 addition & 1 deletion lib/cisco_node_utils/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Container module for version number only.
module CiscoNodeUtils
VERSION = '1.4.0'
VERSION = '1.4.1'
gem_version = Gem::Version.new(Gem::VERSION)
min_gem_version = Gem::Version.new('2.1.0')
fail 'Required rubygems version >= 2.1.0' if gem_version < min_gem_version
Expand Down
10 changes: 8 additions & 2 deletions tests/cmd_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ nexus:
no feature lacp
no feature dhcp
no feature vtp
nvgen: false

feature-snmp-comm-acl-ro:
command: |
Expand All @@ -40,14 +41,19 @@ nexus:
snmp-server community admincom use-acl SNMP_RW
feature-int-loopback:
command: >
command: |
interface loopback0
description testloopback
feature-int-portchannel:
command: >
setup: |
interface port-channel100
no switchport
command: |
feature bfd
interface port-channel100
description test-portchannel
no bfd echo
ios_xr:
name-server:
Expand Down
Loading

0 comments on commit f8d1620

Please sign in to comment.