From 6ef66e2de5d4dccb5242cd5cf0257b650be559d4 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Tue, 21 Nov 2023 12:54:15 +0530 Subject: [PATCH 01/27] Fix ansible-lint issues (#448) * Fix ansible-lint issues * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README.md * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update runtime.yml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix sanity * Delete tests/integration/network-integration.cfg * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * REvert --------- Co-authored-by: Ashwini Mhatre Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- ...isco.iosxr.iosxr_acl_interfaces_module.rst | 111 ++-- docs/cisco.iosxr.iosxr_acls_module.rst | 197 ++++---- docs/cisco.iosxr.iosxr_banner_module.rst | 2 +- ....iosxr.iosxr_bgp_address_family_module.rst | 48 +- docs/cisco.iosxr.iosxr_bgp_global_module.rst | 299 +++++------ ...sxr_bgp_neighbor_address_family_module.rst | 64 +-- ...cisco.iosxr.iosxr_bgp_templates_module.rst | 187 ++++--- docs/cisco.iosxr.iosxr_command_module.rst | 36 +- docs/cisco.iosxr.iosxr_config_module.rst | 14 +- docs/cisco.iosxr.iosxr_facts_module.rst | 20 +- docs/cisco.iosxr.iosxr_hostname_module.rst | 34 +- docs/cisco.iosxr.iosxr_interfaces_module.rst | 72 +-- ...cisco.iosxr.iosxr_l2_interfaces_module.rst | 101 ++-- ...cisco.iosxr.iosxr_l3_interfaces_module.rst | 74 +-- ...sco.iosxr.iosxr_lacp_interfaces_module.rst | 78 +-- ...isco.iosxr.iosxr_lag_interfaces_module.rst | 120 ++--- ...sco.iosxr.iosxr_lldp_interfaces_module.rst | 55 +- ...isco.iosxr.iosxr_logging_global_module.rst | 322 ++++++------ docs/cisco.iosxr.iosxr_logging_module.rst | 16 +- docs/cisco.iosxr.iosxr_ntp_global_module.rst | 278 +++++----- ...sco.iosxr.iosxr_ospf_interfaces_module.rst | 22 +- docs/cisco.iosxr.iosxr_ospfv2_module.rst | 229 ++++----- docs/cisco.iosxr.iosxr_ospfv3_module.rst | 11 +- .../cisco.iosxr.iosxr_prefix_lists_module.rst | 250 +++++---- docs/cisco.iosxr.iosxr_snmp_server_module.rst | 475 +++++++++--------- ...cisco.iosxr.iosxr_static_routes_module.rst | 233 +++++---- docs/cisco.iosxr.iosxr_system_module.rst | 22 +- docs/cisco.iosxr.iosxr_user_module.rst | 12 +- plugins/modules/iosxr_acl_interfaces.py | 111 ++-- plugins/modules/iosxr_acls.py | 197 ++++---- plugins/modules/iosxr_banner.py | 2 +- plugins/modules/iosxr_bgp_address_family.py | 48 +- plugins/modules/iosxr_bgp_global.py | 300 +++++------ .../iosxr_bgp_neighbor_address_family.py | 65 +-- plugins/modules/iosxr_bgp_templates.py | 187 ++++--- plugins/modules/iosxr_command.py | 36 +- plugins/modules/iosxr_config.py | 14 +- plugins/modules/iosxr_facts.py | 20 +- plugins/modules/iosxr_hostname.py | 34 +- plugins/modules/iosxr_interfaces.py | 72 +-- plugins/modules/iosxr_l2_interfaces.py | 104 ++-- plugins/modules/iosxr_l3_interfaces.py | 74 +-- plugins/modules/iosxr_lacp.py | 2 - plugins/modules/iosxr_lacp_interfaces.py | 80 ++- plugins/modules/iosxr_lag_interfaces.py | 122 +++-- plugins/modules/iosxr_lldp_global.py | 3 - plugins/modules/iosxr_lldp_interfaces.py | 56 ++- plugins/modules/iosxr_logging.py | 16 +- plugins/modules/iosxr_logging_global.py | 322 ++++++------ plugins/modules/iosxr_ntp_global.py | 278 +++++----- plugins/modules/iosxr_ospf_interfaces.py | 22 +- plugins/modules/iosxr_ospfv2.py | 229 ++++----- plugins/modules/iosxr_ospfv3.py | 11 +- plugins/modules/iosxr_prefix_lists.py | 250 +++++---- plugins/modules/iosxr_snmp_server.py | 475 +++++++++--------- plugins/modules/iosxr_static_routes.py | 233 +++++---- plugins/modules/iosxr_system.py | 22 +- plugins/modules/iosxr_user.py | 12 +- requirements.txt | 1 - tests/sanity/ignore-2.16.txt | 1 + tests/sanity/ignore-2.17.txt | 1 + 61 files changed, 3390 insertions(+), 3392 deletions(-) diff --git a/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst b/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst index c61999008..34b2b30f0 100644 --- a/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst @@ -240,27 +240,26 @@ Examples - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + - afi: ipv6 + acls: + - name: acl6_1 + direction: in + - name: acl6_2 + direction: out + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: out state: merged # After state: @@ -309,14 +308,14 @@ Examples - name: Update acl_interfaces configuration using merged cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: out - - name: acl_1 - direction: in + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: out + - name: acl_1 + direction: in state: merged # After state: @@ -363,15 +362,17 @@ Examples # ipv4 access-group acl_1 egress # ! - - name: Replace device configurations of listed interface with provided configurations + - name: >- + Replace device configurations of listed interface with provided + configurations cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - acls: - - name: acl6_3 - direction: in + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv6 + acls: + - name: acl6_3 + direction: in state: replaced # After state: @@ -418,16 +419,16 @@ Examples - name: Overridde all interface ACL configuration with provided configuration cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: in - - afi: ipv6 - acls: - - name: acl6_3 - direction: out + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: in + - afi: ipv6 + acls: + - name: acl6_3 + direction: out state: overridden # After state: @@ -474,7 +475,7 @@ Examples - name: Delete all ACL attributes of GigabitEthernet0/0/0/1 cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/1 + - name: GigabitEthernet0/0/0/1 state: deleted # After state: @@ -674,14 +675,14 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out state: rendered # Task Output (redacted) diff --git a/docs/cisco.iosxr.iosxr_acls_module.rst b/docs/cisco.iosxr.iosxr_acls_module.rst index e5ddf3321..32cf48121 100644 --- a/docs/cisco.iosxr.iosxr_acls_module.rst +++ b/docs/cisco.iosxr.iosxr_acls_module.rst @@ -4034,85 +4034,80 @@ Examples - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_acls: config: - - afi: ipv6 - acls: - - name: acl6_1 - aces: - - sequence: 10 - grant: deny - protocol: tcp - source: - prefix: 2001:db8:1234::/48 - port_protocol: - range: - start: ftp - end: telnet - destination: - any: true - protocol_options: - tcp: - syn: true - ttl: - range: - start: 180 - end: 250 - routing: true - authen: true - log: true - - - sequence: 20 - grant: permit - protocol: icmpv6 - source: - any: true - destination: - any: true - protocol_options: - icmpv6: - router_advertisement: true - precedence: network - destopts: true - - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 16 - remark: TEST_ACL_1_REMARK - - - sequence: 21 - grant: permit - protocol: tcp - source: - host: 192.0.2.10 - port_protocol: - range: - start: pop3 - end: 121 - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - protocol_options: - tcp: - rst: true - - - sequence: 23 - grant: deny - protocol: icmp - source: - any: true - destination: - prefix: 198.51.100.0/28 - protocol_options: - icmp: - reassembly_timeout: true - dscp: - lt: af12 - - - name: acl_2 - aces: - - sequence: 10 - remark: TEST_ACL_2_REMARK + - afi: ipv6 + acls: + - name: acl6_1 + aces: + - sequence: 10 + grant: deny + protocol: tcp + source: + prefix: '2001:db8:1234::/48' + port_protocol: + range: + start: ftp + end: telnet + destination: + any: true + protocol_options: + tcp: + syn: true + ttl: + range: + start: 180 + end: 250 + routing: true + authen: true + log: true + - sequence: 20 + grant: permit + protocol: icmpv6 + source: + any: true + destination: + any: true + protocol_options: + icmpv6: + router_advertisement: true + precedence: network + destopts: true + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 16 + remark: TEST_ACL_1_REMARK + - sequence: 21 + grant: permit + protocol: tcp + source: + host: 192.0.2.10 + port_protocol: + range: + start: pop3 + end: 121 + destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + protocol_options: + tcp: + rst: true + - sequence: 23 + grant: deny + protocol: icmp + source: + any: true + destination: + prefix: 198.51.100.0/28 + protocol_options: + icmp: + reassembly_timeout: true + dscp: + lt: af12 + - name: acl_2 + aces: + - sequence: 10 + remark: TEST_ACL_2_REMARK state: merged # Task Output @@ -4279,7 +4274,6 @@ Examples protocol_options: tcp: syn: true - - sequence: 23 protocol_options: icmp: @@ -4516,7 +4510,6 @@ Examples any: true ttl: eq: 100 - - sequence: 12 grant: deny source: @@ -4765,7 +4758,6 @@ Examples destination: any: true protocol: tcp - - name: acl_2 aces: - sequence: 20 @@ -5435,27 +5427,26 @@ Examples - name: Render platform specific commands (without connecting to the device) cisco.iosxr.iosxr_acls: config: - - afi: ipv4 - acls: - - name: acl_2 - aces: - - sequence: 11 - grant: permit - protocol: igmp - source: - host: 198.51.100.130 - destination: - any: true - ttl: - eq: 100 - - - sequence: 12 - grant: deny - source: - any: true - destination: - any: true - protocol: icmp + - afi: ipv4 + acls: + - name: acl_2 + aces: + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp state: rendered # Task Output (redacted) diff --git a/docs/cisco.iosxr.iosxr_banner_module.rst b/docs/cisco.iosxr.iosxr_banner_module.rst index 747571a97..46d105682 100644 --- a/docs/cisco.iosxr.iosxr_banner_module.rst +++ b/docs/cisco.iosxr.iosxr_banner_module.rst @@ -128,7 +128,7 @@ Examples - name: Configure banner from file cisco.iosxr.iosxr_banner: banner: motd - text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" + text: '{{ lookup(''file'', ''./config_partial/raw_banner.cfg'') }}' state: present diff --git a/docs/cisco.iosxr.iosxr_bgp_address_family_module.rst b/docs/cisco.iosxr.iosxr_bgp_address_family_module.rst index 8ad152d3b..5a3ae6c65 100644 --- a/docs/cisco.iosxr.iosxr_bgp_address_family_module.rst +++ b/docs/cisco.iosxr.iosxr_bgp_address_family_module.rst @@ -2663,17 +2663,17 @@ Examples cisco.iosxr.iosxr_bgp_address_family: state: merged config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 9 redistribute: - protocol: connected metric: 10 - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast dynamic_med: 10 redistribute: - protocol: application @@ -2768,10 +2768,10 @@ Examples cisco.iosxr.iosxr_bgp_address_family: state: replaced config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 10 # Task output @@ -2845,10 +2845,10 @@ Examples cisco.iosxr.iosxr_bgp_address_family: state: overridden config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 10 @@ -2939,17 +2939,17 @@ Examples cisco.iosxr.iosxr_bgp_address_family: state: rendered config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 9 redistribute: - protocol: connected metric: 10 - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast dynamic_med: 10 redistribute: - protocol: application @@ -2979,21 +2979,21 @@ Examples # # Using gathered # ------------- - - name: Merge the provided configuration with the existing running configuration + - name: Gather existing running configuration cisco.iosxr.iosxr_bgp_address_family: state: gathered config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 9 redistribute: - protocol: connected metric: 10 - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast dynamic_med: 10 redistribute: - protocol: application @@ -3031,8 +3031,8 @@ Examples # # Using parsed # - #parsed.cfg - #------------ + # parsed.cfg + # ------------ # router bgp 65536 # bgp router-id 192.0.1.1 # address-family ipv4 unicast diff --git a/docs/cisco.iosxr.iosxr_bgp_global_module.rst b/docs/cisco.iosxr.iosxr_bgp_global_module.rst index 1d2297c60..382bd6659 100644 --- a/docs/cisco.iosxr.iosxr_bgp_global_module.rst +++ b/docs/cisco.iosxr.iosxr_bgp_global_module.rst @@ -8997,45 +8997,44 @@ Examples # # Before state # ------------ - # RP/0/0/CPU0:10#show running-config router bgp # Thu Feb 4 09:38:36.245 UTC # % No such configuration item(s) # RP/0/0/CPU0:10# - - name: Merge the following BGP global configuration - cisco.iosxr.iosxr_bgp_global: - config: - as_number: 65536 - default_metric: 5 - socket: - receive_buffer_size: 514 - send_buffer_size: 4098 - bgp: - confederation: - identifier: 4 - bestpath: - med: - confed: True - cluster_id: 5 - router_id: 192.0.2.10 - neighbors: - - neighbor: 192.0.2.13 - remote_as: 65538 - bfd: - fast_detect: - strict_mode: True - multiplier: 6 - minimum_interval: 20 - vrfs: - - vrf: vrf1 - default_metric: 5 + - name: Merge the following BGP global configuration + cisco.iosxr.iosxr_bgp_global: + config: + as_number: 65536 + default_metric: 5 + socket: + receive_buffer_size: 514 + send_buffer_size: 4098 + bgp: + confederation: + identifier: 4 + bestpath: + med: + confed: true + cluster_id: 5 + router_id: 192.0.2.10 + neighbors: + - neighbor: 192.0.2.13 + remote_as: 65538 + bfd: + fast_detect: + strict_mode: true + multiplier: 6 + minimum_interval: 20 + vrfs: + - vrf: vrf1 + default_metric: 5 + # # Task Output: - # ------------ + # --------------- # # before: {} - # commands: # - router bgp 65536 # - bgp cluster-id 5 @@ -9129,37 +9128,38 @@ Examples # ! # ! - - name: Replace the following configuration - cisco.iosxr.iosxr_bgp_global: - state: replaced - config: - as_number: 65536 - default_metric: 4 - socket: - receive_buffer_size: 514 - send_buffer_size: 4098 - bgp: - confederation: - identifier: 4 - bestpath: - med: - confed: True - cluster_id: 5 - router_id: 192.0.2.10 - neighbors: - - neighbor: 192.0.2.14 - remote_as: 65538 - bfd: - fast_detect: - strict_mode: True - multiplier: 6 - minimum_interval: 20 - vrfs: - - vrf: vrf1 - default_metric: 5 + - name: Replace the following configuration + cisco.iosxr.iosxr_bgp_global: + state: replaced + config: + as_number: 65536 + default_metric: 4 + socket: + receive_buffer_size: 514 + send_buffer_size: 4098 + bgp: + confederation: + identifier: 4 + bestpath: + med: + confed: true + cluster_id: 5 + router_id: 192.0.2.10 + neighbors: + - neighbor: 192.0.2.14 + remote_as: 65538 + bfd: + fast_detect: + strict_mode: true + multiplier: 6 + minimum_interval: 20 + vrfs: + - vrf: vrf1 + default_metric: 5 + # # Task Output: - # ------------ + # ------------- # # before: # as_number: '65536' @@ -9273,37 +9273,37 @@ Examples # ! # ! - - name: Override running config with provided configuration - cisco.iosxr.iosxr_bgp_global: - state: overridden - config: - as_number: 65536 - default_metric: 4 - socket: - receive_buffer_size: 514 - send_buffer_size: 4098 - bgp: - confederation: - identifier: 4 - bestpath: - med: - confed: True - cluster_id: 5 - router_id: 192.0.2.10 - neighbors: - - neighbor: 192.0.2.14 - remote_as: 65538 - bfd: - fast_detect: - strict_mode: True - multiplier: 6 - minimum_interval: 20 - vrfs: - - vrf: vrf1 - default_metric: 5 + - name: Override running config with provided configuration + cisco.iosxr.iosxr_bgp_global: + state: overridden + config: + as_number: 65536 + default_metric: 4 + socket: + receive_buffer_size: 514 + send_buffer_size: 4098 + bgp: + confederation: + identifier: 4 + bestpath: + med: + confed: true + cluster_id: 5 + router_id: 192.0.2.10 + neighbors: + - neighbor: 192.0.2.14 + remote_as: 65538 + bfd: + fast_detect: + strict_mode: true + multiplier: 6 + minimum_interval: 20 + vrfs: + - vrf: vrf1 + default_metric: 5 # # Task Output: - # ------------ + # ------------- # # before: # as_number: '65536' @@ -9418,14 +9418,15 @@ Examples # ! # - - name: Delete BGP configurations handled by this module - cisco.iosxr.iosxr_bgp_global: - config: - as_number: 65536 - state: deleted + - name: Delete BGP configurations handled by this module + cisco.iosxr.iosxr_bgp_global: + config: + as_number: 65536 + state: deleted + # # Task Output: - # ------------ + # ------------- # # before: # as_number: '65536' @@ -9504,13 +9505,13 @@ Examples # ! # - - name: Purge all BGP configurations from the device - cisco.iosxr.iosxr_bgp_global: - state: purged + - name: Purge all BGP configurations from the device + cisco.iosxr.iosxr_bgp_global: + state: purged # # Task Output: - # ------------ + # ------------- # # before: # as_number: '65536' @@ -9550,49 +9551,54 @@ Examples # Thu Feb 4 09:38:36.245 UTC # % No such configuration item(s) # RP/0/0/CPU0:10# + # - # Using replaced # - - name: Render platform specific configuration lines (without connecting to the device) - cisco.iosxr.iosxr_bgp_global: - state: rendered - config: - as_number: 1 - default_metric: 4 - vrfs: - - vrf: vrf3 - bfd: - minimum_interval: 20 - multiplier: 10 - bgp: - fast_external_fallover: - disable: True - router_id: 1.2.3.4 - auto_policy_soft_reset: - disable: True - timers: - keepalive_time: 20 - holdtime: 30 - - vrf: vrf2 - bgp: - enforce_first_as: - disable: True - default_metric: 4 - neighbors: - - neighbor: 1.1.1.3 - remote_as: 2 - graceful_maintenance: - set: True - activate: - inheritance_disable: True - local_preference: - value: 1 - as_prepends: - value: 2 + # Using Rendered + # ----------------- + # + - name: >- + Render platform specific configuration lines (without connecting to the + device) + cisco.iosxr.iosxr_bgp_global: + state: rendered + config: + as_number: 1 + default_metric: 4 + vrfs: + - vrf: vrf3 + bfd: + minimum_interval: 20 + multiplier: 10 + bgp: + fast_external_fallover: + disable: true + router_id: 1.2.3.4 + auto_policy_soft_reset: + disable: true + timers: + keepalive_time: 20 + holdtime: 30 + - vrf: vrf2 + bgp: + enforce_first_as: + disable: true + default_metric: 4 + neighbors: + - neighbor: 1.1.1.3 + remote_as: 2 + graceful_maintenance: + set: true + activate: + inheritance_disable: true + local_preference: + value: 1 + as_prepends: + value: 2 - # Task Output: - # ------------ # + # Task output + # ----------------------- # rendered: # - router bgp 1 # - default-metric 4 @@ -9638,14 +9644,13 @@ Examples # ! # - - name: Parse externally provided BGP config - cisco.iosxr.iosxr_bgp_global: - running_config: "{{ lookup('file', 'parsed.cfg') }}" - state: parsed + - name: Parse externally provided BGP config + cisco.iosxr.iosxr_bgp_global: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed - # Task Output: - # ------------ - # + # Task output + # ----------------------- # parsed: # as_number: '65536' # bgp: @@ -9699,9 +9704,9 @@ Examples # ! # ! - - name: Gather bgp global facts - cisco.iosxr.iosxr_bgp_global: - state: gathered + - name: Gather bgp global facts + cisco.iosxr.iosxr_bgp_global: + state: gathered # Task Output: # ------------ diff --git a/docs/cisco.iosxr.iosxr_bgp_neighbor_address_family_module.rst b/docs/cisco.iosxr.iosxr_bgp_neighbor_address_family_module.rst index 74e3b014b..271fa5ffb 100644 --- a/docs/cisco.iosxr.iosxr_bgp_neighbor_address_family_module.rst +++ b/docs/cisco.iosxr.iosxr_bgp_neighbor_address_family_module.rst @@ -3583,16 +3583,16 @@ Examples neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true weight: 5 - neighbor_address: 192.0.2.3 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -3602,8 +3602,8 @@ Examples neighbors: - neighbor_address: 192.0.2.4 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -3612,8 +3612,8 @@ Examples neighbors: - neighbor_address: 192.0.2.5 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -3765,7 +3765,7 @@ Examples # capability orf prefix both # default-originate - - name: Delete the provided configuration + - name: Delete the provided configuration cisco.iosxr.iosxr_bgp_neighbor_address_family: state: deleted config: @@ -3773,8 +3773,8 @@ Examples neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -3868,8 +3868,8 @@ Examples neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast default_originate: set: true weight: 4 @@ -3996,7 +3996,7 @@ Examples # capability orf prefix both # default-originate - - name: override the provided configuration + - name: override the provided configuration cisco.iosxr.iosxr_bgp_neighbor_address_family: state: overridden config: @@ -4004,8 +4004,8 @@ Examples neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -4077,7 +4077,9 @@ Examples # neighbor 192.0.2.5 # remote-as 65540 - - name: Render platform specific configuration lines with state rendered (without connecting to the device) + - name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_bgp_neighbor_address_family: state: rendered config: @@ -4085,16 +4087,16 @@ Examples neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true weight: 5 - neighbor_address: 192.0.2.3 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -4104,8 +4106,8 @@ Examples neighbors: - neighbor_address: 192.0.2.4 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -4114,8 +4116,8 @@ Examples neighbors: - neighbor_address: 192.0.2.5 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -4149,8 +4151,8 @@ Examples # # Using parsed # - #parsed.cfg - #------------ + # parsed.cfg + # ------------ # router bgp 65536 # bgp router-id 192.0.1.1 # address-family ipv4 unicast @@ -4232,8 +4234,8 @@ Examples # capability_orf_prefix: both # # - #Using Gathered - #----------------- + # Using Gathered + # ----------------- # Before state state: # ------------- # RP/0/0/CPU0:iosxr-02#show running-config router bgp @@ -4275,8 +4277,8 @@ Examples # - name: Gathered the provided configuration with the existing running configuration cisco.iosxr.iosxr_bgp_neighbor_address_family: - config: - state: gathered + config: + state: gathered # Task output diff --git a/docs/cisco.iosxr.iosxr_bgp_templates_module.rst b/docs/cisco.iosxr.iosxr_bgp_templates_module.rst index 3dbc6cae0..ed91c05d2 100644 --- a/docs/cisco.iosxr.iosxr_bgp_templates_module.rst +++ b/docs/cisco.iosxr.iosxr_bgp_templates_module.rst @@ -4628,52 +4628,52 @@ Examples - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_bgp_templates: config: - as_number: 65536 - neighbor: - - address_family: - - advertise: - local_labeled_route: - set: true - afi: ipv4 - safi: unicast - advertisement_interval: 10 - bfd: - fast_detect: - strict_mode: true - internal_vpn_client: true - name: neighbor-group1 - precedence: critical - - cluster_id: "1" - description: neighbor-group2 - dmz_link_bandwidth: - set: true - ebgp_multihop: - value: 255 - egress_engineering: - set: true - graceful_maintenance: - as_prepends: - value: 0 - set: true - ignore_connected_check: - set: true - internal_vpn_client: true - local: - address: - inheritance_disable: true - local_as: - value: 6 - name: neighbor-group2 - precedence: flash - receive_buffer_size: 512 - send_buffer_size: 4096 - session_open_mode: both - tcp: - mss: - inheritance_disable: true - ttl_security: - set: true - update_source: Loopback919 + as_number: 65536 + neighbor: + - address_family: + - advertise: + local_labeled_route: + set: true + afi: ipv4 + safi: unicast + advertisement_interval: 10 + bfd: + fast_detect: + strict_mode: true + internal_vpn_client: true + name: neighbor-group1 + precedence: critical + - cluster_id: '1' + description: neighbor-group2 + dmz_link_bandwidth: + set: true + ebgp_multihop: + value: 255 + egress_engineering: + set: true + graceful_maintenance: + as_prepends: + value: 0 + set: true + ignore_connected_check: + set: true + internal_vpn_client: true + local: + address: + inheritance_disable: true + local_as: + value: 6 + name: neighbor-group2 + precedence: flash + receive_buffer_size: 512 + send_buffer_size: 4096 + session_open_mode: both + tcp: + mss: + inheritance_disable: true + ttl_security: + set: true + update_source: Loopback919 state: merged # Task Output @@ -4833,29 +4833,29 @@ Examples - name: Replaced given bgp_templates configuration cisco.iosxr.iosxr_bgp_templates: - config: - as_number: 65536 - neighbor: - - address_family: - - advertise: - local_labeled_route: - set: true - afi: ipv4 - safi: unicast - advertisement_interval: 12 - name: neighbor-group1 - precedence: flash - - cluster_id: "2" - description: replace neighbor-group2 - ebgp_multihop: - value: 254 - graceful_maintenance: - as_prepends: - value: 2 - set: true - update_source: Loopback917 - name: neighbor-group2 - state: replaced + config: + as_number: 65536 + neighbor: + - address_family: + - advertise: + local_labeled_route: + set: true + afi: ipv4 + safi: unicast + advertisement_interval: 12 + name: neighbor-group1 + precedence: flash + - cluster_id: '2' + description: replace neighbor-group2 + ebgp_multihop: + value: 254 + graceful_maintenance: + as_prepends: + value: 2 + set: true + update_source: Loopback917 + name: neighbor-group2 + state: replaced # Task Output # ----------- @@ -5004,8 +5004,8 @@ Examples - name: Delete given bgp_nbr_address_family configuration cisco.iosxr.iosxr_bgp_templates: &deleted - config: - state: deleted + config: + state: deleted # Task Output # ----------- @@ -5045,8 +5045,6 @@ Examples # # RP/0/RP0/CPU0:10# - - # Using gathered # Before state: # ------------- @@ -5087,8 +5085,8 @@ Examples - name: Gather given bgp_templates configuration cisco.iosxr.iosxr_bgp_templates: &id001 - config: - state: gathered + config: + state: gathered # Task output # ----------- @@ -5179,25 +5177,24 @@ Examples # internal-vpn-client # ! # ! - - name: override given bgp_templates configuration cisco.iosxr.iosxr_bgp_templates: - config: - as_number: 65536 - neighbor: - - address_family: - - advertise: - local_labeled_route: - disable: true - afi: ipv4 - safi: unicast - advertisement_interval: 12 - bfd: - fast_detect: - strict_mode: true - name: neighbor-group1 - precedence: flash - state: overridden + config: + as_number: 65536 + neighbor: + - address_family: + - advertise: + local_labeled_route: + disable: true + afi: ipv4 + safi: unicast + advertisement_interval: 12 + bfd: + fast_detect: + strict_mode: true + name: neighbor-group1 + precedence: flash + state: overridden # Task Output # ----------- @@ -5276,7 +5273,9 @@ Examples # Using rendered - - name: Render platform specific configuration lines with state rendered (without connecting to the device) + - name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_bgp_templates: config: as_number: 65536 @@ -5294,7 +5293,7 @@ Examples internal_vpn_client: true name: neighbor-group1 precedence: critical - - cluster_id: "1" + - cluster_id: '1' description: neighbor-group2 dmz_link_bandwidth: set: true diff --git a/docs/cisco.iosxr.iosxr_command_module.rst b/docs/cisco.iosxr.iosxr_command_module.rst index 7d77a4e76..fa3db325e 100644 --- a/docs/cisco.iosxr.iosxr_command_module.rst +++ b/docs/cisco.iosxr.iosxr_command_module.rst @@ -153,32 +153,32 @@ Examples - name: run multiple commands on remote nodes cisco.iosxr.iosxr_command: commands: - - show version - - show interfaces - - {command: example command that prompts, prompt: expected prompt, answer: yes} + - show version + - show interfaces + - {command: example command that prompts, prompt: expected prompt, answer: true} - name: run multiple commands and evaluate the output cisco.iosxr.iosxr_command: commands: - - show version - - show interfaces + - show version + - show interfaces wait_for: - - result[0] contains IOS-XR - - result[1] contains Loopback0 + - result[0] contains IOS-XR + - result[1] contains Loopback0 - - name: multiple prompt, multiple answer (mandatory check for all prompts) + - name: 'multiple prompt, multiple answer (mandatory check for all prompts)' cisco.iosxr.iosxr_command: commands: - - command: key config-key password-encryption - prompt: - - "Enter old key :" - - "Enter new key :" - - "Enter confirm key :" - answer: - - "test1234" - - "test12345" - - "test12345" - check_all: true + - command: key config-key password-encryption + prompt: + - 'Enter old key :' + - 'Enter new key :' + - 'Enter confirm key :' + answer: + - test1234 + - test12345 + - test12345 + check_all: true diff --git a/docs/cisco.iosxr.iosxr_config_module.rst b/docs/cisco.iosxr.iosxr_config_module.rst index a358ac0ec..28c4c4b37 100644 --- a/docs/cisco.iosxr.iosxr_config_module.rst +++ b/docs/cisco.iosxr.iosxr_config_module.rst @@ -375,28 +375,26 @@ Examples - name: configure interface settings cisco.iosxr.iosxr_config: lines: - - description test interface - - ip address 172.31.1.1 255.255.255.0 + - description test interface + - ip address 172.31.1.1 255.255.255.0 parents: interface GigabitEthernet0/0/0/0 - name: load a config from disk and replace the current config cisco.iosxr.iosxr_config: src: config.cfg replace: config - backup: yes + backup: 'yes' - - name: for idempotency, use full-form commands + - name: 'for idempotency, use full-form commands' cisco.iosxr.iosxr_config: lines: - # - shut - - shutdown - # parents: int g0/0/0/1 + - shutdown parents: interface GigabitEthernet0/0/0/1 - name: configurable backup path cisco.iosxr.iosxr_config: src: config.cfg - backup: yes + backup: true backup_options: filename: backup.cfg dir_path: /home/user diff --git a/docs/cisco.iosxr.iosxr_facts_module.rst b/docs/cisco.iosxr.iosxr_facts_module.rst index 3525556d3..07ad7bd41 100644 --- a/docs/cisco.iosxr.iosxr_facts_module.rst +++ b/docs/cisco.iosxr.iosxr_facts_module.rst @@ -112,25 +112,25 @@ Examples # Collect only the config and default facts - cisco.iosxr.iosxr_facts: gather_subset: - - config + - config # Do not collect hardware facts - cisco.iosxr.iosxr_facts: gather_subset: - - '!hardware' + - '!hardware' # Collect only the lacp facts - cisco.iosxr.iosxr_facts: gather_subset: - - '!all' - - '!min' + - '!all' + - '!min' gather_network_resources: - - lacp + - lacp # Do not collect lacp_interfaces facts - cisco.iosxr.iosxr_facts: gather_network_resources: - - '!lacp_interfaces' + - '!lacp_interfaces' # Collect lacp and minimal default facts - cisco.iosxr.iosxr_facts: @@ -140,11 +140,11 @@ Examples # Collect only the interfaces facts - cisco.iosxr.iosxr_facts: gather_subset: - - '!all' - - '!min' + - '!all' + - '!min' gather_network_resources: - - interfaces - - l2_interfaces + - interfaces + - l2_interfaces diff --git a/docs/cisco.iosxr.iosxr_hostname_module.rst b/docs/cisco.iosxr.iosxr_hostname_module.rst index cd3855dc8..de7e0ed3a 100644 --- a/docs/cisco.iosxr.iosxr_hostname_module.rst +++ b/docs/cisco.iosxr.iosxr_hostname_module.rst @@ -133,9 +133,9 @@ Examples # Before state: # ------------- - #RP/0/RP0/CPU0:ios#show running-config hostname - #Thu Jan 20 19:48:56.011 UTC - #hostname ios + # RP/0/RP0/CPU0:ios#show running-config hostname + # Thu Jan 20 19:48:56.011 UTC + # hostname ios # Merged play: # ------------ @@ -156,7 +156,7 @@ Examples # ------------ # RP/0/0/CPU0:Router1#show running-config hostname - #Thu Jan 20 19:48:56.011 UTC + # Thu Jan 20 19:48:56.011 UTC # hostname Router1 @@ -165,7 +165,7 @@ Examples # ------------- # RP/0/0/CPU0:Router1#show running-config hostname - #Thu Jan 20 19:48:56.011 UTC + # Thu Jan 20 19:48:56.011 UTC # hostname Router1 # Deleted play: @@ -184,9 +184,9 @@ Examples # After state: # ------------ - #RP/0/RP0/CPU0:ios#show running-config hostname - #Thu Jan 20 19:55:12.971 UTC - #hostname ios + # RP/0/RP0/CPU0:ios#show running-config hostname + # Thu Jan 20 19:55:12.971 UTC + # hostname ios # Using state: overridden # Before state: @@ -213,17 +213,17 @@ Examples # After state: # ------------ - #RP/0/RP0/CPU0:RouterTest#show running-config hostname - #Thu Jan 20 19:48:56.011 UTC - #hostname RouterTest + # RP/0/RP0/CPU0:RouterTest#show running-config hostname + # Thu Jan 20 19:48:56.011 UTC + # hostname RouterTest # Using state: replaced # Before state: # ------------- - #RP/0/RP0/CPU0:RouterTest#show running-config hostname - #Thu Jan 20 19:48:56.011 UTC - #hostname RouterTest + # RP/0/RP0/CPU0:RouterTest#show running-config hostname + # Thu Jan 20 19:48:56.011 UTC + # hostname RouterTest # Replaced play: # -------------- @@ -247,9 +247,9 @@ Examples # Before state: # ------------- - #RP/0/RP0/CPU0:RouterTest#show running-config hostname - #Thu Jan 20 19:48:56.011 UTC - #hostname RouterTest + # RP/0/RP0/CPU0:RouterTest#show running-config hostname + # Thu Jan 20 19:48:56.011 UTC + # hostname RouterTest # Gathered play: # -------------- diff --git a/docs/cisco.iosxr.iosxr_interfaces_module.rst b/docs/cisco.iosxr.iosxr_interfaces_module.rst index 850fb77b3..cf82bc6e8 100644 --- a/docs/cisco.iosxr.iosxr_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_interfaces_module.rst @@ -233,13 +233,13 @@ Examples - name: Configure Ethernet interfaces cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - description: Configured by Ansible - enabled: true - - name: GigabitEthernet0/0/0/3 - description: Configured by Ansible Network - enabled: false - duplex: full + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: full state: merged # Task Output @@ -316,14 +316,14 @@ Examples - name: Replace their existing configuration per interface cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - description: Configured by Ansible - enabled: true - mtu: 2000 - - name: GigabitEthernet0/0/0/3 - description: Configured by Ansible Network - enabled: false - duplex: auto + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + mtu: 2000 + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: auto state: replaced # Task Output @@ -407,14 +407,14 @@ Examples - name: Override interfaces configuration cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - description: Configured by Ansible - enabled: true - duplex: auto - - name: GigabitEthernet0/0/0/3 - description: Configured by Ansible Network - enabled: false - speed: 1000 + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + duplex: auto + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + speed: 1000 state: overridden # Task Output @@ -494,8 +494,8 @@ Examples - name: Delete interfaces arguments cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + - name: GigabitEthernet0/0/0/3 state: deleted # Task Output @@ -604,17 +604,17 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/0 - description: Configured and Merged by Ansible-Network - mtu: 110 - enabled: true - duplex: half - - name: GigabitEthernet0/0/0/1 - description: Configured and Merged by Ansible-Network - mtu: 2800 - enabled: false - speed: 100 - duplex: full + - name: GigabitEthernet0/0/0/0 + description: Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full state: rendered # Task Output diff --git a/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst b/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst index bfefedfea..bf19ac2f0 100644 --- a/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_l2_interfaces_module.rst @@ -415,20 +415,21 @@ Examples - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/3 - native_vlan: 20 - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: true - l2protocol: - - stp: tunnel - - name: GigabitEthernet0/0/0/3.900 - l2transport: true - q_vlan: - - 20 - - 40 + - name: GigabitEthernet0/0/0/3 + native_vlan: 20 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: tunnel + - name: GigabitEthernet0/0/0/3.900 + l2transport: true + q_vlan: + - 20 + - 40 state: merged + # After state: # ------------ # @@ -477,20 +478,23 @@ Examples # dot1q vlan 20 40 # ! - - name: Replaces device configuration of listed interfaces with provided configuration + - name: >- + Replaces device configuration of listed interfaces with provided + configuration cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: true - l2protocol: - - stp: forward - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - any + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any state: replaced + # After state: # ------------- # @@ -542,17 +546,18 @@ Examples - name: Override device configuration of all interfaces with provided configuration cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: true - l2protocol: - - stp: forward - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - any + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any state: overridden + # After state: # ------------- # @@ -601,7 +606,7 @@ Examples - name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)" cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/4 state: deleted # After state: @@ -743,25 +748,21 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_l2_interfaces: config: - - - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - l2transport: true - l2protocol: - - - pvst: tunnel - - - cdp: forward - propagate: true - - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - 40 - - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + - pvst: tunnel + - cdp: forward + propagate: true + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 state: rendered + # Task Output (redacted) # ----------------------- # "rendered": [ diff --git a/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst b/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst index 531553106..b57c413a1 100644 --- a/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst @@ -239,13 +239,13 @@ Examples - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/2 - ipv4: - - address: 192.168.0.1/24 - - name: GigabitEthernet0/0/0/3 - ipv4: - - address: 192.168.2.1/24 - secondary: true + - name: GigabitEthernet0/0/0/2 + ipv4: + - address: 192.168.0.1/24 + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.2.1/24 + secondary: true state: merged # Task Output @@ -313,13 +313,14 @@ Examples - name: Override device configuration of all interfaces with provided configuration cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/3 - ipv4: - - address: 192.168.0.2/24 - - address: 192.168.2.1/24 - secondary: true + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.0.2/24 + - address: 192.168.2.1/24 + secondary: true state: overridden + # Task Output # ----------- # @@ -387,17 +388,20 @@ Examples # ipv4 address 192.168.2.1 255.255.255.0 secondary # ! - - name: Replaces device configuration of listed interfaces with provided configuration + - name: >- + Replaces device configuration of listed interfaces with provided + configuration cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/3 - ipv6: - - address: fd5d:12c9:2201:1::1/64 - - name: GigabitEthernet0/0/0/2 - ipv4: - - address: 192.168.0.2/24 + - name: GigabitEthernet0/0/0/3 + ipv6: + - address: 'fd5d:12c9:2201:1::1/64' + - name: GigabitEthernet0/0/0/2 + ipv4: + - address: 192.168.0.2/24 state: replaced + # Task Output # ----------- # @@ -464,14 +468,15 @@ Examples # ipv6 address fd5d:12c9:2201:1::1/64 # ! - - name: "Delete attributes for interfaces (This won't delete the interface itself)" + - name: Delete attributes for interfaces (This won't delete the interface itself) cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/4 - - name: GigabitEthernet0/0/0/3.700 + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/3.700 state: deleted + # Task Output # ----------- # @@ -543,7 +548,7 @@ Examples # interface preconfigure GigabitEthernet0/0/0/4 # ipv6 address fd5d:12c9:2201:1::1/64 # shutdown - #! + # ! - name: "Delete L3 config of all interfaces (This won't delete the interface itself)" cisco.iosxr.iosxr_l3_interfaces: @@ -681,18 +686,19 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/0 - ipv4: - - address: 198.51.100.1/24 - - name: GigabitEthernet0/0/0/1 - ipv6: - - address: 2001:db8:0:3::/64 - ipv4: - - address: 192.0.2.1/24 - - address: 192.0.2.2/24 - secondary: true + - name: GigabitEthernet0/0/0/0 + ipv4: + - address: 198.51.100.1/24 + - name: GigabitEthernet0/0/0/1 + ipv6: + - address: '2001:db8:0:3::/64' + ipv4: + - address: 192.0.2.1/24 + - address: 192.0.2.2/24 + secondary: true state: rendered + # Task Output # ----------- # diff --git a/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst b/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst index 1defd59d6..ca81c7281 100644 --- a/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_lacp_interfaces_module.rst @@ -297,19 +297,18 @@ Examples - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - churn_logging: actor - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/1 - period: 200 + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/1 + period: 200 state: merged + # # # ----------- @@ -397,13 +396,13 @@ Examples - name: Replace LACP configuration of listed interfaces with provided configuration cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - churn_logging: partner - - - name: GigabitEthernet0/0/0/2 - period: 300 + - name: Bundle-Ether10 + churn_logging: partner + - name: GigabitEthernet0/0/0/2 + period: 300 state: replaced + # # # ----------- @@ -493,15 +492,15 @@ Examples - name: Override all interface LACP configuration with provided configuration cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether12 - churn_logging: both - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: GigabitEthernet0/0/0/1 - period: 300 + - name: Bundle-Ether12 + churn_logging: both + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: GigabitEthernet0/0/0/1 + period: 300 state: overridden + # # # ----------- @@ -586,16 +585,18 @@ Examples # ! # - - name: Deleted LACP configurations of provided interfaces (Note - This won't delete + - name: >- + Deleted LACP configurations of provided interfaces (Note - This won't delete the interface itself) cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - - name: Bundle-Ether11 - - name: GigabitEthernet0/0/0/1 - - name: GigabitEthernet0/0/0/2 + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: GigabitEthernet0/0/0/1 + - name: GigabitEthernet0/0/0/2 state: deleted + # # # ----------- @@ -691,19 +692,18 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - churn_logging: actor - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/1 - period: 200 + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/1 + period: 200 state: rendered + # ------------- # Output # ------------- diff --git a/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst b/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst index 8d4cda1a3..8950db1b9 100644 --- a/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst @@ -319,26 +319,26 @@ Examples - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: inherit - - member: GigabitEthernet0/0/0/3 - mode: inherit - mode: active - links: - max_active: 5 - min_active: 2 - load_balancing_hash: src-ip - - - name: Bundle-Ether12 - members: - - member: GigabitEthernet0/0/0/2 - mode: passive - - member: GigabitEthernet0/0/0/4 - mode: passive - load_balancing_hash: dst-ip + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip state: merged + # # # ----------- @@ -429,15 +429,14 @@ Examples - name: Replace device configuration of listed Bundles with provided configurations cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether12 - members: - - name: GigabitEthernet0/0/0/2 - mode: passive - - - name: Bundle-Ether11 - members: - - name: GigabitEthernet0/0/0/4 - load_balancing_hash: src-ip + - name: Bundle-Ether12 + members: + - name: GigabitEthernet0/0/0/2 + mode: passive + - name: Bundle-Ether11 + members: + - name: GigabitEthernet0/0/0/4 + load_balancing_hash: src-ip state: replaced # # @@ -538,15 +537,16 @@ Examples - name: Overrides all device configuration with provided configuration cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: inherit - - member: GigabitEthernet0/0/0/2 - mode: inherit - mode: active - load_balancing_hash: dst-ip + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/2 + mode: inherit + mode: active + load_balancing_hash: dst-ip state: overridden + # # # ------------ @@ -636,15 +636,17 @@ Examples # # - - name: Delete attributes of given bundles and removes member interfaces from them + - name: >- + Delete attributes of given bundles and removes member interfaces from them (Note - This won't delete the bundles themselves) cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - - name: Bundle-Ether11 - - name: Bundle-Ether12 + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: Bundle-Ether12 state: deleted + # # # ------------ @@ -898,25 +900,24 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: inherit - - member: GigabitEthernet0/0/0/3 - mode: inherit - mode: active - links: - max_active: 5 - min_active: 2 - load_balancing_hash: src-ip - - - name: Bundle-Ether12 - members: - - member: GigabitEthernet0/0/0/2 - mode: passive - - member: GigabitEthernet0/0/0/4 - mode: passive - load_balancing_hash: dst-ip + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip state: rendered # Output: @@ -949,7 +950,6 @@ Examples # - " bundle id 12 mode passive" # ] # - # diff --git a/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst b/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst index 3fb795717..70892cf6e 100644 --- a/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst @@ -225,17 +225,17 @@ Examples - name: Merge provided configuration with running configuration cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - destination: - mac_address: ieee-nearest-non-tmpr-bridge - transmit: false - - - name: GigabitEthernet0/0/0/2 - destination: - mac_address: ieee-nearest-bridge - receive: false + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false state: merged + # # # ------------------------ @@ -347,15 +347,17 @@ Examples # # - - name: Replace existing LLDP configurations of specified interfaces with provided + - name: >- + Replace existing LLDP configurations of specified interfaces with provided configuration cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - destination: - mac_address: ieee-nearest-non-tmpr-bridge + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge state: replaced + # # # ------------------------ @@ -471,13 +473,16 @@ Examples # # - - name: Override the LLDP configurations of all the interfaces with provided configurations + - name: >- + Override the LLDP configurations of all the interfaces with provided + configurations cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - transmit: false + - name: GigabitEthernet0/0/0/1 + transmit: false state: overridden + # # # ------------------------ @@ -743,17 +748,15 @@ Examples - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - destination: - mac_address: ieee-nearest-non-tmpr-bridge - transmit: false - - - name: GigabitEthernet0/0/0/2 - destination: - mac_address: ieee-nearest-bridge - receive: false + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false state: rendered - # ------------------------ # Module Execution Result # ------------------------ diff --git a/docs/cisco.iosxr.iosxr_logging_global_module.rst b/docs/cisco.iosxr.iosxr_logging_global_module.rst index 872434004..c0dd4be33 100644 --- a/docs/cisco.iosxr.iosxr_logging_global_module.rst +++ b/docs/cisco.iosxr.iosxr_logging_global_module.rst @@ -1764,56 +1764,56 @@ Examples .. code-block:: yaml # Using merged - #----------------- + # ----------------- # Before state - #RP/0/0/CPU0:10#show running-config logging - #Thu Feb 4 09:38:36.245 UTC - #% No such configuration item(s) - #RP/0/0/CPU0:10# + # RP/0/0/CPU0:10#show running-config logging + # Thu Feb 4 09:38:36.245 UTC + # % No such configuration item(s) + # RP/0/0/CPU0:10# # # - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_logging_global: - config: - buffered: - size: 2097152 - severity: warnings - correlator: - buffer_size: 1024 - events: - display_location: True - files: - - maxfilesize: '1024' - name: test - path: test - severity: info - hostnameprefix: test - hosts: - - host: 1.1.1.1 - port: default - severity: critical - vrf: default - ipv4: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - source_interfaces: - - interface: GigabitEthernet0/0/0/0 - vrf: test - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test2 - vrf: test - trap: - severity: informational - state: merged + config: + buffered: + size: 2097152 + severity: warnings + correlator: + buffer_size: 1024 + events: + display_location: true + files: + - maxfilesize: '1024' + name: test + path: test + severity: info + hostnameprefix: test + hosts: + - host: 1.1.1.1 + port: default + severity: critical + vrf: default + ipv4: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + source_interfaces: + - interface: GigabitEthernet0/0/0/0 + vrf: test + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test2 + vrf: test + trap: + severity: informational + state: merged # # # After state: - #------------------------------------------- - #RP/0/0/CPU0:10#show running-config logging + # ------------------------------------------- + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -1832,8 +1832,8 @@ Examples # logging localfilesize 1024 # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test - #------------------------------------------------ - #Module execution + # ------------------------------------------------ + # Module execution # # "after": { # "buffered": { @@ -1982,8 +1982,8 @@ Examples # Using replaced: # ----------------------------------------------------------- # - #Before state - #RP/0/0/CPU0:10#show running-config logging + # Before state + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -2002,42 +2002,42 @@ Examples # logging localfilesize 1024 # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test - #----------------------------------------------------------- + # ----------------------------------------------------------- # - name: Replace BGP configuration with provided configuration cisco.iosxr.iosxr_logging_global: - state: replaced - config: - buffered: - severity: errors - correlator: - buffer_size: 1024 - files: - - maxfilesize: '1024' - name: test - path: test1 - severity: info - hostnameprefix: test1 - hosts: - - host: 1.1.1.3 - port: default - severity: critical - vrf: default - ipv6: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test - vrf: test - trap: - severity: critical + state: replaced + config: + buffered: + severity: errors + correlator: + buffer_size: 1024 + files: + - maxfilesize: '1024' + name: test + path: test1 + severity: info + hostnameprefix: test1 + hosts: + - host: 1.1.1.3 + port: default + severity: critical + vrf: default + ipv6: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test + vrf: test + trap: + severity: critical # # After state: - #RP/0/0/CPU0:10#show running-config logging + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:31:51.709 UTC # logging tls-server test # vrf test @@ -2053,7 +2053,7 @@ Examples # logging correlator buffer-size 1024 # logging localfilesize 1024 # logging hostnameprefix test1 - #----------------------------------------------------------------- + # ----------------------------------------------------------------- # # Module Execution: # "after": { @@ -2173,7 +2173,7 @@ Examples # Using deleted: # ----------------------------------------------------------- # Before state: - #RP/0/0/CPU0:10#show running-config logging + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -2193,15 +2193,15 @@ Examples # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test # - #----------------------------------------------------------- + # ----------------------------------------------------------- - name: Delete given logging_global configuration cisco.iosxr.iosxr_logging_global: - state: deleted + state: deleted # # After state: - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # - #------------------------------------------------------------- + # ------------------------------------------------------------- # Module Execution: # # "after": {}, @@ -2287,7 +2287,7 @@ Examples # using gathered: # ------------------------------------------------------------ # Before state: - #RP/0/0/CPU0:10#show running-config logging + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -2310,9 +2310,9 @@ Examples # - name: Gather iosxr_logging_global facts using gathered state cisco.iosxr.iosxr_logging_global: - state: gathered + state: gathered # - #------------------------------------------------------------- + # ------------------------------------------------------------- # Module Execution: # # "changed": false, @@ -2379,7 +2379,7 @@ Examples # # # Using parsed: - #--------------------------------------------------------------- + # --------------------------------------------------------------- # # parsed.cfg # @@ -2404,9 +2404,9 @@ Examples # - name: Parse externally provided Logging global config to agnostic model cisco.iosxr.iosxr_logging_global: - running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" - state: parsed - #---------------------------------------------------------------- + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + # ---------------------------------------------------------------- # Module execution: # "changed": false, # "parsed": { @@ -2466,44 +2466,46 @@ Examples # # Using rendered: # ---------------------------------------------------------------------------- - - name: Render platform specific configuration lines with state rendered (without connecting to the device) + - name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_logging_global: - state: rendered - config: - buffered: - size: 2097152 - severity: warnings - correlator: - buffer_size: 1024 - events: - display_location: True - files: - - maxfilesize: '1024' - name: test - path: test - severity: info - hostnameprefix: test - hosts: - - host: 1.1.1.1 - port: default - severity: critical - vrf: default - ipv4: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - source_interfaces: - - interface: GigabitEthernet0/0/0/0 - vrf: test - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test2 - vrf: test - trap: - severity: informational - #---------------------------------------------------------------- + state: rendered + config: + buffered: + size: 2097152 + severity: warnings + correlator: + buffer_size: 1024 + events: + display_location: true + files: + - maxfilesize: '1024' + name: test + path: test + severity: info + hostnameprefix: test + hosts: + - host: 1.1.1.1 + port: default + severity: critical + vrf: default + ipv4: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + source_interfaces: + - interface: GigabitEthernet0/0/0/0 + vrf: test + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test2 + vrf: test + trap: + severity: informational + # ---------------------------------------------------------------- # Module Execution: # "rendered": [ # "logging buffered errors", @@ -2526,7 +2528,7 @@ Examples # Using overridden: # --------------------------------------------------------------------------------- # Before state: - #RP/0/0/CPU0:10#show running-config logging + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -2546,42 +2548,42 @@ Examples # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test # - #----------------------------------------------------------- + # ----------------------------------------------------------- # - name: Overridde logging global configuration with provided configuration cisco.iosxr.iosxr_logging_global: - state: overridden - config: - buffered: - severity: errors - correlator: - buffer_size: 1024 - files: - - maxfilesize: '1024' - name: test - path: test1 - severity: info - hostnameprefix: test1 - hosts: - - host: 1.1.1.3 - port: default - severity: critical - vrf: default - ipv6: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test - vrf: test - trap: - severity: critical + state: overridden + config: + buffered: + severity: errors + correlator: + buffer_size: 1024 + files: + - maxfilesize: '1024' + name: test + path: test1 + severity: info + hostnameprefix: test1 + hosts: + - host: 1.1.1.3 + port: default + severity: critical + vrf: default + ipv6: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test + vrf: test + trap: + severity: critical # # After state: - #RP/0/0/CPU0:10#show running-config logging + # RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:31:51.709 UTC # logging tls-server test # vrf test @@ -2597,7 +2599,7 @@ Examples # logging correlator buffer-size 1024 # logging localfilesize 1024 # logging hostnameprefix test1 - #----------------------------------------------------------------- + # ----------------------------------------------------------------- # # Module Execution: # "after": { diff --git a/docs/cisco.iosxr.iosxr_logging_module.rst b/docs/cisco.iosxr.iosxr_logging_module.rst index 58e73d977..c75f0dc7d 100644 --- a/docs/cisco.iosxr.iosxr_logging_module.rst +++ b/docs/cisco.iosxr.iosxr_logging_module.rst @@ -457,18 +457,18 @@ Examples - name: Configure logging using aggregate cisco.iosxr.iosxr_logging: aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} - name: Delete logging using aggregate cisco.iosxr.iosxr_logging: aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} state: absent diff --git a/docs/cisco.iosxr.iosxr_ntp_global_module.rst b/docs/cisco.iosxr.iosxr_ntp_global_module.rst index 7f2fd2969..01800361d 100644 --- a/docs/cisco.iosxr.iosxr_ntp_global_module.rst +++ b/docs/cisco.iosxr.iosxr_ntp_global_module.rst @@ -1647,51 +1647,51 @@ Examples # ------------ - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_ntp_global: - config: - access_group: - ipv4: - peer: PeerAcl1 - query_only: QueryOnlyAcl1 - serve: ServeAcl1 - serve_only: ServeOnlyAcl1 - vrfs: - - ipv4: - peer: PeerAcl3 - serve: ServeAcl2 - name: siteA - authenticate: true - broadcastdelay: 1 - drift: - aging_time: 0 - file: apphost - interfaces: - - name: GigabitEthernet0/0/0/0 - multicast_client: 224.0.0.8 - multicast_destination: 224.0.0.8 - broadcast_client: true - ipv4: - dscp: af11 - ipv6: - precedence: routine - log_internal_sync: true - master: 1 - max_associations: 10 - passive: true - peers: - - iburst: true - peer: 192.0.2.1 - vrf: siteC - servers: - - burst: true - server: 192.0.2.2 - vrf: siteD - source: GigabitEthernet0/0/0/0 - source_vrfs: - - name: GigabitEthernet0/0/0/0 - vrf: siteE - trusted_keys: - - key_id: 1 - update_calendar: true + config: + access_group: + ipv4: + peer: PeerAcl1 + query_only: QueryOnlyAcl1 + serve: ServeAcl1 + serve_only: ServeOnlyAcl1 + vrfs: + - ipv4: + peer: PeerAcl3 + serve: ServeAcl2 + name: siteA + authenticate: true + broadcastdelay: 1 + drift: + aging_time: 0 + file: apphost + interfaces: + - name: GigabitEthernet0/0/0/0 + multicast_client: 224.0.0.8 + multicast_destination: 224.0.0.8 + broadcast_client: true + ipv4: + dscp: af11 + ipv6: + precedence: routine + log_internal_sync: true + master: 1 + max_associations: 10 + passive: true + peers: + - iburst: true + peer: 192.0.2.1 + vrf: siteC + servers: + - burst: true + server: 192.0.2.2 + vrf: siteD + source: GigabitEthernet0/0/0/0 + source_vrfs: + - name: GigabitEthernet0/0/0/0 + vrf: siteE + trusted_keys: + - key_id: 1 + update_calendar: true # Commands Fired: # ------------ # "commands": [ @@ -1859,52 +1859,52 @@ Examples # ---------------- - name: Override BGP configuration with provided configuration cisco.iosxr.iosxr_ntp_global: - state: overridden - config: - access_group: - ipv4: - peer: PeerAcl1 - query_only: QueryOnlyAcl1 - serve: ServeAcl4 - serve_only: ServeOnlyAcl1 - vrfs: - - ipv4: - peer: PeerAcl3 - serve: ServeAcl2 - name: siteA - authenticate: true - broadcastdelay: 1 - drift: - aging_time: 0 - file: apphost - interfaces: - - name: GigabitEthernet0/0/0/1 - multicast_client: 224.0.0.8 - multicast_destination: 224.0.0.8 - broadcast_client: true - ipv4: - dscp: af12 - ipv6: - precedence: routine - log_internal_sync: true - master: 1 - max_associations: 10 - passive: true - peers: - - iburst: true - peer: 192.0.2.3 - vrf: siteC - servers: - - burst: true - server: 192.0.2.2 - vrf: siteD - source: GigabitEthernet0/0/0/1 - source_vrfs: - - name: GigabitEthernet0/0/0/0 - vrf: siteE - trusted_keys: - - key_id: 1 - update_calendar: true + state: overridden + config: + access_group: + ipv4: + peer: PeerAcl1 + query_only: QueryOnlyAcl1 + serve: ServeAcl4 + serve_only: ServeOnlyAcl1 + vrfs: + - ipv4: + peer: PeerAcl3 + serve: ServeAcl2 + name: siteA + authenticate: true + broadcastdelay: 1 + drift: + aging_time: 0 + file: apphost + interfaces: + - name: GigabitEthernet0/0/0/1 + multicast_client: 224.0.0.8 + multicast_destination: 224.0.0.8 + broadcast_client: true + ipv4: + dscp: af12 + ipv6: + precedence: routine + log_internal_sync: true + master: 1 + max_associations: 10 + passive: true + peers: + - iburst: true + peer: 192.0.2.3 + vrf: siteC + servers: + - burst: true + server: 192.0.2.2 + vrf: siteD + source: GigabitEthernet0/0/0/1 + source_vrfs: + - name: GigabitEthernet0/0/0/0 + vrf: siteE + trusted_keys: + - key_id: 1 + update_calendar: true # Commands Fired: # --------------- # "commands": [ @@ -1990,52 +1990,52 @@ Examples # ---------------- - name: Replaced BGP configuration with provided configuration cisco.iosxr.iosxr_ntp_global: - state: replaced - config: - access_group: - ipv4: - peer: PeerAcl1 - query_only: QueryOnlyAcl1 - serve: ServeAcl4 - serve_only: ServeOnlyAcl1 - vrfs: - - ipv4: - peer: PeerAcl3 - serve: ServeAcl2 - name: siteA - authenticate: true - broadcastdelay: 1 - drift: - aging_time: 0 - file: apphost - interfaces: - - name: GigabitEthernet0/0/0/1 - multicast_client: 224.0.0.8 - multicast_destination: 224.0.0.8 - broadcast_client: true - ipv4: - dscp: af12 - ipv6: - precedence: routine - log_internal_sync: true - master: 1 - max_associations: 10 - passive: true - peers: - - iburst: true - peer: 192.0.2.3 - vrf: siteC - servers: - - burst: true - server: 192.0.2.2 - vrf: siteD - source: GigabitEthernet0/0/0/1 - source_vrfs: - - name: GigabitEthernet0/0/0/0 - vrf: siteE - trusted_keys: - - key_id: 1 - update_calendar: true + state: replaced + config: + access_group: + ipv4: + peer: PeerAcl1 + query_only: QueryOnlyAcl1 + serve: ServeAcl4 + serve_only: ServeOnlyAcl1 + vrfs: + - ipv4: + peer: PeerAcl3 + serve: ServeAcl2 + name: siteA + authenticate: true + broadcastdelay: 1 + drift: + aging_time: 0 + file: apphost + interfaces: + - name: GigabitEthernet0/0/0/1 + multicast_client: 224.0.0.8 + multicast_destination: 224.0.0.8 + broadcast_client: true + ipv4: + dscp: af12 + ipv6: + precedence: routine + log_internal_sync: true + master: 1 + max_associations: 10 + passive: true + peers: + - iburst: true + peer: 192.0.2.3 + vrf: siteC + servers: + - burst: true + server: 192.0.2.2 + vrf: siteD + source: GigabitEthernet0/0/0/1 + source_vrfs: + - name: GigabitEthernet0/0/0/0 + vrf: siteE + trusted_keys: + - key_id: 1 + update_calendar: true # Commands Fired: # --------------- # "commands": [ @@ -2196,7 +2196,9 @@ Examples # Using state: rendered # Rendered play: # -------------- - - name: Render platform specific configuration lines with state rendered (without connecting to the device) + - name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_ntp_global: state: rendered config: diff --git a/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst b/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst index 90bfd176d..a98178d93 100644 --- a/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst +++ b/docs/cisco.iosxr.iosxr_ospf_interfaces_module.rst @@ -2394,7 +2394,7 @@ Examples address_family: - afi: ipv4 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.3 cost: 20 @@ -2403,7 +2403,7 @@ Examples keychain: cisco - afi: ipv6 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.2 cost: 30 @@ -2495,7 +2495,7 @@ Examples address_family: - afi: ipv4 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.3 cost: 30 @@ -2504,7 +2504,7 @@ Examples keychain: ciscoiosxr - afi: ipv6 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.2 cost: 30 @@ -2590,7 +2590,7 @@ Examples address_family: - afi: ipv4 processes: - - process_id: "LAB1" + - process_id: LAB1 area: area_id: 0.0.0.3 cost: 10 @@ -2848,18 +2848,18 @@ Examples address_family: - afi: ipv4 processes: - - process_id: "LAB3" - area: - area_id: 0.0.0.3 + - process_id: LAB3 + area: + area_id: 0.0.0.3 cost: 20 authentication: message_digest: keychain: cisco - afi: ipv6 processes: - - process_id: "LAB3" - area: - area_id: 0.0.0.2 + - process_id: LAB3 + area: + area_id: 0.0.0.2 cost: 30 state: rendered diff --git a/docs/cisco.iosxr.iosxr_ospfv2_module.rst b/docs/cisco.iosxr.iosxr_ospfv2_module.rst index e42308d58..fe61bd4f6 100644 --- a/docs/cisco.iosxr.iosxr_ospfv2_module.rst +++ b/docs/cisco.iosxr.iosxr_ospfv2_module.rst @@ -5583,48 +5583,47 @@ Examples cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: '27' - areas: - - area_id: '10' - hello_interval: 2 + - process_id: '27' + areas: + - area_id: '10' + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: '26' + adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + - process_id: '10' authentication: - keychain: ansi11393 - - process_id: '26' - adjacency_stagger: - max_adjacency: 20 - min_adjacency: 10 - - process_id: '10' - authentication: - keychain: ansible_test1102 - areas: - - area_id: '11' - default_cost: 5 - cost: 11 - - area_id: 22 - default_cost: 6 - - process_id: '30' - areas: - - area_id: 11 - default_cost: 5 - - area_id: 22 - default_cost: 6 - - cost: 2 - default_metric: 10 - transmit_delay: 2 - hello_interval: 1 - dead_interval: 2 - retransmit_interval: 2 - weight: 2 - packet_size: 577 - priority: 1 - router_id: 2.2.2.2 - demand_circuit: enable - passive: disable - summary_in: enable - flood_reduction: disable - mtu_ignore: enable - external_out: disable + keychain: ansible_test1102 + areas: + - area_id: '11' + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: '30' + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable state: merged # Task Output: @@ -5810,19 +5809,19 @@ Examples cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: 27 - areas: - - area_id: 10 - hello_interval: 2 - - area_id: 20 - cost: 2 - default_cost: 2 - authentication: - keychain: ansi11393 - - process_id: 26 - adjacency_stagger: - min_adjacency: 10 - max_adjacency: 20 + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 state: replaced # Task Output: @@ -6038,23 +6037,24 @@ Examples cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: 27 - areas: - - area_id: 10 - hello_interval: 2 - authentication: - keychain: ansi11393 - - area_id: 20 - cost: 2 - default_cost: 2 - authentication: - keychain: ansi11393 - - process_id: 26 - adjacency_stagger: - min_adjacency: 10 - max_adjacency: 20 + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 state: overridden + # # Task Output: # ------------ @@ -6248,12 +6248,13 @@ Examples cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: '10' - - process_id: '26' - - process_id: '27' - - process_id: '30' + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' state: deleted + # # Task Output: # ------------ @@ -6485,50 +6486,50 @@ Examples cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: 27 - areas: - - area_id: 10 - hello_interval: 2 + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + - process_id: 10 authentication: - keychain: ansi11393 - - process_id: 26 - adjacency_stagger: - min_adjacency: 10 - max_adjacency: 20 - - process_id: 10 - authentication: - keychain: ansible_test1102 - areas: - - area_id: 11 - default_cost: 5 - cost: 11 - - area_id: 22 - default_cost: 6 - - process_id: 30 - areas: - - area_id: 11 - default_cost: 5 - - area_id: 22 - default_cost: 6 - - cost: 2 - default_metric: 10 - transmit_delay: 2 - hello_interval: 1 - dead_interval: 2 - retransmit_interval: 2 - weight: 2 - packet_size: 577 - priority: 1 - router_id: 2.2.2.2 - demand_circuit: enable - passive: disable - summary_in: enable - flood_reduction: disable - mtu_ignore: enable - external_out: disable + keychain: ansible_test1102 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable state: rendered + # # Task Output: # ------------ diff --git a/docs/cisco.iosxr.iosxr_ospfv3_module.rst b/docs/cisco.iosxr.iosxr_ospfv3_module.rst index 168cd62f2..494562fc5 100644 --- a/docs/cisco.iosxr.iosxr_ospfv3_module.rst +++ b/docs/cisco.iosxr.iosxr_ospfv3_module.rst @@ -9241,7 +9241,7 @@ Examples retransmit_interval: 2 packet_size: 577 priority: 1 - router_id: '2.2.2.2' + router_id: 2.2.2.2 demand_circuit: true mtu_ignore: true state: merged @@ -9787,12 +9787,13 @@ Examples cisco.iosxr.iosxr_ospfv3: config: processes: - - process_id: '10' - - process_id: '26' - - process_id: '27' - - process_id: '30' + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' state: deleted + # # Task Output: # ------------ diff --git a/docs/cisco.iosxr.iosxr_prefix_lists_module.rst b/docs/cisco.iosxr.iosxr_prefix_lists_module.rst index 6e9bc7367..348b07d0c 100644 --- a/docs/cisco.iosxr.iosxr_prefix_lists_module.rst +++ b/docs/cisco.iosxr.iosxr_prefix_lists_module.rst @@ -322,50 +322,50 @@ Examples # Before state - #RP/0/0/CPU0:10#show running-config - #Thu Feb 4 09:38:36.245 UTC - #% No such configuration item(s) - #RP/0/0/CPU0:10# + # RP/0/0/CPU0:10#show running-config + # Thu Feb 4 09:38:36.245 UTC + # % No such configuration item(s) + # RP/0/0/CPU0:10# # - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_prefix_lists: - state: merged - config: - - afi: ipv6 - prefix_lists: - - name: pl_1 - entries: - - prefix: 2001:db8:1234::/48 - action: deny - sequence: 1 - - name: pl_2 - entries: - - sequence: 2 - action: remark - description: TEST_PL_2_REMARK - - afi: ipv4 - prefix_lists: - - name: pl1 - entries: - - sequence: 3 - action: remark - description: TEST_PL1_2_REMARK - - sequence: 4 - action: permit - prefix: 10.0.0.0/24 - - name: pl2 - entries: - - sequence: 5 - action: remark - description: TEST_PL2_REMARK - - name: pl3 - entries: - - sequence: 6 - action: permit - prefix: 35.0.0.0/8 - eq: 0 + state: merged + config: + - afi: ipv6 + prefix_lists: + - name: pl_1 + entries: + - prefix: '2001:db8:1234::/48' + action: deny + sequence: 1 + - name: pl_2 + entries: + - sequence: 2 + action: remark + description: TEST_PL_2_REMARK + - afi: ipv4 + prefix_lists: + - name: pl1 + entries: + - sequence: 3 + action: remark + description: TEST_PL1_2_REMARK + - sequence: 4 + action: permit + prefix: 10.0.0.0/24 + - name: pl2 + entries: + - sequence: 5 + action: remark + description: TEST_PL2_REMARK + - name: pl3 + entries: + - sequence: 6 + action: permit + prefix: 35.0.0.0/8 + eq: 0 # Task Output # ------------- @@ -415,12 +415,12 @@ Examples # After state: # ------------ - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 # ! # ipv6 prefix-list pl_2 - # 2 remark TEST_PL_2_REMARK + # 2 remark TEST_PL_2_REMAR # ! # ipv4 prefix-list pl1 # 3 remark TEST_PL1_2_REMARK @@ -439,7 +439,7 @@ Examples # Before state: # ------------- - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 @@ -457,29 +457,31 @@ Examples # - - name: Replace device configurations of listed prefix lists with provided configurations + - name: >- + Replace device configurations of listed prefix lists with provided + configurations register: result - cisco.iosxr.iosxr_prefix_lists: &id001 + cisco.iosxr.iosxr_prefix_lists: config: - - afi: ipv4 - prefix_lists: - - name: pl1 - entries: - - sequence: 3 - action: permit - prefix: 10.0.0.0/24 - - afi: ipv6 - prefix_lists: - - name: pl_1 - entries: - - prefix: 2001:db8:1234::/48 - action: permit - sequence: 1 - - name: pl_2 - entries: - - sequence: 2 - action: remark - description: TEST_PL1_2 + - afi: ipv4 + prefix_lists: + - name: pl1 + entries: + - sequence: 3 + action: permit + prefix: 10.0.0.0/24 + - afi: ipv6 + prefix_lists: + - name: pl_1 + entries: + - prefix: '2001:db8:1234::/48' + action: permit + sequence: 1 + - name: pl_2 + entries: + - sequence: 2 + action: remark + description: TEST_PL1_2 state: replaced @@ -546,7 +548,7 @@ Examples # After state: - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 @@ -644,7 +646,7 @@ Examples # After state: # ------------ - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 # ! @@ -665,7 +667,7 @@ Examples - name: Gather ACL interfaces facts using gathered state cisco.iosxr.iosxr_prefix_lists: - state: gathered + state: gathered # gathered: # - afi: ipv6 @@ -707,7 +709,7 @@ Examples # parsed.cfg - #------------------------------ + # ------------------------------ # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 # ! @@ -722,11 +724,10 @@ Examples # 5 remark TEST_PL2_REMARK - - name: Parse externally provided Prefix_lists config to agnostic model cisco.iosxr.iosxr_prefix_lists: - running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" - state: parsed + running_config: '{{ lookup(''file'', ''./fixtures/parsed.cfg'') }}' + state: parsed # Task Output @@ -771,40 +772,39 @@ Examples - name: Render platform specific commands from task input using rendered state register: result cisco.iosxr.iosxr_prefix_lists: - config: - - afi: ipv6 - prefix_lists: - - name: pl_1 - entries: - - prefix: 2001:db8:1234::/48 - action: deny - sequence: 1 - - name: pl_2 - entries: - - sequence: 2 - action: remark - description: TEST_PL_2_REMARK - - afi: ipv4 - prefix_lists: - - name: pl1 - entries: - - sequence: 3 - action: remark - description: TEST_PL1_2_REMARK - - sequence: 4 - action: permit - prefix: 10.0.0.0/24 - - name: pl2 - entries: - - sequence: 5 - action: remark - description: TEST_PL2_REMARK - - sequence: 6 - action: permit - prefix: 35.0.0.0/8 - eq: 0 - - state: rendered + config: + - afi: ipv6 + prefix_lists: + - name: pl_1 + entries: + - prefix: '2001:db8:1234::/48' + action: deny + sequence: 1 + - name: pl_2 + entries: + - sequence: 2 + action: remark + description: TEST_PL_2_REMARK + - afi: ipv4 + prefix_lists: + - name: pl1 + entries: + - sequence: 3 + action: remark + description: TEST_PL1_2_REMARK + - sequence: 4 + action: permit + prefix: 10.0.0.0/24 + - name: pl2 + entries: + - sequence: 5 + action: remark + description: TEST_PL2_REMARK + - sequence: 6 + action: permit + prefix: 35.0.0.0/8 + eq: 0 + state: rendered # Task Output @@ -818,14 +818,12 @@ Examples # "ipv4 prefix-list pl2 6 permit 35.0.0.0/8 eq 0" # ] - - # Using overridden: # Before state: # ------------- - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 @@ -842,22 +840,22 @@ Examples # - name: Overridde all Prefix_lists configuration with provided configuration cisco.iosxr.iosxr_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: pl3 - entries: - - sequence: 3 - action: remark - description: TEST_PL1_3_REMARK - - sequence: 4 - action: permit - prefix: 10.0.0.0/24 - - sequence: 6 - action: permit - prefix: 35.0.0.0/8 - eq: 0 - state: overridden + config: + - afi: ipv4 + prefix_lists: + - name: pl3 + entries: + - sequence: 3 + action: remark + description: TEST_PL1_3_REMARK + - sequence: 4 + action: permit + prefix: 10.0.0.0/24 + - sequence: 6 + action: permit + prefix: 35.0.0.0/8 + eq: 0 + state: overridden # Task Output @@ -916,14 +914,14 @@ Examples # After state: - #RP/0/0/CPU0:10#show running-config + # RP/0/0/CPU0:10#show running-config # - #ipv4 prefix-list pl3 + # ipv4 prefix-list pl3 # 3 remark TEST_PL1_3_REMARK # 4 permit 10.0.0.0/24 # 6 permit 35.0.0.0/8 eq 0 # ! - #! + # ! diff --git a/docs/cisco.iosxr.iosxr_snmp_server_module.rst b/docs/cisco.iosxr.iosxr_snmp_server_module.rst index b89aea405..eab8fe518 100644 --- a/docs/cisco.iosxr.iosxr_snmp_server_module.rst +++ b/docs/cisco.iosxr.iosxr_snmp_server_module.rst @@ -5417,101 +5417,102 @@ Examples # --------------------- EMPTY ----------------- # Merged play: # ------------ + - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_snmp_server: - config: - vrfs: - - hosts: - - community: test1 - host: 1.1.1.1 - traps: true - vrf: vrf1 - users: - - Ipv4_acl: test1 - Ipv6_acl: test2 - group: test2 - user: u1 - version: v1 - timeouts: - duplicate: 0 - inQdrop: 0 - trap: - throttle_time: 12 - targets: - - host: 1.1.1.2 - name: test + config: + vrfs: + - hosts: + - community: test1 + host: 1.1.1.1 + traps: true + vrf: vrf1 + users: + - Ipv4_acl: test1 + Ipv6_acl: test2 + group: test2 + user: u1 + version: v1 + timeouts: + duplicate: 0 + inQdrop: 0 + trap: + throttle_time: 12 + targets: + - host: 1.1.1.2 + name: test + ifmib: + internal_cache_max_duration: 4 + inform: + retries: 7 + chassis_id: test2 + packetsize: 490 + queue_length: 2 + throttle_time: 60 + trap_source: GigabitEthernet0/0/0/2 + trap_timeout: 3 + context: + - c1 + - c2 + contact: t1 + correlator: + buffer_size: 1024 + communities: + - name: test2 + ro: true + sdrowner: true + acl_v4: test + acl_v6: test1 + community_maps: + - name: cm1 + context: c1 + target_list: t1 + security_name: s1 + drop: + report_IPv4: test1 + unknown_user: true + ipv6: + precedence: routine + ipv4: + dscp: af11 + location: test1 + logging_threshold_oid_processing: 1 + logging_threshold_pdu_processing: 1 + mib_bulkstat_max_procmem_size: 101 + mroutemib_send_all_vrf: true + overload_control: + overload_drop_time: 4 + overload_throttle_rate: 6 + notification_log_mib: + GlobalSize: 5 + size: 5 + traps: + hsrp: true + ipsla: true + ipsec: + start: true + stop: true + bridgemib: true + bulkstat_collection: true + cisco_entity_ext: true + config: true + copy_complete: true + addrpool: + high: true + low: true + bfd: true + bgp: + cbgp2: true + l2tun: + sessions: true + tunnel_down: true + tunnel_up: true + l2vpn: + all: true + vc_down: true + vc_up: true + msdp_peer_state_change: true - ifmib: - internal_cache_max_duration: 4 - inform: - retries: 7 - chassis_id: test2 - packetsize: 490 - queue_length: 2 - throttle_time: 60 - trap_source: GigabitEthernet0/0/0/2 - trap_timeout: 3 - context: - - c1 - - c2 - contact: t1 - correlator: - buffer_size: 1024 - communities: - - name: test2 - ro: true - sdrowner: true - acl_v4: test - acl_v6: test1 - community_maps: - - name: cm1 - context: c1 - target_list: t1 - security_name: s1 - drop: - report_IPv4: test1 - unknown_user: true - ipv6: - precedence: routine - ipv4: - dscp: af11 - location: test1 - logging_threshold_oid_processing: 1 - logging_threshold_pdu_processing: 1 - mib_bulkstat_max_procmem_size: 101 - mroutemib_send_all_vrf: true - overload_control: - overload_drop_time: 4 - overload_throttle_rate: 6 - notification_log_mib: - GlobalSize: 5 - size: 5 - traps: - hsrp: true - ipsla: true - ipsec: - start: true - stop: true - bridgemib: true - bulkstat_collection: true - cisco_entity_ext: true - config: true - copy_complete: true - addrpool: - high: true - low: true - bfd: true - bgp: - cbgp2: true - l2tun: - sessions: true - tunnel_down: true - tunnel_up: true - l2vpn: - all: true - vc_down: true - vc_up: true - msdp_peer_state_change: true # # Commands Fired: # ------------ @@ -5822,78 +5823,78 @@ Examples # ---------------- - name: Override Snmp-server configuration with provided configuration cisco.iosxr.iosxr_snmp_server: - config: - timeouts: - duplicate: 0 - inQdrop: 0 - trap: - throttle_time: 13 - targets: - - host: 1.1.1.2 - name: test + config: + timeouts: + duplicate: 0 + inQdrop: 0 + trap: + throttle_time: 13 + targets: + - host: 1.1.1.2 + name: test + ifmib: + internal_cache_max_duration: 5 + inform: + retries: 7 + chassis_id: test + packetsize: 491 + queue_length: 2 + throttle_time: 60 + trap_source: GigabitEthernet0/0/0/2 + trap_timeout: 3 + context: + - c1 + - c2 + contact: t1 + correlator: + buffer_size: 1025 + communities: + - name: test1 + ro: true + sdrowner: true + acl_v4: test + acl_v6: test1 + community_maps: + - name: cm2 + context: c1 + target_list: t1 + security_name: s1 + drop: + report_IPv4: test2 + unknown_user: true + ipv6: + precedence: routine + ipv4: + dscp: af11 + location: test1 + logging_threshold_oid_processing: 2 + logging_threshold_pdu_processing: 2 + mib_bulkstat_max_procmem_size: 101 + mroutemib_send_all_vrf: true + overload_control: + overload_drop_time: 4 + overload_throttle_rate: 6 + notification_log_mib: + GlobalSize: 5 + size: 5 + traps: + hsrp: true + ipsla: true + ipsec: + start: true + stop: true + bridgemib: true + bulkstat_collection: true + cisco_entity_ext: true + config: true + copy_complete: true + l2vpn: + all: true + vc_down: true + vc_up: true + msdp_peer_state_change: true + state: overridden - ifmib: - internal_cache_max_duration: 5 - inform: - retries: 7 - chassis_id: test - packetsize: 491 - queue_length: 2 - throttle_time: 60 - trap_source: GigabitEthernet0/0/0/2 - trap_timeout: 3 - context: - - c1 - - c2 - contact: t1 - correlator: - buffer_size: 1025 - communities: - - name: test1 - ro: true - sdrowner: true - acl_v4: test - acl_v6: test1 - community_maps: - - name: cm2 - context: c1 - target_list: t1 - security_name: s1 - drop: - report_IPv4: test2 - unknown_user: true - ipv6: - precedence: routine - ipv4: - dscp: af11 - location: test1 - logging_threshold_oid_processing: 2 - logging_threshold_pdu_processing: 2 - mib_bulkstat_max_procmem_size: 101 - mroutemib_send_all_vrf: true - overload_control: - overload_drop_time: 4 - overload_throttle_rate: 6 - notification_log_mib: - GlobalSize: 5 - size: 5 - traps: - hsrp: true - ipsla: true - ipsec: - start: true - stop: true - bridgemib: true - bulkstat_collection: true - cisco_entity_ext: true - config: true - copy_complete: true - l2vpn: - all: true - vc_down: true - vc_up: true - msdp_peer_state_change: true - state: overridden # Commands Fired: # --------------- # "commands": [ @@ -6033,78 +6034,78 @@ Examples # ---------------- - name: Replace Snmp-server configuration with provided configuration cisco.iosxr.iosxr_snmp_server: - state: replaced - config: - timeouts: - duplicate: 0 - inQdrop: 0 - trap: - throttle_time: 13 - targets: - - host: 1.1.1.2 - name: test + state: replaced + config: + timeouts: + duplicate: 0 + inQdrop: 0 + trap: + throttle_time: 13 + targets: + - host: 1.1.1.2 + name: test + ifmib: + internal_cache_max_duration: 5 + inform: + retries: 7 + chassis_id: test + packetsize: 491 + queue_length: 2 + throttle_time: 60 + trap_source: GigabitEthernet0/0/0/2 + trap_timeout: 3 + context: + - c1 + - c2 + contact: t1 + correlator: + buffer_size: 1025 + communities: + - name: test1 + ro: true + sdrowner: true + acl_v4: test + acl_v6: test1 + community_maps: + - name: cm2 + context: c1 + target_list: t1 + security_name: s1 + drop: + report_IPv4: test2 + unknown_user: true + ipv6: + precedence: routine + ipv4: + dscp: af11 + location: test1 + logging_threshold_oid_processing: 2 + logging_threshold_pdu_processing: 2 + mib_bulkstat_max_procmem_size: 101 + mroutemib_send_all_vrf: true + overload_control: + overload_drop_time: 4 + overload_throttle_rate: 6 + notification_log_mib: + GlobalSize: 5 + size: 5 + traps: + hsrp: true + ipsla: true + ipsec: + start: true + stop: true + bridgemib: true + bulkstat_collection: true + cisco_entity_ext: true + config: true + copy_complete: true + l2vpn: + all: true + vc_down: true + vc_up: true + msdp_peer_state_change: true - ifmib: - internal_cache_max_duration: 5 - inform: - retries: 7 - chassis_id: test - packetsize: 491 - queue_length: 2 - throttle_time: 60 - trap_source: GigabitEthernet0/0/0/2 - trap_timeout: 3 - context: - - c1 - - c2 - contact: t1 - correlator: - buffer_size: 1025 - communities: - - name: test1 - ro: true - sdrowner: true - acl_v4: test - acl_v6: test1 - community_maps: - - name: cm2 - context: c1 - target_list: t1 - security_name: s1 - drop: - report_IPv4: test2 - unknown_user: true - ipv6: - precedence: routine - ipv4: - dscp: af11 - location: test1 - logging_threshold_oid_processing: 2 - logging_threshold_pdu_processing: 2 - mib_bulkstat_max_procmem_size: 101 - mroutemib_send_all_vrf: true - overload_control: - overload_drop_time: 4 - overload_throttle_rate: 6 - notification_log_mib: - GlobalSize: 5 - size: 5 - traps: - hsrp: true - ipsla: true - ipsec: - start: true - stop: true - bridgemib: true - bulkstat_collection: true - cisco_entity_ext: true - config: true - copy_complete: true - l2vpn: - all: true - vc_down: true - vc_up: true - msdp_peer_state_change: true # # Commands Fired: # --------------- @@ -6397,7 +6398,9 @@ Examples # Using state: rendered # Rendered play: # -------------- - - name: Render platform specific configuration lines with state rendered (without connecting to the device) + - name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_snmp_server: state: rendered config: @@ -6421,7 +6424,6 @@ Examples targets: - host: 1.1.1.2 name: test - ifmib: internal_cache_max_duration: 4 inform: @@ -6494,6 +6496,7 @@ Examples vc_up: true msdp_peer_state_change: true register: result + # Module Execution Result: # ------------------------ # "rendered": [ diff --git a/docs/cisco.iosxr.iosxr_static_routes_module.rst b/docs/cisco.iosxr.iosxr_static_routes_module.rst index 7174bdbc7..5005ef6b2 100644 --- a/docs/cisco.iosxr.iosxr_static_routes_module.rst +++ b/docs/cisco.iosxr.iosxr_static_routes_module.rst @@ -445,57 +445,52 @@ Examples - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_static_routes: config: - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.16/28 - next_hops: - - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - description: LAB - metric: 120 - tag: 10 - - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - - dest: 192.0.2.32/28 - next_hops: - - forward_router_address: 192.0.2.11 - admin_distance: 100 - - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - interface: FastEthernet0/0/0/7 - description: DC - - - interface: FastEthernet0/0/0/8 - forward_router_address: 2001:db8:2000:2::1 - - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: DEV - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 + - address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.16/28 + next_hops: + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + - dest: 192.0.2.32/28 + next_hops: + - forward_router_address: 192.0.2.11 + admin_distance: 100 + - afi: ipv6 + safi: unicast + routes: + - dest: '2001:db8:1000::/36' + next_hops: + - interface: FastEthernet0/0/0/7 + description: DC + - interface: FastEthernet0/0/0/8 + forward_router_address: '2001:db8:2000:2::1' + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 state: merged + # Task Output # ----------- # before: [] @@ -608,23 +603,22 @@ Examples - name: Update existing static routes configuration using merged cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - vrflabel: 2301 - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - description: rt_test_1 + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + vrflabel: 2301 + dest_vrf: test_1 + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + description: rt_test_1 state: merged # Task Output @@ -777,17 +771,17 @@ Examples - name: Replace device configurations of static routes with provided configurations cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: DEV_NEW - dest_vrf: dev_test_2 + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV_NEW + dest_vrf: dev_test_2 state: replaced # Task Output @@ -843,7 +837,7 @@ Examples # vrflabel: 124 # safi: unicast # vrf: DEV_SITE - #commands: + # commands: # - router static # - vrf DEV_SITE # - address-family ipv4 unicast @@ -946,25 +940,25 @@ Examples - name: Overridde all static routes configuration with provided configuration cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_NEW - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: DEV1 - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:3000::/36 - next_hops: - - interface: FastEthernet0/0/0/4 - forward_router_address: 2001:db8:2000:2::2 - description: PROD1 - track: ip_sla_1 + - vrf: DEV_NEW + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV1 + - afi: ipv6 + safi: unicast + routes: + - dest: '2001:db8:3000::/36' + next_hops: + - interface: FastEthernet0/0/0/4 + forward_router_address: '2001:db8:2000:2::2' + description: PROD1 + track: ip_sla_1 state: overridden # Task Output @@ -1091,10 +1085,10 @@ Examples - name: Delete all destination network entries under a single AFI cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast state: deleted # Task output @@ -1410,26 +1404,25 @@ Examples # Using rendered - name: Render platform specific commands (without connecting to the device) - cisco.iosxr.iosxr_static_routes: + cisco.iosxr.iosxr_static_routes: null config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: DEV - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 # Task Output (redacted) # ----------------------- diff --git a/docs/cisco.iosxr.iosxr_system_module.rst b/docs/cisco.iosxr.iosxr_system_module.rst index efc494ed1..f59eea224 100644 --- a/docs/cisco.iosxr.iosxr_system_module.rst +++ b/docs/cisco.iosxr.iosxr_system_module.rst @@ -196,17 +196,17 @@ Examples hostname: iosxr01 domain_name: test.example.com domain_search: - - ansible.com - - redhat.com - - cisco.com + - ansible.com + - redhat.com + - cisco.com - name: remove configuration cisco.iosxr.iosxr_system: hostname: iosxr01 domain_name: test.example.com domain_search: - - ansible.com - - redhat.com - - cisco.com + - ansible.com + - redhat.com + - cisco.com state: absent - name: configure hostname and domain-name with vrf cisco.iosxr.iosxr_system: @@ -214,9 +214,9 @@ Examples vrf: nondefault domain_name: test.example.com domain_search: - - ansible.com - - redhat.com - - cisco.com + - ansible.com + - redhat.com + - cisco.com - name: configure DNS lookup sources cisco.iosxr.iosxr_system: lookup_source: MgmtEth0/0/CPU0/0 @@ -224,8 +224,8 @@ Examples - name: configure name servers cisco.iosxr.iosxr_system: name_servers: - - 8.8.8.8 - - 8.8.4.4 + - 8.8.8.8 + - 8.8.4.4 diff --git a/docs/cisco.iosxr.iosxr_user_module.rst b/docs/cisco.iosxr.iosxr_user_module.rst index 808742af5..b56d09516 100644 --- a/docs/cisco.iosxr.iosxr_user_module.rst +++ b/docs/cisco.iosxr.iosxr_user_module.rst @@ -424,18 +424,18 @@ Examples - name: set multiple users to group sys-admin cisco.iosxr.iosxr_user: aggregate: - - name: netop - - name: netend + - name: netop + - name: netend group: sysadmin state: present - name: set multiple users to multiple groups cisco.iosxr.iosxr_user: aggregate: - - name: netop - - name: netend + - name: netop + - name: netend groups: - - sysadmin - - root-system + - sysadmin + - root-system state: present - name: Change Password for User netop cisco.iosxr.iosxr_user: diff --git a/plugins/modules/iosxr_acl_interfaces.py b/plugins/modules/iosxr_acl_interfaces.py index 7dc8df807..80dcc44f4 100644 --- a/plugins/modules/iosxr_acl_interfaces.py +++ b/plugins/modules/iosxr_acl_interfaces.py @@ -130,27 +130,26 @@ - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out + - afi: ipv6 + acls: + - name: acl6_1 + direction: in + - name: acl6_2 + direction: out + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: out state: merged # After state: @@ -199,14 +198,14 @@ - name: Update acl_interfaces configuration using merged cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: out - - name: acl_1 - direction: in + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: out + - name: acl_1 + direction: in state: merged # After state: @@ -253,15 +252,17 @@ # ipv4 access-group acl_1 egress # ! -- name: Replace device configurations of listed interface with provided configurations +- name: >- + Replace device configurations of listed interface with provided + configurations cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - acls: - - name: acl6_3 - direction: in + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv6 + acls: + - name: acl6_3 + direction: in state: replaced # After state: @@ -308,16 +309,16 @@ - name: Overridde all interface ACL configuration with provided configuration cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: in - - afi: ipv6 - acls: - - name: acl6_3 - direction: out + - name: GigabitEthernet0/0/0/1 + access_groups: + - afi: ipv4 + acls: + - name: acl_2 + direction: in + - afi: ipv6 + acls: + - name: acl6_3 + direction: out state: overridden # After state: @@ -364,7 +365,7 @@ - name: Delete all ACL attributes of GigabitEthernet0/0/0/1 cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/1 + - name: GigabitEthernet0/0/0/1 state: deleted # After state: @@ -564,14 +565,14 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_acl_interfaces: config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out + - name: GigabitEthernet0/0/0/0 + access_groups: + - afi: ipv4 + acls: + - name: acl_1 + direction: in + - name: acl_2 + direction: out state: rendered # Task Output (redacted) diff --git a/plugins/modules/iosxr_acls.py b/plugins/modules/iosxr_acls.py index 813eb12ab..620838353 100644 --- a/plugins/modules/iosxr_acls.py +++ b/plugins/modules/iosxr_acls.py @@ -709,85 +709,80 @@ - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_acls: config: - - afi: ipv6 - acls: - - name: acl6_1 - aces: - - sequence: 10 - grant: deny - protocol: tcp - source: - prefix: 2001:db8:1234::/48 - port_protocol: - range: - start: ftp - end: telnet - destination: - any: true - protocol_options: - tcp: - syn: true - ttl: - range: - start: 180 - end: 250 - routing: true - authen: true - log: true - - - sequence: 20 - grant: permit - protocol: icmpv6 - source: - any: true - destination: - any: true - protocol_options: - icmpv6: - router_advertisement: true - precedence: network - destopts: true - - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 16 - remark: TEST_ACL_1_REMARK - - - sequence: 21 - grant: permit - protocol: tcp - source: - host: 192.0.2.10 - port_protocol: - range: - start: pop3 - end: 121 - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - protocol_options: - tcp: - rst: true - - - sequence: 23 - grant: deny - protocol: icmp - source: - any: true - destination: - prefix: 198.51.100.0/28 - protocol_options: - icmp: - reassembly_timeout: true - dscp: - lt: af12 - - - name: acl_2 - aces: - - sequence: 10 - remark: TEST_ACL_2_REMARK + - afi: ipv6 + acls: + - name: acl6_1 + aces: + - sequence: 10 + grant: deny + protocol: tcp + source: + prefix: '2001:db8:1234::/48' + port_protocol: + range: + start: ftp + end: telnet + destination: + any: true + protocol_options: + tcp: + syn: true + ttl: + range: + start: 180 + end: 250 + routing: true + authen: true + log: true + - sequence: 20 + grant: permit + protocol: icmpv6 + source: + any: true + destination: + any: true + protocol_options: + icmpv6: + router_advertisement: true + precedence: network + destopts: true + - afi: ipv4 + acls: + - name: acl_1 + aces: + - sequence: 16 + remark: TEST_ACL_1_REMARK + - sequence: 21 + grant: permit + protocol: tcp + source: + host: 192.0.2.10 + port_protocol: + range: + start: pop3 + end: 121 + destination: + address: 198.51.100.0 + wildcard_bits: 0.0.0.15 + protocol_options: + tcp: + rst: true + - sequence: 23 + grant: deny + protocol: icmp + source: + any: true + destination: + prefix: 198.51.100.0/28 + protocol_options: + icmp: + reassembly_timeout: true + dscp: + lt: af12 + - name: acl_2 + aces: + - sequence: 10 + remark: TEST_ACL_2_REMARK state: merged # Task Output @@ -954,7 +949,6 @@ protocol_options: tcp: syn: true - - sequence: 23 protocol_options: icmp: @@ -1191,7 +1185,6 @@ any: true ttl: eq: 100 - - sequence: 12 grant: deny source: @@ -1440,7 +1433,6 @@ destination: any: true protocol: tcp - - name: acl_2 aces: - sequence: 20 @@ -2110,27 +2102,26 @@ - name: Render platform specific commands (without connecting to the device) cisco.iosxr.iosxr_acls: config: - - afi: ipv4 - acls: - - name: acl_2 - aces: - - sequence: 11 - grant: permit - protocol: igmp - source: - host: 198.51.100.130 - destination: - any: true - ttl: - eq: 100 - - - sequence: 12 - grant: deny - source: - any: true - destination: - any: true - protocol: icmp + - afi: ipv4 + acls: + - name: acl_2 + aces: + - sequence: 11 + grant: permit + protocol: igmp + source: + host: 198.51.100.130 + destination: + any: true + ttl: + eq: 100 + - sequence: 12 + grant: deny + source: + any: true + destination: + any: true + protocol: icmp state: rendered # Task Output (redacted) diff --git a/plugins/modules/iosxr_banner.py b/plugins/modules/iosxr_banner.py index 2d80022b9..909d79511 100644 --- a/plugins/modules/iosxr_banner.py +++ b/plugins/modules/iosxr_banner.py @@ -70,7 +70,7 @@ - name: Configure banner from file cisco.iosxr.iosxr_banner: banner: motd - text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" + text: '{{ lookup(''file'', ''./config_partial/raw_banner.cfg'') }}' state: present """ diff --git a/plugins/modules/iosxr_bgp_address_family.py b/plugins/modules/iosxr_bgp_address_family.py index 3010a2f7f..b0cf5a8c7 100644 --- a/plugins/modules/iosxr_bgp_address_family.py +++ b/plugins/modules/iosxr_bgp_address_family.py @@ -492,17 +492,17 @@ cisco.iosxr.iosxr_bgp_address_family: state: merged config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 9 redistribute: - protocol: connected metric: 10 - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast dynamic_med: 10 redistribute: - protocol: application @@ -597,10 +597,10 @@ cisco.iosxr.iosxr_bgp_address_family: state: replaced config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 10 # Task output @@ -674,10 +674,10 @@ cisco.iosxr.iosxr_bgp_address_family: state: overridden config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 10 @@ -768,17 +768,17 @@ cisco.iosxr.iosxr_bgp_address_family: state: rendered config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 9 redistribute: - protocol: connected metric: 10 - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast dynamic_med: 10 redistribute: - protocol: application @@ -808,21 +808,21 @@ # # Using gathered # ------------- -- name: Merge the provided configuration with the existing running configuration +- name: Gather existing running configuration cisco.iosxr.iosxr_bgp_address_family: state: gathered config: - as_number: "65536" + as_number: '65536' address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast vrf: vrf1 dynamic_med: 9 redistribute: - protocol: connected metric: 10 - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast dynamic_med: 10 redistribute: - protocol: application @@ -860,8 +860,8 @@ # # Using parsed # -#parsed.cfg -#------------ +# parsed.cfg +# ------------ # router bgp 65536 # bgp router-id 192.0.1.1 # address-family ipv4 unicast diff --git a/plugins/modules/iosxr_bgp_global.py b/plugins/modules/iosxr_bgp_global.py index d7f344409..fe444a9ea 100644 --- a/plugins/modules/iosxr_bgp_global.py +++ b/plugins/modules/iosxr_bgp_global.py @@ -939,45 +939,44 @@ # # Before state # ------------ - # RP/0/0/CPU0:10#show running-config router bgp # Thu Feb 4 09:38:36.245 UTC # % No such configuration item(s) # RP/0/0/CPU0:10# - - name: Merge the following BGP global configuration - cisco.iosxr.iosxr_bgp_global: - config: - as_number: 65536 - default_metric: 5 - socket: - receive_buffer_size: 514 - send_buffer_size: 4098 - bgp: - confederation: - identifier: 4 - bestpath: - med: - confed: True - cluster_id: 5 - router_id: 192.0.2.10 - neighbors: - - neighbor: 192.0.2.13 - remote_as: 65538 - bfd: - fast_detect: - strict_mode: True - multiplier: 6 - minimum_interval: 20 - vrfs: - - vrf: vrf1 - default_metric: 5 +- name: Merge the following BGP global configuration + cisco.iosxr.iosxr_bgp_global: + config: + as_number: 65536 + default_metric: 5 + socket: + receive_buffer_size: 514 + send_buffer_size: 4098 + bgp: + confederation: + identifier: 4 + bestpath: + med: + confed: true + cluster_id: 5 + router_id: 192.0.2.10 + neighbors: + - neighbor: 192.0.2.13 + remote_as: 65538 + bfd: + fast_detect: + strict_mode: true + multiplier: 6 + minimum_interval: 20 + vrfs: + - vrf: vrf1 + default_metric: 5 +# # Task Output: -# ------------ +# --------------- # # before: {} - # commands: # - router bgp 65536 # - bgp cluster-id 5 @@ -1071,37 +1070,38 @@ # ! # ! - - name: Replace the following configuration - cisco.iosxr.iosxr_bgp_global: - state: replaced - config: - as_number: 65536 - default_metric: 4 - socket: - receive_buffer_size: 514 - send_buffer_size: 4098 - bgp: - confederation: - identifier: 4 - bestpath: - med: - confed: True - cluster_id: 5 - router_id: 192.0.2.10 - neighbors: - - neighbor: 192.0.2.14 - remote_as: 65538 - bfd: - fast_detect: - strict_mode: True - multiplier: 6 - minimum_interval: 20 - vrfs: - - vrf: vrf1 - default_metric: 5 +- name: Replace the following configuration + cisco.iosxr.iosxr_bgp_global: + state: replaced + config: + as_number: 65536 + default_metric: 4 + socket: + receive_buffer_size: 514 + send_buffer_size: 4098 + bgp: + confederation: + identifier: 4 + bestpath: + med: + confed: true + cluster_id: 5 + router_id: 192.0.2.10 + neighbors: + - neighbor: 192.0.2.14 + remote_as: 65538 + bfd: + fast_detect: + strict_mode: true + multiplier: 6 + minimum_interval: 20 + vrfs: + - vrf: vrf1 + default_metric: 5 +# # Task Output: -# ------------ +# ------------- # # before: # as_number: '65536' @@ -1215,37 +1215,37 @@ # ! # ! - - name: Override running config with provided configuration - cisco.iosxr.iosxr_bgp_global: - state: overridden - config: - as_number: 65536 - default_metric: 4 - socket: - receive_buffer_size: 514 - send_buffer_size: 4098 - bgp: - confederation: - identifier: 4 - bestpath: - med: - confed: True - cluster_id: 5 - router_id: 192.0.2.10 - neighbors: - - neighbor: 192.0.2.14 - remote_as: 65538 - bfd: - fast_detect: - strict_mode: True - multiplier: 6 - minimum_interval: 20 - vrfs: - - vrf: vrf1 - default_metric: 5 +- name: Override running config with provided configuration + cisco.iosxr.iosxr_bgp_global: + state: overridden + config: + as_number: 65536 + default_metric: 4 + socket: + receive_buffer_size: 514 + send_buffer_size: 4098 + bgp: + confederation: + identifier: 4 + bestpath: + med: + confed: true + cluster_id: 5 + router_id: 192.0.2.10 + neighbors: + - neighbor: 192.0.2.14 + remote_as: 65538 + bfd: + fast_detect: + strict_mode: true + multiplier: 6 + minimum_interval: 20 + vrfs: + - vrf: vrf1 + default_metric: 5 # # Task Output: -# ------------ +# ------------- # # before: # as_number: '65536' @@ -1360,14 +1360,15 @@ # ! # - - name: Delete BGP configurations handled by this module - cisco.iosxr.iosxr_bgp_global: - config: - as_number: 65536 - state: deleted +- name: Delete BGP configurations handled by this module + cisco.iosxr.iosxr_bgp_global: + config: + as_number: 65536 + state: deleted +# # Task Output: -# ------------ +# ------------- # # before: # as_number: '65536' @@ -1446,13 +1447,13 @@ # ! # - - name: Purge all BGP configurations from the device - cisco.iosxr.iosxr_bgp_global: - state: purged +- name: Purge all BGP configurations from the device + cisco.iosxr.iosxr_bgp_global: + state: purged # # Task Output: -# ------------ +# ------------- # # before: # as_number: '65536' @@ -1492,49 +1493,54 @@ # Thu Feb 4 09:38:36.245 UTC # % No such configuration item(s) # RP/0/0/CPU0:10# +# -# Using replaced # - - name: Render platform specific configuration lines (without connecting to the device) - cisco.iosxr.iosxr_bgp_global: - state: rendered - config: - as_number: 1 - default_metric: 4 - vrfs: - - vrf: vrf3 - bfd: - minimum_interval: 20 - multiplier: 10 - bgp: - fast_external_fallover: - disable: True - router_id: 1.2.3.4 - auto_policy_soft_reset: - disable: True - timers: - keepalive_time: 20 - holdtime: 30 - - vrf: vrf2 - bgp: - enforce_first_as: - disable: True - default_metric: 4 - neighbors: - - neighbor: 1.1.1.3 - remote_as: 2 - graceful_maintenance: - set: True - activate: - inheritance_disable: True - local_preference: - value: 1 - as_prepends: - value: 2 +# Using Rendered +# ----------------- +# +- name: >- + Render platform specific configuration lines (without connecting to the + device) + cisco.iosxr.iosxr_bgp_global: + state: rendered + config: + as_number: 1 + default_metric: 4 + vrfs: + - vrf: vrf3 + bfd: + minimum_interval: 20 + multiplier: 10 + bgp: + fast_external_fallover: + disable: true + router_id: 1.2.3.4 + auto_policy_soft_reset: + disable: true + timers: + keepalive_time: 20 + holdtime: 30 + - vrf: vrf2 + bgp: + enforce_first_as: + disable: true + default_metric: 4 + neighbors: + - neighbor: 1.1.1.3 + remote_as: 2 + graceful_maintenance: + set: true + activate: + inheritance_disable: true + local_preference: + value: 1 + as_prepends: + value: 2 -# Task Output: -# ------------ # +# Task output +# ----------------------- # rendered: # - router bgp 1 # - default-metric 4 @@ -1580,14 +1586,13 @@ # ! # - - name: Parse externally provided BGP config - cisco.iosxr.iosxr_bgp_global: - running_config: "{{ lookup('file', 'parsed.cfg') }}" - state: parsed +- name: Parse externally provided BGP config + cisco.iosxr.iosxr_bgp_global: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed -# Task Output: -# ------------ -# +# Task output +# ----------------------- # parsed: # as_number: '65536' # bgp: @@ -1641,9 +1646,9 @@ # ! # ! - - name: Gather bgp global facts - cisco.iosxr.iosxr_bgp_global: - state: gathered +- name: Gather bgp global facts + cisco.iosxr.iosxr_bgp_global: + state: gathered # Task Output: # ------------ @@ -1673,7 +1678,6 @@ # vrfs: # - default_metric: 5 # vrf: vrf1 - """ RETURN = """ before: diff --git a/plugins/modules/iosxr_bgp_neighbor_address_family.py b/plugins/modules/iosxr_bgp_neighbor_address_family.py index 85903d307..4657d771a 100644 --- a/plugins/modules/iosxr_bgp_neighbor_address_family.py +++ b/plugins/modules/iosxr_bgp_neighbor_address_family.py @@ -418,16 +418,16 @@ neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true weight: 5 - neighbor_address: 192.0.2.3 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -437,8 +437,8 @@ neighbors: - neighbor_address: 192.0.2.4 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -447,8 +447,8 @@ neighbors: - neighbor_address: 192.0.2.5 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -600,7 +600,7 @@ # capability orf prefix both # default-originate -- name: Delete the provided configuration +- name: Delete the provided configuration cisco.iosxr.iosxr_bgp_neighbor_address_family: state: deleted config: @@ -608,8 +608,8 @@ neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -703,8 +703,8 @@ neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast default_originate: set: true weight: 4 @@ -831,7 +831,7 @@ # capability orf prefix both # default-originate -- name: override the provided configuration +- name: override the provided configuration cisco.iosxr.iosxr_bgp_neighbor_address_family: state: overridden config: @@ -839,8 +839,8 @@ neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -912,7 +912,9 @@ # neighbor 192.0.2.5 # remote-as 65540 -- name: Render platform specific configuration lines with state rendered (without connecting to the device) +- name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_bgp_neighbor_address_family: state: rendered config: @@ -920,16 +922,16 @@ neighbors: - neighbor_address: 192.0.2.2 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true weight: 5 - neighbor_address: 192.0.2.3 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -939,8 +941,8 @@ neighbors: - neighbor_address: 192.0.2.4 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -949,8 +951,8 @@ neighbors: - neighbor_address: 192.0.2.5 address_family: - - afi: "ipv4" - safi: "unicast" + - afi: ipv4 + safi: unicast multipath: true default_originate: set: true @@ -984,8 +986,8 @@ # # Using parsed # -#parsed.cfg -#------------ +# parsed.cfg +# ------------ # router bgp 65536 # bgp router-id 192.0.1.1 # address-family ipv4 unicast @@ -1067,8 +1069,8 @@ # capability_orf_prefix: both # # -#Using Gathered -#----------------- +# Using Gathered +# ----------------- # Before state state: # ------------- # RP/0/0/CPU0:iosxr-02#show running-config router bgp @@ -1110,8 +1112,8 @@ # - name: Gathered the provided configuration with the existing running configuration cisco.iosxr.iosxr_bgp_neighbor_address_family: - config: - state: gathered + config: + state: gathered # Task output @@ -1157,7 +1159,6 @@ # set: true # capability_orf_prefix: both # - """ from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/iosxr_bgp_templates.py b/plugins/modules/iosxr_bgp_templates.py index 6800ed60a..5db2cb2ad 100644 --- a/plugins/modules/iosxr_bgp_templates.py +++ b/plugins/modules/iosxr_bgp_templates.py @@ -798,52 +798,52 @@ - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_bgp_templates: config: - as_number: 65536 - neighbor: - - address_family: - - advertise: - local_labeled_route: - set: true - afi: ipv4 - safi: unicast - advertisement_interval: 10 - bfd: - fast_detect: - strict_mode: true - internal_vpn_client: true - name: neighbor-group1 - precedence: critical - - cluster_id: "1" - description: neighbor-group2 - dmz_link_bandwidth: - set: true - ebgp_multihop: - value: 255 - egress_engineering: - set: true - graceful_maintenance: - as_prepends: - value: 0 - set: true - ignore_connected_check: - set: true - internal_vpn_client: true - local: - address: - inheritance_disable: true - local_as: - value: 6 - name: neighbor-group2 - precedence: flash - receive_buffer_size: 512 - send_buffer_size: 4096 - session_open_mode: both - tcp: - mss: - inheritance_disable: true - ttl_security: - set: true - update_source: Loopback919 + as_number: 65536 + neighbor: + - address_family: + - advertise: + local_labeled_route: + set: true + afi: ipv4 + safi: unicast + advertisement_interval: 10 + bfd: + fast_detect: + strict_mode: true + internal_vpn_client: true + name: neighbor-group1 + precedence: critical + - cluster_id: '1' + description: neighbor-group2 + dmz_link_bandwidth: + set: true + ebgp_multihop: + value: 255 + egress_engineering: + set: true + graceful_maintenance: + as_prepends: + value: 0 + set: true + ignore_connected_check: + set: true + internal_vpn_client: true + local: + address: + inheritance_disable: true + local_as: + value: 6 + name: neighbor-group2 + precedence: flash + receive_buffer_size: 512 + send_buffer_size: 4096 + session_open_mode: both + tcp: + mss: + inheritance_disable: true + ttl_security: + set: true + update_source: Loopback919 state: merged # Task Output @@ -1003,29 +1003,29 @@ - name: Replaced given bgp_templates configuration cisco.iosxr.iosxr_bgp_templates: - config: - as_number: 65536 - neighbor: - - address_family: - - advertise: - local_labeled_route: - set: true - afi: ipv4 - safi: unicast - advertisement_interval: 12 - name: neighbor-group1 - precedence: flash - - cluster_id: "2" - description: replace neighbor-group2 - ebgp_multihop: - value: 254 - graceful_maintenance: - as_prepends: - value: 2 - set: true - update_source: Loopback917 - name: neighbor-group2 - state: replaced + config: + as_number: 65536 + neighbor: + - address_family: + - advertise: + local_labeled_route: + set: true + afi: ipv4 + safi: unicast + advertisement_interval: 12 + name: neighbor-group1 + precedence: flash + - cluster_id: '2' + description: replace neighbor-group2 + ebgp_multihop: + value: 254 + graceful_maintenance: + as_prepends: + value: 2 + set: true + update_source: Loopback917 + name: neighbor-group2 + state: replaced # Task Output # ----------- @@ -1174,8 +1174,8 @@ - name: Delete given bgp_nbr_address_family configuration cisco.iosxr.iosxr_bgp_templates: &deleted - config: - state: deleted + config: + state: deleted # Task Output # ----------- @@ -1215,8 +1215,6 @@ # # RP/0/RP0/CPU0:10# - - # Using gathered # Before state: # ------------- @@ -1257,8 +1255,8 @@ - name: Gather given bgp_templates configuration cisco.iosxr.iosxr_bgp_templates: &id001 - config: - state: gathered + config: + state: gathered # Task output # ----------- @@ -1349,25 +1347,24 @@ # internal-vpn-client # ! # ! - - name: override given bgp_templates configuration cisco.iosxr.iosxr_bgp_templates: - config: - as_number: 65536 - neighbor: - - address_family: - - advertise: - local_labeled_route: - disable: true - afi: ipv4 - safi: unicast - advertisement_interval: 12 - bfd: - fast_detect: - strict_mode: true - name: neighbor-group1 - precedence: flash - state: overridden + config: + as_number: 65536 + neighbor: + - address_family: + - advertise: + local_labeled_route: + disable: true + afi: ipv4 + safi: unicast + advertisement_interval: 12 + bfd: + fast_detect: + strict_mode: true + name: neighbor-group1 + precedence: flash + state: overridden # Task Output # ----------- @@ -1446,7 +1443,9 @@ # Using rendered -- name: Render platform specific configuration lines with state rendered (without connecting to the device) +- name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_bgp_templates: config: as_number: 65536 @@ -1464,7 +1463,7 @@ internal_vpn_client: true name: neighbor-group1 precedence: critical - - cluster_id: "1" + - cluster_id: '1' description: neighbor-group2 dmz_link_bandwidth: set: true diff --git a/plugins/modules/iosxr_command.py b/plugins/modules/iosxr_command.py index 5838de0da..814ee5d68 100644 --- a/plugins/modules/iosxr_command.py +++ b/plugins/modules/iosxr_command.py @@ -88,32 +88,32 @@ - name: run multiple commands on remote nodes cisco.iosxr.iosxr_command: commands: - - show version - - show interfaces - - {command: example command that prompts, prompt: expected prompt, answer: yes} + - show version + - show interfaces + - {command: example command that prompts, prompt: expected prompt, answer: true} - name: run multiple commands and evaluate the output cisco.iosxr.iosxr_command: commands: - - show version - - show interfaces + - show version + - show interfaces wait_for: - - result[0] contains IOS-XR - - result[1] contains Loopback0 + - result[0] contains IOS-XR + - result[1] contains Loopback0 -- name: multiple prompt, multiple answer (mandatory check for all prompts) +- name: 'multiple prompt, multiple answer (mandatory check for all prompts)' cisco.iosxr.iosxr_command: commands: - - command: key config-key password-encryption - prompt: - - "Enter old key :" - - "Enter new key :" - - "Enter confirm key :" - answer: - - "test1234" - - "test12345" - - "test12345" - check_all: true + - command: key config-key password-encryption + prompt: + - 'Enter old key :' + - 'Enter new key :' + - 'Enter confirm key :' + answer: + - test1234 + - test12345 + - test12345 + check_all: true """ RETURN = """ diff --git a/plugins/modules/iosxr_config.py b/plugins/modules/iosxr_config.py index bef0477fd..7fc59fefa 100644 --- a/plugins/modules/iosxr_config.py +++ b/plugins/modules/iosxr_config.py @@ -195,28 +195,26 @@ - name: configure interface settings cisco.iosxr.iosxr_config: lines: - - description test interface - - ip address 172.31.1.1 255.255.255.0 + - description test interface + - ip address 172.31.1.1 255.255.255.0 parents: interface GigabitEthernet0/0/0/0 - name: load a config from disk and replace the current config cisco.iosxr.iosxr_config: src: config.cfg replace: config - backup: yes + backup: 'yes' -- name: for idempotency, use full-form commands +- name: 'for idempotency, use full-form commands' cisco.iosxr.iosxr_config: lines: - # - shut - - shutdown - # parents: int g0/0/0/1 + - shutdown parents: interface GigabitEthernet0/0/0/1 - name: configurable backup path cisco.iosxr.iosxr_config: src: config.cfg - backup: yes + backup: true backup_options: filename: backup.cfg dir_path: /home/user diff --git a/plugins/modules/iosxr_facts.py b/plugins/modules/iosxr_facts.py index c3e7df382..c406a18b7 100644 --- a/plugins/modules/iosxr_facts.py +++ b/plugins/modules/iosxr_facts.py @@ -67,25 +67,25 @@ # Collect only the config and default facts - cisco.iosxr.iosxr_facts: gather_subset: - - config + - config # Do not collect hardware facts - cisco.iosxr.iosxr_facts: gather_subset: - - '!hardware' + - '!hardware' # Collect only the lacp facts - cisco.iosxr.iosxr_facts: gather_subset: - - '!all' - - '!min' + - '!all' + - '!min' gather_network_resources: - - lacp + - lacp # Do not collect lacp_interfaces facts - cisco.iosxr.iosxr_facts: gather_network_resources: - - '!lacp_interfaces' + - '!lacp_interfaces' # Collect lacp and minimal default facts - cisco.iosxr.iosxr_facts: @@ -95,11 +95,11 @@ # Collect only the interfaces facts - cisco.iosxr.iosxr_facts: gather_subset: - - '!all' - - '!min' + - '!all' + - '!min' gather_network_resources: - - interfaces - - l2_interfaces + - interfaces + - l2_interfaces """ RETURN = """ diff --git a/plugins/modules/iosxr_hostname.py b/plugins/modules/iosxr_hostname.py index a41aaf77d..7ea657a32 100644 --- a/plugins/modules/iosxr_hostname.py +++ b/plugins/modules/iosxr_hostname.py @@ -71,9 +71,9 @@ # Before state: # ------------- -#RP/0/RP0/CPU0:ios#show running-config hostname -#Thu Jan 20 19:48:56.011 UTC -#hostname ios +# RP/0/RP0/CPU0:ios#show running-config hostname +# Thu Jan 20 19:48:56.011 UTC +# hostname ios # Merged play: # ------------ @@ -94,7 +94,7 @@ # ------------ # RP/0/0/CPU0:Router1#show running-config hostname -#Thu Jan 20 19:48:56.011 UTC +# Thu Jan 20 19:48:56.011 UTC # hostname Router1 @@ -103,7 +103,7 @@ # ------------- # RP/0/0/CPU0:Router1#show running-config hostname -#Thu Jan 20 19:48:56.011 UTC +# Thu Jan 20 19:48:56.011 UTC # hostname Router1 # Deleted play: @@ -122,9 +122,9 @@ # After state: # ------------ -#RP/0/RP0/CPU0:ios#show running-config hostname -#Thu Jan 20 19:55:12.971 UTC -#hostname ios +# RP/0/RP0/CPU0:ios#show running-config hostname +# Thu Jan 20 19:55:12.971 UTC +# hostname ios # Using state: overridden # Before state: @@ -151,17 +151,17 @@ # After state: # ------------ -#RP/0/RP0/CPU0:RouterTest#show running-config hostname -#Thu Jan 20 19:48:56.011 UTC -#hostname RouterTest +# RP/0/RP0/CPU0:RouterTest#show running-config hostname +# Thu Jan 20 19:48:56.011 UTC +# hostname RouterTest # Using state: replaced # Before state: # ------------- -#RP/0/RP0/CPU0:RouterTest#show running-config hostname -#Thu Jan 20 19:48:56.011 UTC -#hostname RouterTest +# RP/0/RP0/CPU0:RouterTest#show running-config hostname +# Thu Jan 20 19:48:56.011 UTC +# hostname RouterTest # Replaced play: # -------------- @@ -185,9 +185,9 @@ # Before state: # ------------- -#RP/0/RP0/CPU0:RouterTest#show running-config hostname -#Thu Jan 20 19:48:56.011 UTC -#hostname RouterTest +# RP/0/RP0/CPU0:RouterTest#show running-config hostname +# Thu Jan 20 19:48:56.011 UTC +# hostname RouterTest # Gathered play: # -------------- diff --git a/plugins/modules/iosxr_interfaces.py b/plugins/modules/iosxr_interfaces.py index 4f4345d3c..bfa25edca 100644 --- a/plugins/modules/iosxr_interfaces.py +++ b/plugins/modules/iosxr_interfaces.py @@ -121,13 +121,13 @@ - name: Configure Ethernet interfaces cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - description: Configured by Ansible - enabled: true - - name: GigabitEthernet0/0/0/3 - description: Configured by Ansible Network - enabled: false - duplex: full + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: full state: merged # Task Output @@ -204,14 +204,14 @@ - name: Replace their existing configuration per interface cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - description: Configured by Ansible - enabled: true - mtu: 2000 - - name: GigabitEthernet0/0/0/3 - description: Configured by Ansible Network - enabled: false - duplex: auto + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + mtu: 2000 + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + duplex: auto state: replaced # Task Output @@ -295,14 +295,14 @@ - name: Override interfaces configuration cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - description: Configured by Ansible - enabled: true - duplex: auto - - name: GigabitEthernet0/0/0/3 - description: Configured by Ansible Network - enabled: false - speed: 1000 + - name: GigabitEthernet0/0/0/2 + description: Configured by Ansible + enabled: true + duplex: auto + - name: GigabitEthernet0/0/0/3 + description: Configured by Ansible Network + enabled: false + speed: 1000 state: overridden # Task Output @@ -382,8 +382,8 @@ - name: Delete interfaces arguments cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/2 - - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + - name: GigabitEthernet0/0/0/3 state: deleted # Task Output @@ -492,17 +492,17 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_interfaces: config: - - name: GigabitEthernet0/0/0/0 - description: Configured and Merged by Ansible-Network - mtu: 110 - enabled: true - duplex: half - - name: GigabitEthernet0/0/0/1 - description: Configured and Merged by Ansible-Network - mtu: 2800 - enabled: false - speed: 100 - duplex: full + - name: GigabitEthernet0/0/0/0 + description: Configured and Merged by Ansible-Network + mtu: 110 + enabled: true + duplex: half + - name: GigabitEthernet0/0/0/1 + description: Configured and Merged by Ansible-Network + mtu: 2800 + enabled: false + speed: 100 + duplex: full state: rendered # Task Output diff --git a/plugins/modules/iosxr_l2_interfaces.py b/plugins/modules/iosxr_l2_interfaces.py index d1f8bbea6..0614dbda4 100644 --- a/plugins/modules/iosxr_l2_interfaces.py +++ b/plugins/modules/iosxr_l2_interfaces.py @@ -183,20 +183,21 @@ - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/3 - native_vlan: 20 - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: true - l2protocol: - - stp: tunnel - - name: GigabitEthernet0/0/0/3.900 - l2transport: true - q_vlan: - - 20 - - 40 + - name: GigabitEthernet0/0/0/3 + native_vlan: 20 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: tunnel + - name: GigabitEthernet0/0/0/3.900 + l2transport: true + q_vlan: + - 20 + - 40 state: merged + # After state: # ------------ # @@ -245,20 +246,23 @@ # dot1q vlan 20 40 # ! -- name: Replaces device configuration of listed interfaces with provided configuration +- name: >- + Replaces device configuration of listed interfaces with provided + configuration cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: true - l2protocol: - - stp: forward - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - any + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any state: replaced + # After state: # ------------- # @@ -310,17 +314,18 @@ - name: Override device configuration of all interfaces with provided configuration cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: true - l2protocol: - - stp: forward - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - any + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 + l2transport: true + l2protocol: + - stp: forward + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - any state: overridden + # After state: # ------------- # @@ -369,7 +374,7 @@ - name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)" cisco.iosxr.iosxr_l2_interfaces: config: - - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/4 state: deleted # After state: @@ -511,25 +516,21 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_l2_interfaces: config: - - - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - l2transport: true - l2protocol: - - - pvst: tunnel - - - cdp: forward - propagate: true - - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - 40 - - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 + - name: GigabitEthernet0/0/0/1 + native_vlan: 10 + l2transport: true + l2protocol: + - pvst: tunnel + - cdp: forward + propagate: true + - name: GigabitEthernet0/0/0/3.900 + q_vlan: + - 20 + - 40 + - name: GigabitEthernet0/0/0/4 + native_vlan: 40 state: rendered + # Task Output (redacted) # ----------------------- # "rendered": [ @@ -656,9 +657,6 @@ # shutdown # dot1q native vlan 40 # ! - - - """ RETURN = """ diff --git a/plugins/modules/iosxr_l3_interfaces.py b/plugins/modules/iosxr_l3_interfaces.py index c683e292c..babf38a90 100644 --- a/plugins/modules/iosxr_l3_interfaces.py +++ b/plugins/modules/iosxr_l3_interfaces.py @@ -128,13 +128,13 @@ - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/2 - ipv4: - - address: 192.168.0.1/24 - - name: GigabitEthernet0/0/0/3 - ipv4: - - address: 192.168.2.1/24 - secondary: true + - name: GigabitEthernet0/0/0/2 + ipv4: + - address: 192.168.0.1/24 + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.2.1/24 + secondary: true state: merged # Task Output @@ -202,13 +202,14 @@ - name: Override device configuration of all interfaces with provided configuration cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/3 - ipv4: - - address: 192.168.0.2/24 - - address: 192.168.2.1/24 - secondary: true + - name: GigabitEthernet0/0/0/3 + ipv4: + - address: 192.168.0.2/24 + - address: 192.168.2.1/24 + secondary: true state: overridden + # Task Output # ----------- # @@ -276,17 +277,20 @@ # ipv4 address 192.168.2.1 255.255.255.0 secondary # ! -- name: Replaces device configuration of listed interfaces with provided configuration +- name: >- + Replaces device configuration of listed interfaces with provided + configuration cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/3 - ipv6: - - address: fd5d:12c9:2201:1::1/64 - - name: GigabitEthernet0/0/0/2 - ipv4: - - address: 192.168.0.2/24 + - name: GigabitEthernet0/0/0/3 + ipv6: + - address: 'fd5d:12c9:2201:1::1/64' + - name: GigabitEthernet0/0/0/2 + ipv4: + - address: 192.168.0.2/24 state: replaced + # Task Output # ----------- # @@ -353,14 +357,15 @@ # ipv6 address fd5d:12c9:2201:1::1/64 # ! -- name: "Delete attributes for interfaces (This won't delete the interface itself)" +- name: Delete attributes for interfaces (This won't delete the interface itself) cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/4 - - name: GigabitEthernet0/0/0/3.700 + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/3.700 state: deleted + # Task Output # ----------- # @@ -432,7 +437,7 @@ # interface preconfigure GigabitEthernet0/0/0/4 # ipv6 address fd5d:12c9:2201:1::1/64 # shutdown -#! +# ! - name: "Delete L3 config of all interfaces (This won't delete the interface itself)" cisco.iosxr.iosxr_l3_interfaces: @@ -570,18 +575,19 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_l3_interfaces: config: - - name: GigabitEthernet0/0/0/0 - ipv4: - - address: 198.51.100.1/24 - - name: GigabitEthernet0/0/0/1 - ipv6: - - address: 2001:db8:0:3::/64 - ipv4: - - address: 192.0.2.1/24 - - address: 192.0.2.2/24 - secondary: true + - name: GigabitEthernet0/0/0/0 + ipv4: + - address: 198.51.100.1/24 + - name: GigabitEthernet0/0/0/1 + ipv6: + - address: '2001:db8:0:3::/64' + ipv4: + - address: 192.0.2.1/24 + - address: 192.0.2.2/24 + secondary: true state: rendered + # Task Output # ----------- # diff --git a/plugins/modules/iosxr_lacp.py b/plugins/modules/iosxr_lacp.py index f963ff66c..f4fd19ae5 100644 --- a/plugins/modules/iosxr_lacp.py +++ b/plugins/modules/iosxr_lacp.py @@ -329,8 +329,6 @@ # RP/0/0/CPU0:an-iosxr-02#show running-config lacp # lacp system mac 00c1.4c00.bd15 # lacp system priority - - """ RETURN = """ before: diff --git a/plugins/modules/iosxr_lacp_interfaces.py b/plugins/modules/iosxr_lacp_interfaces.py index 1ebeaae8f..07a93d0e5 100644 --- a/plugins/modules/iosxr_lacp_interfaces.py +++ b/plugins/modules/iosxr_lacp_interfaces.py @@ -165,19 +165,18 @@ - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - churn_logging: actor - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/1 - period: 200 + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/1 + period: 200 state: merged + # # # ----------- @@ -265,13 +264,13 @@ - name: Replace LACP configuration of listed interfaces with provided configuration cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - churn_logging: partner - - - name: GigabitEthernet0/0/0/2 - period: 300 + - name: Bundle-Ether10 + churn_logging: partner + - name: GigabitEthernet0/0/0/2 + period: 300 state: replaced + # # # ----------- @@ -361,15 +360,15 @@ - name: Override all interface LACP configuration with provided configuration cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether12 - churn_logging: both - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: GigabitEthernet0/0/0/1 - period: 300 + - name: Bundle-Ether12 + churn_logging: both + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: GigabitEthernet0/0/0/1 + period: 300 state: overridden + # # # ----------- @@ -454,16 +453,18 @@ # ! # -- name: Deleted LACP configurations of provided interfaces (Note - This won't delete +- name: >- + Deleted LACP configurations of provided interfaces (Note - This won't delete the interface itself) cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - - name: Bundle-Ether11 - - name: GigabitEthernet0/0/0/1 - - name: GigabitEthernet0/0/0/2 + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: GigabitEthernet0/0/0/1 + - name: GigabitEthernet0/0/0/2 state: deleted + # # # ----------- @@ -559,19 +560,18 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_lacp_interfaces: config: - - name: Bundle-Ether10 - churn_logging: actor - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/1 - period: 200 + - name: Bundle-Ether10 + churn_logging: actor + collector_max_delay: 100 + switchover_suppress_flaps: 500 + - name: Bundle-Ether11 + system: + mac: 00c2.4c00.bd15 + - name: GigabitEthernet0/0/0/1 + period: 200 state: rendered + # ------------- # Output # ------------- @@ -587,8 +587,6 @@ # - "interface GigabitEthernet0/0/0/1" # - " lacp period 200" # - - """ RETURN = """ before: diff --git a/plugins/modules/iosxr_lag_interfaces.py b/plugins/modules/iosxr_lag_interfaces.py index 6d1dacec1..4732dbfde 100644 --- a/plugins/modules/iosxr_lag_interfaces.py +++ b/plugins/modules/iosxr_lag_interfaces.py @@ -157,26 +157,26 @@ - name: Merge provided configuration with device configuration cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: inherit - - member: GigabitEthernet0/0/0/3 - mode: inherit - mode: active - links: - max_active: 5 - min_active: 2 - load_balancing_hash: src-ip - - - name: Bundle-Ether12 - members: - - member: GigabitEthernet0/0/0/2 - mode: passive - - member: GigabitEthernet0/0/0/4 - mode: passive - load_balancing_hash: dst-ip + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip state: merged + # # # ----------- @@ -267,15 +267,14 @@ - name: Replace device configuration of listed Bundles with provided configurations cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether12 - members: - - name: GigabitEthernet0/0/0/2 - mode: passive - - - name: Bundle-Ether11 - members: - - name: GigabitEthernet0/0/0/4 - load_balancing_hash: src-ip + - name: Bundle-Ether12 + members: + - name: GigabitEthernet0/0/0/2 + mode: passive + - name: Bundle-Ether11 + members: + - name: GigabitEthernet0/0/0/4 + load_balancing_hash: src-ip state: replaced # # @@ -376,15 +375,16 @@ - name: Overrides all device configuration with provided configuration cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: inherit - - member: GigabitEthernet0/0/0/2 - mode: inherit - mode: active - load_balancing_hash: dst-ip + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/2 + mode: inherit + mode: active + load_balancing_hash: dst-ip state: overridden + # # # ------------ @@ -474,15 +474,17 @@ # # -- name: Delete attributes of given bundles and removes member interfaces from them +- name: >- + Delete attributes of given bundles and removes member interfaces from them (Note - This won't delete the bundles themselves) cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - - name: Bundle-Ether11 - - name: Bundle-Ether12 + - name: Bundle-Ether10 + - name: Bundle-Ether11 + - name: Bundle-Ether12 state: deleted + # # # ------------ @@ -736,25 +738,24 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_lag_interfaces: config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: inherit - - member: GigabitEthernet0/0/0/3 - mode: inherit - mode: active - links: - max_active: 5 - min_active: 2 - load_balancing_hash: src-ip - - - name: Bundle-Ether12 - members: - - member: GigabitEthernet0/0/0/2 - mode: passive - - member: GigabitEthernet0/0/0/4 - mode: passive - load_balancing_hash: dst-ip + - name: Bundle-Ether10 + members: + - member: GigabitEthernet0/0/0/1 + mode: inherit + - member: GigabitEthernet0/0/0/3 + mode: inherit + mode: active + links: + max_active: 5 + min_active: 2 + load_balancing_hash: src-ip + - name: Bundle-Ether12 + members: + - member: GigabitEthernet0/0/0/2 + mode: passive + - member: GigabitEthernet0/0/0/4 + mode: passive + load_balancing_hash: dst-ip state: rendered # Output: @@ -787,9 +788,6 @@ # - " bundle id 12 mode passive" # ] # -# - - """ RETURN = """ before: diff --git a/plugins/modules/iosxr_lldp_global.py b/plugins/modules/iosxr_lldp_global.py index 662fb498e..c3eb21ddb 100644 --- a/plugins/modules/iosxr_lldp_global.py +++ b/plugins/modules/iosxr_lldp_global.py @@ -426,9 +426,6 @@ # "lldp tlv-select management-address disable", # "lldp timer 3000" # ] - - - """ RETURN = """ before: diff --git a/plugins/modules/iosxr_lldp_interfaces.py b/plugins/modules/iosxr_lldp_interfaces.py index f88d132e5..0322a0e1f 100644 --- a/plugins/modules/iosxr_lldp_interfaces.py +++ b/plugins/modules/iosxr_lldp_interfaces.py @@ -120,17 +120,17 @@ - name: Merge provided configuration with running configuration cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - destination: - mac_address: ieee-nearest-non-tmpr-bridge - transmit: false - - - name: GigabitEthernet0/0/0/2 - destination: - mac_address: ieee-nearest-bridge - receive: false + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false state: merged + # # # ------------------------ @@ -242,15 +242,17 @@ # # -- name: Replace existing LLDP configurations of specified interfaces with provided +- name: >- + Replace existing LLDP configurations of specified interfaces with provided configuration cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - destination: - mac_address: ieee-nearest-non-tmpr-bridge + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge state: replaced + # # # ------------------------ @@ -366,13 +368,16 @@ # # -- name: Override the LLDP configurations of all the interfaces with provided configurations +- name: >- + Override the LLDP configurations of all the interfaces with provided + configurations cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - transmit: false + - name: GigabitEthernet0/0/0/1 + transmit: false state: overridden + # # # ------------------------ @@ -638,17 +643,15 @@ - name: Render platform specific commands from task input using rendered state cisco.iosxr.iosxr_lldp_interfaces: config: - - name: GigabitEthernet0/0/0/1 - destination: - mac_address: ieee-nearest-non-tmpr-bridge - transmit: false - - - name: GigabitEthernet0/0/0/2 - destination: - mac_address: ieee-nearest-bridge - receive: false + - name: GigabitEthernet0/0/0/1 + destination: + mac_address: ieee-nearest-non-tmpr-bridge + transmit: false + - name: GigabitEthernet0/0/0/2 + destination: + mac_address: ieee-nearest-bridge + receive: false state: rendered - # ------------------------ # Module Execution Result # ------------------------ @@ -661,7 +664,6 @@ # "lldp receive disable", # "lldp destination mac-address ieee-nearest-bridge" # ] - """ RETURN = """ before: diff --git a/plugins/modules/iosxr_logging.py b/plugins/modules/iosxr_logging.py index 9889f568f..abca845df 100644 --- a/plugins/modules/iosxr_logging.py +++ b/plugins/modules/iosxr_logging.py @@ -201,18 +201,18 @@ - name: Configure logging using aggregate cisco.iosxr.iosxr_logging: aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} - name: Delete logging using aggregate cisco.iosxr.iosxr_logging: aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} + - {dest: console, level: warning} + - {dest: buffered, size: 4800000} + - {dest: file, name: file3, size: 2048} + - {dest: host, name: host3, level: critical} state: absent """ diff --git a/plugins/modules/iosxr_logging_global.py b/plugins/modules/iosxr_logging_global.py index 4d25dcaab..55dd23f6b 100644 --- a/plugins/modules/iosxr_logging_global.py +++ b/plugins/modules/iosxr_logging_global.py @@ -364,56 +364,56 @@ """ EXAMPLES = """ # Using merged -#----------------- +# ----------------- # Before state -#RP/0/0/CPU0:10#show running-config logging -#Thu Feb 4 09:38:36.245 UTC -#% No such configuration item(s) -#RP/0/0/CPU0:10# +# RP/0/0/CPU0:10#show running-config logging +# Thu Feb 4 09:38:36.245 UTC +# % No such configuration item(s) +# RP/0/0/CPU0:10# # # - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_logging_global: - config: - buffered: - size: 2097152 - severity: warnings - correlator: - buffer_size: 1024 - events: - display_location: True - files: - - maxfilesize: '1024' - name: test - path: test - severity: info - hostnameprefix: test - hosts: - - host: 1.1.1.1 - port: default - severity: critical - vrf: default - ipv4: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - source_interfaces: - - interface: GigabitEthernet0/0/0/0 - vrf: test - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test2 - vrf: test - trap: - severity: informational - state: merged + config: + buffered: + size: 2097152 + severity: warnings + correlator: + buffer_size: 1024 + events: + display_location: true + files: + - maxfilesize: '1024' + name: test + path: test + severity: info + hostnameprefix: test + hosts: + - host: 1.1.1.1 + port: default + severity: critical + vrf: default + ipv4: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + source_interfaces: + - interface: GigabitEthernet0/0/0/0 + vrf: test + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test2 + vrf: test + trap: + severity: informational + state: merged # # # After state: -#------------------------------------------- -#RP/0/0/CPU0:10#show running-config logging +# ------------------------------------------- +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -432,8 +432,8 @@ # logging localfilesize 1024 # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test -#------------------------------------------------ -#Module execution +# ------------------------------------------------ +# Module execution # # "after": { # "buffered": { @@ -582,8 +582,8 @@ # Using replaced: # ----------------------------------------------------------- # -#Before state -#RP/0/0/CPU0:10#show running-config logging +# Before state +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -602,42 +602,42 @@ # logging localfilesize 1024 # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test -#----------------------------------------------------------- +# ----------------------------------------------------------- # - name: Replace BGP configuration with provided configuration cisco.iosxr.iosxr_logging_global: - state: replaced - config: - buffered: - severity: errors - correlator: - buffer_size: 1024 - files: - - maxfilesize: '1024' - name: test - path: test1 - severity: info - hostnameprefix: test1 - hosts: - - host: 1.1.1.3 - port: default - severity: critical - vrf: default - ipv6: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test - vrf: test - trap: - severity: critical + state: replaced + config: + buffered: + severity: errors + correlator: + buffer_size: 1024 + files: + - maxfilesize: '1024' + name: test + path: test1 + severity: info + hostnameprefix: test1 + hosts: + - host: 1.1.1.3 + port: default + severity: critical + vrf: default + ipv6: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test + vrf: test + trap: + severity: critical # # After state: -#RP/0/0/CPU0:10#show running-config logging +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:31:51.709 UTC # logging tls-server test # vrf test @@ -653,7 +653,7 @@ # logging correlator buffer-size 1024 # logging localfilesize 1024 # logging hostnameprefix test1 -#----------------------------------------------------------------- +# ----------------------------------------------------------------- # # Module Execution: # "after": { @@ -773,7 +773,7 @@ # Using deleted: # ----------------------------------------------------------- # Before state: -#RP/0/0/CPU0:10#show running-config logging +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -793,15 +793,15 @@ # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test # -#----------------------------------------------------------- +# ----------------------------------------------------------- - name: Delete given logging_global configuration cisco.iosxr.iosxr_logging_global: - state: deleted + state: deleted # # After state: -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # -#------------------------------------------------------------- +# ------------------------------------------------------------- # Module Execution: # # "after": {}, @@ -887,7 +887,7 @@ # using gathered: # ------------------------------------------------------------ # Before state: -#RP/0/0/CPU0:10#show running-config logging +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -910,9 +910,9 @@ # - name: Gather iosxr_logging_global facts using gathered state cisco.iosxr.iosxr_logging_global: - state: gathered + state: gathered # -#------------------------------------------------------------- +# ------------------------------------------------------------- # Module Execution: # # "changed": false, @@ -979,7 +979,7 @@ # # # Using parsed: -#--------------------------------------------------------------- +# --------------------------------------------------------------- # # parsed.cfg # @@ -1004,9 +1004,9 @@ # - name: Parse externally provided Logging global config to agnostic model cisco.iosxr.iosxr_logging_global: - running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" - state: parsed -#---------------------------------------------------------------- + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed +# ---------------------------------------------------------------- # Module execution: # "changed": false, # "parsed": { @@ -1066,44 +1066,46 @@ # # Using rendered: # ---------------------------------------------------------------------------- -- name: Render platform specific configuration lines with state rendered (without connecting to the device) +- name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_logging_global: - state: rendered - config: - buffered: - size: 2097152 - severity: warnings - correlator: - buffer_size: 1024 - events: - display_location: True - files: - - maxfilesize: '1024' - name: test - path: test - severity: info - hostnameprefix: test - hosts: - - host: 1.1.1.1 - port: default - severity: critical - vrf: default - ipv4: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - source_interfaces: - - interface: GigabitEthernet0/0/0/0 - vrf: test - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test2 - vrf: test - trap: - severity: informational -#---------------------------------------------------------------- + state: rendered + config: + buffered: + size: 2097152 + severity: warnings + correlator: + buffer_size: 1024 + events: + display_location: true + files: + - maxfilesize: '1024' + name: test + path: test + severity: info + hostnameprefix: test + hosts: + - host: 1.1.1.1 + port: default + severity: critical + vrf: default + ipv4: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + source_interfaces: + - interface: GigabitEthernet0/0/0/0 + vrf: test + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test2 + vrf: test + trap: + severity: informational +# ---------------------------------------------------------------- # Module Execution: # "rendered": [ # "logging buffered errors", @@ -1126,7 +1128,7 @@ # Using overridden: # --------------------------------------------------------------------------------- # Before state: -#RP/0/0/CPU0:10#show running-config logging +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:09:18.491 UTC # logging tls-server test # vrf test @@ -1146,42 +1148,42 @@ # logging source-interface GigabitEthernet0/0/0/0 vrf test # logging hostnameprefix test # -#----------------------------------------------------------- +# ----------------------------------------------------------- # - name: Overridde logging global configuration with provided configuration cisco.iosxr.iosxr_logging_global: - state: overridden - config: - buffered: - severity: errors - correlator: - buffer_size: 1024 - files: - - maxfilesize: '1024' - name: test - path: test1 - severity: info - hostnameprefix: test1 - hosts: - - host: 1.1.1.3 - port: default - severity: critical - vrf: default - ipv6: - dscp: af11 - localfilesize: 1024 - monitor: - severity: errors - tls_servers: - - name: test - tls_hostname: test2 - trustpoint: test - vrf: test - trap: - severity: critical + state: overridden + config: + buffered: + severity: errors + correlator: + buffer_size: 1024 + files: + - maxfilesize: '1024' + name: test + path: test1 + severity: info + hostnameprefix: test1 + hosts: + - host: 1.1.1.3 + port: default + severity: critical + vrf: default + ipv6: + dscp: af11 + localfilesize: 1024 + monitor: + severity: errors + tls_servers: + - name: test + tls_hostname: test2 + trustpoint: test + vrf: test + trap: + severity: critical # # After state: -#RP/0/0/CPU0:10#show running-config logging +# RP/0/0/CPU0:10#show running-config logging # Tue Jul 20 18:31:51.709 UTC # logging tls-server test # vrf test @@ -1197,7 +1199,7 @@ # logging correlator buffer-size 1024 # logging localfilesize 1024 # logging hostnameprefix test1 -#----------------------------------------------------------------- +# ----------------------------------------------------------------- # # Module Execution: # "after": { diff --git a/plugins/modules/iosxr_ntp_global.py b/plugins/modules/iosxr_ntp_global.py index 94ca24f4c..bdcf2e523 100644 --- a/plugins/modules/iosxr_ntp_global.py +++ b/plugins/modules/iosxr_ntp_global.py @@ -273,51 +273,51 @@ # ------------ - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_ntp_global: - config: - access_group: - ipv4: - peer: PeerAcl1 - query_only: QueryOnlyAcl1 - serve: ServeAcl1 - serve_only: ServeOnlyAcl1 - vrfs: - - ipv4: - peer: PeerAcl3 - serve: ServeAcl2 - name: siteA - authenticate: true - broadcastdelay: 1 - drift: - aging_time: 0 - file: apphost - interfaces: - - name: GigabitEthernet0/0/0/0 - multicast_client: 224.0.0.8 - multicast_destination: 224.0.0.8 - broadcast_client: true - ipv4: - dscp: af11 - ipv6: - precedence: routine - log_internal_sync: true - master: 1 - max_associations: 10 - passive: true - peers: - - iburst: true - peer: 192.0.2.1 - vrf: siteC - servers: - - burst: true - server: 192.0.2.2 - vrf: siteD - source: GigabitEthernet0/0/0/0 - source_vrfs: - - name: GigabitEthernet0/0/0/0 - vrf: siteE - trusted_keys: - - key_id: 1 - update_calendar: true + config: + access_group: + ipv4: + peer: PeerAcl1 + query_only: QueryOnlyAcl1 + serve: ServeAcl1 + serve_only: ServeOnlyAcl1 + vrfs: + - ipv4: + peer: PeerAcl3 + serve: ServeAcl2 + name: siteA + authenticate: true + broadcastdelay: 1 + drift: + aging_time: 0 + file: apphost + interfaces: + - name: GigabitEthernet0/0/0/0 + multicast_client: 224.0.0.8 + multicast_destination: 224.0.0.8 + broadcast_client: true + ipv4: + dscp: af11 + ipv6: + precedence: routine + log_internal_sync: true + master: 1 + max_associations: 10 + passive: true + peers: + - iburst: true + peer: 192.0.2.1 + vrf: siteC + servers: + - burst: true + server: 192.0.2.2 + vrf: siteD + source: GigabitEthernet0/0/0/0 + source_vrfs: + - name: GigabitEthernet0/0/0/0 + vrf: siteE + trusted_keys: + - key_id: 1 + update_calendar: true # Commands Fired: # ------------ # "commands": [ @@ -485,52 +485,52 @@ # ---------------- - name: Override BGP configuration with provided configuration cisco.iosxr.iosxr_ntp_global: - state: overridden - config: - access_group: - ipv4: - peer: PeerAcl1 - query_only: QueryOnlyAcl1 - serve: ServeAcl4 - serve_only: ServeOnlyAcl1 - vrfs: - - ipv4: - peer: PeerAcl3 - serve: ServeAcl2 - name: siteA - authenticate: true - broadcastdelay: 1 - drift: - aging_time: 0 - file: apphost - interfaces: - - name: GigabitEthernet0/0/0/1 - multicast_client: 224.0.0.8 - multicast_destination: 224.0.0.8 - broadcast_client: true - ipv4: - dscp: af12 - ipv6: - precedence: routine - log_internal_sync: true - master: 1 - max_associations: 10 - passive: true - peers: - - iburst: true - peer: 192.0.2.3 - vrf: siteC - servers: - - burst: true - server: 192.0.2.2 - vrf: siteD - source: GigabitEthernet0/0/0/1 - source_vrfs: - - name: GigabitEthernet0/0/0/0 - vrf: siteE - trusted_keys: - - key_id: 1 - update_calendar: true + state: overridden + config: + access_group: + ipv4: + peer: PeerAcl1 + query_only: QueryOnlyAcl1 + serve: ServeAcl4 + serve_only: ServeOnlyAcl1 + vrfs: + - ipv4: + peer: PeerAcl3 + serve: ServeAcl2 + name: siteA + authenticate: true + broadcastdelay: 1 + drift: + aging_time: 0 + file: apphost + interfaces: + - name: GigabitEthernet0/0/0/1 + multicast_client: 224.0.0.8 + multicast_destination: 224.0.0.8 + broadcast_client: true + ipv4: + dscp: af12 + ipv6: + precedence: routine + log_internal_sync: true + master: 1 + max_associations: 10 + passive: true + peers: + - iburst: true + peer: 192.0.2.3 + vrf: siteC + servers: + - burst: true + server: 192.0.2.2 + vrf: siteD + source: GigabitEthernet0/0/0/1 + source_vrfs: + - name: GigabitEthernet0/0/0/0 + vrf: siteE + trusted_keys: + - key_id: 1 + update_calendar: true # Commands Fired: # --------------- # "commands": [ @@ -616,52 +616,52 @@ # ---------------- - name: Replaced BGP configuration with provided configuration cisco.iosxr.iosxr_ntp_global: - state: replaced - config: - access_group: - ipv4: - peer: PeerAcl1 - query_only: QueryOnlyAcl1 - serve: ServeAcl4 - serve_only: ServeOnlyAcl1 - vrfs: - - ipv4: - peer: PeerAcl3 - serve: ServeAcl2 - name: siteA - authenticate: true - broadcastdelay: 1 - drift: - aging_time: 0 - file: apphost - interfaces: - - name: GigabitEthernet0/0/0/1 - multicast_client: 224.0.0.8 - multicast_destination: 224.0.0.8 - broadcast_client: true - ipv4: - dscp: af12 - ipv6: - precedence: routine - log_internal_sync: true - master: 1 - max_associations: 10 - passive: true - peers: - - iburst: true - peer: 192.0.2.3 - vrf: siteC - servers: - - burst: true - server: 192.0.2.2 - vrf: siteD - source: GigabitEthernet0/0/0/1 - source_vrfs: - - name: GigabitEthernet0/0/0/0 - vrf: siteE - trusted_keys: - - key_id: 1 - update_calendar: true + state: replaced + config: + access_group: + ipv4: + peer: PeerAcl1 + query_only: QueryOnlyAcl1 + serve: ServeAcl4 + serve_only: ServeOnlyAcl1 + vrfs: + - ipv4: + peer: PeerAcl3 + serve: ServeAcl2 + name: siteA + authenticate: true + broadcastdelay: 1 + drift: + aging_time: 0 + file: apphost + interfaces: + - name: GigabitEthernet0/0/0/1 + multicast_client: 224.0.0.8 + multicast_destination: 224.0.0.8 + broadcast_client: true + ipv4: + dscp: af12 + ipv6: + precedence: routine + log_internal_sync: true + master: 1 + max_associations: 10 + passive: true + peers: + - iburst: true + peer: 192.0.2.3 + vrf: siteC + servers: + - burst: true + server: 192.0.2.2 + vrf: siteD + source: GigabitEthernet0/0/0/1 + source_vrfs: + - name: GigabitEthernet0/0/0/0 + vrf: siteE + trusted_keys: + - key_id: 1 + update_calendar: true # Commands Fired: # --------------- # "commands": [ @@ -822,7 +822,9 @@ # Using state: rendered # Rendered play: # -------------- -- name: Render platform specific configuration lines with state rendered (without connecting to the device) +- name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_ntp_global: state: rendered config: diff --git a/plugins/modules/iosxr_ospf_interfaces.py b/plugins/modules/iosxr_ospf_interfaces.py index 6045e28d8..5ee6930f2 100644 --- a/plugins/modules/iosxr_ospf_interfaces.py +++ b/plugins/modules/iosxr_ospf_interfaces.py @@ -492,7 +492,7 @@ address_family: - afi: ipv4 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.3 cost: 20 @@ -501,7 +501,7 @@ keychain: cisco - afi: ipv6 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.2 cost: 30 @@ -593,7 +593,7 @@ address_family: - afi: ipv4 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.3 cost: 30 @@ -602,7 +602,7 @@ keychain: ciscoiosxr - afi: ipv6 processes: - - process_id: "LAB3" + - process_id: LAB3 area: area_id: 0.0.0.2 cost: 30 @@ -688,7 +688,7 @@ address_family: - afi: ipv4 processes: - - process_id: "LAB1" + - process_id: LAB1 area: area_id: 0.0.0.3 cost: 10 @@ -946,18 +946,18 @@ address_family: - afi: ipv4 processes: - - process_id: "LAB3" - area: - area_id: 0.0.0.3 + - process_id: LAB3 + area: + area_id: 0.0.0.3 cost: 20 authentication: message_digest: keychain: cisco - afi: ipv6 processes: - - process_id: "LAB3" - area: - area_id: 0.0.0.2 + - process_id: LAB3 + area: + area_id: 0.0.0.2 cost: 30 state: rendered diff --git a/plugins/modules/iosxr_ospfv2.py b/plugins/modules/iosxr_ospfv2.py index 5aabe2091..f86a75a62 100644 --- a/plugins/modules/iosxr_ospfv2.py +++ b/plugins/modules/iosxr_ospfv2.py @@ -1077,48 +1077,47 @@ cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: '27' - areas: - - area_id: '10' - hello_interval: 2 + - process_id: '27' + areas: + - area_id: '10' + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: '26' + adjacency_stagger: + max_adjacency: 20 + min_adjacency: 10 + - process_id: '10' authentication: - keychain: ansi11393 - - process_id: '26' - adjacency_stagger: - max_adjacency: 20 - min_adjacency: 10 - - process_id: '10' - authentication: - keychain: ansible_test1102 - areas: - - area_id: '11' - default_cost: 5 - cost: 11 - - area_id: 22 - default_cost: 6 - - process_id: '30' - areas: - - area_id: 11 - default_cost: 5 - - area_id: 22 - default_cost: 6 - - cost: 2 - default_metric: 10 - transmit_delay: 2 - hello_interval: 1 - dead_interval: 2 - retransmit_interval: 2 - weight: 2 - packet_size: 577 - priority: 1 - router_id: 2.2.2.2 - demand_circuit: enable - passive: disable - summary_in: enable - flood_reduction: disable - mtu_ignore: enable - external_out: disable + keychain: ansible_test1102 + areas: + - area_id: '11' + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: '30' + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable state: merged # Task Output: @@ -1304,19 +1303,19 @@ cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: 27 - areas: - - area_id: 10 - hello_interval: 2 - - area_id: 20 - cost: 2 - default_cost: 2 - authentication: - keychain: ansi11393 - - process_id: 26 - adjacency_stagger: - min_adjacency: 10 - max_adjacency: 20 + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 state: replaced # Task Output: @@ -1532,23 +1531,24 @@ cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: 27 - areas: - - area_id: 10 - hello_interval: 2 - authentication: - keychain: ansi11393 - - area_id: 20 - cost: 2 - default_cost: 2 - authentication: - keychain: ansi11393 - - process_id: 26 - adjacency_stagger: - min_adjacency: 10 - max_adjacency: 20 + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - area_id: 20 + cost: 2 + default_cost: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 state: overridden + # # Task Output: # ------------ @@ -1742,12 +1742,13 @@ cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: '10' - - process_id: '26' - - process_id: '27' - - process_id: '30' + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' state: deleted + # # Task Output: # ------------ @@ -1979,50 +1980,50 @@ cisco.iosxr.iosxr_ospfv2: config: processes: - - process_id: 27 - areas: - - area_id: 10 - hello_interval: 2 + - process_id: 27 + areas: + - area_id: 10 + hello_interval: 2 + authentication: + keychain: ansi11393 + - process_id: 26 + adjacency_stagger: + min_adjacency: 10 + max_adjacency: 20 + - process_id: 10 authentication: - keychain: ansi11393 - - process_id: 26 - adjacency_stagger: - min_adjacency: 10 - max_adjacency: 20 - - process_id: 10 - authentication: - keychain: ansible_test1102 - areas: - - area_id: 11 - default_cost: 5 - cost: 11 - - area_id: 22 - default_cost: 6 - - process_id: 30 - areas: - - area_id: 11 - default_cost: 5 - - area_id: 22 - default_cost: 6 - - cost: 2 - default_metric: 10 - transmit_delay: 2 - hello_interval: 1 - dead_interval: 2 - retransmit_interval: 2 - weight: 2 - packet_size: 577 - priority: 1 - router_id: 2.2.2.2 - demand_circuit: enable - passive: disable - summary_in: enable - flood_reduction: disable - mtu_ignore: enable - external_out: disable + keychain: ansible_test1102 + areas: + - area_id: 11 + default_cost: 5 + cost: 11 + - area_id: 22 + default_cost: 6 + - process_id: 30 + areas: + - area_id: 11 + default_cost: 5 + - area_id: 22 + default_cost: 6 + cost: 2 + default_metric: 10 + transmit_delay: 2 + hello_interval: 1 + dead_interval: 2 + retransmit_interval: 2 + weight: 2 + packet_size: 577 + priority: 1 + router_id: 2.2.2.2 + demand_circuit: enable + passive: disable + summary_in: enable + flood_reduction: disable + mtu_ignore: enable + external_out: disable state: rendered + # # Task Output: # ------------ diff --git a/plugins/modules/iosxr_ospfv3.py b/plugins/modules/iosxr_ospfv3.py index 183e2b47b..b86e4ff1b 100644 --- a/plugins/modules/iosxr_ospfv3.py +++ b/plugins/modules/iosxr_ospfv3.py @@ -1653,7 +1653,7 @@ retransmit_interval: 2 packet_size: 577 priority: 1 - router_id: '2.2.2.2' + router_id: 2.2.2.2 demand_circuit: true mtu_ignore: true state: merged @@ -2199,12 +2199,13 @@ cisco.iosxr.iosxr_ospfv3: config: processes: - - process_id: '10' - - process_id: '26' - - process_id: '27' - - process_id: '30' + - process_id: '10' + - process_id: '26' + - process_id: '27' + - process_id: '30' state: deleted + # # Task Output: # ------------ diff --git a/plugins/modules/iosxr_prefix_lists.py b/plugins/modules/iosxr_prefix_lists.py index dc2f01843..c47998020 100644 --- a/plugins/modules/iosxr_prefix_lists.py +++ b/plugins/modules/iosxr_prefix_lists.py @@ -104,50 +104,50 @@ # Before state -#RP/0/0/CPU0:10#show running-config -#Thu Feb 4 09:38:36.245 UTC -#% No such configuration item(s) -#RP/0/0/CPU0:10# +# RP/0/0/CPU0:10#show running-config +# Thu Feb 4 09:38:36.245 UTC +# % No such configuration item(s) +# RP/0/0/CPU0:10# # - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_prefix_lists: - state: merged - config: - - afi: ipv6 - prefix_lists: - - name: pl_1 - entries: - - prefix: 2001:db8:1234::/48 - action: deny - sequence: 1 - - name: pl_2 - entries: - - sequence: 2 - action: remark - description: TEST_PL_2_REMARK - - afi: ipv4 - prefix_lists: - - name: pl1 - entries: - - sequence: 3 - action: remark - description: TEST_PL1_2_REMARK - - sequence: 4 - action: permit - prefix: 10.0.0.0/24 - - name: pl2 - entries: - - sequence: 5 - action: remark - description: TEST_PL2_REMARK - - name: pl3 - entries: - - sequence: 6 - action: permit - prefix: 35.0.0.0/8 - eq: 0 + state: merged + config: + - afi: ipv6 + prefix_lists: + - name: pl_1 + entries: + - prefix: '2001:db8:1234::/48' + action: deny + sequence: 1 + - name: pl_2 + entries: + - sequence: 2 + action: remark + description: TEST_PL_2_REMARK + - afi: ipv4 + prefix_lists: + - name: pl1 + entries: + - sequence: 3 + action: remark + description: TEST_PL1_2_REMARK + - sequence: 4 + action: permit + prefix: 10.0.0.0/24 + - name: pl2 + entries: + - sequence: 5 + action: remark + description: TEST_PL2_REMARK + - name: pl3 + entries: + - sequence: 6 + action: permit + prefix: 35.0.0.0/8 + eq: 0 # Task Output # ------------- @@ -197,12 +197,12 @@ # After state: # ------------ -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 # ! # ipv6 prefix-list pl_2 -# 2 remark TEST_PL_2_REMARK +# 2 remark TEST_PL_2_REMAR # ! # ipv4 prefix-list pl1 # 3 remark TEST_PL1_2_REMARK @@ -221,7 +221,7 @@ # Before state: # ------------- -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 @@ -239,29 +239,31 @@ # -- name: Replace device configurations of listed prefix lists with provided configurations +- name: >- + Replace device configurations of listed prefix lists with provided + configurations register: result - cisco.iosxr.iosxr_prefix_lists: &id001 + cisco.iosxr.iosxr_prefix_lists: config: - - afi: ipv4 - prefix_lists: - - name: pl1 - entries: - - sequence: 3 - action: permit - prefix: 10.0.0.0/24 - - afi: ipv6 - prefix_lists: - - name: pl_1 - entries: - - prefix: 2001:db8:1234::/48 - action: permit - sequence: 1 - - name: pl_2 - entries: - - sequence: 2 - action: remark - description: TEST_PL1_2 + - afi: ipv4 + prefix_lists: + - name: pl1 + entries: + - sequence: 3 + action: permit + prefix: 10.0.0.0/24 + - afi: ipv6 + prefix_lists: + - name: pl_1 + entries: + - prefix: '2001:db8:1234::/48' + action: permit + sequence: 1 + - name: pl_2 + entries: + - sequence: 2 + action: remark + description: TEST_PL1_2 state: replaced @@ -328,7 +330,7 @@ # After state: -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 @@ -426,7 +428,7 @@ # After state: # ------------ -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 # ! @@ -447,7 +449,7 @@ - name: Gather ACL interfaces facts using gathered state cisco.iosxr.iosxr_prefix_lists: - state: gathered + state: gathered # gathered: # - afi: ipv6 @@ -489,7 +491,7 @@ # parsed.cfg -#------------------------------ +# ------------------------------ # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 # ! @@ -504,11 +506,10 @@ # 5 remark TEST_PL2_REMARK - - name: Parse externally provided Prefix_lists config to agnostic model cisco.iosxr.iosxr_prefix_lists: - running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" - state: parsed + running_config: '{{ lookup(''file'', ''./fixtures/parsed.cfg'') }}' + state: parsed # Task Output @@ -553,40 +554,39 @@ - name: Render platform specific commands from task input using rendered state register: result cisco.iosxr.iosxr_prefix_lists: - config: - - afi: ipv6 - prefix_lists: - - name: pl_1 - entries: - - prefix: 2001:db8:1234::/48 - action: deny - sequence: 1 - - name: pl_2 - entries: - - sequence: 2 - action: remark - description: TEST_PL_2_REMARK - - afi: ipv4 - prefix_lists: - - name: pl1 - entries: - - sequence: 3 - action: remark - description: TEST_PL1_2_REMARK - - sequence: 4 - action: permit - prefix: 10.0.0.0/24 - - name: pl2 - entries: - - sequence: 5 - action: remark - description: TEST_PL2_REMARK - - sequence: 6 - action: permit - prefix: 35.0.0.0/8 - eq: 0 - - state: rendered + config: + - afi: ipv6 + prefix_lists: + - name: pl_1 + entries: + - prefix: '2001:db8:1234::/48' + action: deny + sequence: 1 + - name: pl_2 + entries: + - sequence: 2 + action: remark + description: TEST_PL_2_REMARK + - afi: ipv4 + prefix_lists: + - name: pl1 + entries: + - sequence: 3 + action: remark + description: TEST_PL1_2_REMARK + - sequence: 4 + action: permit + prefix: 10.0.0.0/24 + - name: pl2 + entries: + - sequence: 5 + action: remark + description: TEST_PL2_REMARK + - sequence: 6 + action: permit + prefix: 35.0.0.0/8 + eq: 0 + state: rendered # Task Output @@ -600,14 +600,12 @@ # "ipv4 prefix-list pl2 6 permit 35.0.0.0/8 eq 0" # ] - - # Using overridden: # Before state: # ------------- -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # # ipv6 prefix-list pl_1 # 1 deny 2001:db8:1234::/48 @@ -624,22 +622,22 @@ # - name: Overridde all Prefix_lists configuration with provided configuration cisco.iosxr.iosxr_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: pl3 - entries: - - sequence: 3 - action: remark - description: TEST_PL1_3_REMARK - - sequence: 4 - action: permit - prefix: 10.0.0.0/24 - - sequence: 6 - action: permit - prefix: 35.0.0.0/8 - eq: 0 - state: overridden + config: + - afi: ipv4 + prefix_lists: + - name: pl3 + entries: + - sequence: 3 + action: remark + description: TEST_PL1_3_REMARK + - sequence: 4 + action: permit + prefix: 10.0.0.0/24 + - sequence: 6 + action: permit + prefix: 35.0.0.0/8 + eq: 0 + state: overridden # Task Output @@ -698,14 +696,14 @@ # After state: -#RP/0/0/CPU0:10#show running-config +# RP/0/0/CPU0:10#show running-config # -#ipv4 prefix-list pl3 +# ipv4 prefix-list pl3 # 3 remark TEST_PL1_3_REMARK # 4 permit 10.0.0.0/24 # 6 permit 35.0.0.0/8 eq 0 # ! -#! +# ! """ RETURN = """ diff --git a/plugins/modules/iosxr_snmp_server.py b/plugins/modules/iosxr_snmp_server.py index 43d7016d0..9bc685756 100644 --- a/plugins/modules/iosxr_snmp_server.py +++ b/plugins/modules/iosxr_snmp_server.py @@ -910,101 +910,102 @@ # --------------------- EMPTY ----------------- # Merged play: # ------------ + - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_snmp_server: - config: - vrfs: - - hosts: - - community: test1 - host: 1.1.1.1 - traps: true - vrf: vrf1 - users: - - Ipv4_acl: test1 - Ipv6_acl: test2 - group: test2 - user: u1 - version: v1 - timeouts: - duplicate: 0 - inQdrop: 0 - trap: - throttle_time: 12 - targets: - - host: 1.1.1.2 - name: test + config: + vrfs: + - hosts: + - community: test1 + host: 1.1.1.1 + traps: true + vrf: vrf1 + users: + - Ipv4_acl: test1 + Ipv6_acl: test2 + group: test2 + user: u1 + version: v1 + timeouts: + duplicate: 0 + inQdrop: 0 + trap: + throttle_time: 12 + targets: + - host: 1.1.1.2 + name: test + ifmib: + internal_cache_max_duration: 4 + inform: + retries: 7 + chassis_id: test2 + packetsize: 490 + queue_length: 2 + throttle_time: 60 + trap_source: GigabitEthernet0/0/0/2 + trap_timeout: 3 + context: + - c1 + - c2 + contact: t1 + correlator: + buffer_size: 1024 + communities: + - name: test2 + ro: true + sdrowner: true + acl_v4: test + acl_v6: test1 + community_maps: + - name: cm1 + context: c1 + target_list: t1 + security_name: s1 + drop: + report_IPv4: test1 + unknown_user: true + ipv6: + precedence: routine + ipv4: + dscp: af11 + location: test1 + logging_threshold_oid_processing: 1 + logging_threshold_pdu_processing: 1 + mib_bulkstat_max_procmem_size: 101 + mroutemib_send_all_vrf: true + overload_control: + overload_drop_time: 4 + overload_throttle_rate: 6 + notification_log_mib: + GlobalSize: 5 + size: 5 + traps: + hsrp: true + ipsla: true + ipsec: + start: true + stop: true + bridgemib: true + bulkstat_collection: true + cisco_entity_ext: true + config: true + copy_complete: true + addrpool: + high: true + low: true + bfd: true + bgp: + cbgp2: true + l2tun: + sessions: true + tunnel_down: true + tunnel_up: true + l2vpn: + all: true + vc_down: true + vc_up: true + msdp_peer_state_change: true - ifmib: - internal_cache_max_duration: 4 - inform: - retries: 7 - chassis_id: test2 - packetsize: 490 - queue_length: 2 - throttle_time: 60 - trap_source: GigabitEthernet0/0/0/2 - trap_timeout: 3 - context: - - c1 - - c2 - contact: t1 - correlator: - buffer_size: 1024 - communities: - - name: test2 - ro: true - sdrowner: true - acl_v4: test - acl_v6: test1 - community_maps: - - name: cm1 - context: c1 - target_list: t1 - security_name: s1 - drop: - report_IPv4: test1 - unknown_user: true - ipv6: - precedence: routine - ipv4: - dscp: af11 - location: test1 - logging_threshold_oid_processing: 1 - logging_threshold_pdu_processing: 1 - mib_bulkstat_max_procmem_size: 101 - mroutemib_send_all_vrf: true - overload_control: - overload_drop_time: 4 - overload_throttle_rate: 6 - notification_log_mib: - GlobalSize: 5 - size: 5 - traps: - hsrp: true - ipsla: true - ipsec: - start: true - stop: true - bridgemib: true - bulkstat_collection: true - cisco_entity_ext: true - config: true - copy_complete: true - addrpool: - high: true - low: true - bfd: true - bgp: - cbgp2: true - l2tun: - sessions: true - tunnel_down: true - tunnel_up: true - l2vpn: - all: true - vc_down: true - vc_up: true - msdp_peer_state_change: true # # Commands Fired: # ------------ @@ -1315,78 +1316,78 @@ # ---------------- - name: Override Snmp-server configuration with provided configuration cisco.iosxr.iosxr_snmp_server: - config: - timeouts: - duplicate: 0 - inQdrop: 0 - trap: - throttle_time: 13 - targets: - - host: 1.1.1.2 - name: test + config: + timeouts: + duplicate: 0 + inQdrop: 0 + trap: + throttle_time: 13 + targets: + - host: 1.1.1.2 + name: test + ifmib: + internal_cache_max_duration: 5 + inform: + retries: 7 + chassis_id: test + packetsize: 491 + queue_length: 2 + throttle_time: 60 + trap_source: GigabitEthernet0/0/0/2 + trap_timeout: 3 + context: + - c1 + - c2 + contact: t1 + correlator: + buffer_size: 1025 + communities: + - name: test1 + ro: true + sdrowner: true + acl_v4: test + acl_v6: test1 + community_maps: + - name: cm2 + context: c1 + target_list: t1 + security_name: s1 + drop: + report_IPv4: test2 + unknown_user: true + ipv6: + precedence: routine + ipv4: + dscp: af11 + location: test1 + logging_threshold_oid_processing: 2 + logging_threshold_pdu_processing: 2 + mib_bulkstat_max_procmem_size: 101 + mroutemib_send_all_vrf: true + overload_control: + overload_drop_time: 4 + overload_throttle_rate: 6 + notification_log_mib: + GlobalSize: 5 + size: 5 + traps: + hsrp: true + ipsla: true + ipsec: + start: true + stop: true + bridgemib: true + bulkstat_collection: true + cisco_entity_ext: true + config: true + copy_complete: true + l2vpn: + all: true + vc_down: true + vc_up: true + msdp_peer_state_change: true + state: overridden - ifmib: - internal_cache_max_duration: 5 - inform: - retries: 7 - chassis_id: test - packetsize: 491 - queue_length: 2 - throttle_time: 60 - trap_source: GigabitEthernet0/0/0/2 - trap_timeout: 3 - context: - - c1 - - c2 - contact: t1 - correlator: - buffer_size: 1025 - communities: - - name: test1 - ro: true - sdrowner: true - acl_v4: test - acl_v6: test1 - community_maps: - - name: cm2 - context: c1 - target_list: t1 - security_name: s1 - drop: - report_IPv4: test2 - unknown_user: true - ipv6: - precedence: routine - ipv4: - dscp: af11 - location: test1 - logging_threshold_oid_processing: 2 - logging_threshold_pdu_processing: 2 - mib_bulkstat_max_procmem_size: 101 - mroutemib_send_all_vrf: true - overload_control: - overload_drop_time: 4 - overload_throttle_rate: 6 - notification_log_mib: - GlobalSize: 5 - size: 5 - traps: - hsrp: true - ipsla: true - ipsec: - start: true - stop: true - bridgemib: true - bulkstat_collection: true - cisco_entity_ext: true - config: true - copy_complete: true - l2vpn: - all: true - vc_down: true - vc_up: true - msdp_peer_state_change: true - state: overridden # Commands Fired: # --------------- # "commands": [ @@ -1526,78 +1527,78 @@ # ---------------- - name: Replace Snmp-server configuration with provided configuration cisco.iosxr.iosxr_snmp_server: - state: replaced - config: - timeouts: - duplicate: 0 - inQdrop: 0 - trap: - throttle_time: 13 - targets: - - host: 1.1.1.2 - name: test + state: replaced + config: + timeouts: + duplicate: 0 + inQdrop: 0 + trap: + throttle_time: 13 + targets: + - host: 1.1.1.2 + name: test + ifmib: + internal_cache_max_duration: 5 + inform: + retries: 7 + chassis_id: test + packetsize: 491 + queue_length: 2 + throttle_time: 60 + trap_source: GigabitEthernet0/0/0/2 + trap_timeout: 3 + context: + - c1 + - c2 + contact: t1 + correlator: + buffer_size: 1025 + communities: + - name: test1 + ro: true + sdrowner: true + acl_v4: test + acl_v6: test1 + community_maps: + - name: cm2 + context: c1 + target_list: t1 + security_name: s1 + drop: + report_IPv4: test2 + unknown_user: true + ipv6: + precedence: routine + ipv4: + dscp: af11 + location: test1 + logging_threshold_oid_processing: 2 + logging_threshold_pdu_processing: 2 + mib_bulkstat_max_procmem_size: 101 + mroutemib_send_all_vrf: true + overload_control: + overload_drop_time: 4 + overload_throttle_rate: 6 + notification_log_mib: + GlobalSize: 5 + size: 5 + traps: + hsrp: true + ipsla: true + ipsec: + start: true + stop: true + bridgemib: true + bulkstat_collection: true + cisco_entity_ext: true + config: true + copy_complete: true + l2vpn: + all: true + vc_down: true + vc_up: true + msdp_peer_state_change: true - ifmib: - internal_cache_max_duration: 5 - inform: - retries: 7 - chassis_id: test - packetsize: 491 - queue_length: 2 - throttle_time: 60 - trap_source: GigabitEthernet0/0/0/2 - trap_timeout: 3 - context: - - c1 - - c2 - contact: t1 - correlator: - buffer_size: 1025 - communities: - - name: test1 - ro: true - sdrowner: true - acl_v4: test - acl_v6: test1 - community_maps: - - name: cm2 - context: c1 - target_list: t1 - security_name: s1 - drop: - report_IPv4: test2 - unknown_user: true - ipv6: - precedence: routine - ipv4: - dscp: af11 - location: test1 - logging_threshold_oid_processing: 2 - logging_threshold_pdu_processing: 2 - mib_bulkstat_max_procmem_size: 101 - mroutemib_send_all_vrf: true - overload_control: - overload_drop_time: 4 - overload_throttle_rate: 6 - notification_log_mib: - GlobalSize: 5 - size: 5 - traps: - hsrp: true - ipsla: true - ipsec: - start: true - stop: true - bridgemib: true - bulkstat_collection: true - cisco_entity_ext: true - config: true - copy_complete: true - l2vpn: - all: true - vc_down: true - vc_up: true - msdp_peer_state_change: true # # Commands Fired: # --------------- @@ -1890,7 +1891,9 @@ # Using state: rendered # Rendered play: # -------------- -- name: Render platform specific configuration lines with state rendered (without connecting to the device) +- name: >- + Render platform specific configuration lines with state rendered (without + connecting to the device) cisco.iosxr.iosxr_snmp_server: state: rendered config: @@ -1914,7 +1917,6 @@ targets: - host: 1.1.1.2 name: test - ifmib: internal_cache_max_duration: 4 inform: @@ -1987,6 +1989,7 @@ vc_up: true msdp_peer_state_change: true register: result + # Module Execution Result: # ------------------------ # "rendered": [ diff --git a/plugins/modules/iosxr_static_routes.py b/plugins/modules/iosxr_static_routes.py index 7bc9cbd8c..3a9fa07b3 100644 --- a/plugins/modules/iosxr_static_routes.py +++ b/plugins/modules/iosxr_static_routes.py @@ -172,57 +172,52 @@ - name: Merge the provided configuration with the existing running configuration cisco.iosxr.iosxr_static_routes: config: - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.16/28 - next_hops: - - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - description: LAB - metric: 120 - tag: 10 - - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - - dest: 192.0.2.32/28 - next_hops: - - forward_router_address: 192.0.2.11 - admin_distance: 100 - - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - interface: FastEthernet0/0/0/7 - description: DC - - - interface: FastEthernet0/0/0/8 - forward_router_address: 2001:db8:2000:2::1 - - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: DEV - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 + - address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.16/28 + next_hops: + - forward_router_address: 192.0.2.10 + interface: FastEthernet0/0/0/1 + description: LAB + metric: 120 + tag: 10 + - interface: FastEthernet0/0/0/5 + track: ip_sla_1 + - dest: 192.0.2.32/28 + next_hops: + - forward_router_address: 192.0.2.11 + admin_distance: 100 + - afi: ipv6 + safi: unicast + routes: + - dest: '2001:db8:1000::/36' + next_hops: + - interface: FastEthernet0/0/0/7 + description: DC + - interface: FastEthernet0/0/0/8 + forward_router_address: '2001:db8:2000:2::1' + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 state: merged + # Task Output # ----------- # before: [] @@ -335,23 +330,22 @@ - name: Update existing static routes configuration using merged cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - vrflabel: 2301 - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - description: rt_test_1 + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + vrflabel: 2301 + dest_vrf: test_1 + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + description: rt_test_1 state: merged # Task Output @@ -504,17 +498,17 @@ - name: Replace device configurations of static routes with provided configurations cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: DEV_NEW - dest_vrf: dev_test_2 + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV_NEW + dest_vrf: dev_test_2 state: replaced # Task Output @@ -570,7 +564,7 @@ # vrflabel: 124 # safi: unicast # vrf: DEV_SITE -#commands: +# commands: # - router static # - vrf DEV_SITE # - address-family ipv4 unicast @@ -673,25 +667,25 @@ - name: Overridde all static routes configuration with provided configuration cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_NEW - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: DEV1 - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:3000::/36 - next_hops: - - interface: FastEthernet0/0/0/4 - forward_router_address: 2001:db8:2000:2::2 - description: PROD1 - track: ip_sla_1 + - vrf: DEV_NEW + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.15 + interface: FastEthernet0/0/0/3 + description: DEV1 + - afi: ipv6 + safi: unicast + routes: + - dest: '2001:db8:3000::/36' + next_hops: + - interface: FastEthernet0/0/0/4 + forward_router_address: '2001:db8:2000:2::2' + description: PROD1 + track: ip_sla_1 state: overridden # Task Output @@ -818,10 +812,10 @@ - name: Delete all destination network entries under a single AFI cisco.iosxr.iosxr_static_routes: config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast state: deleted # Task output @@ -1137,26 +1131,25 @@ # Using rendered - name: Render platform specific commands (without connecting to the device) - cisco.iosxr.iosxr_static_routes: + cisco.iosxr.iosxr_static_routes: null config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: DEV - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 + - vrf: DEV_SITE + address_families: + - afi: ipv4 + safi: unicast + routes: + - dest: 192.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.12 + description: DEV + dest_vrf: test_1 + - dest: 192.0.2.80/28 + next_hops: + - interface: FastEthernet0/0/0/2 + forward_router_address: 192.0.2.14 + dest_vrf: test_1 + track: ip_sla_2 + vrflabel: 124 # Task Output (redacted) # ----------------------- diff --git a/plugins/modules/iosxr_system.py b/plugins/modules/iosxr_system.py index 0d0d60adb..d05608b6d 100644 --- a/plugins/modules/iosxr_system.py +++ b/plugins/modules/iosxr_system.py @@ -91,17 +91,17 @@ hostname: iosxr01 domain_name: test.example.com domain_search: - - ansible.com - - redhat.com - - cisco.com + - ansible.com + - redhat.com + - cisco.com - name: remove configuration cisco.iosxr.iosxr_system: hostname: iosxr01 domain_name: test.example.com domain_search: - - ansible.com - - redhat.com - - cisco.com + - ansible.com + - redhat.com + - cisco.com state: absent - name: configure hostname and domain-name with vrf cisco.iosxr.iosxr_system: @@ -109,9 +109,9 @@ vrf: nondefault domain_name: test.example.com domain_search: - - ansible.com - - redhat.com - - cisco.com + - ansible.com + - redhat.com + - cisco.com - name: configure DNS lookup sources cisco.iosxr.iosxr_system: lookup_source: MgmtEth0/0/CPU0/0 @@ -119,8 +119,8 @@ - name: configure name servers cisco.iosxr.iosxr_system: name_servers: - - 8.8.8.8 - - 8.8.4.4 + - 8.8.8.8 + - 8.8.4.4 """ RETURN = """ diff --git a/plugins/modules/iosxr_user.py b/plugins/modules/iosxr_user.py index ce4965a89..e89d6e9eb 100644 --- a/plugins/modules/iosxr_user.py +++ b/plugins/modules/iosxr_user.py @@ -224,18 +224,18 @@ - name: set multiple users to group sys-admin cisco.iosxr.iosxr_user: aggregate: - - name: netop - - name: netend + - name: netop + - name: netend group: sysadmin state: present - name: set multiple users to multiple groups cisco.iosxr.iosxr_user: aggregate: - - name: netop - - name: netend + - name: netop + - name: netend groups: - - sysadmin - - root-system + - sysadmin + - root-system state: present - name: Change Password for User netop cisco.iosxr.iosxr_user: diff --git a/requirements.txt b/requirements.txt index 83f814754..f2500cdb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ ncclient paramiko ipaddress -ansible-pylibssh grpcio protobuf diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt index 04e4d941a..450f3eab7 100644 --- a/tests/sanity/ignore-2.16.txt +++ b/tests/sanity/ignore-2.16.txt @@ -1,3 +1,4 @@ plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index 04e4d941a..450f3eab7 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -1,3 +1,4 @@ plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip From 6a074994f7acec9f27a27dca0b5654d49934b524 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Tue, 21 Nov 2023 17:50:54 +0530 Subject: [PATCH 02/27] Fix issue in cleanup of interfaces. (#456) Co-authored-by: Ashwini Mhatre --- changelogs/fragments/fix_acl_interfaces.yaml | 3 +++ .../targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/fix_acl_interfaces.yaml diff --git a/changelogs/fragments/fix_acl_interfaces.yaml b/changelogs/fragments/fix_acl_interfaces.yaml new file mode 100644 index 000000000..71732f7f1 --- /dev/null +++ b/changelogs/fragments/fix_acl_interfaces.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Fix cleanup issue in interfaces diff --git a/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml index 62eeb392e..6b08c8d17 100644 --- a/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml @@ -18,6 +18,9 @@ - 0/0/0/1 - 0/0/0/2 - 0/0/0/4.1 + - 0/0/0/4 + - 0/0/0/8 + - 0/0/0/9 ignore_errors: true cisco.iosxr.iosxr_config: lines: From 8b39f3eacb80e24ac6f0f19e6772376175347f58 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Wed, 22 Nov 2023 11:36:25 +0530 Subject: [PATCH 03/27] Fix issue in gathred state of interfaces RMs (#454) * Fix issue in gathred state of interfaces RMs * Add tests --------- Co-authored-by: Ashwini Mhatre --- changelogs/fragments/bugfix_interfaces.yaml | 3 + .../iosxr/facts/interfaces/interfaces.py | 2 +- .../facts/l2_interfaces/l2_interfaces.py | 2 +- .../facts/l3_interfaces/l3_interfaces.py | 74 +++++++++---------- .../fixtures/iosxr_interface_gathered.cfg | 11 +++ .../network/iosxr/test_iosxr_interfaces.py | 32 ++++++-- .../network/iosxr/test_iosxr_l3_interfaces.py | 22 ++++-- 7 files changed, 95 insertions(+), 51 deletions(-) create mode 100644 changelogs/fragments/bugfix_interfaces.yaml create mode 100644 tests/unit/modules/network/iosxr/fixtures/iosxr_interface_gathered.cfg diff --git a/changelogs/fragments/bugfix_interfaces.yaml b/changelogs/fragments/bugfix_interfaces.yaml new file mode 100644 index 000000000..17148e5e7 --- /dev/null +++ b/changelogs/fragments/bugfix_interfaces.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Fix issue in gathered state of interfaces and l3_interfaces RMs(https://github.com/ansible-collections/cisco.iosxr/issues/452, https://github.com/ansible-collections/cisco.iosxr/issues/451) diff --git a/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py b/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py index becdae1e7..5efcd6084 100644 --- a/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py +++ b/plugins/module_utils/network/iosxr/facts/interfaces/interfaces.py @@ -112,4 +112,4 @@ def render_config(self, spec, conf): enabled = utils.parse_conf_cmd_arg(conf, "shutdown", False) config["enabled"] = enabled if enabled is not None else True - return utils.remove_empties(config) + return utils.remove_empties(config) diff --git a/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py b/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py index 19150c1f0..f562e20f8 100644 --- a/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py +++ b/plugins/module_utils/network/iosxr/facts/l2_interfaces/l2_interfaces.py @@ -155,4 +155,4 @@ def render_config(self, spec, conf): if cpsv: config["l2protocol"].append({"cpsv": cpsv}) - return utils.remove_empties(config) + return utils.remove_empties(config) diff --git a/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py index 4d0158e25..b4dba858e 100644 --- a/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py +++ b/plugins/module_utils/network/iosxr/facts/l3_interfaces/l3_interfaces.py @@ -94,43 +94,43 @@ def render_config(self, spec, conf): """ config = deepcopy(spec) match = re.search(r"^(\S+)", conf) - - intf = match.group(1) - if match.group(1).lower() == "preconfigure": - match = re.search(r"^(\S+) (.*)", conf) - if match: - intf = match.group(2) - - if get_interface_type(intf) == "unknown": - return {} - - # populate the facts from the configuration - config["name"] = intf - - # Get the configured IPV4 details - ipv4 = [] - ipv4_all = re.findall(r"ipv4 address (\S+.*)", conf) - for each in ipv4_all: - each_ipv4 = dict() - if "secondary" in each: - each_ipv4["address"] = self.format_ipv4(each.split(" secondary")[0]) - each_ipv4["secondary"] = True - elif "secondary" not in each and "dhcp" not in each: - each_ipv4["address"] = self.format_ipv4(each) - elif "dhcp" in each: - each_ipv4["address"] = "dhcp" - ipv4.append(each_ipv4) - config["ipv4"] = ipv4 - - # Get the configured IPV6 details - ipv6 = [] - ipv6_all = re.findall(r"ipv6 address (\S+)", conf) - for each in ipv6_all: - each_ipv6 = dict() - each_ipv6["address"] = each - ipv6.append(each_ipv6) - config["ipv6"] = ipv6 - return utils.remove_empties(config) + if match: + intf = match.group(1) + if match.group(1).lower() == "preconfigure": + match = re.search(r"^(\S+) (.*)", conf) + if match: + intf = match.group(2) + + if get_interface_type(intf) == "unknown": + return {} + + # populate the facts from the configuration + config["name"] = intf + + # Get the configured IPV4 details + ipv4 = [] + ipv4_all = re.findall(r"ipv4 address (\S+.*)", conf) + for each in ipv4_all: + each_ipv4 = dict() + if "secondary" in each: + each_ipv4["address"] = self.format_ipv4(each.split(" secondary")[0]) + each_ipv4["secondary"] = True + elif "secondary" not in each and "dhcp" not in each: + each_ipv4["address"] = self.format_ipv4(each) + elif "dhcp" in each: + each_ipv4["address"] = "dhcp" + ipv4.append(each_ipv4) + config["ipv4"] = ipv4 + + # Get the configured IPV6 details + ipv6 = [] + ipv6_all = re.findall(r"ipv6 address (\S+)", conf) + for each in ipv6_all: + each_ipv6 = dict() + each_ipv6["address"] = each + ipv6.append(each_ipv6) + config["ipv6"] = ipv6 + return utils.remove_empties(config) def format_ipv4(self, address): if address.split(" ")[1]: diff --git a/tests/unit/modules/network/iosxr/fixtures/iosxr_interface_gathered.cfg b/tests/unit/modules/network/iosxr/fixtures/iosxr_interface_gathered.cfg new file mode 100644 index 000000000..f05a6eb71 --- /dev/null +++ b/tests/unit/modules/network/iosxr/fixtures/iosxr_interface_gathered.cfg @@ -0,0 +1,11 @@ + +interface GigabitEthernet0/0/0/5 + description RTI-DSKMPLS-LP201 #G0/0 + mtu 9216 + ipv4 address 10.255.2.9 255.255.255.252 +! +interface GigabitEthernet0/0/0/6 + description RTI-DSKMPLS-LP301 #G0/1 + mtu 9216 + ipv4 address 10.255.2.17 255.255.255.252 +! diff --git a/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py index 901ff40cd..bff925c60 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py @@ -68,14 +68,14 @@ def tearDown(self): self.mock_load_config.stop() self.mock_execute_show_command.stop() - def _prepare(self): + def _prepare(self, interface_conf): def load_from_file(*args, **kwargs): - return load_fixture("iosxr_interface_config.cfg") + return load_fixture(interface_conf) self.execute_show_command.side_effect = load_from_file def test_iosxr_interfaces_merged_idempotent(self): - self._prepare() + self._prepare("iosxr_interface_config.cfg") set_module_args( dict( config=[ @@ -138,7 +138,7 @@ def test_iosxr_interfaces_merged(self): self.assertEqual(sorted(result["commands"]), sorted(commands)) def test_iosxr_interfaces_replaced(self): - self._prepare() + self._prepare("iosxr_interface_config.cfg") set_module_args( dict( config=[ @@ -168,7 +168,7 @@ def test_iosxr_interfaces_replaced(self): self.assertEqual(sorted(result["commands"]), sorted(commands)) def test_iosxr_interfaces_deleted(self): - self._prepare() + self._prepare("iosxr_interface_config.cfg") set_module_args(dict(state="deleted")) commands = [ @@ -268,7 +268,7 @@ def test_iosxr_interfaces_parsed(self): def test_iosxr_interfaces_overridden(self): self.maxDiff = None - self._prepare() + self._prepare("iosxr_interface_config.cfg") set_module_args( dict( config=[ @@ -298,3 +298,23 @@ def test_iosxr_interfaces_overridden(self): result = self.execute_module(changed=True) self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_interfaces_gathered(self): + self._prepare("iosxr_interface_gathered.cfg") + set_module_args(dict(state="gathered")) + result = self.execute_module(changed=False) + gathered = [ + { + "name": "GigabitEthernet0/0/0/5", + "description": "RTI-DSKMPLS-LP201 #G0/0", + "enabled": True, + "mtu": 9216, + }, + { + "name": "GigabitEthernet0/0/0/6", + "description": "RTI-DSKMPLS-LP301 #G0/1", + "enabled": True, + "mtu": 9216, + }, + ] + self.assertEqual(gathered, result["gathered"]) diff --git a/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py index 1bbfa7578..071b16b8f 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py @@ -67,14 +67,14 @@ def tearDown(self): self.mock_load_config.stop() self.mock_execute_show_command.stop() - def _prepare(self): + def _prepare(self, l3_interface_config): def load_from_file(*args, **kwargs): - return load_fixture("iosxr_l3_interface_config.cfg") + return load_fixture(l3_interface_config) self.execute_show_command.side_effect = load_from_file def test_iosxr_l3_interfaces_merged_idempotent(self): - self._prepare() + self._prepare("iosxr_l3_interface_config.cfg") set_module_args( dict( config=[ @@ -128,7 +128,7 @@ def test_iosxr_l3_interfaces_merged(self): self.assertEqual(sorted(result["commands"]), sorted(commands)) def test_iosxr_l3_interfaces_replaced(self): - self._prepare() + self._prepare("iosxr_l3_interface_config.cfg") set_module_args( dict( config=[ @@ -153,7 +153,7 @@ def test_iosxr_l3_interfaces_replaced(self): self.assertEqual(sorted(result["commands"]), sorted(commands)) def test_iosxr_l3_interfaces_deleted(self): - self._prepare() + self._prepare("iosxr_l3_interface_config.cfg") set_module_args(dict(state="deleted")) commands = [ @@ -228,7 +228,7 @@ def test_iosxr_l3_interfaces_parsed(self): def test_iosxr_l3_interfaces_overridden(self): self.maxDiff = None - self._prepare() + self._prepare("iosxr_l3_interface_config.cfg") set_module_args( dict( config=[ @@ -253,3 +253,13 @@ def test_iosxr_l3_interfaces_overridden(self): result = self.execute_module(changed=True) self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_iosxr_3_interfaces_gathered(self): + self._prepare("iosxr_interface_gathered.cfg") + set_module_args(dict(state="gathered")) + result = self.execute_module(changed=False) + gathered = [ + {"name": "GigabitEthernet0/0/0/5", "ipv4": [{"address": "10.255.2.9/30"}]}, + {"name": "GigabitEthernet0/0/0/6", "ipv4": [{"address": "10.255.2.17/30"}]}, + ] + self.assertEqual(gathered, result["gathered"]) From a28ba3b33794c3e33a5eed85a01ac5a534448934 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Fri, 24 Nov 2023 16:26:10 +0530 Subject: [PATCH 04/27] Update tests.yml --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1a1278d2e..7f62fa282 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ --- -name: Test collection +name: CI concurrency: group: ${{ github.head_ref || github.run_id }} @@ -17,7 +17,7 @@ jobs: uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main changelog: uses: ansible-network/github_actions/.github/workflows/changelog.yml@main - if: github.event_name != 'schedule' + if: github.event_name != 'pull_request' sanity: uses: ansible-network/github_actions/.github/workflows/sanity.yml@main unit-galaxy: @@ -29,7 +29,7 @@ jobs: git+https://github.com/ansible-collections/ansible.utils.git git+https://github.com/ansible-collections/ansible.netcommon.git all_green: - if: ${{ always() && (github.event_name != 'schedule') }} + if: ${{ always() }} needs: - ansible-lint - changelog From a7b7d3fd5eb5f89ad7125b96d65cb0cbfb1085dc Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Fri, 24 Nov 2023 16:26:24 +0530 Subject: [PATCH 05/27] Update tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7f62fa282..1e55e1900 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main changelog: uses: ansible-network/github_actions/.github/workflows/changelog.yml@main - if: github.event_name != 'pull_request' + if: github.event_name == 'pull_request' sanity: uses: ansible-network/github_actions/.github/workflows/sanity.yml@main unit-galaxy: From 874ef437c7d2bf61017820280befd1471a3fe8b2 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Fri, 24 Nov 2023 16:26:52 +0530 Subject: [PATCH 06/27] Update tests.yml --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1e55e1900..21f8ea565 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,10 +39,11 @@ jobs: runs-on: ubuntu-latest steps: - run: >- - python -c "assert set([ + python -c "assert 'failure' not in + set([ '${{ needs.ansible-lint.result }}', '${{ needs.changelog.result }}', '${{ needs.sanity.result }}', '${{ needs.unit-galaxy.result }}', '${{ needs.unit-source.result }}' - ]) == {'success'}" + ])" From b8b293bf407d6337ee57a752019ad1a661e6e2ac Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Fri, 24 Nov 2023 16:28:04 +0530 Subject: [PATCH 07/27] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0d66637b7..e17005579 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Cisco IOSXR Collection [![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/cisco.iosxr) [![Codecov](https://codecov.io/gh/ansible-collections/cisco.iosxr/branch/main/graph/badge.svg)](https://codecov.io/gh/ansible-collections/cisco.iosxr) +[![CI](https://github.com/ansible-collections/cisco.iosxr/actions/workflows/tests.yml/badge.svg?branch=main&event=schedule)](https://github.com/ansible-collections/cisco.iosxr/actions/workflows/tests.yml) + The Ansible Cisco IOSXR collection includes a variety of Ansible content to help automate the management of Cisco IOSXR network appliances. This collection has been tested against Cisco IOSXR version 7.0.2. From 71f7d0bb21bf050fe27688c610f53699d1ecf782 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Mon, 27 Nov 2023 15:11:09 +0530 Subject: [PATCH 08/27] Revert (#458) Co-authored-by: Ashwini Mhatre --- changelogs/fragments/revert_pylibssh_depn.yaml | 3 +++ requirements.txt | 1 + 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/revert_pylibssh_depn.yaml diff --git a/changelogs/fragments/revert_pylibssh_depn.yaml b/changelogs/fragments/revert_pylibssh_depn.yaml new file mode 100644 index 000000000..2cd5e6211 --- /dev/null +++ b/changelogs/fragments/revert_pylibssh_depn.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Add ansible-pylibssh dependency. diff --git a/requirements.txt b/requirements.txt index f2500cdb1..2fb85f407 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ paramiko ipaddress grpcio protobuf +ansible-pylibssh From 033213bda50697913154c91670c406e9ec8af20f Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Mon, 27 Nov 2023 17:58:17 +0530 Subject: [PATCH 09/27] Prepare for release 6.1.1 (#459) Co-authored-by: Ashwini Mhatre --- CHANGELOG.rst | 8 ++++++++ changelogs/changelog.yaml | 11 +++++++++++ changelogs/fragments/bugfix_interfaces.yaml | 3 --- changelogs/fragments/fix_acl_interfaces.yaml | 3 --- changelogs/fragments/fix_python_version.yaml | 3 --- changelogs/fragments/revert_pylibssh_depn.yaml | 3 --- 6 files changed, 19 insertions(+), 12 deletions(-) delete mode 100644 changelogs/fragments/bugfix_interfaces.yaml delete mode 100644 changelogs/fragments/fix_acl_interfaces.yaml delete mode 100644 changelogs/fragments/fix_python_version.yaml delete mode 100644 changelogs/fragments/revert_pylibssh_depn.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 896bf0a68..b2f32296d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,14 @@ Cisco Iosxr Collection Release Notes .. contents:: Topics +v6.1.1 +====== + +Bugfixes +-------- + +- Fix issue in gathered state of interfaces and l3_interfaces RMs(https://github.com/ansible-collections/cisco.iosxr/issues/452, https://github.com/ansible-collections/cisco.iosxr/issues/451) + v6.1.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 6409b2d8e..6f1007dbb 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -677,3 +677,14 @@ releases: - fix_iosxr_config.yaml - prefix_list_doc.yaml release_date: "2023-10-30" + 6.1.1: + changes: + bugfixes: + - Fix issue in gathered state of interfaces and l3_interfaces RMs(https://github.com/ansible-collections/cisco.iosxr/issues/452, + https://github.com/ansible-collections/cisco.iosxr/issues/451) + fragments: + - bugfix_interfaces.yaml + - fix_acl_interfaces.yaml + - fix_python_version.yaml + - revert_pylibssh_depn.yaml + release_date: "2023-11-27" diff --git a/changelogs/fragments/bugfix_interfaces.yaml b/changelogs/fragments/bugfix_interfaces.yaml deleted file mode 100644 index 17148e5e7..000000000 --- a/changelogs/fragments/bugfix_interfaces.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - Fix issue in gathered state of interfaces and l3_interfaces RMs(https://github.com/ansible-collections/cisco.iosxr/issues/452, https://github.com/ansible-collections/cisco.iosxr/issues/451) diff --git a/changelogs/fragments/fix_acl_interfaces.yaml b/changelogs/fragments/fix_acl_interfaces.yaml deleted file mode 100644 index 71732f7f1..000000000 --- a/changelogs/fragments/fix_acl_interfaces.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - Fix cleanup issue in interfaces diff --git a/changelogs/fragments/fix_python_version.yaml b/changelogs/fragments/fix_python_version.yaml deleted file mode 100644 index 69a25f71d..000000000 --- a/changelogs/fragments/fix_python_version.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - Fix python requirement for tests. diff --git a/changelogs/fragments/revert_pylibssh_depn.yaml b/changelogs/fragments/revert_pylibssh_depn.yaml deleted file mode 100644 index 2cd5e6211..000000000 --- a/changelogs/fragments/revert_pylibssh_depn.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - Add ansible-pylibssh dependency. From fd28ea67f4ae22972401b4e88a4a9e3b371fac55 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Wed, 29 Nov 2023 16:50:54 +0530 Subject: [PATCH 10/27] Update galaxy.yml --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index b51e17d7f..d4671c7ab 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -13,4 +13,4 @@ issues: https://github.com/ansible-collections/cisco.iosxr/issues tags: [cisco, iosxr, networking, netconf] # NOTE(pabelanger): We create an empty version key to keep ansible-galaxy # happy. We dynamically inject version info based on git information. -version: "6.1.0" +version: "6.1.1" From b2fdc720929a5c3cb03be64ffd383f767db236b2 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Thu, 30 Nov 2023 12:33:46 +0530 Subject: [PATCH 11/27] fix lint workflow, update reference (#432) * fix lint workflow, update reference * fix lint checkout * Update .ansible-lint * Update tests.yml --------- Co-authored-by: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Co-authored-by: Ashwini Mhatre Co-authored-by: Ashwini Mhatre --- .ansible-lint | 7 +++++++ .github/workflows/lint.yml | 13 +++++++++++++ .github/workflows/tests.yml | 4 ---- changelogs/fragments/trivial_lint.yaml | 3 +++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .ansible-lint create mode 100644 .github/workflows/lint.yml create mode 100644 changelogs/fragments/trivial_lint.yaml diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 000000000..4ff85b9c0 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,7 @@ +--- +profile: production +exclude_paths: + - changelogs/changelog.yaml +skip_list: + # ansible-lint does not like the `import-3.11` ignore in tests/sanity/ignore-*.txt + - sanity diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..4e45c595d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,13 @@ +--- +name: ansible-lint +on: # yamllint disable-line rule:truthy + pull_request: + branches: ["main"] +jobs: + build: + name: Ansible Lint # Naming the build is important to use it as a status check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run ansible-lint + uses: ansible/ansible-lint@main # or version tag instead of 'main' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 21f8ea565..506c33aa0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,8 +13,6 @@ on: # yamllint disable-line rule:truthy - cron: '0 0 * * *' jobs: - ansible-lint: - uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main changelog: uses: ansible-network/github_actions/.github/workflows/changelog.yml@main if: github.event_name == 'pull_request' @@ -31,7 +29,6 @@ jobs: all_green: if: ${{ always() }} needs: - - ansible-lint - changelog - sanity - unit-galaxy @@ -41,7 +38,6 @@ jobs: - run: >- python -c "assert 'failure' not in set([ - '${{ needs.ansible-lint.result }}', '${{ needs.changelog.result }}', '${{ needs.sanity.result }}', '${{ needs.unit-galaxy.result }}', diff --git a/changelogs/fragments/trivial_lint.yaml b/changelogs/fragments/trivial_lint.yaml new file mode 100644 index 000000000..744f36321 --- /dev/null +++ b/changelogs/fragments/trivial_lint.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - "Fix lint action reference." From 33abf80375d908e521c939eea1e2abd73a0e3730 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Thu, 30 Nov 2023 23:18:31 +0530 Subject: [PATCH 12/27] Major release 7.0.0 (#461) * Major release 7.0.0 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Create update_ansible_version.yaml * Update update_ansible_version.yaml * Update changelogs/fragments/update_ansible_version.yaml Co-authored-by: Sagar Paul * Preapare for release 7.0.0 --------- Co-authored-by: Ashwini Mhatre Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nilashish Chakraborty Co-authored-by: Sagar Paul --- CHANGELOG.rst | 13 +++++++++++ README.md | 2 +- changelogs/changelog.yaml | 13 +++++++++++ changelogs/fragments/trivial_lint.yaml | 3 --- galaxy.yml | 4 ++-- meta/runtime.yml | 2 +- tests/config.yml | 2 +- tests/sanity/ignore-2.10.txt | 28 ----------------------- tests/sanity/ignore-2.11.txt | 31 -------------------------- tests/sanity/ignore-2.12.txt | 31 -------------------------- tests/sanity/ignore-2.13.txt | 4 ---- tests/sanity/ignore-2.9.txt | 30 ------------------------- 12 files changed, 31 insertions(+), 132 deletions(-) delete mode 100644 changelogs/fragments/trivial_lint.yaml delete mode 100644 tests/sanity/ignore-2.10.txt delete mode 100644 tests/sanity/ignore-2.11.txt delete mode 100644 tests/sanity/ignore-2.12.txt delete mode 100644 tests/sanity/ignore-2.13.txt delete mode 100644 tests/sanity/ignore-2.9.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b2f32296d..54b9ca7e2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,19 @@ Cisco Iosxr Collection Release Notes .. contents:: Topics +v7.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 `v6.1.1`. + +Major Changes +------------- + +- Bumping `requires_ansible` to `>=2.14.0`, since previous ansible-core versions are EoL now. + v6.1.1 ====== diff --git a/README.md b/README.md index e17005579..d95ac05f6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This collection has been tested against Cisco IOSXR version 7.0.2. ## 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`). diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 6f1007dbb..7d599247d 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -688,3 +688,16 @@ releases: - fix_python_version.yaml - revert_pylibssh_depn.yaml release_date: "2023-11-27" + 7.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 `v6.1.1`. + fragments: + - trivial_lint.yaml + - update_ansible_version.yaml + release_date: "2023-11-30" diff --git a/changelogs/fragments/trivial_lint.yaml b/changelogs/fragments/trivial_lint.yaml deleted file mode 100644 index 744f36321..000000000 --- a/changelogs/fragments/trivial_lint.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - "Fix lint action reference." diff --git a/galaxy.yml b/galaxy.yml index d4671c7ab..cc21f5b27 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: iosxr namespace: cisco @@ -13,4 +13,4 @@ issues: https://github.com/ansible-collections/cisco.iosxr/issues tags: [cisco, iosxr, networking, netconf] # NOTE(pabelanger): We create an empty version key to keep ansible-galaxy # happy. We dynamically inject version info based on git information. -version: "6.1.1" +version: "7.0.0" diff --git a/meta/runtime.yml b/meta/runtime.yml index d2e135969..eb381faa7 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: ">=2.9.10" +requires_ansible: ">=2.14.0" plugin_routing: modules: acl_interfaces: 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/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index c2f1a6018..000000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,28 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.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 b492817fc..000000000 --- a/tests/sanity/ignore-2.11.txt +++ /dev/null @@ -1,31 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.7!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.8!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt deleted file mode 100644 index 14952a817..000000000 --- a/tests/sanity/ignore-2.12.txt +++ /dev/null @@ -1,31 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.8!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt deleted file mode 100644 index 5d99b9b08..000000000 --- a/tests/sanity/ignore-2.13.txt +++ /dev/null @@ -1,4 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.8!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt deleted file mode 100644 index aab3e8dfc..000000000 --- a/tests/sanity/ignore-2.9.txt +++ /dev/null @@ -1,30 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/modules/iosxr_logging.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/iosxr_logging.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip From a1a68293a4aaddf5d8bfce1956e281176a6ec1aa Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Wed, 13 Dec 2023 15:50:08 +0530 Subject: [PATCH 13/27] Fix integration tests (#463) Co-authored-by: Ashwini Mhatre --- changelogs/fragments/fix_iosxr_config.yaml | 3 +++ tests/integration/targets/iosxr_config/tests/cli/backup.yaml | 2 +- .../targets/iosxr_config/tests/cli/comment-too-long.yaml | 1 - tests/integration/targets/iosxr_config/tests/cli/comment.yaml | 3 +-- .../integration/targets/iosxr_config/tests/cli/src_basic.yaml | 3 +-- .../targets/iosxr_config/tests/cli/src_match_none.yaml | 3 +-- 6 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/fix_iosxr_config.yaml diff --git a/changelogs/fragments/fix_iosxr_config.yaml b/changelogs/fragments/fix_iosxr_config.yaml new file mode 100644 index 000000000..5f0bf3d47 --- /dev/null +++ b/changelogs/fragments/fix_iosxr_config.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Fix iosxr_config integration tests diff --git a/tests/integration/targets/iosxr_config/tests/cli/backup.yaml b/tests/integration/targets/iosxr_config/tests/cli/backup.yaml index f33fedff6..26ecf9931 100644 --- a/tests/integration/targets/iosxr_config/tests/cli/backup.yaml +++ b/tests/integration/targets/iosxr_config/tests/cli/backup.yaml @@ -19,7 +19,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Delete configurable backup file path ansible.builtin.file: diff --git a/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml b/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml index cbb59f6e8..b361b6c32 100644 --- a/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml +++ b/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml @@ -20,7 +20,6 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - "'comment argument cannot be more than 60 characters' in result.msg" - ansible.builtin.debug: msg="END cli/comment-too-long.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/iosxr_config/tests/cli/comment.yaml b/tests/integration/targets/iosxr_config/tests/cli/comment.yaml index dcbbe78a8..7b8ba6dec 100644 --- a/tests/integration/targets/iosxr_config/tests/cli/comment.yaml +++ b/tests/integration/targets/iosxr_config/tests/cli/comment.yaml @@ -20,7 +20,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Check device with configuration register: result @@ -31,7 +31,6 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - name: Assert accurately report configuration failure during pseudo-atomic operation register: result diff --git a/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml b/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml index dd79ebe07..e4a7e9393 100644 --- a/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml +++ b/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml @@ -18,7 +18,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Check device with configuration register: result @@ -28,6 +28,5 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - ansible.builtin.debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml b/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml index 7794ab371..3e804679c 100644 --- a/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml +++ b/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml @@ -19,7 +19,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Check device with configuration register: result @@ -29,6 +29,5 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - ansible.builtin.debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}" From 63f2dc18c24da94de5dbb547e4b586bad3278d57 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:38:29 +0530 Subject: [PATCH 14/27] Add cdp neighbors to ansible_net_neighbors facts (#457) * adds cdp neighbors * update * add test * minor updates * add changelog * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ashwini Mhatre --- .../fragments/fix_add_cdp_neighbors.yaml | 3 ++ docs/cisco.iosxr.iosxr_facts_module.rst | 2 +- .../network/iosxr/facts/legacy/base.py | 45 +++++++++++++++++++ plugins/modules/iosxr_facts.py | 3 +- .../modules/network/iosxr/fixtures/show_cdp | 4 ++ .../iosxr/fixtures/show_cdp_neighbors_detail | 16 +++++++ .../modules/network/iosxr/test_iosxr_facts.py | 16 +++++++ 7 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/fix_add_cdp_neighbors.yaml create mode 100644 tests/unit/modules/network/iosxr/fixtures/show_cdp create mode 100644 tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail diff --git a/changelogs/fragments/fix_add_cdp_neighbors.yaml b/changelogs/fragments/fix_add_cdp_neighbors.yaml new file mode 100644 index 000000000..5f4be2446 --- /dev/null +++ b/changelogs/fragments/fix_add_cdp_neighbors.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: + - iosxr_facts - Add cdp neighbors in ansible_net_neighbors dictionary (https://github.com/ansible-collections/cisco.iosxr/pull/457). diff --git a/docs/cisco.iosxr.iosxr_facts_module.rst b/docs/cisco.iosxr.iosxr_facts_module.rst index 07ad7bd41..827a769bf 100644 --- a/docs/cisco.iosxr.iosxr_facts_module.rst +++ b/docs/cisco.iosxr.iosxr_facts_module.rst @@ -381,7 +381,7 @@ Common return values are documented `here when interfaces is configured -
The list of LLDP neighbors from the remote device
+
The list of LLDP and CDP neighbors from the remote device. If both, CDP and LLDP neighbor data is present on one port, CDP is preferred.

diff --git a/plugins/module_utils/network/iosxr/facts/legacy/base.py b/plugins/module_utils/network/iosxr/facts/legacy/base.py index cc657f42a..2baf42c9f 100644 --- a/plugins/module_utils/network/iosxr/facts/legacy/base.py +++ b/plugins/module_utils/network/iosxr/facts/legacy/base.py @@ -123,6 +123,8 @@ class Interfaces(FactsBase): "show ipv6 interface", "show lldp", "show lldp neighbors detail", + "show cdp", + "show cdp neighbors detail", ] def populate(self): @@ -142,6 +144,10 @@ def populate(self): neighbors = self.responses[3] self.facts["neighbors"] = self.parse_neighbors(neighbors) + if "CDP is not enabled" not in self.responses[4]: + neighbors = self.responses[5] + self.facts["neighbors"] = self.parse_cdp_neighbors(neighbors) + def populate_interfaces(self, interfaces): facts = dict() for key, value in iteritems(interfaces): @@ -200,6 +206,25 @@ def parse_neighbors(self, neighbors): facts[intf].append(fact) return facts + def parse_cdp_neighbors(self, neighbors): + facts = dict() + for entry in neighbors.split("-------------------------"): + if entry == "": + continue + intf_port = self.parse_cdp_intf_port(entry) + if intf_port is None: + return facts + intf, port = intf_port + if intf not in facts: + facts[intf] = list() + fact = dict() + fact["host"] = self.parse_cdp_host(entry) + fact["platform"] = self.parse_cdp_platform(entry) + fact["port"] = port + fact["ip"] = self.parse_cdp_ip(entry) + facts[intf].append(fact) + return facts + def parse_interfaces(self, data): parsed = dict() key = "" @@ -281,3 +306,23 @@ def parse_lldp_port(self, data): match = re.search(r"Port id: (.+)$", data, re.M) if match: return match.group(1) + + def parse_cdp_intf_port(self, data): + match = re.search(r"^Interface: (.+), Port ID \(outgoing port\): (.+)$", data, re.M) + if match: + return match.group(1), match.group(2) + + def parse_cdp_host(self, data): + match = re.search(r"^Device ID: (.+)$", data, re.M) + if match: + return match.group(1) + + def parse_cdp_platform(self, data): + match = re.search(r"^Platform: (.+),", data, re.M) + if match: + return match.group(1) + + def parse_cdp_ip(self, data): + match = re.search(r"^ IP address: (.+)$", data, re.M) + if match: + return match.group(1) diff --git a/plugins/modules/iosxr_facts.py b/plugins/modules/iosxr_facts.py index c406a18b7..a85328ab2 100644 --- a/plugins/modules/iosxr_facts.py +++ b/plugins/modules/iosxr_facts.py @@ -172,7 +172,8 @@ returned: when interfaces is configured type: dict ansible_net_neighbors: - description: The list of LLDP neighbors from the remote device + description: The list of LLDP and CDP neighbors from the remote device. If both, + CDP and LLDP neighbor data is present on one port, CDP is preferred. returned: when interfaces is configured type: dict diff --git a/tests/unit/modules/network/iosxr/fixtures/show_cdp b/tests/unit/modules/network/iosxr/fixtures/show_cdp new file mode 100644 index 000000000..cd5d89cee --- /dev/null +++ b/tests/unit/modules/network/iosxr/fixtures/show_cdp @@ -0,0 +1,4 @@ +Global CDP information: + Sending CDP packets every 60 seconds + Sending a holdtime value of 30 seconds + Sending CDPv2 advertisements is not enabled diff --git a/tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail b/tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail new file mode 100644 index 000000000..f1ab85923 --- /dev/null +++ b/tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail @@ -0,0 +1,16 @@ +------------------------- +Device ID: device2.cisco.com +Entry address(es): + IP address: 171.68.162.134 +Platform: cisco 4500, Capabilities: Router +Interface: Ethernet0/1, Port ID (outgoing port): Ethernet0 +Holdtime : 156 sec + +Version : +Cisco Internetwork Operating System Software +IOS (tm) 4500 Software (C4500-J-M), Version 11.1(10.4), MAINTENANCE INTERIM SOFTWARE +Copyright (c) 1986-1997 by Cisco Systems, Inc. +Compiled Mon 07-Apr-97 19:51 by dschwart + + +Total cdp entries displayed : 1 diff --git a/tests/unit/modules/network/iosxr/test_iosxr_facts.py b/tests/unit/modules/network/iosxr/test_iosxr_facts.py index da7d597ae..c9efd77e1 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_facts.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_facts.py @@ -131,3 +131,19 @@ def test_iosxr_facts_cpu_utilization(self): ansible_facts["ansible_net_cpu_utilization"], cpu_utilization_data, ) + + def test_iosxr_facts_neighbors(self): + set_module_args(dict(gather_subset="interfaces")) + result = self.execute_module() + ansible_facts = result["ansible_facts"]["ansible_net_neighbors"] + expected_neighbors = { + "Ethernet0/1": [ + { + "host": "device2.cisco.com", + "platform": "cisco 4500", + "port": "Ethernet0", + "ip": "171.68.162.134", + }, + ], + } + self.assertCountEqual(ansible_facts.keys(), expected_neighbors.keys()) From 8f9341defb91a039e4f99a4770d233ce516eec24 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Thu, 14 Dec 2023 15:51:01 +0530 Subject: [PATCH 15/27] Cleanup (#464) Co-authored-by: Ashwini Mhatre --- .../targets/iosxr_config/tests/cli/replace_block.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml b/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml index b5dce6496..e3977bb74 100644 --- a/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml +++ b/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml @@ -31,3 +31,9 @@ that: - result2.changed == true - result1.commands == result2.commands + +- name: Cleanup + cisco.iosxr.iosxr_config: + commands: + - no interface GigabitEthernet 0/0/0/5 + ignore_errors: true From 06352d2102a58ec391556c09956e0d9aa3515454 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Mon, 8 Jan 2024 18:50:26 +0530 Subject: [PATCH 16/27] Release 7.1.0 (#465) * Release 7.1.0 * UPdate galaxy.yaml --------- Co-authored-by: Ashwini Mhatre --- CHANGELOG.rst | 8 ++++++++ changelogs/changelog.yaml | 8 ++++++++ changelogs/fragments/fix_add_cdp_neighbors.yaml | 3 --- changelogs/fragments/fix_iosxr_config.yaml | 3 --- galaxy.yml | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) delete mode 100644 changelogs/fragments/fix_add_cdp_neighbors.yaml delete mode 100644 changelogs/fragments/fix_iosxr_config.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 54b9ca7e2..b6040dcfa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,14 @@ Cisco Iosxr Collection Release Notes .. contents:: Topics +v7.1.0 +====== + +Minor Changes +------------- + +- iosxr_facts - Add cdp neighbors in ansible_net_neighbors dictionary (https://github.com/ansible-collections/cisco.iosxr/pull/457). + v7.0.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 7d599247d..4f12383cc 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -701,3 +701,11 @@ releases: - trivial_lint.yaml - update_ansible_version.yaml release_date: "2023-11-30" + 7.1.0: + changes: + minor_changes: + - iosxr_facts - Add cdp neighbors in ansible_net_neighbors dictionary (https://github.com/ansible-collections/cisco.iosxr/pull/457). + fragments: + - fix_add_cdp_neighbors.yaml + - fix_iosxr_config.yaml + release_date: "2024-01-08" diff --git a/changelogs/fragments/fix_add_cdp_neighbors.yaml b/changelogs/fragments/fix_add_cdp_neighbors.yaml deleted file mode 100644 index 5f4be2446..000000000 --- a/changelogs/fragments/fix_add_cdp_neighbors.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - iosxr_facts - Add cdp neighbors in ansible_net_neighbors dictionary (https://github.com/ansible-collections/cisco.iosxr/pull/457). diff --git a/changelogs/fragments/fix_iosxr_config.yaml b/changelogs/fragments/fix_iosxr_config.yaml deleted file mode 100644 index 5f0bf3d47..000000000 --- a/changelogs/fragments/fix_iosxr_config.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - Fix iosxr_config integration tests diff --git a/galaxy.yml b/galaxy.yml index cc21f5b27..342b74121 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -13,4 +13,4 @@ issues: https://github.com/ansible-collections/cisco.iosxr/issues tags: [cisco, iosxr, networking, netconf] # NOTE(pabelanger): We create an empty version key to keep ansible-galaxy # happy. We dynamically inject version info based on git information. -version: "7.0.0" +version: "7.1.0" From 0f96bbd12025f7a05d0fd1267e965ed4b02144ab Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Wed, 7 Feb 2024 17:55:26 +0530 Subject: [PATCH 17/27] Fix nightly failures (#469) * Fix nightly failures * Update test-requirements.txt * Update test-requirements.txt * Update test-requirements.txt --------- Co-authored-by: Ashwini Mhatre --- changelogs/fragments/fix_nightly.yaml | 3 +++ test-requirements.txt | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/fix_nightly.yaml diff --git a/changelogs/fragments/fix_nightly.yaml b/changelogs/fragments/fix_nightly.yaml new file mode 100644 index 000000000..58ef4ac50 --- /dev/null +++ b/changelogs/fragments/fix_nightly.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Fix nightly job updating valid pytest-ansible and black version. diff --git a/test-requirements.txt b/test-requirements.txt index 2f1724f01..146694586 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -black==22.3.0 ; python_version > '3.5' +black==23.3.0 flake8 mock pexpect @@ -8,4 +8,6 @@ coverage==4.5.4 google-api-python-client grpcio protobuf -git+https://github.com/ansible-community/pytest-ansible-units.git +pytest-ansible +pytest-xdist +pytest-cov From 8dbc9237830214984225317e39573bf3ab20cc90 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Thu, 8 Feb 2024 18:09:57 +0530 Subject: [PATCH 18/27] move platform guide to this repo (#471) --- README.md | 3 +- platform_guide.rst | 142 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 platform_guide.rst diff --git a/README.md b/README.md index d95ac05f6..cb27ec6a9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ PEP440 is the schema used to describe the versions of Ansible. ### Supported connections -The Cisco IOSXR collection supports ``network_cli`` and ``netconf`` connections. + +The Cisco IOS-XR collection supports ``network_cli`` and ``netconf`` connections. A detailed platform guide can be found [here](https://github.com/ansible-collections/cisco.iosxr/blob/main/platform_guide.rst). ## Included content diff --git a/platform_guide.rst b/platform_guide.rst new file mode 100644 index 000000000..f1e8996ca --- /dev/null +++ b/platform_guide.rst @@ -0,0 +1,142 @@ +.. _iosxr_platform_options: + +*************************************** +IOS-XR Platform Options +*************************************** + +The `Cisco IOS-XR collection `_ supports multiple connections. This page offers details on how each connection works in Ansible and how to use it. + +.. contents:: + :local: + +Connections available +================================================================================ + +.. table:: + :class: documentation-table + + ==================== ========================================== ============================================================================================================ + .. CLI NETCONF + only for modules ``iosxr_banner``, ``iosxr_interface``, ``iosxr_logging``, ``iosxr_system``, ``iosxr_user`` + ==================== ========================================== ============================================================================================================ + Protocol SSH XML over SSH + + Credentials uses SSH keys / SSH-agent if present uses SSH keys / SSH-agent if present + accepts ``-u myuser -k`` if using password accepts ``-u myuser -k`` if using password + + Indirect Access by a bastion (jump host) by a bastion (jump host) + + Connection Settings ``ansible_connection:`` ``ansible_connection:`` + ``ansible.netcommon.network_cli`` ``ansible.netcommon.netconf`` + + Enable Mode not supported not supported + (Privilege Escalation) + + Returned Data Format Refer to individual module documentation Refer to individual module documentation + ==================== ========================================== ============================================================================================================ + + +The ``ansible_connection: local`` has been deprecated. Please use ``ansible_connection: ansible.netcommon.network_cli`` or ``ansible_connection: ansible.netcommon.netconf`` instead. + +Using CLI in Ansible +==================== + +Example CLI inventory ``[iosxr:vars]`` +---------------------------------------- + +.. code-block:: yaml + + [iosxr:vars] + ansible_connection=ansible.netcommon.network_cli + ansible_network_os=cisco.iosxr.iosxr + ansible_user=myuser + ansible_password=!vault... + ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q bastion01"' + +- If you are using SSH keys (including an ssh-agent) you can remove the ``ansible_password`` configuration. +- If you are accessing your host directly (not through a bastion/jump host) you can remove the ``ansible_ssh_common_args`` configuration. +- If you are accessing your host through a bastion/jump host, you cannot include your SSH password in the ``ProxyCommand`` directive. To prevent secrets from leaking out (for example in ``ps`` output), SSH does not support providing passwords through environment variables. + +Example CLI task +---------------- + +.. code-block:: yaml + + - name: Retrieve IOS-XR version + cisco.iosxr.iosxr_command: + commands: show version + when: ansible_network_os == 'cisco.iosxr.iosxr' + +Using NETCONF in Ansible +========================== + +Enabling NETCONF +--------------- + +Before you can use NETCONF to connect to a switch, you must: + + - install the ``ncclient`` python package on your control node(s) with ``pip install ncclient`` + - enable NETCONF on the Cisco IOS-XR device(s) + +To enable NETCONF on a new switch with Ansible, use the ``cisco.iosxr.iosxr_netconf`` module through the CLI connection. Set up your platform-level variables just like in the CLI example above, then run a playbook task like this: + +.. code-block:: yaml + + - name: Enable NETCONF + connection: ansible.netcommon.network_cli + cisco.iosxr.iosxr_netconf: + when: ansible_network_os == 'cisco.iosxr.iosxr' + +Once NETCONF is enabled, change your variables to use the NETCONF connection. + +Example NETCONF inventory ``[iosxr:vars]`` +------------------------------------------ + +.. code-block:: yaml + + [iosxr:vars] + ansible_connection=ansible.netcommon.netconf + ansible_network_os=cisco.iosxr.iosxr + ansible_user=myuser + ansible_password=!vault | + ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q bastion01"' + + +Example NETCONF task +----------------------- + +.. code-block:: yaml + + - name: Configure hostname and domain-name + cisco.iosxr.iosxr_system: + hostname: iosxr01 + domain_name: test.example.com + domain_search: + - ansible.com + - redhat.com + - cisco.com + + +Warning +-------- +Never store passwords in plain text. We recommend using SSH keys to authenticate SSH connections. Ansible supports ssh-agent to manage your SSH keys. If you must use passwords to authenticate SSH connections, we recommend encrypting them with Ansible Vault. + +Cisco IOS-XR platform support matrix +=================================== + +The following platforms and software versions have been certified by Cisco to work with this version of Ansible. + +.. table:: Platform / Software Minimum Requirements + :align: center + + =================== ====================== + Supported Platforms Minimum IOS-XR Version + =================== ====================== + Cisco IOS-XR 7.0.2 and later + =================== ====================== + + +Notes +----- + +`Setting Timeout Option `_ From 478c93dd3945af40f53311dd385580d6132a8d7c Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Wed, 14 Feb 2024 14:07:40 +0530 Subject: [PATCH 19/27] =?UTF-8?q?Add=20missing=20options=20in=20afi=20and?= =?UTF-8?q?=20safi=20in=20address-family=20of=20bgp=5Ftemplate=E2=80=A6=20?= =?UTF-8?q?(#472)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add missing options in afi and safi in address-family of bgp_templates RM. * Add uts * Update test_iosxr_bgp_templates.py --------- Co-authored-by: Ashwini Mhatre --- .../fragments/bugfix_bgp_templates.yaml | 3 ++ ...cisco.iosxr.iosxr_bgp_templates_module.rst | 8 +++++ .../argspec/bgp_templates/bgp_templates.py | 13 +++++++- plugins/modules/iosxr_bgp_templates.py | 5 +-- .../network/iosxr/test_iosxr_bgp_templates.py | 32 +++++++++++++++++++ 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/bugfix_bgp_templates.yaml diff --git a/changelogs/fragments/bugfix_bgp_templates.yaml b/changelogs/fragments/bugfix_bgp_templates.yaml new file mode 100644 index 000000000..042cb47de --- /dev/null +++ b/changelogs/fragments/bugfix_bgp_templates.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Add missing options in afi and safi in address-family of bgp_templates RM. diff --git a/docs/cisco.iosxr.iosxr_bgp_templates_module.rst b/docs/cisco.iosxr.iosxr_bgp_templates_module.rst index ed91c05d2..f923b3af6 100644 --- a/docs/cisco.iosxr.iosxr_bgp_templates_module.rst +++ b/docs/cisco.iosxr.iosxr_bgp_templates_module.rst @@ -225,6 +225,10 @@ Parameters
    Choices:
  • ipv4
  • ipv6
  • +
  • vpn4
  • +
  • vpn6
  • +
  • link-state
  • +
  • l2vpn
@@ -1419,6 +1423,10 @@ Parameters
  • unicast
  • labeled-unicast
  • sr-policy
  • +
  • link-state
  • +
  • evpn
  • +
  • mspw
  • +
  • vpls-vpws
  • diff --git a/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py b/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py index 793f26282..1bcd97b70 100644 --- a/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py +++ b/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py @@ -48,7 +48,14 @@ class Bgp_templatesArgs(object): # pylint: disable=R0903 "options": { "afi": { "type": "str", - "choices": ["ipv4", "ipv6"], + "choices": [ + "ipv4", + "ipv6", + "vpn4", + "vpn6", + "link-state", + "l2vpn", + ], }, "safi": { "type": "str", @@ -62,6 +69,10 @@ class Bgp_templatesArgs(object): # pylint: disable=R0903 "unicast", "labeled-unicast", "sr-policy", + "link-state", + "evpn", + "mspw", + "vpls-vpws", ], }, "signalling": { diff --git a/plugins/modules/iosxr_bgp_templates.py b/plugins/modules/iosxr_bgp_templates.py index 5db2cb2ad..5cbb03359 100644 --- a/plugins/modules/iosxr_bgp_templates.py +++ b/plugins/modules/iosxr_bgp_templates.py @@ -46,11 +46,12 @@ afi: description: address family. type: str - choices: [ 'ipv4', 'ipv6' ] + choices: [ 'ipv4', 'ipv6', 'vpn4', 'vpn6', 'link-state', 'l2vpn'] safi: description: Address Family modifier type: str - choices: [ 'flowspec', 'mdt', 'multicast', 'mvpn', 'rt-filter', 'tunnel', 'unicast', 'labeled-unicast' , 'sr-policy'] + choices: [ 'flowspec', 'mdt', 'multicast', 'mvpn', 'rt-filter', 'tunnel', + 'unicast', 'labeled-unicast' , 'sr-policy', 'link-state', 'evpn', 'mspw', 'vpls-vpws'] signalling: type: dict description: Signalling protocols to disable, BGP or LDP diff --git a/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py b/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py index 4efc04503..c97dd7031 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py @@ -239,6 +239,22 @@ def test_iosxr_bgp_tmpl_merged(self): safi="unicast", advertise=dict(local_labeled_route=dict(set=True)), ), + dict( + afi="vpn4", + safi="unicast", + ), + dict( + afi="vpn6", + safi="unicast", + ), + dict( + afi="link-state", + safi="link-state", + ), + dict( + afi="l2vpn", + safi="evpn", + ), ], ), dict( @@ -324,6 +340,10 @@ def test_iosxr_bgp_tmpl_merged(self): "bfd fast-detect strict-mode", "internal-vpn-client", "precedence critical", + "address-family vpn4 unicast", + "address-family vpn6 unicast", + "address-family link-state link-state", + "address-family l2vpn evpn", "address-family ipv4 unicast", "advertise local-labeled-route", "neighbor-group test1", @@ -1128,6 +1148,14 @@ def test_iosxr_bgp_tmpl_gathered(self): precedence critical advertisement-interval 10 internal-vpn-client + address-family vpn4 unicast + ! + address-family vpn6 unicast + ! + address-family link-state link-state + ! + address-family l2vpn evpn + ! address-family ipv4 unicast advertise local-labeled-route ! @@ -1199,6 +1227,10 @@ def test_iosxr_bgp_tmpl_gathered(self): "advertisement_interval": 10, "internal_vpn_client": True, "address_family": [ + {"afi": "vpn4", "safi": "unicast"}, + {"afi": "vpn6", "safi": "unicast"}, + {"afi": "link-state", "safi": "link-state"}, + {"afi": "l2vpn", "safi": "evpn"}, { "afi": "ipv4", "safi": "unicast", From 8d7c66a24776a97cf0a4544e2f0926a24bcaeaa7 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Thu, 22 Feb 2024 21:16:16 +0530 Subject: [PATCH 20/27] Fix issue in afi choices (#473) * Fix issue in afi choices * Fix uts --------- Co-authored-by: Ashwini Mhatre --- changelogs/fragments/bugfix_bgp_templates.yaml | 2 +- changelogs/fragments/fix_bgp_template.yaml | 3 +++ docs/cisco.iosxr.iosxr_bgp_templates_module.rst | 4 ++-- .../iosxr/argspec/bgp_templates/bgp_templates.py | 4 ++-- plugins/modules/iosxr_bgp_templates.py | 2 +- .../network/iosxr/test_iosxr_bgp_templates.py | 16 ++++++++-------- 6 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/fix_bgp_template.yaml diff --git a/changelogs/fragments/bugfix_bgp_templates.yaml b/changelogs/fragments/bugfix_bgp_templates.yaml index 042cb47de..4b1b1e4b4 100644 --- a/changelogs/fragments/bugfix_bgp_templates.yaml +++ b/changelogs/fragments/bugfix_bgp_templates.yaml @@ -1,3 +1,3 @@ --- -bugfixes: +minor_changes: - Add missing options in afi and safi in address-family of bgp_templates RM. diff --git a/changelogs/fragments/fix_bgp_template.yaml b/changelogs/fragments/fix_bgp_template.yaml new file mode 100644 index 000000000..1cce27038 --- /dev/null +++ b/changelogs/fragments/fix_bgp_template.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Fix 'afi' value in bgp_templates RM to valid values. diff --git a/docs/cisco.iosxr.iosxr_bgp_templates_module.rst b/docs/cisco.iosxr.iosxr_bgp_templates_module.rst index f923b3af6..72440deaa 100644 --- a/docs/cisco.iosxr.iosxr_bgp_templates_module.rst +++ b/docs/cisco.iosxr.iosxr_bgp_templates_module.rst @@ -225,8 +225,8 @@ Parameters
      Choices:
    • ipv4
    • ipv6
    • -
    • vpn4
    • -
    • vpn6
    • +
    • vpnv4
    • +
    • vpnv6
    • link-state
    • l2vpn
    diff --git a/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py b/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py index 1bcd97b70..51a70c5fd 100644 --- a/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py +++ b/plugins/module_utils/network/iosxr/argspec/bgp_templates/bgp_templates.py @@ -51,8 +51,8 @@ class Bgp_templatesArgs(object): # pylint: disable=R0903 "choices": [ "ipv4", "ipv6", - "vpn4", - "vpn6", + "vpnv4", + "vpnv6", "link-state", "l2vpn", ], diff --git a/plugins/modules/iosxr_bgp_templates.py b/plugins/modules/iosxr_bgp_templates.py index 5cbb03359..b57ac4f9f 100644 --- a/plugins/modules/iosxr_bgp_templates.py +++ b/plugins/modules/iosxr_bgp_templates.py @@ -46,7 +46,7 @@ afi: description: address family. type: str - choices: [ 'ipv4', 'ipv6', 'vpn4', 'vpn6', 'link-state', 'l2vpn'] + choices: [ 'ipv4', 'ipv6', 'vpnv4', 'vpnv6', 'link-state', 'l2vpn'] safi: description: Address Family modifier type: str diff --git a/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py b/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py index c97dd7031..ddc6dfb89 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py @@ -240,11 +240,11 @@ def test_iosxr_bgp_tmpl_merged(self): advertise=dict(local_labeled_route=dict(set=True)), ), dict( - afi="vpn4", + afi="vpnv4", safi="unicast", ), dict( - afi="vpn6", + afi="vpnv6", safi="unicast", ), dict( @@ -340,8 +340,8 @@ def test_iosxr_bgp_tmpl_merged(self): "bfd fast-detect strict-mode", "internal-vpn-client", "precedence critical", - "address-family vpn4 unicast", - "address-family vpn6 unicast", + "address-family vpnv4 unicast", + "address-family vpnv6 unicast", "address-family link-state link-state", "address-family l2vpn evpn", "address-family ipv4 unicast", @@ -1148,9 +1148,9 @@ def test_iosxr_bgp_tmpl_gathered(self): precedence critical advertisement-interval 10 internal-vpn-client - address-family vpn4 unicast + address-family vpnv4 unicast ! - address-family vpn6 unicast + address-family vpnv6 unicast ! address-family link-state link-state ! @@ -1227,8 +1227,8 @@ def test_iosxr_bgp_tmpl_gathered(self): "advertisement_interval": 10, "internal_vpn_client": True, "address_family": [ - {"afi": "vpn4", "safi": "unicast"}, - {"afi": "vpn6", "safi": "unicast"}, + {"afi": "vpnv4", "safi": "unicast"}, + {"afi": "vpnv6", "safi": "unicast"}, {"afi": "link-state", "safi": "link-state"}, {"afi": "l2vpn", "safi": "evpn"}, { From e14227cd1f16228d69427b4194a7837c35121387 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Wed, 6 Mar 2024 18:56:37 +0530 Subject: [PATCH 21/27] Prepare for release 7.2.0 (#476) * Prepare for release * update galaxy.yml --------- Co-authored-by: Ashwini Mhatre --- CHANGELOG.rst | 13 +++++++++++++ changelogs/changelog.yaml | 11 +++++++++++ changelogs/fragments/bugfix_bgp_templates.yaml | 3 --- changelogs/fragments/fix_bgp_template.yaml | 3 --- changelogs/fragments/fix_nightly.yaml | 3 --- galaxy.yml | 2 +- 6 files changed, 25 insertions(+), 10 deletions(-) delete mode 100644 changelogs/fragments/bugfix_bgp_templates.yaml delete mode 100644 changelogs/fragments/fix_bgp_template.yaml delete mode 100644 changelogs/fragments/fix_nightly.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b6040dcfa..81065138c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,19 @@ Cisco Iosxr Collection Release Notes .. contents:: Topics +v7.2.0 +====== + +Minor Changes +------------- + +- Add missing options in afi and safi in address-family of bgp_templates RM. + +Bugfixes +-------- + +- Fix 'afi' value in bgp_templates RM to valid values. + v7.1.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 4f12383cc..ab7c68a9a 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -709,3 +709,14 @@ releases: - fix_add_cdp_neighbors.yaml - fix_iosxr_config.yaml release_date: "2024-01-08" + 7.2.0: + changes: + bugfixes: + - Fix 'afi' value in bgp_templates RM to valid values. + minor_changes: + - Add missing options in afi and safi in address-family of bgp_templates RM. + fragments: + - bugfix_bgp_templates.yaml + - fix_bgp_template.yaml + - fix_nightly.yaml + release_date: "2024-03-01" diff --git a/changelogs/fragments/bugfix_bgp_templates.yaml b/changelogs/fragments/bugfix_bgp_templates.yaml deleted file mode 100644 index 4b1b1e4b4..000000000 --- a/changelogs/fragments/bugfix_bgp_templates.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - Add missing options in afi and safi in address-family of bgp_templates RM. diff --git a/changelogs/fragments/fix_bgp_template.yaml b/changelogs/fragments/fix_bgp_template.yaml deleted file mode 100644 index 1cce27038..000000000 --- a/changelogs/fragments/fix_bgp_template.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - Fix 'afi' value in bgp_templates RM to valid values. diff --git a/changelogs/fragments/fix_nightly.yaml b/changelogs/fragments/fix_nightly.yaml deleted file mode 100644 index 58ef4ac50..000000000 --- a/changelogs/fragments/fix_nightly.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - Fix nightly job updating valid pytest-ansible and black version. diff --git a/galaxy.yml b/galaxy.yml index 342b74121..194566307 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -13,4 +13,4 @@ issues: https://github.com/ansible-collections/cisco.iosxr/issues tags: [cisco, iosxr, networking, netconf] # NOTE(pabelanger): We create an empty version key to keep ansible-galaxy # happy. We dynamically inject version info based on git information. -version: "7.1.0" +version: "7.2.0" From 2429e30148efb60e2007250a17e2eab76d3d5fb3 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:16:09 +0530 Subject: [PATCH 22/27] Enable content-actions (#477) * enable content-actions * lint changes * lint changes * lint changes * lint changes * revised changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README.md * add auto-versioning * changes * disable autoversion --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .ansible-lint | 3 +-- .github/CODEOWNERS | 0 .../workflows/{ack.yml => check_label.yml} | 10 +++---- .github/workflows/codecoverage.yml | 3 ++- .github/workflows/draft_release.yml | 18 +++++++++++++ .github/workflows/lint.yml | 13 --------- .github/workflows/push.yml | 27 ------------------- .github/workflows/release.yml | 4 +-- .github/workflows/tests.yml | 14 ++++++---- .pre-commit-config.yaml | 2 +- README.md | 4 +-- requirements.txt | 1 - test-requirements.txt | 1 - tests/sanity/ignore-2.14.txt | 2 +- tests/sanity/ignore-2.15.txt | 2 +- tests/sanity/ignore-2.16.txt | 2 +- tests/sanity/ignore-2.17.txt | 2 +- tox-ansible.ini | 10 +++++++ 18 files changed, 52 insertions(+), 66 deletions(-) create mode 100644 .github/CODEOWNERS rename .github/workflows/{ack.yml => check_label.yml} (60%) create mode 100644 .github/workflows/draft_release.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/push.yml create mode 100644 tox-ansible.ini diff --git a/.ansible-lint b/.ansible-lint index 4ff85b9c0..7324ff454 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,7 +1,6 @@ --- + profile: production -exclude_paths: - - changelogs/changelog.yaml skip_list: # ansible-lint does not like the `import-3.11` ignore in tests/sanity/ignore-*.txt - sanity diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/ack.yml b/.github/workflows/check_label.yml similarity index 60% rename from .github/workflows/ack.yml rename to .github/workflows/check_label.yml index fda595dc5..b120bfa32 100644 --- a/.github/workflows/ack.yml +++ b/.github/workflows/check_label.yml @@ -1,15 +1,11 @@ --- -# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml -name: ack - +name: "Check label" concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true - on: # yamllint disable-line rule:truthy pull_request_target: types: [opened, labeled, unlabeled, synchronize] - jobs: - ack: - uses: ansible/devtools/.github/workflows/ack.yml@main + check_label: + uses: ansible/ansible-content-actions/.github/workflows/check_label.yaml@main diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml index b425edcc2..3e0f17919 100644 --- a/.github/workflows/codecoverage.yml +++ b/.github/workflows/codecoverage.yml @@ -1,8 +1,9 @@ --- -name: Code Coverage +name: "Code coverage" on: # yamllint disable-line rule:truthy push: + branches: [main] pull_request: branches: [ main ] diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml new file mode 100644 index 000000000..88b45f2b0 --- /dev/null +++ b/.github/workflows/draft_release.yml @@ -0,0 +1,18 @@ +--- +name: "Draft release" +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +on: # yamllint disable-line rule:truthy + workflow_dispatch: +env: + NAMESPACE: ${{ github.repository_owner }} + COLLECTION_NAME: iosxr + ANSIBLE_COLLECTIONS_PATHS: ./ +jobs: + update_release_draft: + uses: ansible/ansible-content-actions/.github/workflows/draft_release.yaml@main + with: + repo: ${{ github.event.pull_request.head.repo.full_name }} + secrets: + BOT_PAT: ${{ secrets.BOT_PAT }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 4e45c595d..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: ansible-lint -on: # yamllint disable-line rule:truthy - pull_request: - branches: ["main"] -jobs: - build: - name: Ansible Lint # Naming the build is important to use it as a status check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run ansible-lint - uses: ansible/ansible-lint@main # or version tag instead of 'main' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 06d11b8a0..000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -# push workflow is shared and expected to perform actions after a merge happens -# on a maintenance branch (default or release). For example updating the -# draft release-notes. -# based on great work from -# https://github.com/T-Systems-MMS/ansible-collection-icinga-director -name: push - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -on: # yamllint disable-line rule:truthy - workflow_dispatch: - -env: - NAMESPACE: cisco - COLLECTION_NAME: iosxr - ANSIBLE_COLLECTIONS_PATHS: ./ - -jobs: - update_release_draft: - uses: ansible/devtools/.github/workflows/push_network.yml@main - with: - repo: ansible-collections/cisco.iosxr - secrets: - BOT_PAT: ${{ secrets.BOT_PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb04259d1..6dbb1aa39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ --- -name: release +name: "Release collection" on: # yamllint disable-line rule:truthy release: types: [published] jobs: release: - uses: ansible/devtools/.github/workflows/release_collection.yml@main + uses: ansible/ansible-content-actions/.github/workflows/release.yaml@main with: environment: release secrets: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 506c33aa0..a59a35d77 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,5 +1,5 @@ --- -name: CI +name: "CI" concurrency: group: ${{ github.head_ref || github.run_id }} @@ -14,12 +14,14 @@ on: # yamllint disable-line rule:truthy jobs: changelog: - uses: ansible-network/github_actions/.github/workflows/changelog.yml@main + uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main if: github.event_name == 'pull_request' + ansible-lint: + uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main sanity: - uses: ansible-network/github_actions/.github/workflows/sanity.yml@main + uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main unit-galaxy: - uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main + uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main unit-source: uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main with: @@ -32,6 +34,7 @@ jobs: - changelog - sanity - unit-galaxy + - ansible-lint - unit-source runs-on: ubuntu-latest steps: @@ -41,5 +44,6 @@ jobs: '${{ needs.changelog.result }}', '${{ needs.sanity.result }}', '${{ needs.unit-galaxy.result }}', - '${{ needs.unit-source.result }}' + '${{ needs.ansible-lint.result }}', + '${{ needs.unit-source.outputs.result }}' ])" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fdbd4b3a..d034d8da3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: - repo: https://github.com/ansible-network/collection_prep rev: 1.1.1 hooks: - # - id: autoversion # removed as being handled by GHA push and release drafter + # - id: autoversion # removed as being handled by GHA push and release drafter - id: update-docs - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/README.md b/README.md index cb27ec6a9..a0faec864 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The Ansible Cisco IOSXR collection includes a variety of Ansible content to help automate the management of Cisco IOSXR network appliances. -This collection has been tested against Cisco IOSXR version 7.0.2. +This collection has been tested against Cisco IOS-XR version 7.0.2 ## Ansible version compatibility @@ -77,7 +77,7 @@ Click the ``Content`` button to see the list of content included in this collect ## Installing this collection -You can install the Cisco IOSXR collection with the Ansible Galaxy CLI: +You can install the Cisco IOS-XR collection with the Ansible Galaxy CLI: ansible-galaxy collection install cisco.iosxr diff --git a/requirements.txt b/requirements.txt index 2fb85f407..ece31d550 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ ncclient paramiko -ipaddress grpcio protobuf ansible-pylibssh diff --git a/test-requirements.txt b/test-requirements.txt index 146694586..b8dae64f8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,6 @@ black==23.3.0 flake8 mock pexpect -pytest-xdist yamllint coverage==4.5.4 google-api-python-client diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt index 63b93ff5a..1e8023a57 100644 --- a/tests/sanity/ignore-2.14.txt +++ b/tests/sanity/ignore-2.14.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt index 63b93ff5a..1e8023a57 100644 --- a/tests/sanity/ignore-2.15.txt +++ b/tests/sanity/ignore-2.15.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt index 450f3eab7..6d49e3dcb 100644 --- a/tests/sanity/ignore-2.16.txt +++ b/tests/sanity/ignore-2.16.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index 450f3eab7..6d49e3dcb 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/tox-ansible.ini b/tox-ansible.ini new file mode 100644 index 000000000..5e1f4b36a --- /dev/null +++ b/tox-ansible.ini @@ -0,0 +1,10 @@ +[ansible] + +skip = + py3.7 + py3.8 + 2.9 + 2.10 + 2.11 + 2.12 + 2.13 From cbb648ce9ae8a547694e4dc31cfc0e93753ff8d4 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:41:35 +0530 Subject: [PATCH 23/27] Remove py27 compat files & update imports for patch & magicmock (#480) * remove compat files & imports * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/tests.yml | 2 +- .../fragments/trivial_tests_updates.yaml | 4 + tests/unit/compat/__init__.py | 0 tests/unit/compat/mock.py | 129 ------------------ tests/unit/compat/unittest.py | 41 ------ tests/unit/mock/path.py | 4 +- .../modules/network/iosxr/test_hostname.py | 2 +- .../unit/modules/network/iosxr/test_iosxr.py | 4 +- .../iosxr/test_iosxr_acl_interfaces.py | 3 +- .../modules/network/iosxr/test_iosxr_acls.py | 3 +- .../network/iosxr/test_iosxr_banner.py | 2 +- .../iosxr/test_iosxr_bgp_address_family.py | 2 +- .../network/iosxr/test_iosxr_bgp_global.py | 2 +- .../test_iosxr_bgp_neighbor_address_family.py | 2 +- .../network/iosxr/test_iosxr_bgp_templates.py | 2 +- .../network/iosxr/test_iosxr_command.py | 3 +- .../network/iosxr/test_iosxr_config.py | 2 +- .../modules/network/iosxr/test_iosxr_facts.py | 3 +- .../network/iosxr/test_iosxr_interfaces.py | 3 +- .../network/iosxr/test_iosxr_l2_interfaces.py | 3 +- .../network/iosxr/test_iosxr_l3_interfaces.py | 3 +- .../modules/network/iosxr/test_iosxr_lacp.py | 3 +- .../iosxr/test_iosxr_lacp_interfaces.py | 3 +- .../iosxr/test_iosxr_lag_interfaces.py | 3 +- .../network/iosxr/test_iosxr_lldp_global.py | 3 +- .../iosxr/test_iosxr_lldp_interfaces.py | 3 +- .../iosxr/test_iosxr_logging_global.py | 2 +- .../modules/network/iosxr/test_iosxr_n540.py | 4 +- .../network/iosxr/test_iosxr_netconf.py | 3 +- .../network/iosxr/test_iosxr_ntp_global.py | 2 +- .../iosxr/test_iosxr_ospf_interfaces.py | 3 +- .../network/iosxr/test_iosxr_ospfv2.py | 3 +- .../network/iosxr/test_iosxr_ospfv3.py | 3 +- .../modules/network/iosxr/test_iosxr_ping.py | 2 +- .../network/iosxr/test_iosxr_prefix_lists.py | 2 +- .../network/iosxr/test_iosxr_snmp_server.py | 2 +- .../network/iosxr/test_iosxr_static_routes.py | 3 +- .../network/iosxr/test_iosxr_system.py | 3 +- .../modules/network/iosxr/test_iosxr_user.py | 3 +- .../modules/network/iosxr/test_iosxr_utils.py | 6 +- tests/unit/modules/utils.py | 8 +- tox.ini | 2 +- 42 files changed, 70 insertions(+), 215 deletions(-) create mode 100644 changelogs/fragments/trivial_tests_updates.yaml delete mode 100644 tests/unit/compat/__init__.py delete mode 100644 tests/unit/compat/mock.py delete mode 100644 tests/unit/compat/unittest.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a59a35d77..5c01a71c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,5 +45,5 @@ jobs: '${{ needs.sanity.result }}', '${{ needs.unit-galaxy.result }}', '${{ needs.ansible-lint.result }}', - '${{ needs.unit-source.outputs.result }}' + '${{ needs.unit-source.result }}' ])" diff --git a/changelogs/fragments/trivial_tests_updates.yaml b/changelogs/fragments/trivial_tests_updates.yaml new file mode 100644 index 000000000..6f9f7d906 --- /dev/null +++ b/changelogs/fragments/trivial_tests_updates.yaml @@ -0,0 +1,4 @@ +--- +trivial: + - remove compat files as we stopped testing against python 2.7. + - update direct imports for patch and MagicMock from unittest. diff --git a/tests/unit/compat/__init__.py b/tests/unit/compat/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py deleted file mode 100644 index e4ce72b34..000000000 --- a/tests/unit/compat/mock.py +++ /dev/null @@ -1,129 +0,0 @@ -# (c) 2014, Toshio Kuratomi -# -# 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 . - -# Make coding more python3-ish -from __future__ import absolute_import, division, print_function - - -__metaclass__ = type - -""" -Compat module for Python3.x's unittest.mock module -""" -import sys - -import _io - - -# Python 2.7 - -# Note: Could use the pypi mock library on python3.x as well as python2.x. It -# is the same as the python3 stdlib mock library - -try: - # Allow wildcard import because we really do want to import all of mock's - # symbols into this compat shim - # pylint: disable=wildcard-import,unused-wildcard-import - from unittest.mock import * -except ImportError: - # Python 2 - # pylint: disable=wildcard-import,unused-wildcard-import - try: - from mock import * - except ImportError: - print("You need the mock library installed on python2.x to run tests") - - -# Prior to 3.4.4, mock_open cannot handle binary read_data -if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): - file_spec = None - - def _iterate_read_data(read_data): - # Helper for mock_open: - # Retrieve lines from read_data via a generator so that separate calls to - # readline, read, and readlines are properly interleaved - sep = b"\n" if isinstance(read_data, bytes) else "\n" - data_as_list = [l + sep for l in read_data.split(sep)] - - if data_as_list[-1] == sep: - # If the last line ended in a newline, the list comprehension will have an - # extra entry that's just a newline. Remove this. - data_as_list = data_as_list[:-1] - else: - # If there wasn't an extra newline by itself, then the file being - # emulated doesn't have a newline to end the last line remove the - # newline that our naive format() added - data_as_list[-1] = data_as_list[-1][:-1] - - for line in data_as_list: - yield line - - def mock_open(mock=None, read_data=""): - """ - A helper function to create a mock to replace the use of `open`. It works - for `open` called directly or used as a context manager. - - The `mock` argument is the mock object to configure. If `None` (the - default) then a `MagicMock` will be created for you, with the API limited - to methods or attributes available on standard file handles. - - `read_data` is a string for the `read` methoddline`, and `readlines` of the - file handle to return. This is an empty string by default. - """ - - def _readlines_side_effect(*args, **kwargs): - if handle.readlines.return_value is not None: - return handle.readlines.return_value - return list(_data) - - def _read_side_effect(*args, **kwargs): - if handle.read.return_value is not None: - return handle.read.return_value - return type(read_data)().join(_data) - - def _readline_side_effect(): - if handle.readline.return_value is not None: - while True: - yield handle.readline.return_value - for line in _data: - yield line - - global file_spec - if file_spec is None: - file_spec = list( - set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))), - ) - - if mock is None: - mock = MagicMock(name="open", spec=open) - - handle = MagicMock(spec=file_spec) - handle.__enter__.return_value = handle - - _data = _iterate_read_data(read_data) - - handle.write.return_value = None - handle.read.return_value = None - handle.readline.return_value = None - handle.readlines.return_value = None - - handle.read.side_effect = _read_side_effect - handle.readline.side_effect = _readline_side_effect() - handle.readlines.side_effect = _readlines_side_effect - - mock.return_value = handle - return mock diff --git a/tests/unit/compat/unittest.py b/tests/unit/compat/unittest.py deleted file mode 100644 index df4266ec9..000000000 --- a/tests/unit/compat/unittest.py +++ /dev/null @@ -1,41 +0,0 @@ -# (c) 2014, Toshio Kuratomi -# -# 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 . - -# Make coding more python3-ish -from __future__ import absolute_import, division, print_function - - -__metaclass__ = type - -""" -Compat module for Python2.7's unittest module -""" - -import sys - - -# Allow wildcard import because we really do want to import all of -# unittests's symbols into this compat shim -# pylint: disable=wildcard-import,unused-wildcard-import -if sys.version_info < (2, 7): - try: - # Need unittest2 on python2.6 - from unittest2 import * - except ImportError: - print("You need unittest2 installed on python2.6.x to run tests") -else: - from unittest import * diff --git a/tests/unit/mock/path.py b/tests/unit/mock/path.py index 0c87896da..7d287a5fb 100644 --- a/tests/unit/mock/path.py +++ b/tests/unit/mock/path.py @@ -2,9 +2,9 @@ __metaclass__ = type -from ansible.utils.path import unfrackpath +from unittest.mock import MagicMock -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import MagicMock +from ansible.utils.path import unfrackpath mock_unfrackpath_noop = MagicMock( diff --git a/tests/unit/modules/network/iosxr/test_hostname.py b/tests/unit/modules/network/iosxr/test_hostname.py index 7c676530b..9eda36615 100644 --- a/tests/unit/modules/network/iosxr/test_hostname.py +++ b/tests/unit/modules/network/iosxr/test_hostname.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_hostname -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr.py b/tests/unit/modules/network/iosxr/test_iosxr.py index af2fd3a5c..32eb85797 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr.py +++ b/tests/unit/modules/network/iosxr/test_iosxr.py @@ -22,15 +22,15 @@ __metaclass__ = type from os import path +from unittest import TestCase from ansible.module_utils._text import to_bytes, to_text from mock import MagicMock from ansible_collections.cisco.iosxr.plugins.cliconf import iosxr -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -class TestPluginCLIConfIOSXR(unittest.TestCase): +class TestPluginCLIConfIOSXR(TestCase): """Test class for IOSXR CLI Conf Methods""" def setUp(self): diff --git a/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py index 8500c0733..0c29c6c13 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_acl_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_acls.py b/tests/unit/modules/network/iosxr/test_iosxr_acls.py index 181b239d8..d301bda7b 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_acls.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_acls.py @@ -8,8 +8,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_acls -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_banner.py b/tests/unit/modules/network/iosxr/test_iosxr_banner.py index 5dcbada13..32085d51e 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_banner.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_banner.py @@ -38,9 +38,9 @@ __metaclass__ = type +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_banner -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py b/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py index 57770b59d..ce8d12c95 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_address_family -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py b/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py index 901b5b4d8..6527fb48d 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py b/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py index d6fd0610d..6714adee8 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_neighbor_address_family -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py b/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py index ddc6dfb89..58cec9977 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_templates -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_command.py b/tests/unit/modules/network/iosxr/test_iosxr_command.py index cd691d6c4..b3787e600 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_command.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_command.py @@ -21,8 +21,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_command -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_config.py b/tests/unit/modules/network/iosxr/test_iosxr_config.py index 9ac6866af..dffd4b4c9 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_config.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_config.py @@ -21,10 +21,10 @@ __metaclass__ = type +from unittest.mock import MagicMock, patch from ansible_collections.cisco.iosxr.plugins.cliconf.iosxr import Cliconf from ansible_collections.cisco.iosxr.plugins.modules import iosxr_config -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import MagicMock, patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_facts.py b/tests/unit/modules/network/iosxr/test_iosxr_facts.py index c9efd77e1..6c0e02e0f 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_facts.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_facts.py @@ -23,8 +23,9 @@ import json +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_facts -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py index bff925c60..15a8de4e5 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py index f28561777..9bef80c39 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_l2_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py index 071b16b8f..14b5a1e51 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_l3_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_lacp.py b/tests/unit/modules/network/iosxr/test_iosxr_lacp.py index 23c4b8cd9..09e7fa8ec 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_lacp.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_lacp.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lacp -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py index 55358a061..d6bb57c40 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lacp_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py index b0d68fc62..032539115 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lag_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py b/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py index 4830058df..d2b74103b 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lldp_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py index 78b6d79f0..889eb8e57 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py @@ -22,8 +22,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lldp_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py b/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py index bffee2b17..205740f19 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_logging_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_n540.py b/tests/unit/modules/network/iosxr/test_iosxr_n540.py index d2820cfa1..e7ec26877 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_n540.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_n540.py @@ -22,15 +22,15 @@ __metaclass__ = type from os import path +from unittest import TestCase from ansible.module_utils._text import to_bytes, to_text from mock import MagicMock from ansible_collections.cisco.iosxr.plugins.cliconf import iosxr -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -class TestPluginCLIConfIOSXR(unittest.TestCase): +class TestPluginCLIConfIOSXR(TestCase): """Test class for IOSXR CLI Conf Methods""" def setUp(self): diff --git a/tests/unit/modules/network/iosxr/test_iosxr_netconf.py b/tests/unit/modules/network/iosxr/test_iosxr_netconf.py index 727752948..db1f03449 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_netconf.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_netconf.py @@ -21,8 +21,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_netconf -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py b/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py index 702e2a007..e9e0e66fd 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ntp_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py b/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py index 5b967be00..f5030c703 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py @@ -8,8 +8,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospf_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py b/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py index b51727dbd..3d4e26298 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py @@ -8,8 +8,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospfv2 -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py b/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py index 23c9d071b..447323e7f 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py @@ -8,8 +8,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospfv3 -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_ping.py b/tests/unit/modules/network/iosxr/test_iosxr_ping.py index d0ceda0fb..b5701c655 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_ping.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_ping.py @@ -9,9 +9,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ping -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py b/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py index 6dca5d920..9c2f895ac 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_prefix_lists -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py b/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py index 148625190..eaad485d8 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py @@ -23,9 +23,9 @@ __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_snmp_server -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py b/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py index a185b0c4f..4cce2eb6e 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py @@ -8,8 +8,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_static_routes -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_system.py b/tests/unit/modules/network/iosxr/test_iosxr_system.py index 253725979..973f07066 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_system.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_system.py @@ -21,8 +21,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_system -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_user.py b/tests/unit/modules/network/iosxr/test_iosxr_user.py index 0d783d4cd..0ab53a529 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_user.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_user.py @@ -21,8 +21,9 @@ __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_user -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/tests/unit/modules/network/iosxr/test_iosxr_utils.py b/tests/unit/modules/network/iosxr/test_iosxr_utils.py index 7707adf41..c63e57030 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_utils.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_utils.py @@ -7,11 +7,13 @@ __metaclass__ = type + +from unittest import TestCase + from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import Version -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -class TestIosxrUtils(unittest.TestCase): +class TestIosxrUtils(TestCase): def setUp(self): pass diff --git a/tests/unit/modules/utils.py b/tests/unit/modules/utils.py index d63a86922..87be9cf8e 100644 --- a/tests/unit/modules/utils.py +++ b/tests/unit/modules/utils.py @@ -4,12 +4,12 @@ __metaclass__ = type import json +from unittest import TestCase +from unittest.mock import patch + from ansible.module_utils import basic from ansible.module_utils._text import to_bytes -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch - def set_module_args(args): if "_ansible_remote_tmp" not in args: @@ -40,7 +40,7 @@ def fail_json(*args, **kwargs): raise AnsibleFailJson(kwargs) -class ModuleTestCase(unittest.TestCase): +class ModuleTestCase(TestCase): def setUp(self): self.mock_module = patch.multiple( basic.AnsibleModule, diff --git a/tox.ini b/tox.ini index 6ada631cb..7dbe41e8f 100644 --- a/tox.ini +++ b/tox.ini @@ -28,4 +28,4 @@ show-source = True ignore = E123,E125,E203,E402,E501,E741,F401,F811,F841,W503 max-line-length = 160 builtins = _ -exclude = .git,.tox,tests/unit/compat/ +exclude = .git,.tox From f7335f6a038abc8db4d1ccdafe82179171c39c18 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:31:24 +0530 Subject: [PATCH 24/27] Remove deprecated module (#479) * removes deprecated modules * add changelog * review changes * remove meta runtimes * changelog update * pylint errors * undo compat & other changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- README.md | 1 - changelogs/fragments/remove_deprecated.yaml | 5 + docs/cisco.iosxr.iosxr_logging_module.rst | 538 ------- meta/runtime.yml | 9 - plugins/modules/iosxr_logging.py | 1270 ----------------- .../targets/iosxr_logging/defaults/main.yaml | 3 - .../targets/iosxr_logging/meta/main.yaml | 3 - .../targets/iosxr_logging/tasks/cli.yaml | 24 - .../targets/iosxr_logging/tasks/main.yaml | 6 - .../targets/iosxr_logging/tasks/netconf.yaml | 24 - .../iosxr_logging/tests/cli/basic.yaml | 140 -- .../iosxr_logging/tests/netconf/basic.yaml | 208 --- 12 files changed, 5 insertions(+), 2226 deletions(-) create mode 100644 changelogs/fragments/remove_deprecated.yaml delete mode 100644 docs/cisco.iosxr.iosxr_logging_module.rst delete mode 100644 plugins/modules/iosxr_logging.py delete mode 100644 tests/integration/targets/iosxr_logging/defaults/main.yaml delete mode 100644 tests/integration/targets/iosxr_logging/meta/main.yaml delete mode 100644 tests/integration/targets/iosxr_logging/tasks/cli.yaml delete mode 100644 tests/integration/targets/iosxr_logging/tasks/main.yaml delete mode 100644 tests/integration/targets/iosxr_logging/tasks/netconf.yaml delete mode 100644 tests/integration/targets/iosxr_logging/tests/cli/basic.yaml delete mode 100644 tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml diff --git a/README.md b/README.md index a0faec864..d3e158bba 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ Name | Description [cisco.iosxr.iosxr_lag_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lag_interfaces_module.rst)|Resource module to configure LAG interfaces. [cisco.iosxr.iosxr_lldp_global](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lldp_global_module.rst)|Resource module to configure LLDP. [cisco.iosxr.iosxr_lldp_interfaces](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst)|Resource module to configure LLDP interfaces. -[cisco.iosxr.iosxr_logging](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_logging_module.rst)|(deprecated, removed after 2023-08-01) Configuration management of system logging services on network devices [cisco.iosxr.iosxr_logging_global](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_logging_global_module.rst)|Resource module to configure logging. [cisco.iosxr.iosxr_netconf](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_netconf_module.rst)|Configures NetConf sub-system service on Cisco IOS-XR devices [cisco.iosxr.iosxr_ntp_global](https://github.com/ansible-collections/cisco.iosxr/blob/main/docs/cisco.iosxr.iosxr_ntp_global_module.rst)|Resource module to configure NTP. diff --git a/changelogs/fragments/remove_deprecated.yaml b/changelogs/fragments/remove_deprecated.yaml new file mode 100644 index 000000000..29600e2d9 --- /dev/null +++ b/changelogs/fragments/remove_deprecated.yaml @@ -0,0 +1,5 @@ +--- +major_changes: + - "This release removes the iosxr_logging deprecated module from this collection in favour of iosxr_logging_global module." +removed_features: + - The iosxr_logging module has been removed with this release. diff --git a/docs/cisco.iosxr.iosxr_logging_module.rst b/docs/cisco.iosxr.iosxr_logging_module.rst deleted file mode 100644 index c75f0dc7d..000000000 --- a/docs/cisco.iosxr.iosxr_logging_module.rst +++ /dev/null @@ -1,538 +0,0 @@ -.. _cisco.iosxr.iosxr_logging_module: - - -************************* -cisco.iosxr.iosxr_logging -************************* - -**(deprecated, removed after 2023-08-01) Configuration management of system logging services on network devices** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - -DEPRECATED ----------- -:Removed in collection release after 2023-08-01 -:Why: Updated module released with more functionality. -:Alternative: iosxr_logging_global - - - -Synopsis --------- -- This module provides declarative management configuration of system logging (syslog) on Cisco IOS XR devices. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- ncclient >= 0.5.3 when using netconf -- lxml >= 4.1.1 when using netconf - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ParameterChoices/DefaultsComments
    -
    - aggregate - -
    - list - / elements=dictionary -
    -
    - -
    List of syslog logging configuration definitions.
    -
    -
    - dest - -
    - string -
    -
    -
      Choices: -
    • host
    • -
    • console
    • -
    • monitor
    • -
    • buffered
    • -
    • file
    • -
    -
    -
    Destination for system logging (syslog) messages.
    -
    -
    - facility - -
    - string -
    -
    - -
    To configure the type of syslog facility in which system logging (syslog) messages are sent to syslog servers Optional config for dest = host
    -
    -
    - hostnameprefix - -
    - string -
    -
    - -
    To append a hostname prefix to system logging (syslog) messages logged to syslog servers. Optional config for dest = host
    -
    -
    - level - -
    - string -
    -
    -
      Choices: -
    • emergencies
    • -
    • alerts
    • -
    • critical
    • -
    • errors
    • -
    • warning
    • -
    • notifications
    • -
    • informational
    • -
    • debugging
    • -
    -
    -
    Specifies the severity level for the logging.
    -

    aliases: severity
    -
    -
    - name - -
    - string -
    -
    - -
    When dest = file name indicates file-name
    -
    When dest = host name indicates the host-name or ip-address of syslog server.
    -
    -
    - path - -
    - string -
    -
    - -
    Set file path.
    -
    -
    - size - -
    - integer -
    -
    - -
    Size of buffer when dest = buffered. The acceptable value is in the range 307200 to 125000000 bytes. Default 307200
    -
    Size of file when dest = file. The acceptable value is in the range 1 to 2097152KB. Default 2 GB
    -
    -
    - state - -
    - string -
    -
    -
      Choices: -
    • present
    • -
    • absent
    • -
    -
    -
    Existential state of the logging configuration on the node.
    -
    -
    - vrf - -
    - string -
    -
    - -
    vrf name when syslog server is configured, dest = host
    -
    -
    - dest - -
    - string -
    -
    -
      Choices: -
    • host
    • -
    • console
    • -
    • monitor
    • -
    • buffered
    • -
    • file
    • -
    -
    -
    Destination for system logging (syslog) messages.
    -
    -
    - facility - -
    - string -
    -
    - Default:
    "local7"
    -
    -
    To configure the type of syslog facility in which system logging (syslog) messages are sent to syslog servers Optional config for dest = host
    -
    -
    - hostnameprefix - -
    - string -
    -
    - -
    To append a hostname prefix to system logging (syslog) messages logged to syslog servers. Optional config for dest = host
    -
    -
    - level - -
    - string -
    -
    -
      Choices: -
    • emergencies
    • -
    • alerts
    • -
    • critical
    • -
    • errors
    • -
    • warning
    • -
    • notifications
    • -
    • informational
    • -
    • debugging ←
    • -
    -
    -
    Specifies the severity level for the logging.
    -

    aliases: severity
    -
    -
    - name - -
    - string -
    -
    - -
    When dest = file name indicates file-name
    -
    When dest = host name indicates the host-name or ip-address of syslog server.
    -
    -
    - path - -
    - string -
    -
    - -
    Set file path.
    -
    -
    - size - -
    - integer -
    -
    - -
    Size of buffer when dest = buffered. The acceptable value is in the range 307200 to 125000000 bytes. Default 307200
    -
    Size of file when dest = file. The acceptable value is in the range 1 to 2097152KB. Default 2 GB
    -
    -
    - state - -
    - string -
    -
    -
      Choices: -
    • present ←
    • -
    • absent
    • -
    -
    -
    Existential state of the logging configuration on the node.
    -
    -
    - vrf - -
    - string -
    -
    - Default:
    "default"
    -
    -
    vrf name when syslog server is configured, dest = host
    -
    -
    - - -Notes ------ - -.. note:: - - This module works with connection ``network_cli`` and ``netconf``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. - - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` - - For more information on using Ansible to manage Cisco devices see the `Cisco integration page `_. - - - -Examples --------- - -.. code-block:: yaml - - - name: configure logging for syslog server host - cisco.iosxr.iosxr_logging: - dest: host - name: 10.10.10.1 - level: critical - state: present - - - name: add hostnameprefix configuration - cisco.iosxr.iosxr_logging: - hostnameprefix: host1 - state: absent - - - name: add facility configuration - cisco.iosxr.iosxr_logging: - facility: local1 - state: present - - - name: configure console logging level - cisco.iosxr.iosxr_logging: - dest: console - level: debugging - state: present - - - name: configure monitor logging level - cisco.iosxr.iosxr_logging: - dest: monitor - level: errors - state: present - - - name: configure syslog to a file - cisco.iosxr.iosxr_logging: - dest: file - name: file_name - size: 2048 - level: errors - state: present - - - name: configure buffered logging with size - cisco.iosxr.iosxr_logging: - dest: buffered - size: 5100000 - - - name: Configure logging using aggregate - cisco.iosxr.iosxr_logging: - aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} - - - name: Delete logging using aggregate - cisco.iosxr.iosxr_logging: - aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} - state: absent - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - -
    KeyReturnedDescription
    -
    - commands - -
    - list -
    -
    always (empty list when no commands to send) -
    The list of configuration mode commands to send to the device
    -
    -
    Sample:
    -
    ['logging 10.10.10.1 vrf default severity debugging', 'logging facility local7', 'logging hostnameprefix host1', 'logging console critical', 'logging buffered 2097153', 'logging buffered warnings', 'logging monitor errors', 'logging file log_file maxfilesize 1024 severity info']
    -
    -
    - xml - -
    - list -
    -
    always (empty list when no xml rpc to send) -
    NetConf rpc xml sent to device with transport netconf
    -
    -
    Sample:
    -
    ['<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <syslog xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-infra-syslog-cfg"> <files> <file xc:operation="delete"> <file-name>file1</file-name> <file-log-attributes> <max-file-size>2097152</max-file-size> <severity>2</severity> </file-log-attributes> </file> </files> </syslog> </config>']
    -
    -

    - - -Status ------- - - -- This module will be removed in a release after 2023-08-01. *[deprecated]* -- For more information see `DEPRECATED`_. - - -Authors -~~~~~~~ - -- Trishna Guha (@trishnaguha) -- Kedar Kekan (@kedarX) diff --git a/meta/runtime.yml b/meta/runtime.yml index eb381faa7..5bf8ab65f 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -30,15 +30,6 @@ plugin_routing: redirect: cisco.iosxr.iosxr_lldp_global lldp_interfaces: redirect: cisco.iosxr.iosxr_lldp_interfaces - logging: - redirect: cisco.iosxr.iosxr_logging - deprecation: - removal_date: "2023-08-01" - warning_text: See the plugin documentation for more details - iosxr_logging: - deprecation: - removal_date: "2023-08-01" - warning_text: See the plugin documentation for more details logging_global: redirect: cisco.iosxr.iosxr_logging_global netconf: diff --git a/plugins/modules/iosxr_logging.py b/plugins/modules/iosxr_logging.py deleted file mode 100644 index abca845df..000000000 --- a/plugins/modules/iosxr_logging.py +++ /dev/null @@ -1,1270 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# (c) 2017, 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 - - -DOCUMENTATION = """ -module: iosxr_logging -author: -- Trishna Guha (@trishnaguha) -- Kedar Kekan (@kedarX) -short_description: (deprecated, removed after 2023-08-01) Configuration management of system logging services on network - devices -description: -- This module provides declarative management configuration of system logging (syslog) - on Cisco IOS XR devices. -version_added: 1.0.0 -deprecated: - alternative: iosxr_logging_global - why: Updated module released with more functionality. - removed_at_date: '2023-08-01' -requirements: -- ncclient >= 0.5.3 when using netconf -- lxml >= 4.1.1 when using netconf -notes: -- This module works with connection C(network_cli) and C(netconf). See L(the IOS-XR - Platform Options,../network/user_guide/platform_iosxr.html). -options: - dest: - description: - - Destination for system logging (syslog) messages. - choices: - - host - - console - - monitor - - buffered - - file - type: str - name: - description: - - When C(dest) = I(file) name indicates file-name - - When C(dest) = I(host) name indicates the host-name or ip-address of syslog - server. - type: str - vrf: - description: - - vrf name when syslog server is configured, C(dest) = C(host) - type: str - default: default - size: - description: - - Size of buffer when C(dest) = C(buffered). The acceptable value is in the range - I(307200 to 125000000 bytes). Default 307200 - - Size of file when C(dest) = C(file). The acceptable value is in the range I(1 - to 2097152)KB. Default 2 GB - type: int - facility: - description: - - To configure the type of syslog facility in which system logging (syslog) messages - are sent to syslog servers Optional config for C(dest) = C(host) - default: local7 - type: str - hostnameprefix: - description: - - To append a hostname prefix to system logging (syslog) messages logged to syslog - servers. Optional config for C(dest) = C(host) - type: str - level: - description: - - Specifies the severity level for the logging. - type: str - default: debugging - aliases: - - severity - choices: ["emergencies", "alerts", "critical", "errors", "warning", "notifications", "informational", "debugging"] - path: - description: - Set file path. - type: str - aggregate: - description: List of syslog logging configuration definitions. - type: list - elements: dict - suboptions: - dest: - description: - - Destination for system logging (syslog) messages. - choices: - - host - - console - - monitor - - buffered - - file - type: str - name: - description: - - When C(dest) = I(file) name indicates file-name - - When C(dest) = I(host) name indicates the host-name or ip-address of syslog - server. - type: str - path: - description: - Set file path. - type: str - vrf: - description: - - vrf name when syslog server is configured, C(dest) = C(host) - type: str - size: - description: - - Size of buffer when C(dest) = C(buffered). The acceptable value is in the range - I(307200 to 125000000 bytes). Default 307200 - - Size of file when C(dest) = C(file). The acceptable value is in the range I(1 - to 2097152)KB. Default 2 GB - type: int - facility: - description: - - To configure the type of syslog facility in which system logging (syslog) messages - are sent to syslog servers Optional config for C(dest) = C(host) - type: str - hostnameprefix: - description: - - To append a hostname prefix to system logging (syslog) messages logged to syslog - servers. Optional config for C(dest) = C(host) - type: str - level: - description: - - Specifies the severity level for the logging. - type: str - aliases: - - severity - choices: ["emergencies", "alerts", "critical", "errors", "warning", "notifications", "informational", "debugging"] - state: - description: - - Existential state of the logging configuration on the node. - choices: - - present - - absent - type: str - state: - description: - - Existential state of the logging configuration on the node. - default: present - choices: - - present - - absent - type: str -extends_documentation_fragment: -- cisco.iosxr.iosxr -""" - -EXAMPLES = """ -- name: configure logging for syslog server host - cisco.iosxr.iosxr_logging: - dest: host - name: 10.10.10.1 - level: critical - state: present - -- name: add hostnameprefix configuration - cisco.iosxr.iosxr_logging: - hostnameprefix: host1 - state: absent - -- name: add facility configuration - cisco.iosxr.iosxr_logging: - facility: local1 - state: present - -- name: configure console logging level - cisco.iosxr.iosxr_logging: - dest: console - level: debugging - state: present - -- name: configure monitor logging level - cisco.iosxr.iosxr_logging: - dest: monitor - level: errors - state: present - -- name: configure syslog to a file - cisco.iosxr.iosxr_logging: - dest: file - name: file_name - size: 2048 - level: errors - state: present - -- name: configure buffered logging with size - cisco.iosxr.iosxr_logging: - dest: buffered - size: 5100000 - -- name: Configure logging using aggregate - cisco.iosxr.iosxr_logging: - aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} - -- name: Delete logging using aggregate - cisco.iosxr.iosxr_logging: - aggregate: - - {dest: console, level: warning} - - {dest: buffered, size: 4800000} - - {dest: file, name: file3, size: 2048} - - {dest: host, name: host3, level: critical} - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always (empty list when no commands to send) - type: list - sample: - - logging 10.10.10.1 vrf default severity debugging - - logging facility local7 - - logging hostnameprefix host1 - - logging console critical - - logging buffered 2097153 - - logging buffered warnings - - logging monitor errors - - logging file log_file maxfilesize 1024 severity info -xml: - description: NetConf rpc xml sent to device with transport C(netconf) - returned: always (empty list when no xml rpc to send) - type: list - sample: - - ' - - - - file1 - - 2097152 - 2 - - - - - ' -""" - -import collections -import re - -from copy import deepcopy - -from ansible.module_utils._text import to_text -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - remove_default_spec, -) - -from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxr import ( - build_xml, - etree_find, - etree_findall, - get_capabilities, - get_config, - get_os_version, - is_cliconf, - is_netconf, - load_config, -) -from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import Version - - -severity_level = { - "emergency": "0", - "alert": "1", - "critical": "2", - "error": "3", - "warning": "4", - "notice": "5", - "info": "6", - "debug": "7", - "disable": "15", -} - -severity_transpose = { - "emergencies": "emergency", - "alerts": "alert", - "critical": "critical", - "errors": "error", - "warning": "warning", - "notifications": "notice", - "informational": "info", - "debugging": "debug", -} - - -class ConfigBase(object): - def __init__(self, module): - self._flag = None - self._module = module - self._result = {"changed": False, "warnings": []} - self._want = list() - self._have = list() - - def validate_size(self, value, type=None): - if value: - if type == "buffer": - if value and not int(307200) <= value <= int(125000000): - self._module.fail_json( - msg="buffer size must be between 307200 and 125000000", - ) - elif type == "file": - if value and not int(1) <= value <= int(2097152): - self._module.fail_json( - msg="file size must be between 1 and 2097152", - ) - return value - - def map_params_to_obj(self, required_if=None): - aggregate = self._module.params.get("aggregate") - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = self._module.params[key] - - d = item.copy() - - if d["dest"] not in ("host", "file"): - d["name"] = None - - if d["dest"] == "buffered": - if d["size"] is not None: - d["size"] = str( - self.validate_size(d["size"], "buffer"), - ) - else: - d["size"] = str(307200) - elif d["dest"] == "file": - if d["size"] is not None: - d["size"] = str(self.validate_size(d["size"], "file")) - else: - d["size"] = str(2097152) - else: - d["size"] = None - - if self._flag == "NC": - d["level"] = severity_transpose[d["level"]] - - self._want.append(d) - - else: - params = self._module.params - if params["dest"] not in ("host", "file"): - params["name"] = None - - if params["dest"] == "buffered": - if params["size"] is not None: - params["size"] = str( - self.validate_size(params["size"], "buffer"), - ) - else: - params["size"] = str(307200) - elif params["dest"] == "file": - if params["size"] is not None: - params["size"] = str( - self.validate_size(params["size"], "file"), - ) - else: - params["size"] = str(2097152) - else: - params["size"] = None - - if self._flag == "NC": - params["level"] = severity_transpose[params["level"]] - - self._want.append( - { - "dest": params["dest"], - "name": params["name"], - "vrf": params["vrf"], - "size": params["size"], - "path": params["path"], - "facility": params["facility"], - "level": params["level"], - "hostnameprefix": params["hostnameprefix"], - "state": params["state"], - }, - ) - - -class CliConfiguration(ConfigBase): - def __init__(self, module): - super(CliConfiguration, self).__init__(module) - self._file_list = set() - self._host_list = set() - - def map_obj_to_commands(self, os_version): - commands = list() - for want_item in self._want: - dest = want_item["dest"] - name = want_item["name"] - size = want_item["size"] - path = want_item["path"] - facility = want_item["facility"] - level = want_item["level"] - vrf = want_item["vrf"] - hostnameprefix = want_item["hostnameprefix"] - state = want_item["state"] - del want_item["state"] - - have_size = None - have_console_level = None - have_monitor_level = None - have_prefix = None - have_facility = None - - for item in self._have: - if item["dest"] == "buffered": - have_size = item["size"] - if item["dest"] == "console": - have_console_level = item["level"] - if item["dest"] == "monitor": - have_monitor_level = item["level"] - if item["dest"] is None and item["hostnameprefix"] is not None: - have_prefix = item["hostnameprefix"] - if ( - item["dest"] is None - and item["hostnameprefix"] is None - and item["facility"] is not None - ): - have_facility = item["facility"] - - if state == "absent": - if dest == "host" and name in self._host_list: - commands.append("no logging {0} vrf {1}".format(name, vrf)) - elif dest == "file" and name in self._file_list: - commands.append("no logging file {0}".format(name)) - elif dest == "console" and have_console_level is not None: - commands.append("no logging {0}".format(dest)) - elif dest == "monitor" and have_monitor_level: - commands.append("no logging {0}".format(dest)) - elif dest == "buffered" and have_size: - commands.append("no logging {0}".format(dest)) - - if dest is None and hostnameprefix is not None and have_prefix == hostnameprefix: - commands.append( - "no logging hostnameprefix {0}".format(hostnameprefix), - ) - if dest is None and facility is not None and have_facility == facility: - commands.append("no logging facility {0}".format(facility)) - - if state == "present": - if dest == "host" and name not in self._host_list: - if level == "errors" or level == "informational": - level = severity_transpose[level] - commands.append( - "logging {0} vrf {1} severity {2}".format( - name, - vrf, - level, - ), - ) - elif dest == "file" and name not in self._file_list: - if level == "errors" or level == "informational": - level = severity_transpose[level] - if os_version and Version(os_version) > Version("7.0"): - commands.append( - "logging file {0} path {1} maxfilesize {2} severity {3}".format( - name, - path, - size, - level, - ), - ) - else: - commands.append( - "logging file {0} maxfilesize {1} severity {2}".format( - name, - size, - level, - ), - ) - elif dest == "buffered" and ( - have_size is None or (have_size is not None and size != have_size) - ): - commands.append("logging buffered {0}".format(size)) - elif dest == "console" and ( - have_console_level is None - or (have_console_level is not None and have_console_level != level) - ): - commands.append("logging console {0}".format(level)) - elif dest == "monitor" and ( - have_monitor_level is None - or (have_monitor_level is not None and have_monitor_level != level) - ): - commands.append("logging monitor {0}".format(level)) - - if ( - dest is None - and hostnameprefix is not None - and ( - have_prefix is None - or (have_prefix is not None and hostnameprefix != have_prefix) - ) - ): - commands.append( - "logging hostnameprefix {0}".format(hostnameprefix), - ) - if dest is None and hostnameprefix is None and facility != have_facility: - commands.append("logging facility {0}".format(facility)) - - self._result["commands"] = commands - if commands: - commit = not self._module.check_mode - diff = load_config(self._module, commands, commit=commit) - if diff: - self._result["diff"] = dict(prepared=diff) - self._result["changed"] = True - - def parse_facility(self, line): - match = re.search(r"logging facility (\S+)", line, re.M) - facility = None - if match: - facility = match.group(1) - - return facility - - def parse_size(self, line, dest): - size = None - - if dest == "buffered": - match = re.search(r"logging buffered (\S+)", line, re.M) - if match: - try: - int_size = int(match.group(1)) - except ValueError: - int_size = None - - if int_size is not None: - if isinstance(int_size, int): - size = str(match.group(1)) - if dest == "file": - match = re.search( - r"logging file (\S+) (path\s\S+\s)?maxfilesize (\S+)", - line, - re.M, - ) - if match: - try: - if "path" in line: - int_size = int(match.group(2)) - else: - int_size = int(match.group(1)) - except ValueError: - int_size = None - - if int_size is not None: - if isinstance(int_size, int): - size = str(int_size) - - return size - - def parse_path(self, line, dest): - path = None - - if dest == "file": - match = re.search(r"logging file (\S+) (path\s\S+\s)", line, re.M) - if match: - try: - path = to_text( - match.group(2), - errors="surrogate_or_strict", - ) - except ValueError: - path = None - - return path - - def parse_hostnameprefix(self, line): - prefix = None - match = re.search(r"logging hostnameprefix (\S+)", line, re.M) - if match: - prefix = match.group(1) - return prefix - - def parse_name(self, line, dest): - name = None - if dest == "file": - match = re.search(r"logging file (\S+)", line, re.M) - if match: - name = match.group(1) - elif dest == "host": - match = re.search(r"logging (\S+)", line, re.M) - if match: - name = match.group(1) - - return name - - def parse_level(self, line, dest): - level_group = ( - "emergencies", - "alerts", - "critical", - "errors", - "warning", - "notifications", - "informational", - "debugging", - ) - - level = None - match = re.search(r"logging {0} (\S+)".format(dest), line, re.M) - if match: - if match.group(1) in level_group: - level = match.group(1) - - return level - - def parse_dest(self, line, group): - dest_group = ("console", "monitor", "buffered", "file") - dest = None - if group in dest_group: - dest = group - elif "vrf" in line: - dest = "host" - - return dest - - def parse_vrf(self, line, dest): - vrf = None - if dest == "host": - match = re.search(r"logging (\S+) vrf (\S+)", line, re.M) - if match: - vrf = match.group(2) - return vrf - - def map_config_to_obj(self): - data = get_config(self._module, config_filter="logging") - lines = data.split("\n") - - for line in lines: - match = re.search(r"logging (\S+)", line, re.M) - if match: - dest = self.parse_dest(line, match.group(1)) - name = self.parse_name(line, dest) - if dest == "host" and name is not None: - self._host_list.add(name) - if dest == "file" and name is not None: - self._file_list.add(name) - - self._have.append( - { - "dest": dest, - "name": name, - "size": self.parse_size(line, dest), - "path": self.parse_path(line, dest), - "facility": self.parse_facility(line), - "level": self.parse_level(line, dest), - "vrf": self.parse_vrf(line, dest), - "hostnameprefix": self.parse_hostnameprefix(line), - }, - ) - - def run(self, os_version): - self.map_params_to_obj() - self.map_config_to_obj() - self.map_obj_to_commands(os_version) - - return self._result - - -class NCConfiguration(ConfigBase): - def __init__(self, module): - super(NCConfiguration, self).__init__(module) - self._flag = "NC" - self._log_file_meta = collections.OrderedDict() - self._log_host_meta = collections.OrderedDict() - self._log_console_meta = collections.OrderedDict() - self._log_monitor_meta = collections.OrderedDict() - self._log_buffered_meta = collections.OrderedDict() - self._log_facility_meta = collections.OrderedDict() - self._log_prefix_meta = collections.OrderedDict() - - def map_obj_to_xml_rpc(self, os_version): - file_attribute_path = "file-log-attributes" - if os_version and Version(os_version) > Version("7.0.0"): - file_attribute_path = "file-specification" - self._log_file_meta.update( - [ - ( - "files", - { - "xpath": "syslog/files", - "tag": True, - "operation": "edit", - }, - ), - ( - "file", - { - "xpath": "syslog/files/file", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:name", - { - "xpath": "syslog/files/file/file-name", - "operation": "edit", - }, - ), - ( - "file-attrib", - { - "xpath": "syslog/files/file/" + file_attribute_path, - "tag": True, - "operation": "edit", - }, - ), - ( - "a:size", - { - "xpath": "syslog/files/file/" + file_attribute_path + "/max-file-size", - "operation": "edit", - }, - ), - ( - "a:level", - { - "xpath": "syslog/files/file/" + file_attribute_path + "/severity", - "operation": "edit", - }, - ), - ( - "a:path", - { - "xpath": "syslog/files/file/" + file_attribute_path + "/path", - "operation": "edit", - }, - ), - ], - ) - else: - self._log_file_meta.update( - [ - ( - "files", - { - "xpath": "syslog/files", - "tag": True, - "operation": "edit", - }, - ), - ( - "file", - { - "xpath": "syslog/files/file", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:name", - { - "xpath": "syslog/files/file/file-name", - "operation": "edit", - }, - ), - ( - "file-attrib", - { - "xpath": "syslog/files/file/" + file_attribute_path, - "tag": True, - "operation": "edit", - }, - ), - ( - "a:size", - { - "xpath": "syslog/files/file/" + file_attribute_path + "/max-file-size", - "operation": "edit", - }, - ), - ( - "a:level", - { - "xpath": "syslog/files/file/" + file_attribute_path + "/severity", - "operation": "edit", - }, - ), - ], - ) - self._log_host_meta.update( - [ - ( - "host-server", - { - "xpath": "syslog/host-server", - "tag": True, - "operation": "edit", - }, - ), - ( - "vrfs", - { - "xpath": "syslog/host-server/vrfs", - "tag": True, - "operation": "edit", - }, - ), - ( - "vrf", - { - "xpath": "syslog/host-server/vrfs/vrf", - "tag": True, - "operation": "edit", - }, - ), - ( - "a:vrf", - { - "xpath": "syslog/host-server/vrfs/vrf/vrf-name", - "operation": "edit", - }, - ), - ( - "ipv4s", - { - "xpath": "syslog/host-server/vrfs/vrf/ipv4s", - "tag": True, - "operation": "edit", - }, - ), - ( - "ipv4", - { - "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:name", - { - "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4/address", - "operation": "edit", - }, - ), - ( - "ipv4-sev", - { - "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4/ipv4-severity-port", - "tag": True, - "operation": "edit", - }, - ), - ( - "a:level", - { - "xpath": "syslog/host-server/vrfs/vrf/ipv4s/ipv4/ipv4-severity-port/severity", - "operation": "edit", - }, - ), - ], - ) - self._log_console_meta.update( - [ - ( - "a:enable-console", - { - "xpath": "syslog/enable-console-logging", - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "console", - { - "xpath": "syslog/console-logging", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:console-level", - { - "xpath": "syslog/console-logging/logging-level", - "operation": "edit", - }, - ), - ], - ) - self._log_monitor_meta.update( - [ - ( - "monitor", - { - "xpath": "syslog/monitor-logging", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:monitor-level", - { - "xpath": "syslog/monitor-logging/logging-level", - "operation": "edit", - }, - ), - ], - ) - self._log_buffered_meta.update( - [ - ( - "buffered", - { - "xpath": "syslog/buffered-logging", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:size", - { - "xpath": "syslog/buffered-logging/buffer-size", - "operation": "edit", - }, - ), - ( - "a:level", - { - "xpath": "syslog/buffered-logging/logging-level", - "operation": "edit", - }, - ), - ], - ) - self._log_facility_meta.update( - [ - ( - "facility", - { - "xpath": "syslog/logging-facilities", - "tag": True, - "operation": "edit", - "attrib": "operation", - }, - ), - ( - "a:facility", - { - "xpath": "syslog/logging-facilities/facility-level", - "operation": "edit", - }, - ), - ], - ) - self._log_prefix_meta.update( - [ - ( - "a:hostnameprefix", - { - "xpath": "syslog/host-name-prefix", - "operation": "edit", - "attrib": "operation", - }, - ), - ], - ) - - state = self._module.params["state"] - - _get_filter = build_xml("syslog", opcode="filter") - running = get_config( - self._module, - source="running", - config_filter=_get_filter, - ) - - file_ele = etree_findall(running, "file") - file_list = list() - if len(file_ele): - for file in file_ele: - file_name = etree_find(file, "file-name") - file_list.append( - file_name.text if file_name is not None else None, - ) - vrf_ele = etree_findall(running, "vrf") - host_list = list() - for vrf in vrf_ele: - host_ele = etree_findall(vrf, "ipv4") - for host in host_ele: - host_name = etree_find(host, "address") - host_list.append( - host_name.text if host_name is not None else None, - ) - - console_ele = etree_find(running, "console-logging") - console_level = ( - etree_find(console_ele, "logging-level") if console_ele is not None else None - ) - have_console = console_level.text if console_level is not None else None - - monitor_ele = etree_find(running, "monitor-logging") - monitor_level = ( - etree_find(monitor_ele, "logging-level") if monitor_ele is not None else None - ) - have_monitor = monitor_level.text if monitor_level is not None else None - - buffered_ele = etree_find(running, "buffered-logging") - buffered_size = ( - etree_find(buffered_ele, "buffer-size") if buffered_ele is not None else None - ) - have_buffered = buffered_size.text if buffered_size is not None else None - - facility_ele = etree_find(running, "logging-facilities") - facility_level = ( - etree_find(facility_ele, "facility-level") if facility_ele is not None else None - ) - have_facility = facility_level.text if facility_level is not None else None - - prefix_ele = etree_find(running, "host-name-prefix") - have_prefix = prefix_ele.text if prefix_ele is not None else None - - file_params = list() - host_params = list() - console_params = dict() - monitor_params = dict() - buffered_params = dict() - facility_params = dict() - prefix_params = dict() - - opcode = None - if state == "absent": - opcode = "delete" - for item in self._want: - if item["dest"] == "file" and item["name"] in file_list: - item["level"] = severity_level[item["level"]] - file_params.append(item) - elif item["dest"] == "host" and item["name"] in host_list: - item["level"] = severity_level[item["level"]] - host_params.append(item) - elif item["dest"] == "console" and have_console: - console_params.update({"console-level": item["level"]}) - elif item["dest"] == "monitor" and have_monitor: - monitor_params.update({"monitor-level": item["level"]}) - elif item["dest"] == "buffered" and have_buffered: - buffered_params["size"] = str(item["size"]) if item["size"] else None - buffered_params["level"] = item["level"] if item["level"] else None - elif ( - item["dest"] is None - and item["hostnameprefix"] is None - and item["facility"] is not None - and have_facility - ): - facility_params.update({"facility": item["facility"]}) - elif item["dest"] is None and item["hostnameprefix"] is not None and have_prefix: - prefix_params.update( - {"hostnameprefix": item["hostnameprefix"]}, - ) - elif state == "present": - opcode = "merge" - for item in self._want: - if item["dest"] == "file": - item["level"] = severity_level[item["level"]] - file_params.append(item) - elif item["dest"] == "host": - item["level"] = severity_level[item["level"]] - host_params.append(item) - elif item["dest"] == "console": - console_params.update({"console-level": item["level"]}) - elif item["dest"] == "monitor": - monitor_params.update({"monitor-level": item["level"]}) - elif item["dest"] == "buffered": - buffered_params["size"] = str(item["size"]) if item["size"] else None - buffered_params["level"] = item["level"] if item["level"] else None - elif ( - item["dest"] is None - and item["hostnameprefix"] is None - and item["facility"] is not None - ): - facility_params.update({"facility": item["facility"]}) - elif item["dest"] is None and item["hostnameprefix"] is not None: - prefix_params.update( - {"hostnameprefix": item["hostnameprefix"]}, - ) - - self._result["xml"] = [] - _edit_filter_list = list() - if opcode: - if len(file_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_file_meta, - params=file_params, - opcode=opcode, - ), - ) - if len(host_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_host_meta, - params=host_params, - opcode=opcode, - ), - ) - if len(console_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_console_meta, - params=console_params, - opcode=opcode, - ), - ) - if len(monitor_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_monitor_meta, - params=monitor_params, - opcode=opcode, - ), - ) - if len(buffered_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_buffered_meta, - params=buffered_params, - opcode=opcode, - ), - ) - if len(facility_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_facility_meta, - params=facility_params, - opcode=opcode, - ), - ) - if len(prefix_params): - _edit_filter_list.append( - build_xml( - "syslog", - xmap=self._log_prefix_meta, - params=prefix_params, - opcode=opcode, - ), - ) - - diff = None - if len(_edit_filter_list): - commit = not self._module.check_mode - diff = load_config( - self._module, - _edit_filter_list, - commit=commit, - running=running, - nc_get_filter=_get_filter, - ) - if diff: - if self._module._diff: - self._result["diff"] = dict(prepared=diff) - - self._result["xml"] = _edit_filter_list - self._result["changed"] = True - - def run(self, os_version): - self.map_params_to_obj() - self.map_obj_to_xml_rpc(os_version) - - return self._result - - -def main(): - """main entry point for module execution""" - element_spec = dict( - dest=dict( - type="str", - choices=["host", "console", "monitor", "buffered", "file"], - ), - name=dict(type="str"), - size=dict(type="int"), - path=dict(type="str"), - vrf=dict(type="str", default="default"), - facility=dict(type="str", default="local7"), - hostnameprefix=dict(type="str"), - level=dict( - type="str", - default="debugging", - aliases=["severity"], - choices=[ - "emergencies", - "alerts", - "critical", - "errors", - "warning", - "notifications", - "informational", - "debugging", - ], - ), - state=dict(default="present", choices=["present", "absent"]), - ) - - aggregate_spec = deepcopy(element_spec) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - - mutually_exclusive = [("dest", "facility", "hostnameprefix")] - - required_if = [ - ("dest", "host", ["name"]), - ("dest", "file", ["name"]), - ("dest", "buffered", ["size"]), - ("dest", "console", ["level"]), - ("dest", "monitor", ["level"]), - ] - - argument_spec = dict( - aggregate=dict( - type="list", - elements="dict", - options=aggregate_spec, - mutually_exclusive=mutually_exclusive, - required_if=required_if, - ), - ) - - argument_spec.update(element_spec) - - module = AnsibleModule( - argument_spec=argument_spec, - mutually_exclusive=mutually_exclusive, - required_if=required_if, - supports_check_mode=True, - ) - config_object = None - if is_cliconf(module): - config_object = CliConfiguration(module) - os_version = get_os_version(module) - elif is_netconf(module): - config_object = NCConfiguration(module) - os_version = get_capabilities(module).get("device_info").get("network_os_version") - - if config_object: - result = config_object.run(os_version) - module.exit_json(**result) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/iosxr_logging/defaults/main.yaml b/tests/integration/targets/iosxr_logging/defaults/main.yaml deleted file mode 100644 index 9ef5ba516..000000000 --- a/tests/integration/targets/iosxr_logging/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/tests/integration/targets/iosxr_logging/meta/main.yaml b/tests/integration/targets/iosxr_logging/meta/main.yaml deleted file mode 100644 index be631e5d8..000000000 --- a/tests/integration/targets/iosxr_logging/meta/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - prepare_iosxr_tests diff --git a/tests/integration/targets/iosxr_logging/tasks/cli.yaml b/tests/integration/targets/iosxr_logging/tasks/cli.yaml deleted file mode 100644 index 88e4708f8..000000000 --- a/tests/integration/targets/iosxr_logging/tasks/cli.yaml +++ /dev/null @@ -1,24 +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 case (connection=ansible.netcommon.network_cli) - ansible.builtin.include_tasks: "{{ test_case_to_run }}" - vars: - ansible_connection: ansible.netcommon.network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: Reset connection - ansible.builtin.meta: reset_connection diff --git a/tests/integration/targets/iosxr_logging/tasks/main.yaml b/tests/integration/targets/iosxr_logging/tasks/main.yaml deleted file mode 100644 index 419a6cde6..000000000 --- a/tests/integration/targets/iosxr_logging/tasks/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Include the CLI tasks - ansible.builtin.include_tasks: cli.yaml - -- name: Include the netconf tasks - ansible.builtin.include_tasks: netconf.yaml diff --git a/tests/integration/targets/iosxr_logging/tasks/netconf.yaml b/tests/integration/targets/iosxr_logging/tasks/netconf.yaml deleted file mode 100644 index 26f9ab49a..000000000 --- a/tests/integration/targets/iosxr_logging/tasks/netconf.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Collect all CLI test cases - ansible.builtin.find: - paths: "{{ role_path }}/tests/netconf" - 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 case (connection=ansible.netcommon.netconf) - ansible.builtin.include_tasks: "{{ test_case_to_run }}" - vars: - ansible_connection: ansible.netcommon.netconf - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: - - netconf - -- name: Reset connection - ansible.builtin.meta: reset_connection diff --git a/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml b/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml deleted file mode 100644 index 02280f4a0..000000000 --- a/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml +++ /dev/null @@ -1,140 +0,0 @@ ---- -- name: Remove host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - -- name: Remove console logging - register: result - cisco.iosxr.iosxr_logging: - dest: console - state: absent - -- name: Remove buffered logging - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 2097155 - state: absent - -- name: Set up syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id001 - dest: host - name: 172.16.0.1 - level: errors - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging 172.16.0.1 vrf default severity error" in result.commands' - -- name: Set up syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id001 -- ansible.builtin.assert: &id003 - that: - - result.changed == false - -- name: Delete/disable syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id002 - dest: host - name: 172.16.0.1 - state: absent - -- ansible.builtin.assert: - that: - - result.changed == true - - '"no logging 172.16.0.1 vrf default" in result.commands' - -- name: Delete/disable syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id002 -- ansible.builtin.assert: *id003 -- name: Add console logging with level warning - register: result - cisco.iosxr.iosxr_logging: &id004 - dest: console - level: warning - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging console warning" in result.commands' - -- name: Console logging with level warning (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id004 -- ansible.builtin.assert: *id003 -- name: Remove console logging with level warning - register: result - cisco.iosxr.iosxr_logging: - dest: console - level: warning - state: absent - -- ansible.builtin.assert: &id006 - that: - - result.changed == true - -- name: Configure buffered logging size - register: result - cisco.iosxr.iosxr_logging: &id005 - dest: buffered - size: 4800000 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging buffered 4800000" in result.commands' - -- name: Configure buffered logging size (idempotence) - register: result - cisco.iosxr.iosxr_logging: *id005 -- ansible.builtin.assert: *id003 -- name: Remove buffered logging size - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 4800000 - state: absent - -- ansible.builtin.assert: *id006 -- name: Change logging parameters using aggregate - register: result - cisco.iosxr.iosxr_logging: - aggregate: - - dest: console - level: notifications - - - dest: buffered - size: 4700000 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging buffered 4700000" in result.commands' - - '"logging console notifications" in result.commands' - -- name: Remove logging parameters using aggregate - register: result - cisco.iosxr.iosxr_logging: - aggregate: - - dest: console - level: notifications - - - dest: buffered - size: 4700000 - state: absent - -- ansible.builtin.assert: - that: - - result.changed == true - - '"no logging console" in result.commands' - - '"no logging buffered" in result.commands' diff --git a/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml b/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml deleted file mode 100644 index 2bd05e511..000000000 --- a/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml +++ /dev/null @@ -1,208 +0,0 @@ ---- -- name: Remove host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - -- name: Remove console logging - register: result - cisco.iosxr.iosxr_logging: - dest: console - level: warning - state: absent - -- name: Remove buffered logging - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 2097155 - state: absent - -- name: Set up syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id001 - dest: host - name: 172.16.0.1 - level: errors - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"172.16.0.1" in result.xml[0]' - -- name: Set up syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id001 -- ansible.builtin.assert: &id003 - that: - - result.changed == false - -- name: Delete/disable syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id002 - dest: host - name: 172.16.0.1 - state: absent - -- ansible.builtin.assert: - that: - - result.changed == true - - '"172.16.0.1" in result.xml[0]' - - '"delete" in result.xml[0]' - -- name: Delete/disable syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id002 -- ansible.builtin.assert: *id003 -- name: Add console logging with level warning - register: result - cisco.iosxr.iosxr_logging: &id004 - dest: console - level: warning - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"console" in result.xml[0]' - - '"warning" in result.xml[0]' - -- name: Console logging with level warning (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id004 -- ansible.builtin.assert: *id003 -- name: Remove console logging with level warning - register: result - cisco.iosxr.iosxr_logging: - dest: console - level: warning - state: absent - -- ansible.builtin.assert: &id006 - that: - - result.changed == true - -- name: Configure buffered logging size - register: result - cisco.iosxr.iosxr_logging: &id005 - dest: buffered - size: 4800000 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"buffered" in result.xml[0]' - - '"4800000" in result.xml[0]' - -- name: Configure buffered logging size (idempotence) - register: result - cisco.iosxr.iosxr_logging: *id005 -- ansible.builtin.assert: *id003 -- name: Remove buffered logging size - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 4800000 - state: absent - -- ansible.builtin.assert: *id006 -- name: Change logging parameters using aggregate - register: result - cisco.iosxr.iosxr_logging: - aggregate: - - dest: console - level: notifications - - - dest: buffered - size: 4700000 - - - dest: monitor - level: alerts - - - dest: host - name: 10.10.10.1 - level: errors - - - dest: host - name: 10.10.10.2 - - - dest: file - name: file1 - size: 2048 - level: critical - path: /file1 - - - dest: file - name: file2 - size: 2048 - path: /file2 - - - facility: local3 - - - hostnameprefix: host3 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"file1" in result.xml[0]' - - '"file2" in result.xml[0]' - - '"10.10.10.1" in result.xml[1]' - - '"10.10.10.2" in result.xml[1]' - - '"notice" in result.xml[2]' - - '"alert" in result.xml[3]' - - '"4700000" in result.xml[4]' - - '"debug" in result.xml[4]' - - '"local3" in result.xml[5]' - - '"host3" in result.xml[6]' - -- name: Remove logging parameters using aggregate - register: result - cisco.iosxr.iosxr_logging: - aggregate: - - dest: console - level: notifications - - - dest: buffered - size: 4700000 - - - dest: monitor - level: alerts - - - dest: host - name: 10.10.10.1 - level: errors - - - dest: host - name: 10.10.10.2 - - - dest: file - name: file1 - size: 2048 - level: critical - - - dest: file - name: file2 - size: 2048 - - - facility: local3 - - - hostnameprefix: host3 - state: absent - -- ansible.builtin.assert: - that: - - result.changed == true - - '"file1" in result.xml[0]' - - '"file2" in result.xml[0]' - - '"10.10.10.1" in result.xml[1]' - - '"10.10.10.2" in result.xml[1]' - - '"notice" in result.xml[2]' - - '"alert" in result.xml[3]' - - '"4700000" in result.xml[4]' - - '"debug" in result.xml[4]' - - '"local3" in result.xml[5]' - - '"host3" in result.xml[6]' From 340fbc83c0463ab4da8d46d3d2ef5c2f511e06a6 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:44:11 +0530 Subject: [PATCH 25/27] Prepare for major release 8.0.0 (#481) * prepare for major release * delete the fragments * changelog.rst file * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.rst | 13 +++++++++++++ changelogs/changelog.yaml | 17 ++++++++++++----- changelogs/fragments/remove_deprecated.yaml | 5 ----- changelogs/fragments/trivial_tests_updates.yaml | 4 ---- galaxy.yml | 2 +- 5 files changed, 26 insertions(+), 15 deletions(-) delete mode 100644 changelogs/fragments/remove_deprecated.yaml delete mode 100644 changelogs/fragments/trivial_tests_updates.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 81065138c..70c2fc3b4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,19 @@ Cisco Iosxr Collection Release Notes .. contents:: Topics +v8.0.0 +====== + +Major Changes +------------- + +- This release removes previously deprecated module and attributes from this collection. Please refer to the **Removed Features** section for details. + +Removed Features (previously deprecated) +---------------------------------------- + +- Remove deprecated iosxr_logging module which is replaced with iosxr_logging_global resource module. + v7.2.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index ab7c68a9a..2b66f7eca 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -52,11 +52,6 @@ releases: - description: LLDP interfaces resource module name: iosxr_lldp_interfaces namespace: "" - - description: - Configuration management of system logging services on network - devices - name: iosxr_logging - namespace: "" - description: Configures NetConf sub-system service on Cisco IOS-XR devices name: iosxr_netconf namespace: "" @@ -720,3 +715,15 @@ releases: - fix_bgp_template.yaml - fix_nightly.yaml release_date: "2024-03-01" + 8.0.0: + changes: + major_changes: + - This release removes previously deprecated module and attributes from this + collection. Please refer to the **Removed Features** section for details. + removed_features: + - Remove deprecated iosxr_logging module which is replaced with iosxr_logging_global + resource module. + fragments: + - remove_deprecated.yaml + - trivial_tests_updates.yaml + release_date: "2024-03-27" diff --git a/changelogs/fragments/remove_deprecated.yaml b/changelogs/fragments/remove_deprecated.yaml deleted file mode 100644 index 29600e2d9..000000000 --- a/changelogs/fragments/remove_deprecated.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -major_changes: - - "This release removes the iosxr_logging deprecated module from this collection in favour of iosxr_logging_global module." -removed_features: - - The iosxr_logging module has been removed with this release. diff --git a/changelogs/fragments/trivial_tests_updates.yaml b/changelogs/fragments/trivial_tests_updates.yaml deleted file mode 100644 index 6f9f7d906..000000000 --- a/changelogs/fragments/trivial_tests_updates.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -trivial: - - remove compat files as we stopped testing against python 2.7. - - update direct imports for patch and MagicMock from unittest. diff --git a/galaxy.yml b/galaxy.yml index 194566307..acaab18e6 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -13,4 +13,4 @@ issues: https://github.com/ansible-collections/cisco.iosxr/issues tags: [cisco, iosxr, networking, netconf] # NOTE(pabelanger): We create an empty version key to keep ansible-galaxy # happy. We dynamically inject version info based on git information. -version: "7.2.0" +version: "8.0.0" From f53789bb67e348505dc7fbce37f26d500901c5c7 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Thu, 4 Apr 2024 11:59:55 +0530 Subject: [PATCH 26/27] drop tox-linters and add new build-import workflow (#484) * drop zuul * add ignore-2.18.txt * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .flake8 | 67 +++++++++++++++++++ .github/workflows/tests.yml | 3 + .pre-commit-config.yaml | 12 ++-- .zuul.yaml | 8 --- changelogs/fragments/add_2.18.yaml | 3 + tests/sanity/ignore-2.18.txt | 4 ++ .../modules/network/iosxr/test_iosxr_ping.py | 2 +- tox-ansible.ini | 9 +-- tox.ini | 31 --------- 9 files changed, 87 insertions(+), 52 deletions(-) create mode 100644 .flake8 delete mode 100644 .zuul.yaml create mode 100644 changelogs/fragments/add_2.18.yaml create mode 100644 tests/sanity/ignore-2.18.txt delete mode 100644 tox.ini diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..9a7fc1251 --- /dev/null +++ b/.flake8 @@ -0,0 +1,67 @@ +[flake8] + +builtins = _ + +# Print the total number of errors: +count = true + +# Don't even try to analyze these: +extend-exclude = + # No need to traverse egg info dir + *.egg-info, + # tool cache dirs + *_cache + # project env vars + .env, + # GitHub configs + .github, + # Cache files of MyPy + .mypy_cache, + # Cache files of pytest + .pytest_cache, + # Temp dir of pytest-testmon + .tmontmp, + # Occasional virtualenv dir + .venv + # VS Code + .vscode, + # Temporary build dir + build, + # This contains sdists and wheels of ansible-navigator that we don't want to check + dist, + # Metadata of `pip wheel` cmd is autogenerated + pip-wheel-metadata, + # adjacent venv + venv + # ansible won't let me + __init__.py + +# IMPORTANT: avoid using ignore option, always use extend-ignore instead +# Completely and unconditionally ignore the following errors: +extend-ignore = + F841, + # line-length + E501, + # module level import not at top of file + E402 + +# Accessibility/large fonts and PEP8 unfriendly: +max-line-length = 120 + +# Allow certain violations in certain files: +# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future +per-file-ignores = + # The following ignores have been researched and should be considered permanent + # each should be preceeded with an explanation of each of the error codes + # If other ignores are added for a specific file in the section following this, + # these will need to be added to that line as well. + + + # S101: Allow the use of assert within the tests directory, since tests require it. + tests/**.py: S101 + + # The following were present during the initial implementation. + # They are expected to be fixed and unignored over time. + +# Count the number of occurrences of each error/warning code and print a report: +statistics = true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5c01a71c7..64409a9a4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,6 +16,8 @@ jobs: changelog: uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main if: github.event_name == 'pull_request' + build-import: + uses: ansible/ansible-content-actions/.github/workflows/build_import.yaml@main ansible-lint: uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main sanity: @@ -32,6 +34,7 @@ jobs: if: ${{ always() }} needs: - changelog + - build-import - sanity - unit-galaxy - ansible-lint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d034d8da3..90167726d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,6 @@ repos: - repo: https://github.com/ansible-network/collection_prep rev: 1.1.1 hooks: - # - id: autoversion # removed as being handled by GHA push and release drafter - id: update-docs - repo: https://github.com/pre-commit/pre-commit-hooks @@ -23,7 +22,7 @@ repos: - id: add-trailing-comma - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.3" + rev: "v4.0.0-alpha.8" hooks: - id: prettier entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec" @@ -34,13 +33,18 @@ repos: - prettier-plugin-toml - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: Sort import statements using isort args: ["--filter-files"] - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.12.1 hooks: - id: black + + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 diff --git a/.zuul.yaml b/.zuul.yaml deleted file mode 100644 index a892ec722..000000000 --- a/.zuul.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- project: - check: - jobs: - - ansible-tox-linters - gate: - jobs: - - ansible-tox-linters diff --git a/changelogs/fragments/add_2.18.yaml b/changelogs/fragments/add_2.18.yaml new file mode 100644 index 000000000..0aaf1f750 --- /dev/null +++ b/changelogs/fragments/add_2.18.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Add ignore-2.18.txt. diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt new file mode 100644 index 000000000..6d49e3dcb --- /dev/null +++ b/tests/sanity/ignore-2.18.txt @@ -0,0 +1,4 @@ +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/tests/unit/modules/network/iosxr/test_iosxr_ping.py b/tests/unit/modules/network/iosxr/test_iosxr_ping.py index b5701c655..87ffc4f13 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_ping.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_ping.py @@ -135,7 +135,7 @@ def test_iosxr_ping_state_absent_pass(self): } self.assertEqual(result, mock_res) - def test_iosxr_ping_state_absent_pass(self): + def test_iosxr_ping_state_absent_pass_1(self): self.execute_show_command.return_value = dedent( """\ Type escape sequence to abort. diff --git a/tox-ansible.ini b/tox-ansible.ini index 5e1f4b36a..b49a359f9 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -1,10 +1,3 @@ [ansible] -skip = - py3.7 - py3.8 - 2.9 - 2.10 - 2.11 - 2.12 - 2.13 +skip = "" diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 7dbe41e8f..000000000 --- a/tox.ini +++ /dev/null @@ -1,31 +0,0 @@ -[tox] -minversion = 1.4.2 -envlist = linters -skipsdist = True - -[testenv] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -[testenv:black] -install_command = pip install {opts} {packages} -commands = - black -v {toxinidir} - -[testenv:linters] -install_command = pip install {opts} {packages} -commands = - black -v --diff --check {toxinidir} - flake8 {posargs} - -[testenv:venv] -commands = {posargs} - -[flake8] -# E123, E125 skipped as they are invalid PEP-8. - -show-source = True -ignore = E123,E125,E203,E402,E501,E741,F401,F811,F841,W503 -max-line-length = 160 -builtins = _ -exclude = .git,.tox From 1bba67a670274875550a2a1de46c00014620f4a5 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle <72685035+Ruchip16@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:30:06 +0530 Subject: [PATCH 27/27] Remove tests related to iosxr_logging (#483) * remove tests related to iosxr_logging * add changelog * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- changelogs/fragments/remove_tests.yaml | 3 +++ .../tests/netconf/common_netconf.yaml | 20 ------------------- 2 files changed, 3 insertions(+), 20 deletions(-) create mode 100644 changelogs/fragments/remove_tests.yaml diff --git a/changelogs/fragments/remove_tests.yaml b/changelogs/fragments/remove_tests.yaml new file mode 100644 index 000000000..6e0e85990 --- /dev/null +++ b/changelogs/fragments/remove_tests.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Remove tests related to iosxr_logging deprecated module. diff --git a/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml b/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml index 2ab0957ae..5f08fd677 100644 --- a/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml +++ b/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml @@ -23,24 +23,4 @@ - "'this is my login banner' in result.xml" - "'that has a multiline' in result.xml" -# hit etree_findall() -- name: Remove host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - -- name: Set up syslog host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - level: errors - state: present - register: result - -- ansible.builtin.assert: - that: - - "result.changed == true" - - '"172.16.0.1" in result.xml[0]' - - ansible.builtin.debug: msg="END iosxr netconf/common_netconf.yaml on connection={{ ansible_connection }}"