From 95e11a8fa7667eb6f5df289ba3dca2c34a572b6a Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Sun, 18 Aug 2024 19:32:54 +0530 Subject: [PATCH 1/2] [nxos_bgp_global] - Add fix for local as options (#885) * add fix for local as options * remove debug statements * chore: auto fixes from pre-commit.com hooks * fix argspec * update other local_as * chore: auto fixes from pre-commit.com hooks * fix docs * config and argspec * add UT and changelog * chore: auto fixes from pre-commit.com hooks * check changes * chore: auto fixes from pre-commit.com hooks * remove debug statement * fix tests * remove debug statements --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- changelogs/fragments/fix_local_as.yaml | 6 + docs/cisco.nxos.nxos_bgp_global_module.rst | 223 +- docs/cisco.nxos.nxos_vrf_global_module.rst | 2460 +++++++++++++++++ .../nxos/argspec/bgp_global/bgp_global.py | 18 + .../nxos/config/bgp_global/bgp_global.py | 14 + .../network/nxos/rm_templates/bgp_global.py | 19 +- plugins/modules/nxos_bgp_global.py | 31 +- .../network/nxos/test_nxos_bgp_global.py | 102 +- 8 files changed, 2857 insertions(+), 16 deletions(-) create mode 100644 changelogs/fragments/fix_local_as.yaml create mode 100644 docs/cisco.nxos.nxos_vrf_global_module.rst diff --git a/changelogs/fragments/fix_local_as.yaml b/changelogs/fragments/fix_local_as.yaml new file mode 100644 index 000000000..de9c6667b --- /dev/null +++ b/changelogs/fragments/fix_local_as.yaml @@ -0,0 +1,6 @@ +--- +minor_changes: + - nxos_bgp_global - Deprecate local_as with local_as_config which + supports more configuration attributes, under neighbor. +doc_changes: + - nxos_bgp_global - Marks local_as under neighbor deprecated, and some documentation corrections. diff --git a/docs/cisco.nxos.nxos_bgp_global_module.rst b/docs/cisco.nxos.nxos_bgp_global_module.rst index 19ee2709e..c89e6b0e5 100644 --- a/docs/cisco.nxos.nxos_bgp_global_module.rst +++ b/docs/cisco.nxos.nxos_bgp_global_module.rst @@ -840,7 +840,7 @@ Parameters -
Activiate graceful-shutdown.
+
Activate graceful-shutdown.
@@ -1271,7 +1271,7 @@ Parameters -
Neighbor specific descripion.
+
Neighbor specific description.
@@ -1519,8 +1519,112 @@ Parameters
Specify the local-as number for the eBGP neighbor.
+
Deprecated, Use local_as_config instead, the facts would always render local_as information as a part of local_as_config as_number
+
This option has been deprecated and will be removed in a release after 2027-01-01.
+ + + + +
+ local_as_config + +
+ dictionary +
+ + + + +
Local Autonomous System Number options.
+ + + + + + + +
+ as_number + +
+ string +
+ + + + +
Set Specify the local-as number for the eBGP neighbor.
+ + + + + + + +
+ dual_as + +
+ boolean +
+ + + + + +
Connect using either the local-as number or the real as.
+ + + + + + + +
+ no_prepend + +
+ boolean +
+ + + + + +
Do not prepend the local-as number to updates from the eBGP neighbor.
+ + + + + + + +
+ replace_as + +
+ boolean +
+ + + + + +
Prepend only the local-as number to updates to eBGP neighbor.
+ + + @@ -1597,7 +1701,7 @@ Parameters -
Behaviour in low memory situations.
+
Behavior in low memory situations.
@@ -3371,7 +3475,7 @@ Parameters -
Neighbor specific descripion.
+
Neighbor specific description.
@@ -3632,8 +3736,117 @@ Parameters
Specify the local-as number for the eBGP neighbor.
+
Deprecated, Use local_as_config instead, the facts would always render local_as information as a part of local_as_config as_number
+
This option has been deprecated and will be removed in a release after 2027-01-01.
+ + + + + +
+ local_as_config + +
+ dictionary +
+ + + + +
Local Autonomous System Number options.
+ + + + + + + + +
+ as_number + +
+ string +
+ + + + +
Set Specify the local-as number for the eBGP neighbor.
+ + + + + + + + +
+ dual_as + +
+ boolean +
+ + + + + +
Connect using either the local-as number or the real as.
+ + + + + + + + +
+ no_prepend + +
+ boolean +
+ + + + + +
Do not prepend the local-as number to updates from the eBGP neighbor.
+ + + + + + + + +
+ replace_as + +
+ boolean +
+ + + + + +
Prepend only the local-as number to updates to eBGP neighbor.
+ + + @@ -3714,7 +3927,7 @@ Parameters -
Behaviour in low memory situations.
+
Behavior in low memory situations.
diff --git a/docs/cisco.nxos.nxos_vrf_global_module.rst b/docs/cisco.nxos.nxos_vrf_global_module.rst new file mode 100644 index 000000000..4cd3e9459 --- /dev/null +++ b/docs/cisco.nxos.nxos_vrf_global_module.rst @@ -0,0 +1,2460 @@ +.. _cisco.nxos.nxos_vrf_global_module: + + +************************** +cisco.nxos.nxos_vrf_global +************************** + +**Resource module to configure VRF definitions.** + + +Version added: 8.1.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of VRF definitions on Cisco NXOS. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
A list containing device configurations for VRF.
+
+
+ vrfs + +
+ list + / elements=dictionary +
+
+ +
List of VRF definitions.
+
+
+ description + +
+ string +
+
+ +
Description of the VRF.
+
+
+ ip + +
+ dictionary +
+
+ +
Configure IP features for the specified vrf.
+
+
+ auto_discard + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Auto 0.0.0.0/0 discard route.
+
+
+ domain_list + +
+ list + / elements=string +
+
+ +
Add list domain names.
+
+
+ domain_name + +
+ string +
+
+ +
Specify default domain name.
+
+
+ icmp_err + +
+ dictionary +
+
+ +
Enable ICMP error message.
+
+
+ source_interface + +
+ dictionary +
+
+ +
Configure source-address for applications.
+
+
+ interface + +
+ string +
+
+
    Choices: +
  • loopback
  • +
  • ethernet
  • +
  • port-channel
  • +
+
+
Source interface for ICMP error messages.
+
+
+ interface_value + +
+ string +
+
+ +
Source interface value for ICMP error messages.
+
+
+ igmp + +
+ dictionary +
+
+ +
IGMP global configuration commands
+
+
+ ssm_translate + +
+ list + / elements=dictionary +
+
+ +
Translate IGMPv1/v2 reports to (S,G) route entries.
+
+
+ group + +
+ string +
+
+ +
Source address.
+
+
+ source + +
+ string +
+
+ +
Group address.
+
+
+ mroutes + +
+ list + / elements=dictionary +
+
+ +
Configure multicast routes.
+
+
+ group + +
+ string +
+
+ +
Multicast group address.
+
+
+ preference + +
+ integer +
+
+ +
Preference value.
+
+
+ source + +
+ string +
+
+ +
Source address.
+
+
+ vrf + +
+ string +
+
+ +
VRF name.
+
+
+ multicast + +
+ dictionary +
+
+ +
Configure IP multicast global parameters.
+
+
+ group_range_prefix_list + +
+ string +
+
+ +
Group range prefix-list policy for multicast boundary.
+
+
+ multipath + +
+ dictionary +
+
+ +
Configure ECMP multicast load splitting.
+
+
+ resilient + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure resilient RPF interface.
+
+
+ splitting_type + +
+ dictionary +
+
+ +
Configure multicast load splitting type.
+
+
+ legacy + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure hash based on source and group.
+
+
+ nbm + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure NBM controlled RPF interface.
+
+
+ none + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable multicast load splitting.
+
+
+ sg_hash + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure hash based on source and group address.
+
+
+ sg_hash_next_hop + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure hash based on source and group address and next-hop.
+
+
+ rpf + +
+ list + / elements=dictionary +
+
+ +
Configure RPF check.
+
+
+ group_list_range + +
+ string +
+
+ +
Group range for RPF select.
+
+
+ vrf_name + +
+ string +
+
+ +
VRF for RPF lookup.
+
+
+ name_server + +
+ dictionary +
+
+ +
Specify nameserver address.
+
+
+ address_list + +
+ list + / elements=string +
+
+ +
Configure multicast name server address.
+
+
+ use_vrf + +
+ dictionary +
+
+ +
Display per-VRF information.
+
+
+ source_address + +
+ string +
+
+ +
source address for configuring name server.
+
+
+ vrf + +
+ string +
+
+ +
VRF name.
+
+
+ route + +
+ list + / elements=dictionary +
+
+ +
Configure static routes.
+
+
+ destination + +
+ string +
+
+ +
Next-hop address.
+
+
+ source + +
+ string +
+
+ +
Destination prefix.
+
+
+ tags + +
+ dictionary +
+
+ +
Route tag.
+
+
+ route_pref + +
+ integer +
+
+ +
Route preference.
+
+
+ tag_value + +
+ integer +
+
+ +
Route tag value.
+
+
+ track + +
+ string +
+
+ +
Configure track object.
+
+
+ vrf + +
+ string +
+
+ +
add vrf to the route.
+
+
+ ipv6 + +
+ dictionary +
+
+ +
Configure IPv6 features for the specified vrf.
+
+
+ mld_ssm_translate + +
+ list + / elements=dictionary +
+
+ +
Translate MLDv1/v2 reports to (S,G) route entries.
+
+
+ group + +
+ string +
+
+ +
Source address.
+
+
+ icmp + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure ICMP parameters with mld.
+
+
+ source + +
+ string +
+
+ +
Group address.
+
+
+ multicast + +
+ dictionary +
+
+ +
Configure IP multicast global parameters for ipv6.
+
+
+ group_range_prefix_list + +
+ string +
+
+ +
Group range prefix-list policy for multicast boundary.
+
+
+ multipath + +
+ dictionary +
+
+ +
Configure ECMP multicast load splitting.
+
+
+ resilient + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure resilient RPF interface.
+
+
+ splitting_type + +
+ dictionary +
+
+ +
Configure multicast load splitting type.
+
+
+ none + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable multicast load splitting.
+
+
+ sg_hash + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure hash based on source and group address.
+
+
+ sg_hash_next_hop + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure hash based on source and group address and next-hop.
+
+
+ multicast + +
+ dictionary +
+
+ +
Configure IP multicast options.
+
+
+ service_reflect + +
+ list + / elements=dictionary +
+
+ +
Configure service reflect option.
+
+
+ map_to + +
+ string +
+
+ +
Map to interface.
+
+
+ service_interface + +
+ string +
+
+ +
configure service interface.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the VRF..
+
+
+ vni + +
+ dictionary +
+
+ +
Virtual Network Identifier.
+
+
+ layer_3 + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure Layer 3 VNI.
+
+
+ vni_number + +
+ integer +
+
+ +
VNI number.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the NX-OS device by executing the command show running-config | section ^vrf.
+
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • parsed
  • +
  • gathered
  • +
  • deleted
  • +
  • merged ←
  • +
  • replaced
  • +
  • rendered
  • +
  • overridden
  • +
  • purged
  • +
+
+
The state the configuration should be left in
+
The states rendered, gathered and parsed does not perform any change on the device.
+
The state rendered will transform the configuration in config option to platform specific CLI commands which will be returned in the rendered key within the result. For state rendered active connection to remote host is not required.
+
The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result.
+
The state parsed reads the configuration from running_config option and transforms it into JSON format as per the resource module parameters and the value is returned in the parsed key within the result. The value of running_config option should be the same format as the output of command show running-config | section ^vrf. connection to remote host is not required.
+
+
+ + +Notes +----- + +.. note:: + - Tested against NX-OS 9.3.6. + - This module works with connection ``network_cli`` and ``httpapi``. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.html + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # nxos#show running-config | section ^vrf + + - name: Merge provided VRF configuration + cisco.nxos.vrf_global: + config: + vrfs: + - name: testvrf + description: this is description + ip: + auto_discard: true + domain_list: + - example.net + - example.com + domain_name: test.com + icmp_err: + source_interface: + interface: port-channel + interface_value: '1' + igmp: + ssm_translate: + - group: 232.0.0.0/8 + source: 10.1.1.1 + - group: 239.1.2.3/24 + source: 192.168.1.1 + mroutes: + - group: 192.168.1.0/24 + source: 192.168.1.1 + - group: 192.168.1.0/24 + preference: 2 + source: 192.168.1.2 + vrf: temp1 + multicast: + multipath: + resilient: true + splitting_type: + legacy: true + rpf: + - group_list_range: 238.1.0.0/24 + vrf_name: temp1 + - group_list_range: 239.1.0.0/24 + vrf_name: temp1 + name_server: + address_list: + - 192.168.0.1 + - 192.168.0.2 + - 192.168.1.1 + - 192.169.1.3 + use_vrf: + source_address: 192.168.0.1 + vrf: temp1 + route: + - destination: 192.0.2.22 + source: 192.0.0.0/24 + - destination: 192.0.2.22 + source: 192.0.0.0/24 + vrf: temp1 + - destination: 192.0.2.22 + source: 192.0.2.0/24 + tags: + route_pref: 4 + tag_value: 2 + ipv6: + mld_ssm_translate: + - group: 'ff28::/16' + source: '2001:db8:0:abcd::2' + - group: 'ff30::/16' + source: '2001:db8:0:abcd::5' + multicast: + group_range_prefix_list: temp2 + multipath: + resilient: true + splitting_type: + none: true + multicast: + service_reflect: + - map_to: Ethernet2/2 + service_interface: Ethernet1/1 + - map_to: Ethernet4/2 + service_interface: Ethernet2/1 + vni: + vni_number: 5 + state: merged + + # Task Output: + # ------------ + + # before: {} + # commands: + # - vrf context test1 + # - description this is description + # - ip auto-discard + # - ip domain-name test.net + # - ip name-server 192.168.0.1 192.168.0.2 192.168.1.1 192.169.1.3 + # - ip icmp-errors source-interface port-channel 1 + # - ip multicast multipath resilient + # - ip multicast multipath legacy + # - ip name-server 192.168.0.1 use-vrf temp1 + # - vni 5 + # - ipv6 multicast group-range prefix-list temp2 + # - ipv6 multicast multipath resilient + # - ipv6 multicast multipath none + # - ip domain-list test.org + # - ip domain-list example.com + # - ip domain-list example.net + # - ip igmp ssm-translate 232.0.0.0/8 10.1.1.1 + # - ip igmp ssm-translate 239.1.2.3/24 192.168.1.1 + # - ip mroute 192.168.1.0/24 192.168.1.1 + # - ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1 + # - ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # - ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # - ip route 192.0.0.0/24 192.0.2.22 + # - ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # - ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # - multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2 + # - multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2 + # - ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2 + # - ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::5 + + # after: + # vrfs: + # - name: testvrf + # description: this is description + # ip: + # auto_discard: true + # domain_list: + # - example.net + # - example.com + # domain_name: test.com + # icmp_err: + # source_interface: + # interface: port-channel + # interface_value: '1' + # igmp: + # ssm_translate: + # - group: 232.0.0.0/8 + # source: 10.1.1.1 + # - group: 239.1.2.3/24 + # source: 192.168.1.1 + # mroutes: + # - group: 192.168.1.0/24 + # source: 192.168.1.1 + # - group: 192.168.1.0/24 + # preference: 2 + # source: 192.168.1.2 + # vrf: temp1 + # multicast: + # multipath: + # resilient: true + # splitting_type: + # legacy: true + # rpf: + # - group_list_range: 238.1.0.0/24 + # vrf_name: temp1 + # - group_list_range: 239.1.0.0/24 + # vrf_name: temp1 + # name_server: + # address_list: + # - 192.168.0.1 + # - 192.168.0.2 + # - 192.168.1.1 + # - 192.169.1.3 + # use_vrf: + # source_address: 192.168.0.1 + # vrf: temp1 + # route: + # - destination: 192.0.2.22 + # source: 192.0.0.0/24 + # - destination: 192.0.2.22 + # source: 192.0.0.0/24 + # vrf: temp1 + # - destination: 192.0.2.22 + # source: 192.0.2.0/24 + # tags: + # route_pref: 4 + # tag_value: 2 + # ipv6: + # mld_ssm_translate: + # - group: ff28::/16 + # source: 2001:db8:0:abcd::2 + # - group: ff30::/16 + # source: 2001:db8:0:abcd::5 + # multicast: + # group_range_prefix_list: temp2 + # multipath: + # resilient: true + # splitting_type: + # none: true + # multicast: + # service_reflect: + # - map_to: Ethernet2/2 + # service_interface: Ethernet1/1 + # - map_to: Ethernet4/2 + # service_interface: Ethernet2/1 + # vni: + # vni_number: 5 + + # After state: + # ------------ + # + # nxos#show running-config | section ^vrf + # vrf context testvrf + # description this is description + # ip auto-discard + # ip domain-name test.net + # ip name-server 192.168.0.1 192.168.0.2 192.168.1.1 192.169.1.3 + # ip icmp-errors source-interface port-channel 1 + # ip multicast multipath resilient + # ip multicast multipath legacy + # ip name-server 192.168.0.1 use-vrf temp1 + # vni 5 + # ipv6 multicast group-range prefix-list temp2 + # ipv6 multicast multipath resilient + # ipv6 multicast multipath none + # ip domain-list test.org + # ip domain-list example.com + # ip domain-list example.net + # ip igmp ssm-translate 232.0.0.0/8 10.1.1.1 + # ip igmp ssm-translate 239.1.2.3/24 192.168.1.1 + # ip mroute 192.168.1.0/24 192.168.1.1 + # ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1 + # ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # ip route 192.0.0.0/24 192.0.2.22 + # ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2 + # multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2 + # ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2 + # ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::5 + + # Using deleted + + # Before state: + # ------------- + # + # nxos#show running-config | section ^vrf + # vrf context management + # ip name-server 192.168.255.1 + # ip route 0.0.0.0/0 192.168.255.1 + # vrf context test1 + # description this is description + # ip domain-name test.net + # ip domain-list example.net + # ip domain-list example.com + # ip domain-list test.org + # vni 5 + # ip auto-discard + # ip route 192.0.0.0/24 192.0.2.22 + # ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # ip mroute 192.168.1.0/24 192.168.1.1 + # ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1 + # ip icmp-errors source-interface po1 + # ip igmp ssm-translate 232.0.0.0/8 10.1.1.1 + # ip igmp ssm-translate 239.1.2.3/24 192.168.1.1 + # ip multicast multipath legacy + # ip multicast multipath resilient + # ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # ip multicast group-range prefix-list temp2 + + - name: Delete VRF configuration + cisco.nxos.vrf_global: + config: + vrfs: + - name: test1 + state: deleted + + # Task Output: + # ------------ + # + # before: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + # - name: test1 + # description: this is description + # ip: + # domain_name: test.net + # domain_list: + # - test.org + # - example.net + # - example.com + # auto_discard: true + # route: + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + # vrf: temp1 + # - source: 192.0.2.0/24 + # destination: 192.0.2.22 + # tags: + # tag_value: 2 + # route_pref: 4 + # mroutes: + # - group: 192.168.1.0/24 + # source: 192.168.1.1 + # - group: 192.168.1.0/24 + # source: 192.168.1.2 + # preference: 2 + # vrf: temp1 + # icmp_err: + # source_interface: + # interface: port-channel + # interface_value: '1' + # igmp: + # ssm_translate: + # - group: 232.0.0.0/8 + # source: 10.1.1.1 + # - group: 239.1.2.3/24 + # source: 192.168.1.1 + # multicast: + # multipath: + # splitting_type: + # legacy: true + # resilient: true + # rpf: + # - vrf_name: temp1 + # group_list_range: 238.1.0.0/24 + # - vrf_name: temp1 + # group_list_range: 239.1.0.0/24 + # vni: + # vni_number: 5 + + # commands: + # - vrf context test1 + # - no description this is description + # - no ip auto-discard + # - no ip domain-name test.net + # - no ip icmp-errors source-interface port-channel 1 + # - no ip multicast multipath resilient + # - no ip multicast multipath legacy + # - no vni 5 + # - no ip domain-list example.net + # - no ip domain-list test.org + # - no ip domain-list example.com + # - no ip igmp ssm-translate 232.0.0.0/8 10.1.1.1 + # - no ip igmp ssm-translate 239.1.2.3/24 192.168.1.1 + # - no ip mroute 192.168.1.0/24 192.168.1.1 + # - no ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1 + # - no ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # - no ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # - no ip route 192.0.0.0/24 192.0.2.22 + # - no ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # - no ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # + # after: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + # - name: test1 + + # Using deleted with empty config + + # Before state: + # ------------- + # + # nxos#show running-config | section ^vrf + # vrf context management + # ip name-server 192.168.255.1 + # ip route 0.0.0.0/0 192.168.255.1 + # vrf context test1 + # description this is description + # ip domain-name test.net + # ip domain-list example.net + # ip domain-list example.com + # ip domain-list test.org + # vni 5 + + - name: Delete VRF configuration + cisco.nxos.vrf_global: + config: + vrfs: + - name: test1 + state: deleted + + # Task Output: + # ------------ + # + # before: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + # - name: test1 + # description: this is description + # ip: + # domain_name: test.net + # domain_list: + # - test.org + # - example.net + # - example.com + # vni: + # vni_number: 5 + + # commands: + # - vrf context management + # - no ip name-server 192.168.255.1 + # - no ip route 0.0.0.0/0 192.168.255.1 + # - vrf context test1 + # - no description this is description + # - no ip domain-name test.net + # - no vni 5 + # - no ip domain-list example.net + # - no ip domain-list test.org + # - no ip domain-list example.com + + # after: + # vrfs: + # - name: management + # - name: test1 + + # Using purged + + # Before state: + # ------------- + # + # nxos#show running-config | section ^vrf + # vrf context management + # ip name-server 192.168.255.1 + # ip route 0.0.0.0/0 192.168.255.1 + # vrf context test1 + # description this is description + # ip domain-name example.com + # ip domain-list example.net + # ip domain-list example.org + # vni 5 + # ip auto-discard + # ip route 192.0.0.0/24 192.0.2.22 + # ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # vrf context test2 + # description test description + # ip auto-discard + # ip domain-name test.com + + - name: Override VRF configuration + cisco.nxos.vrf_global: + config: + vrfs: + - name: test1 + - name: test2 + state: purged + + # Task Output: + # ------------ + # + # before: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + # - name: test1 + # description: this is description + # ip: + # domain_name: example.com + # domain_list: + # - example.net + # - example.org + # auto_discard: true + # route: + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + # vrf: temp1 + # - source: 192.0.2.0/24 + # destination: 192.0.2.22 + # tags: + # tag_value: 2 + # route_pref: 4 + # vni: + # vni_number: 5 + # - name: test2 + # description: test description + # ip: + # auto_discard: true + # domain_name: test.com + # + # commands: + # - no vrf context test1 + # - no vrf context test2 + # + # after: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + + # Using overridden + + # Before state: + # ------------- + # + # nxos#show running-config | section ^vrf + # vrf context management + # ip name-server 192.168.255.1 + # ip route 0.0.0.0/0 192.168.255.1 + # vrf context test1 + # description this is description + # ip domain-name example.com + # ip domain-list example.net + # ip domain-list example.org + # vni 5 + # ip auto-discard + # ip route 192.0.0.0/24 192.0.2.22 + # ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # vrf context test2 + # description test description + # ip auto-discard + # ip domain-name test.com + + - name: Override VRF configuration + cisco.nxos.vrf_global: + config: + vrfs: + - name: management + ip: + name_server: + address_list: + - 192.168.255.1 + route: + - source: 0.0.0.0/0 + destination: 192.168.255.1 + - name: test1 + ip: + auto_discard: false + name_server: + address_list: + - 192.168.255.1 + route: + - source: 192.0.0.0/24 + destination: 192.0.2.22 + state: overridden + + # Task Output: + # ------------ + # + # before: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + # - name: test1 + # description: this is description + # ip: + # domain_name: example.com + # domain_list: + # - example.net + # - example.org + # auto_discard: true + # route: + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + # vrf: temp1 + # - source: 192.0.2.0/24 + # destination: 192.0.2.22 + # tags: + # tag_value: 2 + # route_pref: 4 + # vni: + # vni_number: 5 + # - name: test2 + # description: test description + # ip: + # auto_discard: true + # domain_name: test.com + # + # commands: + # - vrf context test1 + # - no description this is description + # - no ip domain-name example.com + # - no ip domain-list example.net + # - no ip domain-list example.org + # - ip name-server 192.168.255.1 + # - no ip auto-discard + # - no vni 5 + # - no ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # - no ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # - vrf context test2 + # - no description test description + # - no ip auto-discard + # - no ip domain-name test.com + # + # after: + # vrfs: + # - name: management + # ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 0.0.0.0/0 + # destination: 192.168.255.1 + # - name: test1 + # ip: + # auto_discard: false + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - source: 192.0.0.0/24 + # destination: 192.0.2.22 + + # Using replaced + + # Before state: + # ------------- + # + # nxos# show running-config | section ^vrf + # vrf context management + # ip name-server 192.168.255.1 + # ip route 0.0.0.0/0 192.168.255.1 + # vrf context temp + # ip domain-name test.org + # ip domain-list example.net + # ip domain-list example.com + # ip domain-list test.org + # ip name-server 192.168.0.1 192.169.1.3 + # ip name-server 192.168.0.1 use-vrf temp1 + # multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2 + # multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2 + # description this is descrition + # vni 5 + # ip auto-discard + # ip route 192.0.0.0/24 192.0.2.22 + # ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # ip mroute 192.168.1.0/24 192.168.1.1 + # ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1 + # ip icmp-errors source-interface po1 + # ip igmp ssm-translate 232.0.0.0/8 10.1.1.1 + # ip igmp ssm-translate 239.1.2.3/24 192.168.1.1 + # ip multicast multipath legacy + # ip multicast multipath resilient + # ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # ip multicast group-range prefix-list temp2 + # ipv6 multicast multipath none + # ipv6 multicast multipath resilient + # ipv6 multicast group-range prefix-list temp2 + # ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2 + # ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::1 + # ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::2 + # ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::3 + + - name: Replaced state for VRF configuration + cisco.nxos.nxos_vrf_global: + config: + vrfs: + - ip: + name_server: + address_list: + - 192.168.255.1 + route: + - destination: 192.168.255.1 + source: 0.0.0.0/0 + name: management + - name: temp + description: Test + ip: + auto_discard: true + domain_list: + - invalid.com + - example.com + domain_name: test.org + state: replaced + + # Task Output: + # ------------ + # + # before: + # vrfs: + # - ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - destination: 192.168.255.1 + # source: 0.0.0.0/0 + # name: management + # - description: this is descrition + # ip: + # auto_discard: true + # domain_list: + # - example.net + # - test.org + # - example.com + # domain_name: test.org + # icmp_err: + # source_interface: + # interface: port-channel + # interface_value: '1' + # igmp: + # ssm_translate: + # - group: 232.0.0.0/8 + # source: 10.1.1.1 + # - group: 239.1.2.3/24 + # source: 192.168.1.1 + # mroutes: + # - group: 192.168.1.0/24 + # source: 192.168.1.1 + # - group: 192.168.1.0/24 + # preference: 2 + # source: 192.168.1.2 + # vrf: temp1 + # multicast: + # multipath: + # resilient: true + # splitting_type: + # legacy: true + # rpf: + # - group_list_range: 238.1.0.0/24 + # vrf_name: temp1 + # - group_list_range: 239.1.0.0/24 + # vrf_name: temp1 + # name_server: + # address_list: + # - 192.168.0.1 + # - 192.169.1.3 + # use_vrf: + # source_address: 192.168.0.1 + # vrf: temp1 + # route: + # - destination: 192.0.2.22 + # source: 192.0.0.0/24 + # - destination: 192.0.2.22 + # source: 192.0.0.0/24 + # vrf: temp1 + # - destination: 192.0.2.22 + # source: 192.0.2.0/24 + # tags: + # route_pref: 4 + # tag_value: 2 + # ipv6: + # mld_ssm_translate: + # - group: ff28::/16 + # source: 2001:db8:0:abcd::2 + # - group: ff30::/16 + # source: 2001:db8:0:abcd::1 + # - group: ff32::/16 + # source: 2001:db8:0:abcd::2 + # - group: ff32::/16 + # source: 2001:db8:0:abcd::3 + # multicast: + # group_range_prefix_list: temp2 + # multipath: + # resilient: true + # splitting_type: + # none: true + # multicast: + # service_reflect: + # - map_to: Ethernet2/2 + # service_interface: Ethernet1/1 + # - map_to: Ethernet4/2 + # service_interface: Ethernet2/1 + # name: temp + # vni: + # vni_number: 5 + # + # commands: + # - vrf context temp + # - description Test + # - no ip name-server 192.168.0.1 192.169.1.3 + # - no ip icmp-errors source-interface port-channel 1 + # - no ip multicast multipath resilient + # - no ip multicast multipath legacy + # - no ip name-server 192.168.0.1 use-vrf temp1 + # - no vni 5 + # - no ipv6 multicast group-range prefix-list temp2 + # - no ipv6 multicast multipath resilient + # - no ipv6 multicast multipath none + # - ip domain-list invalid.com + # - no ip domain-list example.net + # - no ip domain-list test.org + # - no ip igmp ssm-translate 232.0.0.0/8 10.1.1.1 + # - no ip igmp ssm-translate 239.1.2.3/24 192.168.1.1 + # - no ip mroute 192.168.1.0/24 192.168.1.1 + # - no ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1 + # - no ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # - no ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # - no ip route 192.0.0.0/24 192.0.2.22 + # - no ip route 192.0.0.0/24 192.0.2.22 vrf temp1 + # - no ip route 192.0.2.0/24 192.0.2.22 tag 2 4 + # - no multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2 + # - no multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2 + # - no ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2 + # - no ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::1 + # - no ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::2 + # - no ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::3 + # + # after: + # vrfs: + # - ip: + # name_server: + # address_list: + # - 192.168.255.1 + # route: + # - destination: 192.168.255.1 + # source: 0.0.0.0/0 + # name: management + # - description: Test + # ip: + # auto_discard: true + # domain_list: + # - invalid.com + # - example.com + # domain_name: test.org + # multicast: + # rpf: + # - group_list_range: 238.1.0.0/24 + # vrf_name: temp1 + # - group_list_range: 239.1.0.0/24 + # vrf_name: temp1 + # + # After state: + # ------------ + # router-ios#show running-config | section ^vrf + # vrf context management + # ip name-server 192.168.255.1 + # ip route 0.0.0.0/0 192.168.255.1 + # vrf context temp + # ip domain-name test.org + # ip domain-list example.com + # ip domain-list invalid.com + # description Test + # ip auto-discard + # ip multicast rpf select vrf temp1 group-list 238.1.0.0/24 + # ip multicast rpf select vrf temp1 group-list 239.1.0.0/24 + # ip multicast group-range prefix-list temp2 + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ dictionary +
+
when changed +
The resulting configuration after module execution.
+
+
Sample:
+
This output will always be in the same format as the module argspec.
+
+
+ before + +
+ dictionary +
+
when state is merged, replaced, overridden, deleted or purged +
The configuration prior to the module execution.
+
+
Sample:
+
This output will always be in the same format as the module argspec.
+
+
+ commands + +
+ list +
+
when state is merged, replaced, overridden, deleted or purged +
The set of commands pushed to the remote device.
+
+
Sample:
+
['vrf context management', 'description this is management vrf', 'ip domain-name example.com']
+
+
+ gathered + +
+ dictionary +
+
when state is gathered +
Facts about the network resource gathered from the remote device as structured data.
+
+
Sample:
+
This output will always be in the same format as the module argspec.
+
+
+ parsed + +
+ dictionary +
+
when state is parsed +
The device native config provided in running_config option parsed into structured data as per module argspec.
+
+
Sample:
+
This output will always be in the same format as the module argspec.
+
+
+ rendered + +
+ list +
+
when state is rendered +
The provided configuration in the task rendered in device-native format (offline).
+
+
Sample:
+
['vrf context test1', 'description This is a test VRF', 'ip route 192.0.0.0/24 192.0.2.22']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Vinay Mulugund (@roverflow) diff --git a/plugins/module_utils/network/nxos/argspec/bgp_global/bgp_global.py b/plugins/module_utils/network/nxos/argspec/bgp_global/bgp_global.py index 3f17ccebc..db8c423a4 100644 --- a/plugins/module_utils/network/nxos/argspec/bgp_global/bgp_global.py +++ b/plugins/module_utils/network/nxos/argspec/bgp_global/bgp_global.py @@ -187,6 +187,15 @@ class Bgp_globalArgs(object): # pylint: disable=R0903 }, }, "local_as": {"type": "str"}, + "local_as_config": { + "type": "dict", + "options": { + "as_number": {"type": "str"}, + "no_prepend": {"type": "bool"}, + "replace_as": {"type": "bool"}, + "dual_as": {"type": "bool"}, + }, + }, "log_neighbor_changes": { "type": "dict", "options": { @@ -423,6 +432,15 @@ class Bgp_globalArgs(object): # pylint: disable=R0903 }, }, "local_as": {"type": "str"}, + "local_as_config": { + "type": "dict", + "options": { + "as_number": {"type": "str"}, + "no_prepend": {"type": "bool"}, + "replace_as": {"type": "bool"}, + "dual_as": {"type": "bool"}, + }, + }, "log_neighbor_changes": { "type": "dict", "options": { diff --git a/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py b/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py index fe738d1af..22a745d6b 100644 --- a/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py +++ b/plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py @@ -61,6 +61,7 @@ def __init__(self, module): "bestpath.med.non_deterministic", "cluster_id", "local_as", + "local_as_config", "confederation.identifier", "graceful_restart", "graceful_restart.restart_time", @@ -212,6 +213,7 @@ def _compare_neighbors(self, want, have, vrf=None): "inherit.peer", "inherit.peer_session", "local_as", + "local_as_config", "log_neighbor_changes", "low_memory", "password", @@ -313,8 +315,20 @@ def _build_key(x): return (key_1, key_2, key_3, key_4) + def _update_as_numbers(x): + # Check if both 'local_as' and 'local_as_config' are in the dictionary + if "local_as" in x and "local_as_config" in x: + if x["local_as"] and "as_number" in x["local_as_config"]: + del x["local_as"] + + elif x["local_as"] and "as_number" not in x["local_as_config"]: + # Move 'as_number' from 'local_as' to 'local_as_config' + x["local_as_config"]["as_number"] = x["local_as"] + del x["local_as"] + if "neighbors" in entry: for x in entry["neighbors"]: + _update_as_numbers(x) # handle deprecated local_as with local_as_config if "path_attribute" in x: x["path_attribute"] = { _build_key(item): item for item in x.get("path_attribute", []) diff --git a/plugins/module_utils/network/nxos/rm_templates/bgp_global.py b/plugins/module_utils/network/nxos/rm_templates/bgp_global.py index 255ba7db2..913b24585 100644 --- a/plugins/module_utils/network/nxos/rm_templates/bgp_global.py +++ b/plugins/module_utils/network/nxos/rm_templates/bgp_global.py @@ -1010,20 +1010,31 @@ def __init__(self, lines=None, module=None): }, }, { - "name": "local_as", + "name": "local_as_config", "getval": re.compile( r""" \s+neighbor\s(?P\S+) - \slocal-as\s(?P\S+) + \slocal-as\s(?P\d+) + (\s(?Pno-prepend))? + (\s(?Preplace-as))? + (\s(?Pdual-as))? $""", re.VERBOSE, ), - "setval": "local-as {{ local_as }}", + "setval": "local-as {{ local_as_config.as_number|string }}" + "{{ (' no-prepend' ) if local_as_config.no_prepend|d(False) else '' }}" + "{{ (' replace-as' ) if local_as_config.replace_as|d(False) else '' }}" + "{{ (' dual-as' ) if local_as_config.dual_as|d(False) else '' }}", "result": { "vrfs": { '{{ "vrf_" + vrf|d() }}': { "neighbors": { "{{ neighbor_address }}": { - "local_as": "{{ local_as }}", + "local_as_config": { + "as_number": "{{ local_as }}", + "no_prepend": "{{ not not no_prepend }}", + "replace_as": "{{ not not replace_as }}", + "dual_as": "{{ not not dual_as }}", + }, }, }, }, diff --git a/plugins/modules/nxos_bgp_global.py b/plugins/modules/nxos_bgp_global.py index 59e7eefd7..9b04845f0 100644 --- a/plugins/modules/nxos_bgp_global.py +++ b/plugins/modules/nxos_bgp_global.py @@ -171,7 +171,7 @@ type: dict suboptions: set: - description: Activiate graceful-shutdown. + description: Activate graceful-shutdown. type: bool route_map: description: Apply route-map to modify attributes for outbound. @@ -252,7 +252,7 @@ description: Suppress 4-byte AS Capability. type: bool description: - description: Neighbor specific descripion. + description: Neighbor specific description. type: str disable_connected_check: description: Disable check for directly connected peer. @@ -294,8 +294,31 @@ description: Peer-session template to inherit. type: str local_as: - description: Specify the local-as number for the eBGP neighbor. + description: + - Specify the local-as number for the eBGP neighbor. + - B(Deprecated), Use local_as_config instead, the facts would always render local_as information as a part of local_as_config as_number + - This option has been deprecated and will be removed in a release after 2027-01-01. type: str + local_as_config: + description: Local Autonomous System Number options. + type: dict + suboptions: + as_number: + description: + - Set Specify the local-as number for the eBGP neighbor. + type: str + no_prepend: + description: + - Do not prepend the local-as number to updates from the eBGP neighbor. + type: bool + replace_as: + description: + - Prepend only the local-as number to updates to eBGP neighbor. + type: bool + dual_as: + description: + - Connect using either the local-as number or the real as. + type: bool log_neighbor_changes: description: Log message for neighbor up/down event. type: dict @@ -309,7 +332,7 @@ - Disable logging of neighbor up/down event. type: bool low_memory: - description: Behaviour in low memory situations. + description: Behavior in low memory situations. type: dict suboptions: exempt: diff --git a/tests/unit/modules/network/nxos/test_nxos_bgp_global.py b/tests/unit/modules/network/nxos/test_nxos_bgp_global.py index acf79b77e..50f4e78f4 100644 --- a/tests/unit/modules/network/nxos/test_nxos_bgp_global.py +++ b/tests/unit/modules/network/nxos/test_nxos_bgp_global.py @@ -1086,8 +1086,17 @@ def test_nxos_bgp_global_neighbor_3K(self): """\ router bgp 65535 neighbor 192.168.20.2 remote-as 56789 + local-as 65022 no-prepend replace-as dual-as address-family ipv4 unicast soft-reconfiguration inbound always + vrf bgp_vrf + local-as 651002 + address-family ipv4 unicast + network 10.0.6.1/24 + neighbor 10.239.0.13 + remote-as 65000 + local-as 65024 no-prepend replace-as + address-family ipv4 unicast """, ) self.get_config.return_value = "" @@ -1103,13 +1112,100 @@ def test_nxos_bgp_global_neighbor_3K(self): parsed = { "as_number": "65535", - "neighbors": [ + "vrfs": [ { - "neighbor_address": "192.168.20.2", - "remote_as": "56789", + "vrf": "bgp_vrf", + "local_as": "651002", + "neighbors": [ + { + "neighbor_address": "10.239.0.13", + "remote_as": "65000", + "local_as_config": { + "as_number": "65024", + "no_prepend": True, + "replace_as": True, + }, + }, + ], }, ], + "neighbors": [{"neighbor_address": "192.168.20.2", "remote_as": "56789"}], } result = self.execute_module(changed=False) self.assertEqual(result["parsed"], parsed) + + def test_nxos_bgp_global_rendered(self): + set_module_args( + dict( + config={ + "as_number": "123", + "neighbors": [ + { + "local_as_config": { + "as_number": "65022", + "dual_as": True, + "no_prepend": True, + "replace_as": True, + }, + "neighbor_address": "10.0.0.1", + }, + { + "local_as_config": { + "as_number": "65022", + "dual_as": True, + "no_prepend": True, + "replace_as": True, + }, + "local_as": "65001", + "neighbor_address": "10.0.0.2", + }, + { + "local_as_config": { + "dual_as": True, + "no_prepend": True, + "replace_as": True, + }, + "local_as": "65002", + "neighbor_address": "10.0.0.3", + }, + ], + "router_id": "1.1.1.1", + "vrfs": [ + { + "local_as": "651002", + "neighbors": [ + { + "local_as_config": { + "as_number": "65024", + "no_prepend": True, + "replace_as": True, + }, + "neighbor_address": "10.0.0.1", + "remote_as": "65000", + }, + ], + "vrf": "bgp_vrf", + }, + ], + }, + state="rendered", + ), + ) + rendered = [ + "router bgp 123", + "router-id 1.1.1.1", + "neighbor 10.0.0.1", + "local-as 65022 no-prepend replace-as dual-as", + "neighbor 10.0.0.2", + "local-as 65022 no-prepend replace-as dual-as", + "neighbor 10.0.0.3", + "local-as 65002 no-prepend replace-as dual-as", + "vrf bgp_vrf", + "local-as 651002", + "neighbor 10.0.0.1", + "remote-as 65000", + "local-as 65024 no-prepend replace-as", + ] + result = self.execute_module(changed=False) + self.assertEqual(sorted(result["rendered"]), sorted(rendered)) From 72225be5bada34c6ed669a3c416cc959270f55f3 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Mon, 19 Aug 2024 18:26:44 +0530 Subject: [PATCH 2/2] prep release 9.2.0 (#886) * prep release 9.2.0 * chore: auto fixes from pre-commit.com hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.rst | 13 +++++++++++++ changelogs/changelog.yaml | 13 +++++++++++++ changelogs/fragments/0-readme.yml | 3 --- changelogs/fragments/fix_local_as.yaml | 6 ------ changelogs/fragments/fix_pylint.yaml | 3 --- galaxy.yml | 2 +- 6 files changed, 27 insertions(+), 13 deletions(-) delete mode 100644 changelogs/fragments/0-readme.yml delete mode 100644 changelogs/fragments/fix_local_as.yaml delete mode 100644 changelogs/fragments/fix_pylint.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8f165e73d..c410b7bde 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,19 @@ Cisco Nxos Collection Release Notes .. contents:: Topics +v9.2.0 +====== + +Minor Changes +------------- + +- nxos_bgp_global - Deprecate local_as with local_as_config which supports more configuration attributes, under neighbor. + +Documentation Changes +--------------------- + +- nxos_bgp_global - Marks local_as under neighbor deprecated, and some documentation corrections. + v9.1.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index f6e25e774..a4cf490dd 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1208,3 +1208,16 @@ releases: - fix_820.yaml - nxos_vrf_global.yml release_date: "2024-08-05" + 9.2.0: + changes: + doc_changes: + - nxos_bgp_global - Marks local_as under neighbor deprecated, and some documentation + corrections. + minor_changes: + - nxos_bgp_global - Deprecate local_as with local_as_config which supports more + configuration attributes, under neighbor. + fragments: + - 0-readme.yml + - fix_local_as.yaml + - fix_pylint.yaml + release_date: "2024-08-19" diff --git a/changelogs/fragments/0-readme.yml b/changelogs/fragments/0-readme.yml deleted file mode 100644 index 6ae0307d2..000000000 --- a/changelogs/fragments/0-readme.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - README.md - Add Communication section with Forum information. diff --git a/changelogs/fragments/fix_local_as.yaml b/changelogs/fragments/fix_local_as.yaml deleted file mode 100644 index de9c6667b..000000000 --- a/changelogs/fragments/fix_local_as.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -minor_changes: - - nxos_bgp_global - Deprecate local_as with local_as_config which - supports more configuration attributes, under neighbor. -doc_changes: - - nxos_bgp_global - Marks local_as under neighbor deprecated, and some documentation corrections. diff --git a/changelogs/fragments/fix_pylint.yaml b/changelogs/fragments/fix_pylint.yaml deleted file mode 100644 index 84cc5904c..000000000 --- a/changelogs/fragments/fix_pylint.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - nxos_ping - Fixes pylint error where variables are potentially unbound. diff --git a/galaxy.yml b/galaxy.yml index 19eb0e665..743f6df6f 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,4 +10,4 @@ readme: README.md repository: https://github.com/ansible-collections/cisco.nxos issues: https://github.com/ansible-collections/cisco.nxos/issues tags: [cisco, nxos, networking, nxapi, netconf] -version: 9.1.0 +version: 9.2.0