diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1dcb5aa02..f48459a77 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,24 @@ Cisco Ios Collection Release Notes .. contents:: Topics +v6.0.0 +====== + +Release Summary +--------------- + +Starting from this release, the minimum `ansible-core` version this collection requires is `2.14.0`. The last known version compatible with ansible-core<2.14 is `v5.3.0`. + +Major Changes +------------- + +- Bumping `requires_ansible` to `>=2.14.0`, since previous ansible-core versions are EoL now. + +Removed Features (previously deprecated) +---------------------------------------- + +- Removed previously deprecated ios_bgp module in favor of ios_bgp_global and ios_bgp_address_family. + v5.3.0 ====== diff --git a/README.md b/README.md index da89549a1..fabf1f8a2 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This collection has been tested against Cisco IOS XE Version 17.3 on CML. ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.9.10**. +This collection has been tested against following Ansible versions: **>=2.14.0**. For collections that support Ansible 2.9, please ensure you update your `network_os` to use the fully qualified collection name (for example, `cisco.ios.ios`). @@ -38,7 +38,6 @@ Name | Description [cisco.ios.ios_acl_interfaces](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_acl_interfaces_module.rst)|Resource module to configure ACL interfaces. [cisco.ios.ios_acls](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_acls_module.rst)|Resource module to configure ACLs. [cisco.ios.ios_banner](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_banner_module.rst)|Module to configure multiline banners. -[cisco.ios.ios_bgp](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_bgp_module.rst)|Module to configure BGP protocol settings. [cisco.ios.ios_bgp_address_family](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_bgp_address_family_module.rst)|Resource module to configure BGP Address family. [cisco.ios.ios_bgp_global](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_bgp_global_module.rst)|Resource module to configure BGP. [cisco.ios.ios_command](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_command_module.rst)|Module to run commands on remote devices. diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 510f6b809..40a0eb01c 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1065,3 +1065,19 @@ releases: name: ios_vxlan_vtep namespace: "" release_date: "2023-11-29" + 6.0.0: + changes: + major_changes: + - Bumping `requires_ansible` to `>=2.14.0`, since previous ansible-core versions + are EoL now. + release_summary: + Starting from this release, the minimum `ansible-core` version + this collection requires is `2.14.0`. The last known version compatible with + ansible-core<2.14 is `v5.3.0`. + removed_features: + - Removed previously deprecated ios_bgp module in favor of ios_bgp_global and + ios_bgp_address_family. + fragments: + - bgp_dep_rem.yml + - major_600.yml + release_date: "2023-11-30" diff --git a/docs/cisco.ios.ios_bgp_module.rst b/docs/cisco.ios.ios_bgp_module.rst deleted file mode 100644 index c8aa774b0..000000000 --- a/docs/cisco.ios.ios_bgp_module.rst +++ /dev/null @@ -1,1142 +0,0 @@ -.. _cisco.ios.ios_bgp_module: - - -***************** -cisco.ios.ios_bgp -***************** - -**Module to configure BGP protocol settings.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - -DEPRECATED ----------- -:Removed in collection release after 2023-08-24 -:Why: Newer and updated modules released with more functionality -:Alternative: ios_bgp_global - - - -Synopsis --------- -- This module provides configuration management of global BGP parameters on devices running Cisco IOS - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- config - -
- dictionary -
-
- -
Specifies the BGP related configuration.
-
-
- address_family - -
- list - / elements=dictionary -
-
- -
Specifies BGP address family related configurations.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Type of address family to configure.
-
-
- auto_summary - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Enable/disable automatic network number summarization.
-
-
- neighbors - -
- list - / elements=dictionary -
-
- -
Specifies BGP neighbor related configurations in Address Family configuration mode.
-
-
- activate - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Enable the Address Family for this Neighbor.
-
-
- advertisement_interval - -
- integer -
-
- -
Minimum interval between sending BGP routing updates for this neighbor.
-
-
- maximum_prefix - -
- integer -
-
- -
Maximum number of prefixes to accept from this peer.
-
The range is from 1 to 2147483647.
-
-
- neighbor - -
- string - / required -
-
- -
Neighbor router address.
-
-
- next_hop_self - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Enable/disable the next hop calculation for this neighbor.
-
-
- next_hop_unchanged - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Propagate next hop unchanged for iBGP paths to this neighbor.
-
-
- prefix_list_in - -
- string -
-
- -
Name of ip prefix-list to apply to incoming prefixes.
-
-
- prefix_list_out - -
- string -
-
- -
Name of ip prefix-list to apply to outgoing prefixes.
-
-
- remove_private_as - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Remove the private AS number from outbound updates.
-
-
- route_reflector_client - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Specify a neighbor as a route reflector client.
-
-
- route_server_client - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Specify a neighbor as a route server client.
-
-
- networks - -
- list - / elements=dictionary -
-
- -
Specify Networks to announce via BGP.
-
For operation replace, this option is mutually exclusive with root level networks option.
-
-
- masklen - -
- integer -
-
- -
Subnet mask length for the Network to announce(e.g, 8, 16, 24, etc.).
-
-
- prefix - -
- string - / required -
-
- -
Network ID to announce via BGP.
-
-
- route_map - -
- string -
-
- -
Route map to modify the attributes.
-
-
- redistribute - -
- list - / elements=dictionary -
-
- -
Specifies the redistribute information from another routing protocol.
-
-
- id - -
- string -
-
- -
Identifier for the routing protocol for configuring redistribute information.
-
Valid for protocols 'ospf', 'ospfv3' and 'eigrp'.
-
-
- metric - -
- integer -
-
- -
Specifies the metric for redistributed routes.
-
-
- protocol - -
- string - / required -
-
-
    Choices: -
  • ospf
  • -
  • ospfv3
  • -
  • eigrp
  • -
  • isis
  • -
  • static
  • -
  • connected
  • -
  • odr
  • -
  • lisp
  • -
  • mobile
  • -
  • rip
  • -
-
-
Specifies the protocol for configuring redistribute information.
-
-
- route_map - -
- string -
-
- -
Specifies the route map reference.
-
-
- safi - -
- string -
-
-
    Choices: -
  • flowspec
  • -
  • unicast ←
  • -
  • multicast
  • -
  • labeled-unicast
  • -
-
-
Specifies the type of cast for the address family.
-
-
- synchronization - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Enable/disable IGP synchronization.
-
-
- bgp_as - -
- integer - / required -
-
- -
Specifies the BGP Autonomous System (AS) number to configure on the device.
-
-
- log_neighbor_changes - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Enable/disable logging neighbor up/down and reset reason.
-
-
- neighbors - -
- list - / elements=dictionary -
-
- -
Specifies BGP neighbor related configurations.
-
-
- description - -
- string -
-
- -
Neighbor specific description.
-
-
- ebgp_multihop - -
- integer -
-
- -
Specifies the maximum hop count for EBGP neighbors not on directly connected networks.
-
The range is from 1 to 255.
-
-
- enabled - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Administratively shutdown or enable a neighbor.
-
-
- local_as - -
- integer -
-
- -
The local AS number for the neighbor.
-
-
- neighbor - -
- string - / required -
-
- -
Neighbor router address.
-
-
- password - -
- string -
-
- -
Password to authenticate the BGP peer connection.
-
-
- peer_group - -
- string -
-
- -
Name of the peer group that the neighbor is a member of.
-
-
- remote_as - -
- integer - / required -
-
- -
Remote AS of the BGP neighbor to configure.
-
-
- timers - -
- dictionary -
-
- -
Specifies BGP neighbor timer related configurations.
-
-
- holdtime - -
- integer - / required -
-
- -
Interval (in seconds) after not receiving a keepalive message that IOS declares a peer dead.
-
The range is from 0 to 65535.
-
-
- keepalive - -
- integer - / required -
-
- -
Frequency (in seconds) with which the device sends keepalive messages to its peer.
-
The range is from 0 to 65535.
-
-
- min_neighbor_holdtime - -
- integer -
-
- -
Interval (in seconds) specifying the minimum acceptable hold-time from a BGP neighbor.
-
The minimum acceptable hold-time must be less than, or equal to, the interval specified in the holdtime argument.
-
The range is from 0 to 65535.
-
-
- update_source - -
- string -
-
- -
Source of the routing updates.
-
-
- networks - -
- list - / elements=dictionary -
-
- -
Specify Networks to announce via BGP.
-
For operation replace, this option is mutually exclusive with networks option under address_family.
-
For operation replace, if the device already has an address family activated, this option is not allowed.
-
-
- masklen - -
- integer -
-
- -
Subnet mask length for the Network to announce(e.g, 8, 16, 24, etc.).
-
-
- prefix - -
- string - / required -
-
- -
Network ID to announce via BGP.
-
-
- route_map - -
- string -
-
- -
Route map to modify the attributes.
-
-
- router_id - -
- string -
-
- Default:
null
-
-
Configures the BGP routing process router-id value.
-
-
- operation - -
- string -
-
-
    Choices: -
  • merge ←
  • -
  • replace
  • -
  • override
  • -
  • delete
  • -
-
-
Specifies the operation to be performed on the BGP process configured on the device.
-
In case of merge, the input configuration will be merged with the existing BGP configuration on the device.
-
In case of replace, if there is a diff between the existing configuration and the input configuration, the existing configuration will be replaced by the input configuration for every option that has the diff.
-
In case of override, all the existing BGP configuration will be removed from the device and replaced with the input configuration.
-
In case of delete the existing BGP configuration will be removed from the device.
-
-
- - -Notes ------ - -.. note:: - - Tested against Cisco IOS Version 15.6(3)M2 - - - -Examples --------- - -.. code-block:: yaml - - - name: Configure global bgp as 64496 - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - router_id: 192.0.2.1 - log_neighbor_changes: true - neighbors: - - neighbor: 203.0.113.5 - remote_as: 64511 - timers: - keepalive: 300 - holdtime: 360 - min_neighbor_holdtime: 360 - - neighbor: 198.51.100.2 - remote_as: 64498 - networks: - - prefix: 198.51.100.0 - route_map: RMAP_1 - - prefix: 192.0.2.0 - masklen: 23 - address_family: - - afi: ipv4 - safi: unicast - redistribute: - - protocol: ospf - id: 223 - metric: 10 - operation: merge - - - name: Configure BGP neighbors - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.10 - remote_as: 64496 - password: ansible - description: IBGP_NBR_1 - ebgp_multihop: 100 - timers: - keepalive: 300 - holdtime: 360 - min_neighbor_holdtime: 360 - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 - operation: merge - - - name: Configure root-level networks for BGP - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - prefix: 203.0.113.32 - masklen: 27 - route_map: RMAP_2 - operation: merge - - - name: Configure BGP neighbors under address family mode - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: unicast - neighbors: - - neighbor: 203.0.113.10 - activate: true - maximum_prefix: 250 - advertisement_interval: 120 - - neighbor: 192.0.2.15 - activate: true - route_reflector_client: true - operation: merge - - - name: Remove bgp as 64496 from config - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - operation: delete - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- commands - -
- list -
-
always -
The list of configuration mode commands to send to the device
-
-
Sample:
-
['router bgp 64496', 'bgp router-id 192.0.2.1', 'bgp log-neighbor-changes', 'neighbor 203.0.113.5 remote-as 64511', 'neighbor 203.0.113.5 timers 300 360 360', 'neighbor 198.51.100.2 remote-as 64498', 'network 198.51.100.0 route-map RMAP_1', 'network 192.0.2.0 mask 255.255.254.0', 'address-family ipv4', 'redistribute ospf 223 metric 70', 'exit-address-family']
-
-

- - -Status ------- - - -- This module will be removed in a release after 2023-08-24. *[deprecated]* -- For more information see `DEPRECATED`_. - - -Authors -~~~~~~~ - -- Nilashish Chakraborty (@NilashishC) diff --git a/galaxy.yml b/galaxy.yml index cbf813faf..c9bb554d9 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -2,7 +2,7 @@ authors: - Ansible Network Community (ansible-network) dependencies: - "ansible.netcommon": ">=2.5.1" + "ansible.netcommon": ">=6.0.0" license_file: LICENSE name: ios namespace: cisco @@ -11,4 +11,4 @@ readme: README.md repository: https://github.com/ansible-collections/cisco.ios issues: https://github.com/ansible-collections/cisco.ios/issues tags: [cisco, ios, iosxe, networking] -version: "5.3.0" +version: "6.0.0" diff --git a/meta/runtime.yml b/meta/runtime.yml index 4a4bd852d..597327e7b 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -7,8 +7,6 @@ plugin_routing: redirect: cisco.ios.ios banner: redirect: cisco.ios.ios - bgp: - redirect: cisco.ios.ios bgp_global: redirect: cisco.ios.ios command: @@ -31,8 +29,6 @@ plugin_routing: redirect: cisco.ios.ios ios_banner: redirect: cisco.ios.ios - ios_bgp: - redirect: cisco.ios.ios ios_bgp_global: redirect: cisco.ios.ios ios_command: @@ -130,11 +126,6 @@ plugin_routing: redirect: cisco.ios.ios_acls banner: redirect: cisco.ios.ios_banner - bgp: - deprecation: - removal_date: "2023-08-24" - warning_text: See the plugin documentation for more details - redirect: cisco.ios.ios_bgp bgp_global: redirect: cisco.ios.ios_bgp_global command: @@ -151,10 +142,6 @@ plugin_routing: redirect: cisco.ios.ios_hostname interfaces: redirect: cisco.ios.ios_interfaces - ios_bgp: - deprecation: - removal_date: "2023-08-24" - warning_text: See the plugin documentation for more details ios_linkagg: deprecation: removal_date: "2024-06-01" @@ -224,4 +211,4 @@ plugin_routing: redirect: cisco.ios.ios_vrf vxlan_vtep: redirect: cisco.ios.ios_vxlan_vtep -requires_ansible: ">=2.9.10" +requires_ansible: ">=2.14.0" diff --git a/plugins/modules/ios_bgp.py b/plugins/modules/ios_bgp.py deleted file mode 100644 index b01f99428..000000000 --- a/plugins/modules/ios_bgp.py +++ /dev/null @@ -1,504 +0,0 @@ -#!/usr/bin/python -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# -from __future__ import absolute_import, division, print_function - - -__metaclass__ = type - -DOCUMENTATION = """ -module: ios_bgp -author: Nilashish Chakraborty (@NilashishC) -short_description: Module to configure BGP protocol settings. -description: - - This module provides configuration management of global BGP parameters on devices - running Cisco IOS -version_added: 1.0.0 -deprecated: - alternative: ios_bgp_global - why: Newer and updated modules released with more functionality - removed_at_date: "2023-08-24" -notes: - - Tested against Cisco IOS Version 15.6(3)M2 -options: - config: - description: - - Specifies the BGP related configuration. - type: dict - suboptions: - bgp_as: - description: - - Specifies the BGP Autonomous System (AS) number to configure on the device. - type: int - required: true - router_id: - description: - - Configures the BGP routing process router-id value. - type: str - default: - log_neighbor_changes: - description: - - Enable/disable logging neighbor up/down and reset reason. - type: bool - neighbors: - description: - - Specifies BGP neighbor related configurations. - type: list - elements: dict - suboptions: - neighbor: - description: - - Neighbor router address. - required: true - type: str - remote_as: - description: - - Remote AS of the BGP neighbor to configure. - type: int - required: true - update_source: - description: - - Source of the routing updates. - type: str - password: - description: - - Password to authenticate the BGP peer connection. - type: str - enabled: - description: - - Administratively shutdown or enable a neighbor. - type: bool - description: - description: - - Neighbor specific description. - type: str - ebgp_multihop: - description: - - Specifies the maximum hop count for EBGP neighbors not on directly connected - networks. - - The range is from 1 to 255. - type: int - peer_group: - description: - - Name of the peer group that the neighbor is a member of. - type: str - timers: - description: - - Specifies BGP neighbor timer related configurations. - type: dict - suboptions: - keepalive: - description: - - Frequency (in seconds) with which the device sends keepalive messages - to its peer. - - The range is from 0 to 65535. - type: int - required: true - holdtime: - description: - - Interval (in seconds) after not receiving a keepalive message that - IOS declares a peer dead. - - The range is from 0 to 65535. - type: int - required: true - min_neighbor_holdtime: - description: - - Interval (in seconds) specifying the minimum acceptable hold-time - from a BGP neighbor. - - The minimum acceptable hold-time must be less than, or equal to, - the interval specified in the holdtime argument. - - The range is from 0 to 65535. - type: int - local_as: - description: - - The local AS number for the neighbor. - type: int - networks: - description: - - Specify Networks to announce via BGP. - - For operation replace, this option is mutually exclusive with networks option - under address_family. - - For operation replace, if the device already has an address family activated, - this option is not allowed. - type: list - elements: dict - suboptions: - prefix: - description: - - Network ID to announce via BGP. - required: true - type: str - masklen: - description: - - Subnet mask length for the Network to announce(e.g, 8, 16, 24, etc.). - type: int - route_map: - description: - - Route map to modify the attributes. - type: str - address_family: - description: - - Specifies BGP address family related configurations. - type: list - elements: dict - suboptions: - afi: - description: - - Type of address family to configure. - choices: - - ipv4 - - ipv6 - required: true - type: str - safi: - description: - - Specifies the type of cast for the address family. - choices: - - flowspec - - unicast - - multicast - - labeled-unicast - default: unicast - type: str - synchronization: - description: - - Enable/disable IGP synchronization. - type: bool - auto_summary: - description: - - Enable/disable automatic network number summarization. - type: bool - redistribute: - description: - - Specifies the redistribute information from another routing protocol. - type: list - elements: dict - suboptions: - protocol: - description: - - Specifies the protocol for configuring redistribute information. - choices: - - ospf - - ospfv3 - - eigrp - - isis - - static - - connected - - odr - - lisp - - mobile - - rip - required: true - type: str - id: - description: - - Identifier for the routing protocol for configuring redistribute - information. - - Valid for protocols 'ospf', 'ospfv3' and 'eigrp'. - type: str - metric: - description: - - Specifies the metric for redistributed routes. - type: int - route_map: - description: - - Specifies the route map reference. - type: str - networks: - description: - - Specify Networks to announce via BGP. - - For operation replace, this option is mutually exclusive with root level - networks option. - type: list - elements: dict - suboptions: - prefix: - description: - - Network ID to announce via BGP. - required: true - type: str - masklen: - description: - - Subnet mask length for the Network to announce(e.g, 8, 16, 24, etc.). - type: int - route_map: - description: - - Route map to modify the attributes. - type: str - neighbors: - description: - - Specifies BGP neighbor related configurations in Address Family configuration - mode. - type: list - elements: dict - suboptions: - neighbor: - description: - - Neighbor router address. - required: true - type: str - advertisement_interval: - description: - - Minimum interval between sending BGP routing updates for this neighbor. - type: int - route_reflector_client: - description: - - Specify a neighbor as a route reflector client. - type: bool - route_server_client: - description: - - Specify a neighbor as a route server client. - type: bool - activate: - description: - - Enable the Address Family for this Neighbor. - type: bool - remove_private_as: - description: - - Remove the private AS number from outbound updates. - type: bool - next_hop_self: - description: - - Enable/disable the next hop calculation for this neighbor. - type: bool - next_hop_unchanged: - description: - - Propagate next hop unchanged for iBGP paths to this neighbor. - type: bool - maximum_prefix: - description: - - Maximum number of prefixes to accept from this peer. - - The range is from 1 to 2147483647. - type: int - prefix_list_in: - description: - - Name of ip prefix-list to apply to incoming prefixes. - type: str - prefix_list_out: - description: - - Name of ip prefix-list to apply to outgoing prefixes. - type: str - operation: - description: - - Specifies the operation to be performed on the BGP process configured on the - device. - - In case of merge, the input configuration will be merged with the existing BGP - configuration on the device. - - In case of replace, if there is a diff between the existing configuration and - the input configuration, the existing configuration will be replaced by the - input configuration for every option that has the diff. - - In case of override, all the existing BGP configuration will be removed from - the device and replaced with the input configuration. - - In case of delete the existing BGP configuration will be removed from the device. - default: merge - type: str - choices: - - merge - - replace - - override - - delete - -""" - -EXAMPLES = """ -- name: Configure global bgp as 64496 - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - router_id: 192.0.2.1 - log_neighbor_changes: true - neighbors: - - neighbor: 203.0.113.5 - remote_as: 64511 - timers: - keepalive: 300 - holdtime: 360 - min_neighbor_holdtime: 360 - - neighbor: 198.51.100.2 - remote_as: 64498 - networks: - - prefix: 198.51.100.0 - route_map: RMAP_1 - - prefix: 192.0.2.0 - masklen: 23 - address_family: - - afi: ipv4 - safi: unicast - redistribute: - - protocol: ospf - id: 223 - metric: 10 - operation: merge - -- name: Configure BGP neighbors - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.10 - remote_as: 64496 - password: ansible - description: IBGP_NBR_1 - ebgp_multihop: 100 - timers: - keepalive: 300 - holdtime: 360 - min_neighbor_holdtime: 360 - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 - operation: merge - -- name: Configure root-level networks for BGP - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - prefix: 203.0.113.32 - masklen: 27 - route_map: RMAP_2 - operation: merge - -- name: Configure BGP neighbors under address family mode - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: unicast - neighbors: - - neighbor: 203.0.113.10 - activate: true - maximum_prefix: 250 - advertisement_interval: 120 - - neighbor: 192.0.2.15 - activate: true - route_reflector_client: true - operation: merge - -- name: Remove bgp as 64496 from config - cisco.ios.ios_bgp: - config: - bgp_as: 64496 - operation: delete -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always - type: list - sample: - - router bgp 64496 - - bgp router-id 192.0.2.1 - - bgp log-neighbor-changes - - neighbor 203.0.113.5 remote-as 64511 - - neighbor 203.0.113.5 timers 300 360 360 - - neighbor 198.51.100.2 remote-as 64498 - - network 198.51.100.0 route-map RMAP_1 - - network 192.0.2.0 mask 255.255.254.0 - - address-family ipv4 - - redistribute ospf 223 metric 70 - - exit-address-family -""" -from ansible.module_utils._text import to_text - -from ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.cli.config.bgp.process import ( - REDISTRIBUTE_PROTOCOLS, -) -from ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.module import ( - NetworkModule, -) - - -def main(): - """main entry point for module execution""" - network_spec = {"prefix": dict(required=True), "masklen": dict(type="int"), "route_map": dict()} - redistribute_spec = { - "protocol": dict(choices=REDISTRIBUTE_PROTOCOLS, required=True), - "id": dict(), - "metric": dict(type="int"), - "route_map": dict(), - } - timer_spec = { - "keepalive": dict(type="int", required=True), - "holdtime": dict(type="int", required=True), - "min_neighbor_holdtime": dict(type="int"), - } - neighbor_spec = { - "neighbor": dict(required=True), - "remote_as": dict(type="int", required=True), - "local_as": dict(type="int"), - "update_source": dict(), - "password": dict(no_log=True), - "enabled": dict(type="bool"), - "description": dict(), - "ebgp_multihop": dict(type="int"), - "timers": dict(type="dict", options=timer_spec), - "peer_group": dict(), - } - af_neighbor_spec = { - "neighbor": dict(required=True), - "activate": dict(type="bool"), - "advertisement_interval": dict(type="int"), - "remove_private_as": dict(type="bool"), - "next_hop_self": dict(type="bool"), - "next_hop_unchanged": dict(type="bool"), - "route_reflector_client": dict(type="bool"), - "route_server_client": dict(type="bool"), - "maximum_prefix": dict(type="int"), - "prefix_list_in": dict(), - "prefix_list_out": dict(), - } - address_family_spec = { - "afi": dict(choices=["ipv4", "ipv6"], required=True), - "safi": dict( - choices=["flowspec", "labeled-unicast", "multicast", "unicast"], - default="unicast", - ), - "auto_summary": dict(type="bool"), - "synchronization": dict(type="bool"), - "networks": dict(type="list", elements="dict", options=network_spec), - "redistribute": dict(type="list", elements="dict", options=redistribute_spec), - "neighbors": dict(type="list", elements="dict", options=af_neighbor_spec), - } - config_spec = { - "bgp_as": dict(type="int", required=True), - "router_id": dict(), - "log_neighbor_changes": dict(type="bool"), - "neighbors": dict(type="list", elements="dict", options=neighbor_spec), - "address_family": dict(type="list", elements="dict", options=address_family_spec), - "networks": dict(type="list", elements="dict", options=network_spec), - } - argument_spec = { - "config": dict(type="dict", options=config_spec), - "operation": dict(default="merge", choices=["merge", "replace", "override", "delete"]), - } - module = NetworkModule(argument_spec=argument_spec, supports_check_mode=True) - try: - result = module.edit_config(config_filter="| section ^router bgp") - except Exception as exc: - module.fail_json(msg=to_text(exc)) - module.exit_json(**result) - - -if __name__ == "__main__": - main() diff --git a/tests/config.yml b/tests/config.yml index 41f529264..c26ea5966 100644 --- a/tests/config.yml +++ b/tests/config.yml @@ -1,3 +1,3 @@ --- modules: - python_requires: ">=3.6" + python_requires: ">=3.9" diff --git a/tests/integration/targets/ios_bgp/defaults/main.yaml b/tests/integration/targets/ios_bgp/defaults/main.yaml deleted file mode 100644 index 5f709c5aa..000000000 --- a/tests/integration/targets/ios_bgp/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/tests/integration/targets/ios_bgp/meta/main.yaml b/tests/integration/targets/ios_bgp/meta/main.yaml deleted file mode 100644 index ab3ad91bc..000000000 --- a/tests/integration/targets/ios_bgp/meta/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - prepare_ios_tests diff --git a/tests/integration/targets/ios_bgp/tasks/cli.yaml b/tests/integration/targets/ios_bgp/tasks/cli.yaml deleted file mode 100644 index 2b6056023..000000000 --- a/tests/integration/targets/ios_bgp/tasks/cli.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Collect all CLI test cases - ansible.builtin.find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - register: test_cases - delegate_to: localhost - -- name: Set test_items - ansible.builtin.set_fact: - test_items: "{{ test_cases.files | map(attribute='path') | list }}" - -- name: Run test cases (connection=ansible.netcommon.network_cli) - ansible.builtin.include_tasks: "{{ test_case_to_run }}" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/tests/integration/targets/ios_bgp/tasks/main.yaml b/tests/integration/targets/ios_bgp/tasks/main.yaml deleted file mode 100644 index 2269ecb54..000000000 --- a/tests/integration/targets/ios_bgp/tasks/main.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Main task for bgp module - ansible.builtin.include_tasks: cli.yaml - tags: - - network_cli diff --git a/tests/integration/targets/ios_bgp/tests/cli/basic.yaml b/tests/integration/targets/ios_bgp/tests/cli/basic.yaml deleted file mode 100644 index 752f9ff4f..000000000 --- a/tests/integration/targets/ios_bgp/tests/cli/basic.yaml +++ /dev/null @@ -1,490 +0,0 @@ ---- -- ansible.builtin.debug: msg="START ios cli/ios_bgp.yaml on connection={{ ansible_connection }}" - -- name: Clear existing BGP configuration - ignore_errors: true - cisco.ios.ios_bgp: - operation: delete - -- block: - - name: Add fake configuration with 'bgp' string - cisco.ios.ios_config: - match: none - replace: block - lines: - - no ip access-list extended BGP_ACL - - ip access-list extended BGP_ACL - - permit tcp any any eq bgp - - - name: Try delete fake BGP configuration - register: result - cisco.ios.ios_bgp: - operation: delete - - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Clean fake configuration with 'bgp' string - cisco.ios.ios_config: - match: none - replace: block - lines: - - no ip access-list extended BGP_ACL - - - name: Add fake bgp-like configuration - cisco.ios.ios_config: - match: none - replace: block - lines: - - no ip access-list extended BGP_ACL_2 - - ip access-list extended BGP_ACL_2 - - remark router bgp 64496 - - remark neighbor 192.0.2.10 remote-as 64496 - - remark neighbor 192.0.2.10 shutdown - - remark address-family ipv4 - - remark neighbor 192.0.2.10 activate - - remark exit-address-family - - permit tcp any any eq bgp - - - name: Try delete fake bgp-like configuration - register: result - cisco.ios.ios_bgp: - operation: delete - - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Clean fake bgp-like configuration - cisco.ios.ios_config: - match: none - replace: block - lines: - - no ip access-list extended BGP_ACL_2 - - - name: Configure BGP with as 64496 and a router-id - register: result - cisco.ios.ios_bgp: &id001 - operation: merge - config: - bgp_as: 64496 - router_id: 192.0.2.2 - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64496' in result.commands" - - "'bgp router-id 192.0.2.2' in result.commands" - - - name: Configure BGP with as 64496 and a router-id (idempotent) - register: result - cisco.ios.ios_bgp: *id001 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure BGP neighbors - register: result - cisco.ios.ios_bgp: &id002 - operation: merge - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.10 - remote_as: 64496 - password: ansible - description: IBGP_NBR_1 - ebgp_multihop: 100 - timers: - keepalive: 300 - holdtime: 360 - min_neighbor_holdtime: 360 - - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64496' in result.commands" - - "'neighbor 192.0.2.10 remote-as 64496' in result.commands" - - "'neighbor 192.0.2.10 description IBGP_NBR_1' in result.commands" - - "'neighbor 192.0.2.10 ebgp-multihop 100' in result.commands" - - "'neighbor 192.0.2.10 timers 300 360 360' in result.commands" - - "'neighbor 192.0.2.15 remote-as 64496' in result.commands" - - "'neighbor 192.0.2.15 description IBGP_NBR_2' in result.commands" - - "'neighbor 192.0.2.15 ebgp-multihop 150' in result.commands" - - - name: Configure BGP neighbors (idempotent) - register: result - cisco.ios.ios_bgp: *id002 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure BGP neighbors with operation replace - register: result - cisco.ios.ios_bgp: &id003 - operation: replace - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 - - - neighbor: 203.0.113.10 - remote_as: 64511 - description: EBGP_NBR_1 - local_as: 64497 - - - neighbor: 10.10.20.20 - remote_as: 65012 - description: BGP_NBR_2 - ebgp_multihop: 100 - - - ansible.builtin.assert: - that: - - result.changed == true - - "'neighbor 203.0.113.10 remote-as 64511' in result.commands" - - "'neighbor 203.0.113.10 description EBGP_NBR_1' in result.commands" - - "'neighbor 203.0.113.10 local-as 64497' in result.commands" - - "'neighbor 10.10.20.20 remote-as 65012' in result.commands" - - "'neighbor 10.10.20.20 description BGP_NBR_2' in result.commands" - - "'no neighbor 192.0.2.10' in result.commands" - - - name: Configure BGP neighbors with operation replace (idempotent) - register: result - cisco.ios.ios_bgp: *id003 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure root-level networks for BGP - register: result - cisco.ios.ios_bgp: &id004 - operation: merge - config: - bgp_as: 64496 - networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - - prefix: 203.0.113.32 - masklen: 27 - route_map: RMAP_2 - - - ansible.builtin.assert: - that: - - result.changed == True - - "'router bgp 64496' in result.commands" - - "'network 203.0.113.0 mask 255.255.255.224 route-map RMAP_1' in result.commands" - - "'network 203.0.113.32 mask 255.255.255.224 route-map RMAP_2' in result.commands" - - - name: Configure root-level networks for BGP (idempotent) - register: result - cisco.ios.ios_bgp: *id004 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure root-level networks for BGP with operation replace - register: result - cisco.ios.ios_bgp: &id005 - operation: replace - config: - bgp_as: 64496 - networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - - prefix: 198.51.100.16 - masklen: 28 - - - ansible.builtin.assert: - that: - - result.changed == True - - "'router bgp 64496' in result.commands" - - "'network 198.51.100.16 mask 255.255.255.240' in result.commands" - - "'no network 203.0.113.32 mask 255.255.255.224 route-map RMAP_2' in result.commands" - - - name: Configure root-level networks for BGP with operation replace (idempotent) - register: result - cisco.ios.ios_bgp: *id005 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure BGP neighbors under address family mode - register: result - cisco.ios.ios_bgp: &id006 - operation: merge - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: unicast - neighbors: - - neighbor: 203.0.113.10 - activate: true - maximum_prefix: 250 - advertisement_interval: 120 - - - neighbor: 192.0.2.15 - activate: true - route_reflector_client: true - - - neighbor: 10.10.20.20 - activate: true - prefix_list_in: incoming-prefixes - prefix_list_out: outgoing-prefixes - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64496' in result.commands" - - "'address-family ipv4' in result.commands" - - "'neighbor 203.0.113.10 activate' in result.commands" - - "'neighbor 203.0.113.10 maximum-prefix 250' in result.commands" - - "'neighbor 203.0.113.10 advertisement-interval 120' in result.commands" - - "'neighbor 192.0.2.15 activate' in result.commands" - - "'neighbor 192.0.2.15 route-reflector-client' in result.commands" - - "'neighbor 10.10.20.20 activate' in result.commands" - - "'neighbor 10.10.20.20 prefix-list incoming-prefixes in' in result.commands" - - "'neighbor 10.10.20.20 prefix-list outgoing-prefixes out' in result.commands" - - - name: Configure BGP neighbors under address family mode (idempotent) - register: result - cisco.ios.ios_bgp: *id006 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure networks under address family - register: result - cisco.ios.ios_bgp: &id007 - operation: merge - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: multicast - networks: - - prefix: 198.51.100.48 - masklen: 28 - route_map: RMAP_1 - - - prefix: 192.0.2.64 - masklen: 27 - - - prefix: 203.0.113.160 - masklen: 27 - route_map: RMAP_2 - - - afi: ipv4 - safi: unicast - networks: - - prefix: 198.51.100.64 - masklen: 28 - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64496' in result.commands" - - "'address-family ipv4 multicast' in result.commands" - - "'network 198.51.100.48 mask 255.255.255.240 route-map RMAP_1' in result.commands" - - "'network 192.0.2.64 mask 255.255.255.224' in result.commands" - - "'network 203.0.113.160 mask 255.255.255.224 route-map RMAP_2' in result.commands" - - "'exit-address-family' in result.commands" - - "'address-family ipv4' in result.commands" - - "'network 198.51.100.64 mask 255.255.255.240' in result.commands" - - "'exit-address-family' in result.commands" - - - name: Configure networks under address family (idempotent) - register: result - cisco.ios.ios_bgp: *id007 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure networks under address family with operation replace - register: result - cisco.ios.ios_bgp: &id008 - operation: replace - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: multicast - networks: - - prefix: 198.51.100.80 - masklen: 28 - - - prefix: 192.0.2.64 - masklen: 27 - - - prefix: 203.0.113.192 - masklen: 27 - - - afi: ipv4 - safi: unicast - networks: - - prefix: 198.51.100.64 - masklen: 28 - - - ansible.builtin.assert: - that: - - result.changed == true - - '"router bgp 64496" in result.commands' - - '"address-family ipv4 multicast" in result.commands' - - '"network 198.51.100.80 mask 255.255.255.240" in result.commands' - - '"network 203.0.113.192 mask 255.255.255.224" in result.commands' - - '"no network 198.51.100.48 mask 255.255.255.240 route-map RMAP_1" in result.commands' - - '"no network 203.0.113.160 mask 255.255.255.224 route-map RMAP_2" in result.commands' - - '"exit-address-family" in result.commands' - - - name: Configure networks under address family with operation replace (idempotent) - register: result - cisco.ios.ios_bgp: *id008 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Configure redistribute information under address family mode - register: result - cisco.ios.ios_bgp: &id009 - operation: merge - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: multicast - redistribute: - - protocol: ospf - id: 112 - metric: 64 - - - protocol: eigrp - id: 233 - metric: 256 - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64496' in result.commands" - - "'address-family ipv4 multicast' in result.commands" - - "'redistribute ospf 112 metric 64' in result.commands" - - "'redistribute eigrp 233 metric 256' in result.commands" - - "'exit-address-family' in result.commands" - - - name: Configure redistribute information under address family mode (idempotent) - register: result - cisco.ios.ios_bgp: *id009 - - ansible.builtin.assert: - that: - - result.changed == false - - - name: Get the IOS version - cisco.ios.ios_facts: - gather_subset: all - - - name: Configure redistribute information under address family mode with operation replace - register: result - cisco.ios.ios_bgp: &id010 - operation: replace - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: multicast - redistribute: - - protocol: ospf - id: 112 - metric: 64 - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64496' in result.commands" - - "'address-family ipv4 multicast' in result.commands" - - "'no redistribute eigrp 233' in result.commands" - - "'exit-address-family' in result.commands" - - - name: Configure redistribute information under address family mode with operation replace (idempotent) - register: result - when: ansible_net_version != "15.6(2)T" - cisco.ios.ios_bgp: *id010 - - ansible.builtin.assert: - that: - - result.changed == false - when: ansible_net_version != "15.6(2)T" - - - name: Override all the existing BGP configuration - register: result - cisco.ios.ios_bgp: - operation: override - config: - bgp_as: 64497 - router_id: 192.0.2.10 - log_neighbor_changes: true - - - ansible.builtin.assert: - that: - - result.changed == true - - "'no router bgp 64496' in result.commands" - - "'router bgp 64497' in result.commands" - - "'bgp router-id 192.0.2.10' in result.commands" - - "'bgp log-neighbor-changes' in result.commands" - - - name: Configure BGP neighbors with classful boundary - register: result - cisco.ios.ios_bgp: &id011 - config: - bgp_as: 64497 - log_neighbor_changes: true - networks: - - prefix: 198.51.100.0 - masklen: 23 - - - prefix: 201.0.113.32 - masklen: 24 - operation: merge - - - ansible.builtin.assert: - that: - - result.changed == true - - "'router bgp 64497' in result.commands" - - "'network 198.51.100.0 mask 255.255.254.0' in result.commands" - - "'network 201.0.113.32' in result.commands" - - - name: Configure BGP neighbors with classful boundary (idempotent) - register: result - cisco.ios.ios_bgp: *id011 - - ansible.builtin.assert: - that: - - result.changed == false - always: - - name: Teardown - register: result - cisco.ios.ios_bgp: &id012 - operation: delete - - - ansible.builtin.assert: - that: - - result.changed == true - - "'no router bgp 64497' in result.commands" - - - name: Teardown again (idempotent) - register: result - cisco.ios.ios_bgp: *id012 - - ansible.builtin.assert: - that: - - result.changed == false - -- ansible.builtin.debug: msg="END ios cli/ios_bgp.yaml on connection={{ ansible_connection }}" diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index 9dadf1b54..000000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,24 +0,0 @@ -plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` -plugins/module_utils/network/ios/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/ios/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/ios/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/ios/config/route_maps/route_maps.py compile-2.6!skip -plugins/module_utils/network/ios/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/ios/config/ntp_global/ntp_global.py compile-2.6!skip -plugins/modules/ios_route_maps.py import-2.6!skip -plugins/modules/ios_logging_global.py import-2.6!skip -plugins/modules/ios_prefix_lists.py import-2.6!skip -plugins/modules/ios_bgp_address_family.py import-2.6!skip -plugins/module_utils/network/ios/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/ios/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/ios/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/ios/config/route_maps/route_maps.py import-2.6!skip -plugins/module_utils/network/ios/config/logging_global/logging_global.py import-2.6!skip -plugins/module_utils/network/ios/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/ios/config/ntp_global/ntp_global.py import-2.6!skip -plugins/module_utils/network/ios/config/vxlan_vtep/vxlan_vtep.py import-2.6!skip -plugins/module_utils/network/ios/config/evpn_global/evpn_global.py import-2.6!skip -plugins/module_utils/network/ios/config/evpn_evi/evpn_evi.py import-2.6!skip diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt deleted file mode 100644 index 2847c9344..000000000 --- a/tests/sanity/ignore-2.11.txt +++ /dev/null @@ -1,24 +0,0 @@ -plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` -plugins/module_utils/network/ios/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/ios/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/ios/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/ios/config/route_maps/route_maps.py compile-2.6!skip -plugins/module_utils/network/ios/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/ntp_global/ntp_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/modules/ios_route_maps.py import-2.6!skip -plugins/modules/ios_logging_global.py import-2.6!skip -plugins/modules/ios_prefix_lists.py import-2.6!skip -plugins/modules/ios_bgp_address_family.py import-2.6!skip -plugins/module_utils/network/ios/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/ios/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/ios/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/ios/config/route_maps/route_maps.py import-2.6!skip -plugins/module_utils/network/ios/config/logging_global/logging_global.py import-2.6!skip -plugins/module_utils/network/ios/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/ios/config/ntp_global/ntp_global.py import-2.6!skip -plugins/module_utils/network/ios/config/vxlan_vtep/vxlan_vtep.py import-2.6!skip -plugins/module_utils/network/ios/config/evpn_global/evpn_global.py import-2.6!skip -plugins/module_utils/network/ios/config/evpn_evi/evpn_evi.py import-2.6!skip diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt deleted file mode 100644 index d7ff17ca8..000000000 --- a/tests/sanity/ignore-2.12.txt +++ /dev/null @@ -1 +0,0 @@ -plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt deleted file mode 100644 index d7ff17ca8..000000000 --- a/tests/sanity/ignore-2.13.txt +++ /dev/null @@ -1 +0,0 @@ -plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt deleted file mode 100644 index 11aba94e9..000000000 --- a/tests/sanity/ignore-2.9.txt +++ /dev/null @@ -1,32 +0,0 @@ -plugins/modules/ios_bgp.py validate-modules:deprecation-mismatch -plugins/modules/ios_bgp.py validate-modules:invalid-documentation -plugins/modules/ios_lldp.py validate-modules:deprecation-mismatch -plugins/modules/ios_lldp.py validate-modules:invalid-documentation -plugins/modules/ios_ntp.py validate-modules:deprecation-mismatch -plugins/modules/ios_ntp.py validate-modules:invalid-documentation -plugins/modules/ios_linkagg.py validate-modules:deprecation-mismatch -plugins/modules/ios_linkagg.py validate-modules:invalid-documentation -plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` -plugins/module_utils/network/ios/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/ios/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/ios/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/ios/config/route_maps/route_maps.py compile-2.6!skip -plugins/module_utils/network/ios/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/ios/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/modules/ios_route_maps.py import-2.6!skip -plugins/modules/ios_logging_global.py import-2.6!skip -plugins/modules/ios_ntp_global.py import-2.6!skip -plugins/modules/ios_prefix_lists.py import-2.6!skip -plugins/modules/ios_bgp_address_family.py import-2.6!skip -plugins/module_utils/network/ios/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/ios/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/ios/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/ios/config/route_maps/route_maps.py import-2.6!skip -plugins/module_utils/network/ios/config/logging_global/logging_global.py import-2.6!skip -plugins/module_utils/network/ios/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/ios/config/ntp_global/ntp_global.py import-2.6!skip -plugins/module_utils/network/ios/config/vxlan_vtep/vxlan_vtep.py import-2.6!skip -plugins/module_utils/network/ios/config/evpn_global/evpn_global.py import-2.6!skip -plugins/module_utils/network/ios/config/evpn_evi/evpn_evi.py import-2.6!skip diff --git a/tests/unit/modules/network/ios/test_ios_bgp.py b/tests/unit/modules/network/ios/test_ios_bgp.py deleted file mode 100644 index 0145a3c6a..000000000 --- a/tests/unit/modules/network/ios/test_ios_bgp.py +++ /dev/null @@ -1,344 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import absolute_import, division, print_function - - -__metaclass__ = type - -from ansible_collections.cisco.ios.plugins.module_utils.network.ios.providers.cli.config.bgp.process import ( - Provider, -) -from ansible_collections.cisco.ios.plugins.modules import ios_bgp - -from .ios_module import TestIosModule, load_fixture - - -class TestIosBgpModule(TestIosModule): - module = ios_bgp - - def setUp(self): - super(TestIosBgpModule, self).setUp() - self._bgp_config = load_fixture("ios_bgp_config.cfg") - - def test_ios_bgp(self): - obj = Provider( - params=dict( - config=dict( - bgp_as=64496, - router_id="192.0.2.2", - networks=None, - address_family=None, - ), - operation="merge", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ["router bgp 64496", "bgp router-id 192.0.2.2", "exit"]) - - def test_ios_bgp_idempotent(self): - obj = Provider( - params=dict( - config=dict( - bgp_as=64496, - router_id="192.0.2.1", - networks=None, - address_family=None, - ), - operation="merge", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_ios_bgp_remove(self): - obj = Provider( - params=dict( - config=dict(bgp_as=64496, networks=None, address_family=None), - operation="delete", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ["no router bgp 64496"]) - - def test_ios_bgp_neighbor(self): - obj = Provider( - params=dict( - config=dict( - bgp_as=64496, - neighbors=[dict(neighbor="192.51.100.2", remote_as=64496)], - networks=None, - address_family=None, - ), - operation="merge", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual( - commands, - ["router bgp 64496", "neighbor 192.51.100.2 remote-as 64496", "exit"], - ) - - def test_ios_bgp_neighbor_idempotent(self): - obj = Provider( - params=dict( - config=dict( - bgp_as=64496, - neighbors=[ - dict( - neighbor="192.51.100.1", - remote_as=64496, - timers=dict(keepalive=120, holdtime=360, min_neighbor_holdtime=360), - ), - ], - networks=None, - address_family=None, - ), - operation="merge", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_ios_bgp_network(self): - obj = Provider( - params=dict( - config=dict( - bgp_as=64496, - networks=[dict(prefix="192.0.1.0", masklen=23, route_map="RMAP_1")], - address_family=None, - ), - operation="merge", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual( - sorted(commands), - sorted( - [ - "router bgp 64496", - "network 192.0.1.0 mask 255.255.254.0 route-map RMAP_1", - "exit", - ], - ), - ) - - def test_ios_bgp_network_idempotent(self): - obj = Provider( - params=dict( - config=dict( - bgp_as=64496, - networks=[ - dict(prefix="192.0.2.0", masklen=23, route_map="RMAP_1"), - dict(prefix="198.51.100.0", masklen=25, route_map="RMAP_2"), - ], - address_family=None, - ), - operation="merge", - ), - ) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_ios_bgp_address_family_redistribute(self): - rd_1 = dict(protocol="ospf", id="233", metric=90, route_map=None) - - config = dict( - bgp_as=64496, - address_family=[dict(afi="ipv4", safi="unicast", redistribute=[rd_1])], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="merge")) - - commands = obj.render(self._bgp_config) - cmd = [ - "router bgp 64496", - "address-family ipv4", - "redistribute ospf 233 metric 90", - "exit-address-family", - "exit", - ] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_ios_bgp_address_family_redistribute_idempotent(self): - rd_1 = dict(protocol="eigrp", metric=10, route_map="RMAP_3", id=None) - rd_2 = dict(protocol="static", metric=100, id=None, route_map=None) - - config = dict( - bgp_as=64496, - address_family=[dict(afi="ipv4", safi="unicast", redistribute=[rd_1, rd_2])], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="merge")) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_ios_bgp_address_family_neighbors(self): - af_nbr_1 = dict(neighbor="192.51.100.1", maximum_prefix=35, activate=True) - af_nbr_2 = dict(neighbor="192.51.100.3", route_reflector_client=True, activate=True) - - config = dict( - bgp_as=64496, - address_family=[dict(afi="ipv4", safi="multicast", neighbors=[af_nbr_1, af_nbr_2])], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="merge")) - - commands = obj.render(self._bgp_config) - cmd = [ - "router bgp 64496", - "address-family ipv4 multicast", - "neighbor 192.51.100.1 activate", - "neighbor 192.51.100.1 maximum-prefix 35", - "neighbor 192.51.100.3 activate", - "neighbor 192.51.100.3 route-reflector-client", - "exit-address-family", - "exit", - ] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_ios_bgp_address_family_neighbors_idempotent(self): - af_nbr_1 = dict(neighbor="203.0.113.1", remove_private_as=True, maximum_prefix=100) - - config = dict( - bgp_as=64496, - address_family=[dict(afi="ipv4", safi="unicast", neighbors=[af_nbr_1])], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="merge")) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_ios_bgp_address_family_networks(self): - net = dict(prefix="1.0.0.0", masklen=8, route_map="RMAP_1") - net2 = dict(prefix="192.168.1.0", masklen=24, route_map="RMAP_2") - - config = dict( - bgp_as=64496, - address_family=[dict(afi="ipv4", safi="multicast", networks=[net, net2])], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="merge")) - - commands = obj.render(self._bgp_config) - cmd = [ - "router bgp 64496", - "address-family ipv4 multicast", - "network 1.0.0.0 mask 255.0.0.0 route-map RMAP_1", - "network 192.168.1.0 mask 255.255.255.0 route-map RMAP_2", - "exit-address-family", - "exit", - ] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_ios_bgp_address_family_networks_idempotent(self): - net = dict(prefix="203.0.113.0", masklen=27, route_map="RMAP_1") - net2 = dict(prefix="192.0.2.0", masklen=26, route_map="RMAP_2") - - config = dict( - bgp_as=64496, - address_family=[dict(afi="ipv4", safi="multicast", networks=[net, net2])], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="merge")) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_ios_bgp_operation_override(self): - net_1 = dict(prefix="1.0.0.0", masklen=8, route_map="RMAP_1") - net_2 = dict(prefix="192.168.1.0", masklen=24, route_map="RMAP_2") - nbr_1 = dict(neighbor="192.51.100.1", remote_as=64496, update_source="GigabitEthernet0/1") - nbr_2 = dict( - neighbor="192.51.100.3", - remote_as=64496, - timers=dict(keepalive=300, holdtime=360, min_neighbor_holdtime=360), - ) - af_nbr_1 = dict(neighbor="192.51.100.1", maximum_prefix=35) - af_nbr_2 = dict(neighbor="192.51.100.3", route_reflector_client=True) - - af_1 = dict(afi="ipv4", safi="unicast", neighbors=[af_nbr_1, af_nbr_2]) - af_2 = dict(afi="ipv4", safi="multicast", networks=[net_1, net_2]) - config = dict( - bgp_as=64496, - neighbors=[nbr_1, nbr_2], - address_family=[af_1, af_2], - networks=None, - ) - - obj = Provider(params=dict(config=config, operation="override")) - commands = obj.render(self._bgp_config) - - cmd = [ - "no router bgp 64496", - "router bgp 64496", - "neighbor 192.51.100.1 remote-as 64496", - "neighbor 192.51.100.1 update-source GigabitEthernet0/1", - "neighbor 192.51.100.3 remote-as 64496", - "neighbor 192.51.100.3 timers 300 360 360", - "address-family ipv4", - "neighbor 192.51.100.1 maximum-prefix 35", - "neighbor 192.51.100.3 route-reflector-client", - "exit-address-family", - "address-family ipv4 multicast", - "network 1.0.0.0 mask 255.0.0.0 route-map RMAP_1", - "network 192.168.1.0 mask 255.255.255.0 route-map RMAP_2", - "exit-address-family", - "exit", - ] - - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_ios_bgp_operation_replace(self): - rd = dict(protocol="ospf", id=223, metric=110, route_map=None) - net = dict(prefix="203.0.113.0", masklen=27, route_map="RMAP_1") - net2 = dict(prefix="192.0.2.0", masklen=26, route_map="RMAP_2") - - af_1 = dict(afi="ipv4", safi="unicast", redistribute=[rd]) - af_2 = dict(afi="ipv4", safi="multicast", networks=[net, net2]) - - config = dict(bgp_as=64496, address_family=[af_1, af_2], networks=None) - obj = Provider(params=dict(config=config, operation="replace")) - commands = obj.render(self._bgp_config) - - cmd = [ - "router bgp 64496", - "address-family ipv4", - "redistribute ospf 223 metric 110", - "no redistribute eigrp", - "no redistribute static", - "exit-address-family", - "exit", - ] - - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_ios_bgp_operation_replace_with_new_as(self): - rd = dict(protocol="ospf", id=223, metric=110, route_map=None) - - af_1 = dict(afi="ipv4", safi="unicast", redistribute=[rd]) - - config = dict(bgp_as=64497, address_family=[af_1], networks=None) - obj = Provider(params=dict(config=config, operation="replace")) - commands = obj.render(self._bgp_config) - - cmd = [ - "no router bgp 64496", - "router bgp 64497", - "address-family ipv4", - "redistribute ospf 223 metric 110", - "exit-address-family", - "exit", - ] - - self.assertEqual(sorted(commands), sorted(cmd))