From 57cde8f281269d2ff1bc21e796dd6734b1bcbe90 Mon Sep 17 00:00:00 2001 From: Kerry Meyer Date: Tue, 17 Sep 2024 14:46:27 -0500 Subject: [PATCH] 2.5.1 bug fixes (#450) * Enable system auditd and ip loadshare hash downward compatibility (#441) * Enable system auditd and ip loadshare hash downward compatibility. * Add a fragment file. * Add mock handling for edit_config_catch * Fix sanity errors. * Fix mistakes in the fragment file. * Modify the fix to operation on individual requests in the enterprise_sonic httpapi plugin. * Enable conditional suppression of GET exceptions. * Fix handling for an empty GET response. * Fix an indentation in the PoE facts file and fix global PoE empty configuration handling. * Update regex expression in edit_config method (#443) * Update regex expression in edit_config method * Change fragment to bugfix * Update 443-update-regex-edit-config.yaml * Add import of the Ansible ConnectionError exception class for all files where it is used. (#445) * Add import of the Ansible ConnectionError exception class for all files where it is used. * Add a fragment file. * Fix broken module documentation links in the README.md file (#446) * In the enterprise_sonic README.md file, use the new Galaxy module documentation site for all links. * Add a changelog fragment for this PR. * Fix incorrect global regex results. * Change the fragment designation to "trivial" to match changing the PR type to "documentation". * Delete changed, redundant fragment file. --------- Co-authored-by: stalabi1 <54641848+stalabi1@users.noreply.github.com> --- README.md | 128 +++++++++--------- ...441-system-downward-compatibility-fix.yaml | 3 + .../443-update-regex-edit-config.yaml | 2 + .../445-ConnectionError-add-imports.yaml | 3 + .../446-README-documentation-links-fix.yaml | 3 + plugins/httpapi/sonic.py | 9 +- .../network/sonic/config/bfd/bfd.py | 1 + .../network/sonic/config/copp/copp.py | 1 + .../config/dhcp_snooping/dhcp_snooping.py | 1 + .../network/sonic/config/mac/mac.py | 1 + .../sonic/config/ospf_area/ospf_area.py | 1 + .../network/sonic/config/pki/pki.py | 1 + .../network/sonic/config/poe/poe.py | 1 + .../sonic/config/prefix_lists/prefix_lists.py | 1 + .../sonic/config/qos_buffer/qos_buffer.py | 1 + .../config/qos_interfaces/qos_interfaces.py | 1 + .../network/sonic/config/qos_maps/qos_maps.py | 1 + .../network/sonic/config/qos_pfc/qos_pfc.py | 1 + .../config/qos_scheduler/qos_scheduler.py | 1 + .../network/sonic/config/qos_wred/qos_wred.py | 1 + .../network/sonic/config/roce/roce.py | 1 + .../sonic/config/route_maps/route_maps.py | 1 + .../network/sonic/config/sflow/sflow.py | 1 + .../config/static_routes/static_routes.py | 1 + .../network/sonic/facts/bfd/bfd.py | 1 + .../network/sonic/facts/copp/copp.py | 1 + .../network/sonic/facts/mac/mac.py | 1 + .../sonic/facts/mgmt_servers/mgmt_servers.py | 1 + .../sonic/facts/ospf_area/ospf_area.py | 1 + .../network/sonic/facts/pki/pki.py | 1 + .../network/sonic/facts/poe/poe.py | 23 ++-- .../sonic/facts/prefix_lists/prefix_lists.py | 1 + .../facts/qos_interfaces/qos_interfaces.py | 1 + .../network/sonic/facts/qos_maps/qos_maps.py | 1 + .../network/sonic/facts/qos_pfc/qos_pfc.py | 1 + .../facts/qos_scheduler/qos_scheduler.py | 1 + .../network/sonic/facts/qos_wred/qos_wred.py | 1 + .../network/sonic/facts/roce/roce.py | 1 + .../sonic/facts/route_maps/route_maps.py | 1 + .../network/sonic/facts/sflow/sflow.py | 23 ++-- .../facts/static_routes/static_routes.py | 1 + .../network/sonic/facts/stp/stp.py | 1 + .../network/sonic/facts/system/system.py | 3 + .../network/sonic/facts/vrfs/vrfs.py | 7 +- .../network/sonic/facts/vxlans/vxlans.py | 1 + plugins/module_utils/network/sonic/sonic.py | 10 +- .../network/sonic/utils/interfaces_util.py | 1 + plugins/modules/sonic_api.py | 2 +- .../roles/sonic_system/defaults/main.yml | 15 +- 49 files changed, 165 insertions(+), 102 deletions(-) create mode 100644 changelogs/fragments/441-system-downward-compatibility-fix.yaml create mode 100644 changelogs/fragments/443-update-regex-edit-config.yaml create mode 100644 changelogs/fragments/445-ConnectionError-add-imports.yaml create mode 100644 changelogs/fragments/446-README-documentation-links-fix.yaml diff --git a/README.md b/README.md index 01bdda0f0..a9eb2a8e0 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ Collection core modules ------------------------ Name | Description | Connection type --- | --- | --- -[**sonic_command**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_command_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-command-module)|Run commands through the Management Framework CLI|network_cli -[**sonic_config**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_config_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-config-module)|Manage configuration through the Management Framework CLI|network_cli -[**sonic_api**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_api_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-api-module)|Perform REST operations through the Management Framework REST API|httpapi +[**sonic_command**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_command/)|Run commands through the Management Framework CLI|network_cli +[**sonic_config**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_config)|Manage configuration through the Management Framework CLI|network_cli +[**sonic_api**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_api)|Perform REST operations through the Management Framework REST API|httpapi Collection network resource modules ----------------------------------- @@ -35,67 +35,67 @@ Listed are the SONiC Ansible network resource modules which need ***httpapi*** a Name | Description --- | --- -[**sonic_aaa**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_aaa_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-aaa-module)| Manage AAA and its parameters -[**sonic_acl_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_acl_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-acl-interfaces-module)| Manage access control list (ACL) to interface binding -[**sonic_bfd**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bfd_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bfd-module)| Manage BFD configuration -[**sonic_bgp**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-module)| Manage global BGP and its parameters -[**sonic_bgp_af**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_af_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-af-module)| Manage global BGP address-family and its parameters -[**sonic_bgp_as_paths**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_as_paths_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-as-paths-module)| Manage BGP autonomous system path (or as-path-list) and its parameters -[**sonic_bgp_communities**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_communities_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-communities-module)| Manage BGP community and its parameters -[**sonic_bgp_ext_communities**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_ext_communities_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-ext-communities-module)| Manage BGP extended community-list and its parameters -[**sonic_bgp_neighbors**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_neighbors_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-neighbors-module)| Manage a BGP neighbor and its parameters -[**sonic_bgp_neighbors_af**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_neighbors_af_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-bgp-neighbors-af-module)| Manage the BGP neighbor address-family and its parameters -[**sonic_copp**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_copp_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-copp-module)| Manage CoPP configuration -[**sonic_dhcp_relay**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_dhcp_relay_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-dhcp-relay-module)| Manage DHCP and DHCPv6 relay configurations -[**sonic_dhcp_snooping**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_dhcp_snooping_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-dhcp-snooping-module)| Manage DHCP Snooping -[**sonic_fips**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_fips_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-fips-module)| Manage FIPS configurations -[**sonic_image_management**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_image_management_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-image-management-module)| Manage installation of Enterprise SONiC image, software patch and firmware updater. -[**sonic_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-interfaces-module)| Configure Interface attributes -[**sonic_ip_neighbor**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_sonic_ip_neighbor_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-sonic-ip-neighbor-module)| Manage IP neighbor global configuration -[**sonic_l2_acls**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_l2_acls_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-sonic-l2-acls-module)| Manage Layer 2 access control lists (ACL) configurations -[**sonic_l2_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_l2_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-l2-interfaces-module)| Configure interface-to-VLAN association -[**sonic_l3_acls**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_l3_acls_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-sonic-l3-acls-module)| Manage Layer 3 access control lists (ACL) configurations -[**sonic_l3_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_l3_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-l3-interfaces-module)| Configure the IPv4 and IPv6 parameters on Interfaces -[**sonic_lag_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_lag_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-lag-interfaces-module)| Manage link aggregation group (LAG) interface parameters -[**sonic_ldap**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_ldap_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-ldap-module)| Configure global LDAP server settings -[**sonic_lldp_global**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_sonic_lldp_global_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-sonic-lldp-global-module)| Manage Global LLDP configurations -[**sonic_lldp_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_sonic_lldp_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-sonic-lldp-interfaces-module)| Manage interface LLDP configurations -[**sonic_logging**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_logging_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-logging-module)| Manage logging configuration -[**sonic_login_lockout**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_login_lockout_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-login-lockout-module)| Manage Global Login Lockout configuration -[**sonic_mac**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_mac_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-mac-module)| Manage MAC configuration -[**sonic_mclag**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_mclag_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-mclag-module)| Manage multi chassis link aggregation groups domain (MCLAG) and its parameters -[**sonic_mgmt_servers**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_mgmt_servers_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-mgmt-servers-module)| Manage management servers configuration -[**sonic_ntp**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_ntp_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-ntp-module)| Manage NTP configuration -[**sonic_ospf_area**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_ospf_area_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-ospf-area-module)| Configure OSPF area setting -[**sonic_ospfv2**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_ospfv2_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-ospfv2-module)| Configure global OSPFv2 protocol settings -[**sonic_ospfv2_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_ospfv2_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-ospfv2-interfaces-module)| Configure OSPFv2 interface mode protocol settings -[**sonic_pim_global**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_pim_global_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-pim-global-module)| Manage global PIM configuration -[**sonic_pim_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_pim_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-pim-interfaces-module)| Manage interface-specific PIM configurations -[**sonic_pki**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_pki_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-pki-module)| Manages PKI attributes -[**sonic_poe**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_poe_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-poe-module)| Manage Power over Ethernet PoE configuration -[**sonic_port_breakout**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_port_breakout_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-port-breakout-module)| Configure port breakout settings on physical interfaces -[**sonic_port_group**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_port_group_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-port-group-module)| Manage port group configuration -[**sonic_prefix_lists**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_prefix_lists_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-prefix-lists-module)| Manage prefix list configuration -[**sonic_qos_buffer**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_qos_buffer_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-qos-buffer-module)| Manage QoS buffer configuration -[**sonic_qos_interfaces**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_qos_interfaces_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-qos_interfaces-module)| Manage QoS interfaces configuration -[**sonic_qos_maps**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_qos_maps_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-qos_maps-module)| Manage QoS maps configuration -[**sonic_qos_pfc**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_qos_pfc_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-qos-pfc-module)| Manage QoS PFC configuration -[**sonic_qos_scheduler**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_qos_scheduler_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-qos-scheduler-module)| Manage QoS scheduler configuration -[**sonic_qos_wred**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_qos_wred_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-qos-scheduler-module)| Manage QoS WRED profiles configuration -[**sonic_radius_server**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_radius_server_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-radius-server-module)| Manage RADIUS server and its parameters -[**sonic_roce**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_roce_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-roce-module)| Manage RoCE QoS configuration -[**sonic_route_maps**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_route_maps_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-route-maps-module)| Manage route map configuration -[**sonic_sflow**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_sflow_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-sflow-module)| Manage sflow configuration settings -[**sonic_static_routes**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_static_routes_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-static-routes-module)| Manage static routes configuration -[**sonic_stp**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_stp_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-stp-module)| Manage STP configuration -[**sonic_system**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_system_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-system-module)| Configure system parameters -[**sonic_tacacs_server**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_tacacs_server_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-tacacs-server-module)| Manage TACACS server and its parameters -[**sonic_users**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_users_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-users-module)| Manage users and its parameters -[**sonic_vlan_mapping**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_vlan_mapping_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-vlan-mapping-module)| Configure vlan mappings -[**sonic_vlans**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_vlans_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-vlans-module)| Manage VLAN and its parameters -[**sonic_vrfs**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_vrfs_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-vrfs-module)| Manage VRFs and associate VRFs to interfaces -[**sonic_vrrp**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_vrrp_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-vrrp-module)| Manage VRRP protocol configuration settings -[**sonic_vxlans**](https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_vxlans_module.html#ansible-collections-dellemc-enterprise-sonic-sonic-vxlans-module)| Manage VxLAN EVPN and its parameters +[**sonic_aaa**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_aaa)| Manage AAA and its parameters +[**sonic_acl_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_acl_interfaces)| Manage access control list (ACL) to interface binding +[**sonic_bfd**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bfd)| Manage BFD configuration +[**sonic_bgp**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp)| Manage global BGP and its parameters +[**sonic_bgp_af**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp_af)| Manage global BGP address-family and its parameters +[**sonic_bgp_as_paths**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp_as_paths)| Manage BGP autonomous system path (or as-path-list) and its parameters +[**sonic_bgp_communities**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp_communities)| Manage BGP community and its parameters +[**sonic_bgp_ext_communities**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp_ext_communities)| Manage BGP extended community-list and its parameters +[**sonic_bgp_neighbors**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp_neighbors)| Manage a BGP neighbor and its parameters +[**sonic_bgp_neighbors_af**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_bgp_neighbors_af)| Manage the BGP neighbor address-family and its parameters +[**sonic_copp**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_copp)| Manage CoPP configuration +[**sonic_dhcp_relay**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_dhcp_relay)| Manage DHCP and DHCPv6 relay configurations +[**sonic_dhcp_snooping**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_dhcp_snooping)| Manage DHCP Snooping +[**sonic_fips**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_fips)| Manage FIPS configurations +[**sonic_image_management**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_image_management)| Manage installation of Enterprise SONiC image, software patch and firmware updater. +[**sonic_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_interfaces)| Configure Interface attributes +[**sonic_ip_neighbor**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_ip_neighbor)| Manage IP neighbor global configuration +[**sonic_l2_acls**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_l2_acls)| Manage Layer 2 access control lists (ACL) configurations +[**sonic_l2_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_l2_interfaces)| Configure interface-to-VLAN association +[**sonic_l3_acls**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_l3_acls)| Manage Layer 3 access control lists (ACL) configurations +[**sonic_l3_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_l3_interfaces)| Configure the IPv4 and IPv6 parameters on Interfaces +[**sonic_lag_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_lag_interfaces)| Manage link aggregation group (LAG) interface parameters +[**sonic_ldap**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_ldap)| Configure global LDAP server settings +[**sonic_lldp_global**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_lldp_global)| Manage Global LLDP configurations +[**sonic_lldp_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_lldp_interfaces)| Manage interface LLDP configurations +[**sonic_logging**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_logging)| Manage logging configuration +[**sonic_login_lockout**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_login_lockout)| Manage Global Login Lockout configuration +[**sonic_mac**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_mac)| Manage MAC configuration +[**sonic_mclag**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_mclag)| Manage multi chassis link aggregation groups domain (MCLAG) and its parameters +[**sonic_mgmt_servers**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_mgmt_servers)| Manage management servers configuration +[**sonic_ntp**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_ntp)| Manage NTP configuration +[**sonic_ospf_area**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_ospf_area)| Configure OSPF area setting +[**sonic_ospfv2**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_ospfv2)| Configure global OSPFv2 protocol settings +[**sonic_ospfv2_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_ospfv2_interfaces)| Configure OSPFv2 interface mode protocol settings +[**sonic_pim_global**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_pim_global)| Manage global PIM configuration +[**sonic_pim_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_pim_interfaces)| Manage interface-specific PIM configurations +[**sonic_pki**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_pki)| Manages PKI attributes +[**sonic_poe**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_poe)| Manage Power over Ethernet PoE configuration +[**sonic_port_breakout**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_port_breakout)| Configure port breakout settings on physical interfaces +[**sonic_port_group**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_port_group)| Manage port group configuration +[**sonic_prefix_lists**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_prefix_lists)| Manage prefix list configuration +[**sonic_qos_buffer**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_qos_buffer)| Manage QoS buffer configuration +[**sonic_qos_interfaces**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_qos_interfaces)| Manage QoS interfaces configuration +[**sonic_qos_maps**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_qos_maps)| Manage QoS maps configuration +[**sonic_qos_pfc**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_qos_pfc)| Manage QoS PFC configuration +[**sonic_qos_scheduler**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_qos_scheduler)| Manage QoS scheduler configuration +[**sonic_qos_wred**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_qos_wred)| Manage QoS WRED profiles configuration +[**sonic_radius_server**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_radius_server)| Manage RADIUS server and its parameters +[**sonic_roce**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_roce)| Manage RoCE QoS configuration +[**sonic_route_maps**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_route_maps)| Manage route map configuration +[**sonic_sflow**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_sflow)| Manage sflow configuration settings +[**sonic_static_routes**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_static_routes)| Manage static routes configuration +[**sonic_stp**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_stp)| Manage STP configuration +[**sonic_system**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_system)| Configure system parameters +[**sonic_tacacs_server**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_tacacs_server)| Manage TACACS server and its parameters +[**sonic_users**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_users)| Manage users and its parameters +[**sonic_vlan_mapping**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_vlan_mapping)| Configure vlan mappings +[**sonic_vlans**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_vlans)| Manage VLAN and its parameters +[**sonic_vrfs**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_vrfs)| Manage VRFs and associate VRFs to interfaces +[**sonic_vrrp**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_vrrp)| Manage VRRP protocol configuration settings +[**sonic_vxlans**](https://galaxy.ansible.com/ui/repo/published/dellemc/enterprise_sonic/content/module/sonic_vxlans)| Manage VxLAN EVPN and its parameters Sample use case playbooks ------------------------- diff --git a/changelogs/fragments/441-system-downward-compatibility-fix.yaml b/changelogs/fragments/441-system-downward-compatibility-fix.yaml new file mode 100644 index 000000000..33ef73081 --- /dev/null +++ b/changelogs/fragments/441-system-downward-compatibility-fix.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - sonic_system - Catch the ConnectionError exception caused by unconditional fetching of auditd and ip loadshare hash algorithm configuration, and return empty configuration instead of allowing the uncaught exception to abort all "system" operations on SONiC images older than version 4.4.0 (https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/441). diff --git a/changelogs/fragments/443-update-regex-edit-config.yaml b/changelogs/fragments/443-update-regex-edit-config.yaml new file mode 100644 index 000000000..fbc1726fe --- /dev/null +++ b/changelogs/fragments/443-update-regex-edit-config.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Update regex search expression for 'not found' error message in httpapi/sonic.py 'edit_config' method (https://github.com/ansible-collection/dellemc.enterprise_sonic/pull/443). diff --git a/changelogs/fragments/445-ConnectionError-add-imports.yaml b/changelogs/fragments/445-ConnectionError-add-imports.yaml new file mode 100644 index 000000000..ef93d71b2 --- /dev/null +++ b/changelogs/fragments/445-ConnectionError-add-imports.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ConnectionError - Add the needed import of the Ansible ConnectionError exception class for all files where it was previously missing. (https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/445). diff --git a/changelogs/fragments/446-README-documentation-links-fix.yaml b/changelogs/fragments/446-README-documentation-links-fix.yaml new file mode 100644 index 000000000..c86aea313 --- /dev/null +++ b/changelogs/fragments/446-README-documentation-links-fix.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - README - Update all links to module documentation to use the new Ansible documentation web site on the galaxy.ansible.com domain(https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/446). diff --git a/plugins/httpapi/sonic.py b/plugins/httpapi/sonic.py index eb9eda949..6072be17f 100644 --- a/plugins/httpapi/sonic.py +++ b/plugins/httpapi/sonic.py @@ -39,6 +39,7 @@ import json import time +import re from ansible.module_utils._text import to_text from ansible.module_utils.connection import ConnectionError @@ -67,7 +68,7 @@ def send_request(self, data, **message_kwargs): def get(self, command): return self.send_request(path=command, data=None, method='get') - def edit_config(self, requests): + def edit_config(self, requests, suppr_ntf_excp=True): """Send a list of http requests to remote device and return results """ if requests is None: @@ -78,7 +79,11 @@ def edit_config(self, requests): try: response = self.send_request(**req) except ConnectionError as exc: - raise ConnectionError(to_text(exc, errors='surrogate_then_replace')) + if suppr_ntf_excp and req.get('method') == 'get' and re.search("[nN]ot [fF]ound.*code': 404", str(exc)): + # 'code': 404, 'error-message': 'Resource not found' + response = [{}, {}] + else: + raise ConnectionError(to_text(exc, errors='surrogate_then_replace')) responses.append(response) return responses diff --git a/plugins/module_utils/network/sonic/config/bfd/bfd.py b/plugins/module_utils/network/sonic/config/bfd/bfd.py index f04af49b9..4954eb8e7 100644 --- a/plugins/module_utils/network/sonic/config/bfd/bfd.py +++ b/plugins/module_utils/network/sonic/config/bfd/bfd.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase ) diff --git a/plugins/module_utils/network/sonic/config/copp/copp.py b/plugins/module_utils/network/sonic/config/copp/copp.py index 6f3cf462a..2367202bd 100644 --- a/plugins/module_utils/network/sonic/config/copp/copp.py +++ b/plugins/module_utils/network/sonic/config/copp/copp.py @@ -15,6 +15,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/dhcp_snooping/dhcp_snooping.py b/plugins/module_utils/network/sonic/config/dhcp_snooping/dhcp_snooping.py index 15ffd8646..8b309aae4 100644 --- a/plugins/module_utils/network/sonic/config/dhcp_snooping/dhcp_snooping.py +++ b/plugins/module_utils/network/sonic/config/dhcp_snooping/dhcp_snooping.py @@ -16,6 +16,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/mac/mac.py b/plugins/module_utils/network/sonic/config/mac/mac.py index d20257615..7ccb95fa2 100644 --- a/plugins/module_utils/network/sonic/config/mac/mac.py +++ b/plugins/module_utils/network/sonic/config/mac/mac.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/ospf_area/ospf_area.py b/plugins/module_utils/network/sonic/config/ospf_area/ospf_area.py index 16ba5af2b..353ee6e2e 100644 --- a/plugins/module_utils/network/sonic/config/ospf_area/ospf_area.py +++ b/plugins/module_utils/network/sonic/config/ospf_area/ospf_area.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/pki/pki.py b/plugins/module_utils/network/sonic/config/pki/pki.py index 163e59023..e611e9ed0 100644 --- a/plugins/module_utils/network/sonic/config/pki/pki.py +++ b/plugins/module_utils/network/sonic/config/pki/pki.py @@ -15,6 +15,7 @@ __metaclass__ = type +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/poe/poe.py b/plugins/module_utils/network/sonic/config/poe/poe.py index 60f710dab..53e1b23f1 100644 --- a/plugins/module_utils/network/sonic/config/poe/poe.py +++ b/plugins/module_utils/network/sonic/config/poe/poe.py @@ -16,6 +16,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/prefix_lists/prefix_lists.py b/plugins/module_utils/network/sonic/config/prefix_lists/prefix_lists.py index 2b037381b..8b80edfbb 100644 --- a/plugins/module_utils/network/sonic/config/prefix_lists/prefix_lists.py +++ b/plugins/module_utils/network/sonic/config/prefix_lists/prefix_lists.py @@ -14,6 +14,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/qos_buffer/qos_buffer.py b/plugins/module_utils/network/sonic/config/qos_buffer/qos_buffer.py index a4ae9c6b7..520c2e095 100644 --- a/plugins/module_utils/network/sonic/config/qos_buffer/qos_buffer.py +++ b/plugins/module_utils/network/sonic/config/qos_buffer/qos_buffer.py @@ -13,6 +13,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/qos_interfaces/qos_interfaces.py b/plugins/module_utils/network/sonic/config/qos_interfaces/qos_interfaces.py index 1d60b22e0..0ba02a624 100644 --- a/plugins/module_utils/network/sonic/config/qos_interfaces/qos_interfaces.py +++ b/plugins/module_utils/network/sonic/config/qos_interfaces/qos_interfaces.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/qos_maps/qos_maps.py b/plugins/module_utils/network/sonic/config/qos_maps/qos_maps.py index 8044778ad..ac77a2ecf 100644 --- a/plugins/module_utils/network/sonic/config/qos_maps/qos_maps.py +++ b/plugins/module_utils/network/sonic/config/qos_maps/qos_maps.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/qos_pfc/qos_pfc.py b/plugins/module_utils/network/sonic/config/qos_pfc/qos_pfc.py index 3e209b503..547603805 100644 --- a/plugins/module_utils/network/sonic/config/qos_pfc/qos_pfc.py +++ b/plugins/module_utils/network/sonic/config/qos_pfc/qos_pfc.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/qos_scheduler/qos_scheduler.py b/plugins/module_utils/network/sonic/config/qos_scheduler/qos_scheduler.py index 1018babdd..7596648d4 100644 --- a/plugins/module_utils/network/sonic/config/qos_scheduler/qos_scheduler.py +++ b/plugins/module_utils/network/sonic/config/qos_scheduler/qos_scheduler.py @@ -14,6 +14,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/qos_wred/qos_wred.py b/plugins/module_utils/network/sonic/config/qos_wred/qos_wred.py index 196300913..9736fe465 100644 --- a/plugins/module_utils/network/sonic/config/qos_wred/qos_wred.py +++ b/plugins/module_utils/network/sonic/config/qos_wred/qos_wred.py @@ -20,6 +20,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( to_list, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( get_diff, remove_empties_from_list, diff --git a/plugins/module_utils/network/sonic/config/roce/roce.py b/plugins/module_utils/network/sonic/config/roce/roce.py index 1c364e33a..26cde3f12 100644 --- a/plugins/module_utils/network/sonic/config/roce/roce.py +++ b/plugins/module_utils/network/sonic/config/roce/roce.py @@ -13,6 +13,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/route_maps/route_maps.py b/plugins/module_utils/network/sonic/config/route_maps/route_maps.py index d33cfe70a..3e7a1dfba 100644 --- a/plugins/module_utils/network/sonic/config/route_maps/route_maps.py +++ b/plugins/module_utils/network/sonic/config/route_maps/route_maps.py @@ -18,6 +18,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/sflow/sflow.py b/plugins/module_utils/network/sonic/config/sflow/sflow.py index 04c7f5313..1708e5c22 100644 --- a/plugins/module_utils/network/sonic/config/sflow/sflow.py +++ b/plugins/module_utils/network/sonic/config/sflow/sflow.py @@ -15,6 +15,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/static_routes/static_routes.py b/plugins/module_utils/network/sonic/config/static_routes/static_routes.py index 116b9c943..e4e71291e 100644 --- a/plugins/module_utils/network/sonic/config/static_routes/static_routes.py +++ b/plugins/module_utils/network/sonic/config/static_routes/static_routes.py @@ -15,6 +15,7 @@ __metaclass__ = type from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/facts/bfd/bfd.py b/plugins/module_utils/network/sonic/facts/bfd/bfd.py index de8f56e03..cb601cd22 100644 --- a/plugins/module_utils/network/sonic/facts/bfd/bfd.py +++ b/plugins/module_utils/network/sonic/facts/bfd/bfd.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/copp/copp.py b/plugins/module_utils/network/sonic/facts/copp/copp.py index a6286cae1..9a7928ff5 100644 --- a/plugins/module_utils/network/sonic/facts/copp/copp.py +++ b/plugins/module_utils/network/sonic/facts/copp/copp.py @@ -18,6 +18,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( remove_empties ) diff --git a/plugins/module_utils/network/sonic/facts/mac/mac.py b/plugins/module_utils/network/sonic/facts/mac/mac.py index 5412a5e46..0fec31209 100644 --- a/plugins/module_utils/network/sonic/facts/mac/mac.py +++ b/plugins/module_utils/network/sonic/facts/mac/mac.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/mgmt_servers/mgmt_servers.py b/plugins/module_utils/network/sonic/facts/mgmt_servers/mgmt_servers.py index c1a033d42..187aa9f36 100644 --- a/plugins/module_utils/network/sonic/facts/mgmt_servers/mgmt_servers.py +++ b/plugins/module_utils/network/sonic/facts/mgmt_servers/mgmt_servers.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/ospf_area/ospf_area.py b/plugins/module_utils/network/sonic/facts/ospf_area/ospf_area.py index a9abde4c3..1fea0ce3d 100644 --- a/plugins/module_utils/network/sonic/facts/ospf_area/ospf_area.py +++ b/plugins/module_utils/network/sonic/facts/ospf_area/ospf_area.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( remove_empties, validate_config, diff --git a/plugins/module_utils/network/sonic/facts/pki/pki.py b/plugins/module_utils/network/sonic/facts/pki/pki.py index 240c50335..a34bd6e4a 100644 --- a/plugins/module_utils/network/sonic/facts/pki/pki.py +++ b/plugins/module_utils/network/sonic/facts/pki/pki.py @@ -16,6 +16,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/poe/poe.py b/plugins/module_utils/network/sonic/facts/poe/poe.py index b624969f8..a360a5971 100644 --- a/plugins/module_utils/network/sonic/facts/poe/poe.py +++ b/plugins/module_utils/network/sonic/facts/poe/poe.py @@ -17,6 +17,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.poe.poe import PoeArgs from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic \ @@ -157,12 +158,7 @@ def get_poe_info(self): self._module.fail_json(msg=str(exc)) poe_config = {} - try: - poe_config = response[0][1] - if len(poe_config) > 0: - poe_config = poe_config["openconfig-poe:poe"] - except Exception: - raise Exception("response from getting poe facts not formed as expected") + poe_config = response[0][1].get("openconfig-poe:poe", {}) # get poe interface settings try: @@ -172,14 +168,11 @@ def get_poe_info(self): self._module.fail_json(msg=str(exc)) interface_poe_settings = [] - try: - interface_poe_settings = [] - for interface in response[0][1]["openconfig-interfaces:interfaces"]["interface"]: - interface_settings = interface.get("openconfig-if-ethernet:ethernet", {}).get("openconfig-if-poe:poe", {}) - if len(interface_settings) > 0: - interface_settings.update({"name": interface["name"]}) - interface_poe_settings.append(interface_settings) - except Exception: - raise Exception("response from getting poe facts not formed as expected") + poe_interfaces = response[0][1].get("openconfig-interfaces:interfaces", {}).get("interface", []) + for interface in poe_interfaces: + interface_settings = interface.get("openconfig-if-ethernet:ethernet", {}).get("openconfig-if-poe:poe", {}) + if len(interface_settings) > 0: + interface_settings.update({"name": interface["name"]}) + interface_poe_settings.append(interface_settings) formatted_specs = self.format_to_argspec(poe_config, interface_poe_settings) return formatted_specs diff --git a/plugins/module_utils/network/sonic/facts/prefix_lists/prefix_lists.py b/plugins/module_utils/network/sonic/facts/prefix_lists/prefix_lists.py index 757dfcbde..f60c82408 100644 --- a/plugins/module_utils/network/sonic/facts/prefix_lists/prefix_lists.py +++ b/plugins/module_utils/network/sonic/facts/prefix_lists/prefix_lists.py @@ -19,6 +19,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils \ import ( diff --git a/plugins/module_utils/network/sonic/facts/qos_interfaces/qos_interfaces.py b/plugins/module_utils/network/sonic/facts/qos_interfaces/qos_interfaces.py index b1645c19d..a03a38767 100644 --- a/plugins/module_utils/network/sonic/facts/qos_interfaces/qos_interfaces.py +++ b/plugins/module_utils/network/sonic/facts/qos_interfaces/qos_interfaces.py @@ -17,6 +17,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( remove_empties_from_list ) diff --git a/plugins/module_utils/network/sonic/facts/qos_maps/qos_maps.py b/plugins/module_utils/network/sonic/facts/qos_maps/qos_maps.py index f27687c61..638a47ff1 100644 --- a/plugins/module_utils/network/sonic/facts/qos_maps/qos_maps.py +++ b/plugins/module_utils/network/sonic/facts/qos_maps/qos_maps.py @@ -17,6 +17,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( remove_empties ) diff --git a/plugins/module_utils/network/sonic/facts/qos_pfc/qos_pfc.py b/plugins/module_utils/network/sonic/facts/qos_pfc/qos_pfc.py index d4dca63e8..e870ab9d9 100644 --- a/plugins/module_utils/network/sonic/facts/qos_pfc/qos_pfc.py +++ b/plugins/module_utils/network/sonic/facts/qos_pfc/qos_pfc.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/qos_scheduler/qos_scheduler.py b/plugins/module_utils/network/sonic/facts/qos_scheduler/qos_scheduler.py index f06a9371b..b456c7050 100644 --- a/plugins/module_utils/network/sonic/facts/qos_scheduler/qos_scheduler.py +++ b/plugins/module_utils/network/sonic/facts/qos_scheduler/qos_scheduler.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/qos_wred/qos_wred.py b/plugins/module_utils/network/sonic/facts/qos_wred/qos_wred.py index 3f168ceaf..4961e5447 100644 --- a/plugins/module_utils/network/sonic/facts/qos_wred/qos_wred.py +++ b/plugins/module_utils/network/sonic/facts/qos_wred/qos_wred.py @@ -17,6 +17,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( remove_empties_from_list ) diff --git a/plugins/module_utils/network/sonic/facts/roce/roce.py b/plugins/module_utils/network/sonic/facts/roce/roce.py index 550342585..1542d42e7 100644 --- a/plugins/module_utils/network/sonic/facts/roce/roce.py +++ b/plugins/module_utils/network/sonic/facts/roce/roce.py @@ -14,6 +14,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/route_maps/route_maps.py b/plugins/module_utils/network/sonic/facts/route_maps/route_maps.py index 2a63cf357..60a4b29c5 100644 --- a/plugins/module_utils/network/sonic/facts/route_maps/route_maps.py +++ b/plugins/module_utils/network/sonic/facts/route_maps/route_maps.py @@ -18,6 +18,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.route_maps.route_maps import Route_mapsArgs from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import remove_empties_from_list diff --git a/plugins/module_utils/network/sonic/facts/sflow/sflow.py b/plugins/module_utils/network/sonic/facts/sflow/sflow.py index 95edc5f08..06ab33e35 100644 --- a/plugins/module_utils/network/sonic/facts/sflow/sflow.py +++ b/plugins/module_utils/network/sonic/facts/sflow/sflow.py @@ -17,6 +17,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.sflow.sflow import SflowArgs from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic \ @@ -53,17 +54,21 @@ def populate_facts(self, connection, ansible_facts, data=None): if not data: data = self.get_sflow_info() - data = self.format_to_argspec(data) + # convert to argspec for ansible_facts + facts = {} + if data: + data = self.format_to_argspec(data) - # validate can add null values for things missing from device config, - # so doing that before remove empties - cleaned_data = utils.remove_empties( - utils.validate_config(self.argument_spec, data) - ) + # validate can add null values for things missing from device config, + # so doing that before remove empties + cleaned_data = utils.remove_empties( + utils.validate_config(self.argument_spec, data) + ) + if cleaned_data: + facts["sflow"] = cleaned_data["config"] ansible_facts['ansible_network_resources'].pop('sflow', None) - if cleaned_data: - ansible_facts['ansible_network_resources'].update({"sflow": cleaned_data["config"]}) + ansible_facts['ansible_network_resources'].update(facts) return ansible_facts @@ -121,7 +126,7 @@ def get_sflow_info(self): response_body = {} try: - response_body = response[0][1][response_key] + response_body = response[0][1].get(response_key) except Exception: raise Exception("response from getting sflow facts not formed as expected") diff --git a/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py b/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py index 0777e67b2..478eb6b4a 100644 --- a/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py +++ b/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py @@ -15,6 +15,7 @@ from copy import deepcopy +from ansible.module_utils.connection import ConnectionError from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) diff --git a/plugins/module_utils/network/sonic/facts/stp/stp.py b/plugins/module_utils/network/sonic/facts/stp/stp.py index da779c502..d56a0fd50 100644 --- a/plugins/module_utils/network/sonic/facts/stp/stp.py +++ b/plugins/module_utils/network/sonic/facts/stp/stp.py @@ -17,6 +17,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) +from ansible.module_utils.connection import ConnectionError from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( remove_empties ) diff --git a/plugins/module_utils/network/sonic/facts/system/system.py b/plugins/module_utils/network/sonic/facts/system/system.py index 6d2ac6fe3..39a56ab8f 100644 --- a/plugins/module_utils/network/sonic/facts/system/system.py +++ b/plugins/module_utils/network/sonic/facts/system/system.py @@ -16,6 +16,9 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( utils, ) + +from ansible.module_utils.connection import ConnectionError + from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic import ( to_request, edit_config diff --git a/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py b/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py index 375c453d5..772176cd5 100644 --- a/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py +++ b/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py @@ -92,7 +92,7 @@ def render_config(self, spec, conf): def get_all_vrf_interfaces(self): """Get all the interfaces available in chassis""" - all_network_instatnces = {} + all_network_instances = {} request = [{"path": "data/openconfig-network-instance:network-instances", "method": GET}] try: response = edit_config(self._module, to_request(self._module, request)) @@ -100,8 +100,9 @@ def get_all_vrf_interfaces(self): self._module.fail_json(msg=str(exc), code=exc.code) if "openconfig-network-instance:network-instances" in response[0][1]: - all_network_instatnces = response[0][1].get("openconfig-network-instance:network-instances", {}) - return self.get_vrf_interfaces_from_network_instances(all_network_instatnces['network-instance']) + all_network_instances = response[0][1].get("openconfig-network-instance:network-instances", {}) + network_instances = all_network_instances.get('network-instance', []) + return self.get_vrf_interfaces_from_network_instances(network_instances) def get_vrf_interfaces_from_network_instances(self, network_instances): vrf_interfaces = [] diff --git a/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py b/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py index 30d92e7ec..73252c083 100644 --- a/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py +++ b/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py @@ -125,6 +125,7 @@ def get_all_vxlans_vrf_list(self): except ConnectionError as exc: self._module.fail_json(msg=str(exc), code=exc.code) + vxlan_vrf_list = {} if "sonic-vrf:VRF_LIST" in response[0][1]: vxlan_vrf_list = response[0][1].get("sonic-vrf:VRF_LIST", {}) diff --git a/plugins/module_utils/network/sonic/sonic.py b/plugins/module_utils/network/sonic/sonic.py index 920af87e0..9a3a1b036 100644 --- a/plugins/module_utils/network/sonic/sonic.py +++ b/plugins/module_utils/network/sonic/sonic.py @@ -125,18 +125,22 @@ def run_commands(module, commands, check_rc=True): module.fail_json(msg=to_text(exc)) -def edit_config(module, commands, skip_code=None): +def edit_config(module, commands, skip_code=None, suppr_ntf_excp=True): connection = get_connection(module) # Start: This is to convert interface name from Eth1/1 to Eth1%2f1 for request in commands: - # This check is to differenciate between requests and commands + # This check is to differentiate between requests and commands if isinstance(request, dict): url = request.get("path", None) if url: request["path"] = update_url(url) # End - return connection.edit_config(commands) + if suppr_ntf_excp: + # Default: not used for cliconf + return connection.edit_config(commands) + else: + return connection.edit_config(commands, suppr_ntf_excp) def edit_config_reboot(module, commands, skip_code=None): diff --git a/plugins/module_utils/network/sonic/utils/interfaces_util.py b/plugins/module_utils/network/sonic/utils/interfaces_util.py index 60df9251d..aceb98bc3 100644 --- a/plugins/module_utils/network/sonic/utils/interfaces_util.py +++ b/plugins/module_utils/network/sonic/utils/interfaces_util.py @@ -30,6 +30,7 @@ import re from ansible.module_utils._text import to_native +from ansible.module_utils.connection import ConnectionError try: from urllib import quote diff --git a/plugins/modules/sonic_api.py b/plugins/modules/sonic_api.py index 234603a0a..0c5af2ca9 100644 --- a/plugins/modules/sonic_api.py +++ b/plugins/modules/sonic_api.py @@ -116,7 +116,7 @@ def initiate_request(module): request = to_request(module, [{"path": url, "method": method, "data": body}]) try: - response = edit_config(module, request) + response = edit_config(module, request, suppr_ntf_excp=False) except ConnectionError as exc: module.fail_json(msg=to_text(exc)) return response diff --git a/tests/regression/roles/sonic_system/defaults/main.yml b/tests/regression/roles/sonic_system/defaults/main.yml index 57662b0a8..9b7368957 100644 --- a/tests/regression/roles/sonic_system/defaults/main.yml +++ b/tests/regression/roles/sonic_system/defaults/main.yml @@ -12,7 +12,8 @@ tests: ipv4: false ipv6: false auto_breakout: ENABLE - load_share_hash_algo: JENKINS_HASH_HI + # Use only on switch models that support this. + #load_share_hash_algo: JENKINS_HASH_HI audit_rules: BASIC - name: test_case_02 @@ -21,7 +22,8 @@ tests: input: hostname: SONIC-new interface_naming: standard_extended - load_share_hash_algo: JENKINS_HASH_LO + # Use only on switch models that support this. + #load_share_hash_algo: JENKINS_HASH_LO audit_rules: DETAIL - name: test_case_03 @@ -40,7 +42,8 @@ tests: anycast_address: ipv4: false auto_breakout: ENABLE - load_share_hash_algo: JENKINS_HASH_LO + # Use only on switch models that support this. + #load_share_hash_algo: JENKINS_HASH_LO audit_rules: BASIC - name: test_case_05 @@ -60,7 +63,8 @@ tests: ipv4: true mac_address: 00:09:5B:EC:EE:F2 auto_breakout: ENABLE - load_share_hash_algo: CRC_XOR + # Use only on switch models that support this. + #load_share_hash_algo: CRC_XOR audit_rules: BASIC - name: test_case_07 @@ -83,7 +87,8 @@ tests: anycast_address: ipv4: true auto_breakout: ENABLE - load_share_hash_algo: CRC_32HI + # Use only on switch models that support this. + #load_share_hash_algo: CRC_32HI audit_rules: BASIC - name: test_case_09