diff options
Diffstat (limited to 'ansible_collections/arista/eos/plugins')
137 files changed, 6344 insertions, 7557 deletions
diff --git a/ansible_collections/arista/eos/plugins/action/acl_interfaces.py b/ansible_collections/arista/eos/plugins/action/acl_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/acl_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/acl_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/acls.py b/ansible_collections/arista/eos/plugins/action/acls.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/acls.py +++ b/ansible_collections/arista/eos/plugins/action/acls.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/banner.py b/ansible_collections/arista/eos/plugins/action/banner.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/banner.py +++ b/ansible_collections/arista/eos/plugins/action/banner.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/bgp.py b/ansible_collections/arista/eos/plugins/action/bgp.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/bgp.py +++ b/ansible_collections/arista/eos/plugins/action/bgp.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/bgp_address_family.py b/ansible_collections/arista/eos/plugins/action/bgp_address_family.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/bgp_address_family.py +++ b/ansible_collections/arista/eos/plugins/action/bgp_address_family.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/bgp_global.py b/ansible_collections/arista/eos/plugins/action/bgp_global.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/bgp_global.py +++ b/ansible_collections/arista/eos/plugins/action/bgp_global.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/command.py b/ansible_collections/arista/eos/plugins/action/command.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/command.py +++ b/ansible_collections/arista/eos/plugins/action/command.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/config.py b/ansible_collections/arista/eos/plugins/action/config.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/config.py +++ b/ansible_collections/arista/eos/plugins/action/config.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/eapi.py b/ansible_collections/arista/eos/plugins/action/eapi.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/eapi.py +++ b/ansible_collections/arista/eos/plugins/action/eapi.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/eos.py b/ansible_collections/arista/eos/plugins/action/eos.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/eos.py +++ b/ansible_collections/arista/eos/plugins/action/eos.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/facts.py b/ansible_collections/arista/eos/plugins/action/facts.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/facts.py +++ b/ansible_collections/arista/eos/plugins/action/facts.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/hostname.py b/ansible_collections/arista/eos/plugins/action/hostname.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/hostname.py +++ b/ansible_collections/arista/eos/plugins/action/hostname.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/interface.py b/ansible_collections/arista/eos/plugins/action/interface.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/interface.py +++ b/ansible_collections/arista/eos/plugins/action/interface.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/interfaces.py b/ansible_collections/arista/eos/plugins/action/interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/l2_interface.py b/ansible_collections/arista/eos/plugins/action/l2_interface.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/l2_interface.py +++ b/ansible_collections/arista/eos/plugins/action/l2_interface.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/l2_interfaces.py b/ansible_collections/arista/eos/plugins/action/l2_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/l2_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/l2_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/l3_interface.py b/ansible_collections/arista/eos/plugins/action/l3_interface.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/l3_interface.py +++ b/ansible_collections/arista/eos/plugins/action/l3_interface.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/l3_interfaces.py b/ansible_collections/arista/eos/plugins/action/l3_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/l3_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/l3_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/lacp.py b/ansible_collections/arista/eos/plugins/action/lacp.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/lacp.py +++ b/ansible_collections/arista/eos/plugins/action/lacp.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/lacp_interfaces.py b/ansible_collections/arista/eos/plugins/action/lacp_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/lacp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/lacp_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/lag_interfaces.py b/ansible_collections/arista/eos/plugins/action/lag_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/lag_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/lag_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/linkagg.py b/ansible_collections/arista/eos/plugins/action/linkagg.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/linkagg.py +++ b/ansible_collections/arista/eos/plugins/action/linkagg.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/lldp.py b/ansible_collections/arista/eos/plugins/action/lldp.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/lldp.py +++ b/ansible_collections/arista/eos/plugins/action/lldp.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/lldp_global.py b/ansible_collections/arista/eos/plugins/action/lldp_global.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/lldp_global.py +++ b/ansible_collections/arista/eos/plugins/action/lldp_global.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/lldp_interfaces.py b/ansible_collections/arista/eos/plugins/action/lldp_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/lldp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/lldp_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/logging.py b/ansible_collections/arista/eos/plugins/action/logging.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/logging.py +++ b/ansible_collections/arista/eos/plugins/action/logging.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/logging_global.py b/ansible_collections/arista/eos/plugins/action/logging_global.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/logging_global.py +++ b/ansible_collections/arista/eos/plugins/action/logging_global.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/ntp_global.py b/ansible_collections/arista/eos/plugins/action/ntp_global.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/ntp_global.py +++ b/ansible_collections/arista/eos/plugins/action/ntp_global.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/ospf_interfaces.py b/ansible_collections/arista/eos/plugins/action/ospf_interfaces.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/ospf_interfaces.py +++ b/ansible_collections/arista/eos/plugins/action/ospf_interfaces.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/ospfv2.py b/ansible_collections/arista/eos/plugins/action/ospfv2.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/ospfv2.py +++ b/ansible_collections/arista/eos/plugins/action/ospfv2.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/ospfv3.py b/ansible_collections/arista/eos/plugins/action/ospfv3.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/ospfv3.py +++ b/ansible_collections/arista/eos/plugins/action/ospfv3.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/prefix_lists.py b/ansible_collections/arista/eos/plugins/action/prefix_lists.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/prefix_lists.py +++ b/ansible_collections/arista/eos/plugins/action/prefix_lists.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/route_maps.py b/ansible_collections/arista/eos/plugins/action/route_maps.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/route_maps.py +++ b/ansible_collections/arista/eos/plugins/action/route_maps.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/snmp_server.py b/ansible_collections/arista/eos/plugins/action/snmp_server.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/snmp_server.py +++ b/ansible_collections/arista/eos/plugins/action/snmp_server.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/static_route.py b/ansible_collections/arista/eos/plugins/action/static_route.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/static_route.py +++ b/ansible_collections/arista/eos/plugins/action/static_route.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/static_routes.py b/ansible_collections/arista/eos/plugins/action/static_routes.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/static_routes.py +++ b/ansible_collections/arista/eos/plugins/action/static_routes.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/system.py b/ansible_collections/arista/eos/plugins/action/system.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/system.py +++ b/ansible_collections/arista/eos/plugins/action/system.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/user.py b/ansible_collections/arista/eos/plugins/action/user.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/user.py +++ b/ansible_collections/arista/eos/plugins/action/user.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/vlan.py b/ansible_collections/arista/eos/plugins/action/vlan.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/vlan.py +++ b/ansible_collections/arista/eos/plugins/action/vlan.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/vlans.py b/ansible_collections/arista/eos/plugins/action/vlans.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/vlans.py +++ b/ansible_collections/arista/eos/plugins/action/vlans.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/action/vrf.py b/ansible_collections/arista/eos/plugins/action/vrf.py index 0afb7e88f..6aeb55375 100644 --- a/ansible_collections/arista/eos/plugins/action/vrf.py +++ b/ansible_collections/arista/eos/plugins/action/vrf.py @@ -36,9 +36,7 @@ class ActionModule(ActionNetworkModule): del tmp # tmp no longer has any effect module_name = self._task.action.split(".")[-1] - self._config_module = ( - True if module_name in ["eos_config", "config"] else False - ) + self._config_module = True if module_name in ["eos_config", "config"] else False persistent_connection = self._play_context.connection.split(".")[-1] warnings = [] diff --git a/ansible_collections/arista/eos/plugins/cliconf/eos.py b/ansible_collections/arista/eos/plugins/cliconf/eos.py index d5347307d..9c6fb753c 100644 --- a/ansible_collections/arista/eos/plugins/cliconf/eos.py +++ b/ansible_collections/arista/eos/plugins/cliconf/eos.py @@ -64,17 +64,13 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.c NetworkConfig, dumps, ) -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_list, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list from ansible_collections.ansible.netcommon.plugins.plugin_utils.cliconf_base import ( CliconfBase, enable_mode, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.eos import ( - session_name, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.eos import session_name class Cliconf(CliconfBase): @@ -383,9 +379,7 @@ class Cliconf(CliconfBase): else: configdiffobjs = candidate_obj.items - diff["config_diff"] = ( - dumps(configdiffobjs, "commands") if configdiffobjs else "" - ) + diff["config_diff"] = dumps(configdiffobjs, "commands") if configdiffobjs else "" return diff def supports_sessions(self): diff --git a/ansible_collections/arista/eos/plugins/httpapi/eos.py b/ansible_collections/arista/eos/plugins/httpapi/eos.py index 9fa9dfd3e..e24dc57df 100644 --- a/ansible_collections/arista/eos/plugins/httpapi/eos.py +++ b/ansible_collections/arista/eos/plugins/httpapi/eos.py @@ -31,16 +31,10 @@ import json from ansible.errors import AnsibleConnectionFailure from ansible.module_utils._text import to_text from ansible.module_utils.connection import ConnectionError -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_list, -) -from ansible_collections.ansible.netcommon.plugins.plugin_utils.httpapi_base import ( - HttpApiBase, -) - -from ansible_collections.arista.eos.plugins.module_utils.network.eos.eos import ( - session_name, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list +from ansible_collections.ansible.netcommon.plugins.plugin_utils.httpapi_base import HttpApiBase + +from ansible_collections.arista.eos.plugins.module_utils.network.eos.eos import session_name OPTIONS = { diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/argspec/bgp_global/bgp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/argspec/bgp_global/bgp_global.py index 96a055e43..5169baacc 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/argspec/bgp_global/bgp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/argspec/bgp_global/bgp_global.py @@ -47,6 +47,7 @@ class Bgp_globalArgs(object): # pylint: disable=R0903 "purged", "merged", "replaced", + "overridden", "gathered", "rendered", "parsed", diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acl_interfaces/acl_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acl_interfaces/acl_interfaces.py index c76e79595..3014acf8a 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acl_interfaces/acl_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acl_interfaces/acl_interfaces.py @@ -26,9 +26,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Acl_interfaces(ConfigBase): @@ -442,13 +440,7 @@ def add_commands(want, interface): if "acls" in w.keys(): for acl in w["acls"]: commands.append( - afi - + " " - + a_cmd - + " " - + acl["name"] - + " " - + acl["direction"], + afi + " " + a_cmd + " " + acl["name"] + " " + acl["direction"], ) return commands @@ -469,13 +461,6 @@ def remove_commands(want, interface): if "acls" in w.keys(): for acl in w["acls"]: commands.append( - "no " - + afi - + " " - + a_cmd - + " " - + acl["name"] - + " " - + acl["direction"], + "no " + afi + " " + a_cmd + " " + acl["name"] + " " + acl["direction"], ) return commands diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acls/acls.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acls/acls.py index 17fe6cfd3..dbc7f2d00 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acls/acls.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/acls/acls.py @@ -29,9 +29,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Acls(ConfigBase): @@ -156,7 +154,9 @@ class Acls(ConfigBase): have_seq_num = re.search(r"(\d+) (.*)", h) if seq_num.group(1) == have_seq_num.group( 1, - ) and have_seq_num.group(2) != seq_num.group(2): + ) and have_seq_num.group( + 2, + ) != seq_num.group(2): negate_cmd = "no " + seq_num.group(1) config.insert(config.index(w), negate_cmd) if w in h: @@ -182,10 +182,7 @@ class Acls(ConfigBase): to the desired configuration """ commands = [] - if ( - self.state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if self.state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( self.state, @@ -440,14 +437,8 @@ def set_commands(want, have): want_aces = wacl["aces"] for wace in wacl["aces"]: for hace in hacl.get("aces", []): - if ( - "sequence" in wace.keys() - and "sequence" in hace.keys() - ): - if ( - wace["sequence"] - == hace["sequence"] - ): + if "sequence" in wace.keys() and "sequence" in hace.keys(): + if wace["sequence"] == hace["sequence"]: wace_updated = get_updated_ace( wace, hace, @@ -538,16 +529,12 @@ def add_commands(want): for op, val in ace["source"]["port_protocol"].items(): if val.isdigit(): val = socket.getservbyport(int(val)) - command = ( - command + " " + op + " " + val.replace("_", "-") - ) + command = command + " " + op + " " + val.replace("_", "-") if "destination" in ace.keys(): if "any" in ace["destination"].keys(): command = command + " any" elif "subnet_address" in ace["destination"].keys(): - command = ( - command + " " + ace["destination"]["subnet_address"] - ) + command = command + " " + ace["destination"]["subnet_address"] elif "host" in ace["destination"].keys(): command = command + " host " + ace["destination"]["host"] elif "address" in ace["destination"].keys(): @@ -574,9 +561,7 @@ def add_commands(want): for proto in ace["protocol_options"].keys(): if proto == "icmp" or proto == "icmpv6": for icmp_msg in ace["protocol_options"][proto].keys(): - command = ( - command + " " + icmp_msg.replace("_", "-") - ) + command = command + " " + icmp_msg.replace("_", "-") elif proto == "ip" or proto == "ipv6": command = ( command @@ -584,9 +569,7 @@ def add_commands(want): + ace["protocol_options"][proto]["nexthop_group"] ) elif proto == "tcp": - for flag, val in ace["protocol_options"][proto][ - "flags" - ].items(): + for flag, val in ace["protocol_options"][proto]["flags"].items(): if val: command = command + " " + flag if "hop_limit" in ace.keys(): diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_address_family/bgp_address_family.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_address_family/bgp_address_family.py index 021074805..3f0ad8122 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_address_family/bgp_address_family.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_address_family/bgp_address_family.py @@ -28,9 +28,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.bgp_address_family import ( Bgp_afTemplate, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_global/bgp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_global/bgp_global.py index 4658ced75..a556a7f04 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_global/bgp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/bgp_global/bgp_global.py @@ -26,9 +26,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.bgp_global import ( Bgp_globalTemplate, ) @@ -85,10 +83,7 @@ class Bgp_global(ResourceModule): """ wantd = {} haved = {} - if ( - self.want.get("as_number") == self.have.get("as_number") - or not self.have - ): + if self.want.get("as_number") == self.have.get("as_number") or not self.have: if self.want: wantd = {self.want["as_number"]: self.want} if self.have: diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/hostname/hostname.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/hostname/hostname.py index 026e1ae19..469b95f08 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/hostname/hostname.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/hostname/hostname.py @@ -22,9 +22,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.r ResourceModule, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.hostname import ( HostnameTemplate, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/interfaces/interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/interfaces/interfaces.py index fdaa9e979..9680a5bc7 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/interfaces/interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/interfaces/interfaces.py @@ -26,9 +26,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.utils.utils import ( normalize_interface, ) @@ -131,10 +129,7 @@ class Interfaces(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, @@ -172,10 +167,7 @@ class Interfaces(ConfigBase): add_config = dict_diff(extant, desired) del_config = dict_diff(desired, extant) - if ( - "speed" in add_config.keys() - and "duplex" not in add_config.keys() - ): + if "speed" in add_config.keys() and "duplex" not in add_config.keys(): add_config.update({"duplex": desired.get("duplex")}) commands.extend(generate_commands(key, add_config, del_config)) @@ -200,10 +192,7 @@ class Interfaces(ConfigBase): add_config = dict_diff(extant, desired) del_config = dict_diff(desired, extant) - if ( - "speed" in add_config.keys() - and "duplex" not in add_config.keys() - ): + if "speed" in add_config.keys() and "duplex" not in add_config.keys(): add_config.update({"duplex": desired.get("duplex")}) commands.extend(generate_commands(key, add_config, del_config)) @@ -227,10 +216,7 @@ class Interfaces(ConfigBase): extant = dict() add_config = dict_diff(extant, desired) - if ( - "speed" in add_config.keys() - and "duplex" not in add_config.keys() - ): + if "speed" in add_config.keys() and "duplex" not in add_config.keys(): add_config.update({"duplex": desired.get("duplex")}) commands.extend(generate_commands(key, add_config, {})) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l2_interfaces/l2_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l2_interfaces/l2_interfaces.py index a34c1614a..76df21e70 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l2_interfaces/l2_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l2_interfaces/l2_interfaces.py @@ -23,9 +23,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.utils.utils import ( normalize_interface, vlan_range_to_list, @@ -135,10 +133,7 @@ class L2_interfaces(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, @@ -286,8 +281,7 @@ def set_interface(want, have): if want_allowed_vlans and has_allowed_vlans: allowed_vlans = list( - set(want_allowed_vlans.split(",")) - - set(has_allowed_vlans.split(",")), + set(want_allowed_vlans.split(",")) - set(has_allowed_vlans.split(",")), ) elif want_allowed_vlans: allowed_vlans = want_allowed_vlans.split(",") @@ -332,22 +326,15 @@ def clear_interface(want, have): has_trunk = have.get("trunk") or {} wants_trunk = want.get("trunk") or {} - if ( - "trunk_allowed_vlans" in has_trunk - and "trunk_allowed_vlans" not in wants_trunk - ): + if "trunk_allowed_vlans" in has_trunk and "trunk_allowed_vlans" not in wants_trunk: commands.append("no switchport trunk allowed vlan") - if ( - "trunk_allowed_vlans" in has_trunk - and "trunk_allowed_vlans" in wants_trunk - ): + if "trunk_allowed_vlans" in has_trunk and "trunk_allowed_vlans" in wants_trunk: for con in [want, have]: expand_trunk_allowed_vlans(con) want_allowed_vlans = want["trunk"].get("trunk_allowed_vlans") has_allowed_vlans = has_trunk.get("trunk_allowed_vlans") allowed_vlans = list( - set(has_allowed_vlans.split(",")) - - set(want_allowed_vlans.split(",")), + set(has_allowed_vlans.split(",")) - set(want_allowed_vlans.split(",")), ) if allowed_vlans: allowed_vlans = ",".join( diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l3_interfaces/l3_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l3_interfaces/l3_interfaces.py index a34e23619..75cac01bd 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l3_interfaces/l3_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/l3_interfaces/l3_interfaces.py @@ -23,9 +23,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.utils.utils import ( normalize_interface, ) @@ -133,10 +131,7 @@ class L3_interfaces(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, @@ -274,12 +269,8 @@ class L3_interfaces(ConfigBase): def set_interface(want, have): commands = [] - want_ipv4 = set( - tuple(sorted(address.items())) for address in want.get("ipv4") or [] - ) - have_ipv4 = set( - tuple(sorted(address.items())) for address in have.get("ipv4") or [] - ) + want_ipv4 = set(tuple(sorted(address.items())) for address in want.get("ipv4") or []) + have_ipv4 = set(tuple(sorted(address.items())) for address in have.get("ipv4") or []) for address in want_ipv4 - have_ipv4: address = dict(address) for param in ["secondary", "virtual"]: @@ -295,12 +286,8 @@ def set_interface(want, have): address_cmd = "ip address virtual {0}".format(address["address"]) commands.append(address_cmd) - want_ipv6 = set( - tuple(sorted(address.items())) for address in want.get("ipv6") or [] - ) - have_ipv6 = set( - tuple(sorted(address.items())) for address in have.get("ipv6") or [] - ) + want_ipv6 = set(tuple(sorted(address.items())) for address in want.get("ipv6") or []) + have_ipv6 = set(tuple(sorted(address.items())) for address in have.get("ipv6") or []) for address in want_ipv6 - have_ipv6: address = dict(address) commands.append("ipv6 address {0}".format(address["address"])) @@ -309,12 +296,8 @@ def set_interface(want, have): def clear_interface(want, have): commands = [] - want_ipv4 = set( - tuple(sorted(address.items())) for address in want.get("ipv4") or [] - ) - have_ipv4 = set( - tuple(sorted(address.items())) for address in have.get("ipv4") or [] - ) + want_ipv4 = set(tuple(sorted(address.items())) for address in want.get("ipv4") or []) + have_ipv4 = set(tuple(sorted(address.items())) for address in have.get("ipv4") or []) if not want_ipv4 and have_ipv4: commands.append("no ip address") else: @@ -339,12 +322,8 @@ def clear_interface(want, have): # Removing non-secondary removes all other interfaces break - want_ipv6 = set( - tuple(sorted(address.items())) for address in want.get("ipv6") or [] - ) - have_ipv6 = set( - tuple(sorted(address.items())) for address in have.get("ipv6") or [] - ) + want_ipv6 = set(tuple(sorted(address.items())) for address in want.get("ipv6") or []) + have_ipv6 = set(tuple(sorted(address.items())) for address in have.get("ipv6") or []) for address in have_ipv6 - want_ipv6: address = dict(address) commands.append("no ipv6 address {0}".format(address["address"])) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp/lacp.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp/lacp.py index 0d7ba850f..c3ef9c36e 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp/lacp.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp/lacp.py @@ -23,9 +23,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Lacp(ConfigBase): diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py index 64746f880..563612484 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lacp_interfaces/lacp_interfaces.py @@ -24,9 +24,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.utils.utils import ( normalize_interface, ) @@ -130,10 +128,7 @@ class Lacp_interfaces(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lag_interfaces/lag_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lag_interfaces/lag_interfaces.py index b69ae175f..0269a4cc2 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lag_interfaces/lag_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lag_interfaces/lag_interfaces.py @@ -25,9 +25,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.utils.utils import ( normalize_interface, ) @@ -132,10 +130,7 @@ class Lag_interfaces(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_global/lldp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_global/lldp_global.py index f42471ff9..47edf4366 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_global/lldp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_global/lldp_global.py @@ -24,9 +24,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Lldp_global(ConfigBase): @@ -130,10 +128,7 @@ class Lldp_global(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_interfaces/lldp_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_interfaces/lldp_interfaces.py index c0325102b..8e59b86ac 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_interfaces/lldp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/lldp_interfaces/lldp_interfaces.py @@ -24,9 +24,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.utils.utils import ( normalize_interface, ) @@ -132,10 +130,7 @@ class Lldp_interfaces(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/logging_global/logging_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/logging_global/logging_global.py index 8016b29d7..b6881afa9 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/logging_global/logging_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/logging_global/logging_global.py @@ -26,9 +26,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.logging_global import ( Logging_globalTemplate, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ntp_global/ntp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ntp_global/ntp_global.py index 0b8323d15..3d9b59c58 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ntp_global/ntp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ntp_global/ntp_global.py @@ -26,9 +26,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.ntp_global import ( Ntp_globalTemplate, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospf_interfaces/ospf_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospf_interfaces/ospf_interfaces.py index 38d46bd7c..9003864e8 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospf_interfaces/ospf_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospf_interfaces/ospf_interfaces.py @@ -25,9 +25,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.ospf_interfaces import ( Ospf_interfacesTemplate, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv2/ospfv2.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv2/ospfv2.py index f7e85d4a2..6ff7cfe9d 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv2/ospfv2.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv2/ospfv2.py @@ -27,9 +27,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Ospfv2(ConfigBase): @@ -130,10 +128,7 @@ class Ospfv2(ConfigBase): to the desired configuration """ commands = [] - if ( - self.state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if self.state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( self.state, @@ -152,9 +147,7 @@ class Ospfv2(ConfigBase): def _get_os_version(self): os_version = "4.20" if self._connection(): - os_version = self._connection.get_device_info()[ - "network_os_version" - ] + os_version = self._connection.get_device_info()["network_os_version"] return os_version def _state_replaced(self, want, have): @@ -357,9 +350,7 @@ class Ospfv2(ConfigBase): if ospf_params.get("traffic_engineering"): commands.append("traffic-engineering") if ospf_params.get("adjacency"): - threshold = ospf_params["adjacency"]["exchange_start"][ - "threshold" - ] + threshold = ospf_params["adjacency"]["exchange_start"]["threshold"] commands.append( "adjacency exchange-start threshold " + str(threshold), ) @@ -370,7 +361,7 @@ class Ospfv2(ConfigBase): if ospf_params.get("auto_cost"): commands.append( "auto-cost reference-bandwidth " - + ospf_params["auto_cost"], + + str(ospf_params["auto_cost"]["reference_bandwidth"]), ) if ospf_params.get("bfd"): os_version = self._get_os_version() @@ -386,9 +377,7 @@ class Ospfv2(ConfigBase): ) if ospf_params.get("default_metric"): commands.append( - "default-metric" - + " " - + str(ospf_params["default_metric"]), + "default-metric" + " " + str(ospf_params["default_metric"]), ) if ospf_params.get("distance"): for k, v in ospf_params["distance"].items(): @@ -441,8 +430,7 @@ class Ospfv2(ConfigBase): if ospf_params.get("passive_interface"): if "interface_list" in ospf_params["passive_interface"].keys(): commands.append( - "passive-interface " - + ospf_params["passive_interface"]["interface_list"], + "passive-interface " + ospf_params["passive_interface"]["interface_list"], ) else: commands.append("passive-interface default") @@ -454,8 +442,7 @@ class Ospfv2(ConfigBase): commands.append(c) if ospf_params.get("retransmission_threshold"): commands.append( - "retransmission-threshold lsa " - + str(ospf_params["retransmission_threshold"]), + "retransmission-threshold lsa " + str(ospf_params["retransmission_threshold"]), ) if ospf_params.get("rfc1583compatibility"): commands.append("compatible rfc1583") @@ -506,8 +493,7 @@ class Ospfv2(ConfigBase): w_inst.keys(), ) == ["process_id"]: commands.append( - "no router ospf " - + str(w_inst["process_id"]), + "no router ospf " + str(w_inst["process_id"]), ) router_context = 1 if not router_context: @@ -528,15 +514,8 @@ class Ospfv2(ConfigBase): if cmd not in commands: commands.append(cmd) other_commands += 1 - if ( - not other_commands - and len(commands) == 1 - and not router_context - ): - if ( - "no" not in commands[0] - and "router ospf" in commands[0] - ): + if not other_commands and len(commands) == 1 and not router_context: + if "no" not in commands[0] and "router ospf" in commands[0]: commands[0] = "no " + commands[0] return commands @@ -544,9 +523,7 @@ class Ospfv2(ConfigBase): def _get_router_command(inst): command = "" if inst.get("vrf") and inst.get("vrf") != "default": - command = ( - "router ospf " + str(inst["process_id"]) + " vrf " + inst["vrf"] - ) + command = "router ospf " + str(inst["process_id"]) + " vrf " + inst["vrf"] else: command = "router ospf " + str(inst["process_id"]) return command @@ -576,9 +553,7 @@ def _parse_areas(areas): ) elif area.get("not_so_stubby"): command.append( - area_cmd - + " " - + _parse_areas_filter_notsostubby(area["not_so_stubby"]), + area_cmd + " " + _parse_areas_filter_notsostubby(area["not_so_stubby"]), ) elif area.get("nssa"): command.append( @@ -597,10 +572,7 @@ def _parse_areas_filter(filter_dict): filter_cmd = filter_cmd + filter_dict.get("address") else: filter_cmd = ( - filter_cmd - + filter_dict.get("subnet_address") - + " " - + filter_dict.get("subnet_mask") + filter_cmd + filter_dict.get("subnet_address") + " " + filter_dict.get("subnet_mask") ) return filter_cmd @@ -610,17 +582,11 @@ def _parse_areas_filter_notsostubby(nss_dict): if nss_dict.get("default_information_originate"): nss_cmd = nss_cmd + "default-information-originate " for def_keys in nss_dict["default_information_originate"].keys(): - if ( - def_keys == "nssa_only" - and nss_dict["default_information_originate"]["nssa_only"] - ): + if def_keys == "nssa_only" and nss_dict["default_information_originate"]["nssa_only"]: nss_cmd = nss_cmd + " nssa-only " elif nss_dict["default_information_originate"].get(def_keys): nss_cmd = ( - nss_cmd - + def_keys - + " " - + nss_dict["default_information_originate"][def_keys] + nss_cmd + def_keys + " " + nss_dict["default_information_originate"][def_keys] ) elif "lsa" in nss_dict.keys() and nss_dict.get("lsa"): nss_cmd = nss_cmd + " lsa type-7 convert type-5" @@ -636,17 +602,11 @@ def _parse_areas_filter_nssa(nss_dict): if nss_dict.get("default_information_originate"): nss_cmd = nss_cmd + "default-information-originate " for def_keys in nss_dict["default_information_originate"].keys(): - if ( - def_keys == "nssa_only" - and nss_dict["default_information_originate"]["nssa_only"] - ): + if def_keys == "nssa_only" and nss_dict["default_information_originate"]["nssa_only"]: nss_cmd = nss_cmd + " nssa-only " elif nss_dict["default_information_originate"].get(def_keys): nss_cmd = ( - nss_cmd - + def_keys - + " " - + nss_dict["default_information_originate"][def_keys] + nss_cmd + def_keys + " " + nss_dict["default_information_originate"][def_keys] ) elif "no_summary" in nss_dict.keys() and nss_dict.get("no_summary"): nss_cmd = nss_cmd + " no-summary" @@ -660,12 +620,7 @@ def _parse_areas_range(range_dict): if range_dict.get("address"): range_cmd = range_cmd + range_dict["address"] if range_dict.get("subnet_address"): - range_cmd = ( - range_cmd - + range_dict["subnet_address"] - + " " - + range_dict["subnet_mask"] - ) + range_cmd = range_cmd + range_dict["subnet_address"] + " " + range_dict["subnet_mask"] if range_dict.get("advertise") is not None: if range_dict["advertise"]: range_cmd = range_cmd + " advertise " @@ -719,9 +674,7 @@ def _parse_max_metric(max_metric_dict): if v.get("set"): metric_cmd = metric_cmd + " " + k else: - metric_cmd = ( - metric_cmd + " " + k + " " + str(v.get("max_metric_value")) - ) + metric_cmd = metric_cmd + " " + k + " " + str(v.get("max_metric_value")) return metric_cmd @@ -732,12 +685,7 @@ def _parse_networks(net_list): if net_dict.get("prefix"): net_cmd = net_cmd + net_dict.get("prefix") else: - net_cmd = ( - net_cmd - + net_dict.get("network_address") - + " " - + net_dict.get("mask") - ) + net_cmd = net_cmd + net_dict.get("network_address") + " " + net_dict.get("mask") if net_dict.get("area"): net_cmd = net_cmd + " area " + net_dict.get("area") network_cmd.append(net_cmd) @@ -763,9 +711,7 @@ def _parse_summary_address(addr_dict): if addr_dict.get("prefix"): sum_cmd = sum_cmd + addr_dict.get("prefix") else: - sum_cmd = ( - sum_cmd + addr_dict.get("address") + " " + addr_dict.get("mask") - ) + sum_cmd = sum_cmd + addr_dict.get("address") + " " + addr_dict.get("mask") if "attribute_map" in addr_dict.keys(): sum_cmd = sum_cmd + " attribute-map " + addr_dict["attribute_map"] elif addr_dict.get("not_advertise"): @@ -785,11 +731,7 @@ def _parse_timers(timers_list, os_version="4.20"): if t_key == "lsa": if t_dict["lsa"].get("rx"): if os_version < "4.23": - t_cmd = ( - t_cmd - + "lsa arrival " - + str(t_dict["lsa"]["rx"]["min_interval"]) - ) + t_cmd = t_cmd + "lsa arrival " + str(t_dict["lsa"]["rx"]["min_interval"]) else: t_cmd = ( t_cmd diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv3/ospfv3.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv3/ospfv3.py index a16d163e5..ed01f1c5e 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv3/ospfv3.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/ospfv3/ospfv3.py @@ -29,9 +29,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u get_from_dict, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.ospfv3 import ( Ospfv3Template, ) @@ -298,11 +296,7 @@ class Ospfv3(ResourceModule): want=entry, have=hafs.pop(name, {}), ) - if ( - len(self.commands) != begin - and "afi" in entry - and entry["afi"] != "router" - ): + if len(self.commands) != begin and "afi" in entry and entry["afi"] != "router": self._rotate_commands(begin=begin) self.commands.insert( begin, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/prefix_lists/prefix_lists.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/prefix_lists/prefix_lists.py index 347f8d426..76c21a8d3 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/prefix_lists/prefix_lists.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/prefix_lists/prefix_lists.py @@ -27,9 +27,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.prefix_lists import ( Prefix_listsTemplate, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/route_maps/route_maps.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/route_maps/route_maps.py index 7f799d793..54b21b981 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/route_maps/route_maps.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/route_maps/route_maps.py @@ -26,9 +26,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u dict_merge, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.route_maps import ( Route_mapsTemplate, ) @@ -151,9 +149,9 @@ class Route_maps(ResourceModule): if c.startswith("route-map"): parent_present = True break - if ( - before_maps == after_maps and len(self.commands) > after_maps - ) or (not parent_present and len(self.commands) > after_maps): + if (before_maps == after_maps and len(self.commands) > after_maps) or ( + not parent_present and len(self.commands) > after_maps + ): self._compare_maps({k: v}, {}) self.commands.insert(after_maps, self.commands.pop(-1)) @@ -199,11 +197,7 @@ class Route_maps(ResourceModule): def _select_parser(self, w): parser = "" - if ( - "statement" in w.keys() - and "action" in w.keys() - and "sequence" in w.keys() - ): + if "statement" in w.keys() and "action" in w.keys() and "sequence" in w.keys(): parser = "route_map.statement.entries" elif "statement" in w.keys() and "action" in w.keys(): parser = "route_map.statement.action" diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/snmp_server/snmp_server.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/snmp_server/snmp_server.py index 7d850fea2..b707f8d72 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/snmp_server/snmp_server.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/snmp_server/snmp_server.py @@ -29,9 +29,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u get_from_dict, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts from ansible_collections.arista.eos.plugins.module_utils.network.eos.rm_templates.snmp_server import ( Snmp_serverTemplate, ) @@ -112,9 +110,7 @@ class Snmp_server(ResourceModule): # if state is deleted, empty out wantd and set haved to wantd if self.state == "deleted": - haved = { - k: v for k, v in iteritems(haved) if k in wantd or not wantd - } + haved = {k: v for k, v in iteritems(haved) if k in wantd or not wantd} wantd = {} # if state is deleted, empty out wantd and set haved to wantd diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/static_routes/static_routes.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/static_routes/static_routes.py index 0c4198edf..140e1f989 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/static_routes/static_routes.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/static_routes/static_routes.py @@ -25,9 +25,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u remove_empties, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Static_routes(ConfigBase): @@ -264,11 +262,7 @@ def add_commands(want): commandset = [] if not want: return commandset - vrf = ( - want["vrf"] - if "vrf" in want.keys() and want["vrf"] is not None - else None - ) + vrf = want["vrf"] if "vrf" in want.keys() and want["vrf"] is not None else None for address_family in want["address_families"]: for route in address_family["routes"]: for next_hop in route["next_hops"]: @@ -326,11 +320,7 @@ def del_commands(want, have): for command in haveconfigs: if want["vrf"] in command: commandset.append(command) - elif ( - want is not None - and "vrf" not in want.keys() - and "address_families" not in want.keys() - ): + elif want is not None and "vrf" not in want.keys() and "address_families" not in want.keys(): commandset = [] for command in haveconfigs: if "vrf" not in command: diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/vlans/vlans.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/vlans/vlans.py index 664216e6d..fe03d95c6 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/vlans/vlans.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/config/vlans/vlans.py @@ -24,9 +24,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.u to_list, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import ( - Facts, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.facts.facts import Facts class Vlans(ConfigBase): @@ -123,10 +121,7 @@ class Vlans(ConfigBase): to the desired configuration """ state = self._module.params["state"] - if ( - state in ("merged", "replaced", "overridden", "rendered") - and not want - ): + if state in ("merged", "replaced", "overridden", "rendered") and not want: self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( state, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/eos.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/eos.py index 292ad274f..e95e7e828 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/eos.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/eos.py @@ -154,10 +154,7 @@ class Cli: response = conn.get_session_config(commands, commit, replace) except ConnectionError as exc: message = getattr(exc, "err", to_text(exc)) - if ( - "check mode is not supported without configuration session" - in message - ): + if "check mode is not supported without configuration session" in message: self._module.warn( "EOS can not check config without config session", ) @@ -177,10 +174,7 @@ class Cli: response = conn.edit_config(commands, commit, replace) except ConnectionError as exc: message = getattr(exc, "err", to_text(exc)) - if ( - "check mode is not supported without configuration session" - in message - ): + if "check mode is not supported without configuration session" in message: self._module.warn( "EOS can not check config without config session", ) @@ -360,9 +354,7 @@ class HttpApi: else: configdiffobjs = candidate_obj.items - diff["config_diff"] = ( - dumps(configdiffobjs, "commands") if configdiffobjs else {} - ) + diff["config_diff"] = dumps(configdiffobjs, "commands") if configdiffobjs else {} return diff def load_config(self, config, commit=False, replace=False): diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acl_interfaces/acl_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acl_interfaces/acl_interfaces.py index 2e53931de..c06dd93cb 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acl_interfaces/acl_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acl_interfaces/acl_interfaces.py @@ -20,9 +20,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.acl_interfaces.acl_interfaces import ( Acl_interfacesArgs, @@ -68,9 +66,7 @@ class Acl_interfacesFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = [] for resource in resources: if resource: @@ -85,9 +81,7 @@ class Acl_interfacesFacts(object): self.argument_spec, {"config": objs}, ) - facts["acl_interfaces"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["acl_interfaces"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acls/acls.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acls/acls.py index 567fca8ba..a8b017f75 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acls/acls.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/acls/acls.py @@ -19,9 +19,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.acls.acls import ( AclsArgs, @@ -159,22 +157,12 @@ class AclsFacts(object): if seq: ace_dict.update({"sequence": dev_config_remainder.pop(0)}) ace_dict.update({"grant": dev_config_remainder.pop(0)}) - if ( - dev_config_remainder - and dev_config_remainder[0] == "vlan" - ): + if dev_config_remainder and dev_config_remainder[0] == "vlan": vlan_str = "" dev_config_remainder.pop(0) - if ( - dev_config_remainder - and dev_config_remainder[0] == "inner" - ): + if dev_config_remainder and dev_config_remainder[0] == "inner": vlan_str = dev_config_remainder.pop(0) + " " - vlan_str = ( - dev_config_remainder.pop(0) - + " " - + dev_config_remainder.pop(0) - ) + vlan_str = dev_config_remainder.pop(0) + " " + dev_config_remainder.pop(0) ace_dict.update({"vlan": vlan_str}) if not standard: protocol = dev_config_remainder[0] @@ -186,18 +174,12 @@ class AclsFacts(object): r"[a-z\d:\.]+", dev_config_remainder[0], ) - if ( - dev_config_remainder - and dev_config_remainder[0] == "host" - ): + if dev_config_remainder and dev_config_remainder[0] == "host": source_dict.update( {"host": dev_config_remainder.pop(1)}, ) dev_config_remainder.pop(0) - elif ( - dev_config_remainder - and dev_config_remainder[0] == "any" - ): + elif dev_config_remainder and dev_config_remainder[0] == "any": source_dict.update({"any": True}) dev_config_remainder.pop(0) elif src_prefix: @@ -212,21 +194,14 @@ class AclsFacts(object): {"wildcard_bits": dev_config_remainder.pop(0)}, ) if dev_config_remainder: - if ( - dev_config_remainder - and dev_config_remainder[0] in operator - ): + if dev_config_remainder and dev_config_remainder[0] in operator: port_dict = {} src_port = "" src_opr = dev_config_remainder.pop(0) portlist = dev_config_remainder[:] for config_remainder in portlist: addr = re.search(r"[\.\:]", config_remainder) - if ( - config_remainder == "any" - or config_remainder == "host" - or addr - ): + if config_remainder == "any" or config_remainder == "host" or addr: break src_port = src_port + " " + config_remainder dev_config_remainder.pop(0) @@ -235,10 +210,7 @@ class AclsFacts(object): source_dict.update({"port_protocol": port_dict}) ace_dict.update({"source": source_dict}) if not dev_config_remainder or standard: - if ( - dev_config_remainder - and "log" in dev_config_remainder - ): + if dev_config_remainder and "log" in dev_config_remainder: ace_dict.update({"log": True}) if bool(ace_dict): ace_list.append(ace_dict.copy()) @@ -252,16 +224,10 @@ class AclsFacts(object): r"[a-z\d:\.]+", dev_config_remainder[0], ) - if ( - dev_config_remainder - and dev_config_remainder[0] == "host" - ): + if dev_config_remainder and dev_config_remainder[0] == "host": dest_dict.update({"host": dev_config_remainder.pop(1)}) dev_config_remainder.pop(0) - elif ( - dev_config_remainder - and dev_config_remainder[0] == "any" - ): + elif dev_config_remainder and dev_config_remainder[0] == "any": dest_dict.update({"any": True}) dev_config_remainder.pop(0) elif dest_prefix: @@ -282,10 +248,7 @@ class AclsFacts(object): dest_opr = dev_config_remainder.pop(0) portlist = dev_config_remainder[:] for config_remainder in portlist: - if ( - config_remainder in operator - or config_remainder in others - ): + if config_remainder in operator or config_remainder in others: break dest_port = dest_port + " " + config_remainder dev_config_remainder.pop(0) @@ -308,10 +271,7 @@ class AclsFacts(object): if protocol in ["tcp", "6"]: protocol = "tcp" flags_dict = {} - if ( - dev_config_remainder - and dev_config_remainder[0] in flags - ): + if dev_config_remainder and dev_config_remainder[0] in flags: flaglist = dev_config_remainder[:] for config_remainder in flaglist: if config_remainder not in flags: @@ -332,19 +292,13 @@ class AclsFacts(object): protocol = "icmp" elif protocol == "58": protocol = "icmpv6" - if ( - dev_config_remainder - and dev_config_remainder[0] not in others - ): + if dev_config_remainder and dev_config_remainder[0] not in others: icmp_dict.update({dev_config_remainder[0]: True}) dev_config_remainder.pop(0) if bool(icmp_dict): protocol_option_dict.update({protocol: icmp_dict}) if protocol in ["ip", "ipv6"]: - if ( - dev_config_remainder - and dev_config_remainder[0] == "nexthop_group" - ): + if dev_config_remainder and dev_config_remainder[0] == "nexthop_group": dev_config_remainder.pop(0) ip_dict.update( {"nexthop_group": dev_config_remainder.pop(0)}, @@ -355,10 +309,7 @@ class AclsFacts(object): ace_dict.update( {"protocol_options": protocol_option_dict}, ) - if ( - dev_config_remainder - and dev_config_remainder[0] == "ttl" - ): + if dev_config_remainder and dev_config_remainder[0] == "ttl": dev_config_remainder.pop(0) op = dev_config_remainder.pop(0) ttl_dict = {op: dev_config_remainder.pop(0)} @@ -370,9 +321,9 @@ class AclsFacts(object): config_remainder, ) hoplimit_dict = { - dev_config_remainder[ - hop_index + 1 - ]: dev_config_remainder[hop_index + 2], + dev_config_remainder[hop_index + 1]: dev_config_remainder[ + hop_index + 2 + ], } ace_dict.update({"hop_limit": hoplimit_dict}) dev_config_remainder.pop(0) @@ -380,8 +331,7 @@ class AclsFacts(object): ace_dict.update({config_remainder: True}) dev_config_remainder.pop(0) if dev_config_remainder: - config.update({"line": dev_config}) - return utils.remove_empties(config) + ace_dict.update({"line": dev_config}) if bool(ace_dict): ace_list.append(ace_dict.copy()) if len(ace_list): diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_address_family/bgp_address_family.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_address_family/bgp_address_family.py index 649e5c6eb..b69687c6f 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_address_family/bgp_address_family.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_address_family/bgp_address_family.py @@ -19,9 +19,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.bgp_address_family.bgp_address_family import ( Bgp_afArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_global/bgp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_global/bgp_global.py index 9cb785a3c..478c3ec23 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_global/bgp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/bgp_global/bgp_global.py @@ -16,9 +16,7 @@ based on the configuration. """ from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.bgp_global.bgp_global import ( Bgp_globalArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/hostname/hostname.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/hostname/hostname.py index 1c95fe576..c19db2fcf 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/hostname/hostname.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/hostname/hostname.py @@ -15,9 +15,7 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.hostname.hostname import ( HostnameArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/interfaces/interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/interfaces/interfaces.py index f4d77637e..e285a3c02 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/interfaces/interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/interfaces/interfaces.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.interfaces.interfaces import ( InterfacesArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l2_interfaces/l2_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l2_interfaces/l2_interfaces.py index b77b1a611..97dfcf4a6 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l2_interfaces/l2_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l2_interfaces/l2_interfaces.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.l2_interfaces.l2_interfaces import ( L2_interfacesArgs, @@ -73,9 +71,7 @@ class L2_interfacesFacts(object): self.argument_spec, {"config": objs}, ) - facts["l2_interfaces"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["l2_interfaces"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l3_interfaces/l3_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l3_interfaces/l3_interfaces.py index 3a617507e..8648ed1aa 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l3_interfaces/l3_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/l3_interfaces/l3_interfaces.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.l3_interfaces.l3_interfaces import ( L3_interfacesArgs, @@ -64,9 +62,7 @@ class L3_interfacesFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = [] for resource in resources: @@ -80,9 +76,7 @@ class L3_interfacesFacts(object): self.argument_spec, {"config": objs}, ) - facts["l3_interfaces"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["l3_interfaces"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts @@ -106,10 +100,10 @@ class L3_interfacesFacts(object): for match in matches: address, dummy, remainder = match.partition(" ") if address == "virtual": - ipv4 = {"virtual": True, "address": remainder} + ipv4 = {"virtual": True, "address": remainder.split(" ")[0]} else: ipv4 = {"address": address} - if remainder == "secondary": + if "secondary" in remainder: ipv4["secondary"] = True config["ipv4"].append(ipv4) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp/lacp.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp/lacp.py index 28ba476b8..d2af70ee2 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp/lacp.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp/lacp.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.lacp.lacp import ( LacpArgs, @@ -64,9 +62,7 @@ class LacpFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = {} for resource in resources: diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp_interfaces/lacp_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp_interfaces/lacp_interfaces.py index 6961ca1b6..abcefd396 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp_interfaces/lacp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lacp_interfaces/lacp_interfaces.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.lacp_interfaces.lacp_interfaces import ( Lacp_interfacesArgs, @@ -64,9 +62,7 @@ class Lacp_interfacesFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = [] for resource in resources: @@ -82,9 +78,7 @@ class Lacp_interfacesFacts(object): self.argument_spec, {"config": objs}, ) - facts["lacp_interfaces"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["lacp_interfaces"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lag_interfaces/lag_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lag_interfaces/lag_interfaces.py index 73b6be3bb..15ac2dc1f 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lag_interfaces/lag_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lag_interfaces/lag_interfaces.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.lag_interfaces.lag_interfaces import ( Lag_interfacesArgs, @@ -64,9 +62,7 @@ class Lag_interfacesFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = {} for resource in resources: @@ -88,9 +84,7 @@ class Lag_interfacesFacts(object): self.argument_spec, {"config": objs}, ) - facts["lag_interfaces"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["lag_interfaces"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_global/lldp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_global/lldp_global.py index d59be7c54..2fac25dc3 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_global/lldp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_global/lldp_global.py @@ -19,9 +19,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.lldp_global.lldp_global import ( Lldp_globalArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_interfaces/lldp_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_interfaces/lldp_interfaces.py index 569986ef2..a69328ffd 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_interfaces/lldp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/lldp_interfaces/lldp_interfaces.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.lldp_interfaces.lldp_interfaces import ( Lldp_interfacesArgs, @@ -61,9 +59,7 @@ class Lldp_interfacesFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = [] for resource in resources: @@ -79,9 +75,7 @@ class Lldp_interfacesFacts(object): self.argument_spec, {"config": objs}, ) - facts["lldp_interfaces"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["lldp_interfaces"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/logging_global/logging_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/logging_global/logging_global.py index e2e0e2cfd..e1c5aa2b9 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/logging_global/logging_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/logging_global/logging_global.py @@ -16,9 +16,7 @@ based on the configuration. """ from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.logging_global.logging_global import ( Logging_globalArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ntp_global/ntp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ntp_global/ntp_global.py index 96c2321c7..b4e43da93 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ntp_global/ntp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ntp_global/ntp_global.py @@ -15,9 +15,7 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.ntp_global.ntp_global import ( Ntp_globalArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospf_interfaces/ospf_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospf_interfaces/ospf_interfaces.py index 981b6bca7..f8076aff0 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospf_interfaces/ospf_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospf_interfaces/ospf_interfaces.py @@ -17,9 +17,7 @@ based on the configuration. import re -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.ospf_interfaces.ospf_interfaces import ( Ospf_interfacesArgs, @@ -62,9 +60,7 @@ class Ospf_interfacesFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] # parse native config using the Ospf_interfaces template ospf_interfaces_facts = [] for resource in resources: diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv2/ospfv2.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv2/ospfv2.py index f5f35541a..6e6d84321 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv2/ospfv2.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv2/ospfv2.py @@ -19,9 +19,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.ospfv2.ospfv2 import ( Ospfv2Args, @@ -66,9 +64,7 @@ class Ospfv2Facts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs_list = [] objs = {} for resource in resources: @@ -467,16 +463,11 @@ class Ospfv2Facts(object): }, ) elif val == "external_lsa": - if ( - i < len(config_params) - and config_params[i + 1].isdigit() - ): + if i < len(config_params) and config_params[i + 1].isdigit(): router_lsa_dict.update( { "external_lsa": { - "max_metric_value": config_params[ - i + 1 - ], + "max_metric_value": config_params[i + 1], }, }, ) @@ -485,16 +476,11 @@ class Ospfv2Facts(object): {"external_lsa": {"set": True}}, ) elif val == "summary_lsa": - if ( - i < len(config_params) - 1 - and config_params[i + 1].isdigit() - ): + if i < len(config_params) - 1 and config_params[i + 1].isdigit(): router_lsa_dict.update( { "summary_lsa": { - "max_metric_value": config_params[ - i + 1 - ], + "max_metric_value": config_params[i + 1], }, }, ) diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv3/ospfv3.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv3/ospfv3.py index 3efa27cdf..3fd8ed21e 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv3/ospfv3.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/ospfv3/ospfv3.py @@ -19,9 +19,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.ospfv3.ospfv3 import ( Ospfv3Args, @@ -77,9 +75,7 @@ class Ospfv3Facts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] # parse native config using the Ospfv3 template ospfv3_facts = {"processes": []} diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/prefix_lists/prefix_lists.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/prefix_lists/prefix_lists.py index aa1f81b84..1a006e5e3 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/prefix_lists/prefix_lists.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/prefix_lists/prefix_lists.py @@ -16,9 +16,7 @@ based on the configuration. """ from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.prefix_lists.prefix_lists import ( Prefix_listsArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/route_maps/route_maps.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/route_maps/route_maps.py index e5ca11162..34864a795 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/route_maps/route_maps.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/route_maps/route_maps.py @@ -20,9 +20,7 @@ import re from copy import deepcopy from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.route_maps.route_maps import ( Route_mapsArgs, @@ -76,9 +74,7 @@ class Route_mapsFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] # parse native config using the Ospf_interfaces template route_maps_facts = [] # parse native config using the Route_maps template diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/snmp_server/snmp_server.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/snmp_server/snmp_server.py index 3746be94c..8c763fd7f 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/snmp_server/snmp_server.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/snmp_server/snmp_server.py @@ -15,9 +15,7 @@ for a given resource, parsed, and the facts tree is populated based on the configuration. """ -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.snmp_server.snmp_server import ( Snmp_serverArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/static_routes/static_routes.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/static_routes/static_routes.py index 85b0e7475..c97c48d5f 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/static_routes/static_routes.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/static_routes/static_routes.py @@ -19,9 +19,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.static_routes.static_routes import ( Static_routesArgs, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/vlans/vlans.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/vlans/vlans.py index 876891253..eddd4c4e5 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/vlans/vlans.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/facts/vlans/vlans.py @@ -18,9 +18,7 @@ import re from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.vlans.vlans import ( VlansArgs, @@ -61,9 +59,7 @@ class VlansFacts(object): resource_delim, resource_delim, ) - resources = [ - p.strip() for p in re.findall(find_pattern, data, re.DOTALL) - ] + resources = [p.strip() for p in re.findall(find_pattern, data, re.DOTALL)] objs = [] for resource in resources: @@ -79,9 +75,7 @@ class VlansFacts(object): self.argument_spec, {"config": objs}, ) - facts["vlans"] = [ - utils.remove_empties(cfg) for cfg in params["config"] - ] + facts["vlans"] = [utils.remove_empties(cfg) for cfg in params["config"]] ansible_facts["ansible_network_resources"].update(facts) return ansible_facts diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/address_family.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/address_family.py index dcbf45a4a..8a5aa0153 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/address_family.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/address_family.py @@ -9,9 +9,7 @@ __metaclass__ = type import re from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_list, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list from ansible_collections.arista.eos.plugins.module_utils.network.eos.providers.cli.config.bgp.neighbors import ( AFNeighbors, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/neighbors.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/neighbors.py index 760827a93..d1f865d06 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/neighbors.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/neighbors.py @@ -9,9 +9,7 @@ __metaclass__ = type import re from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_list, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list from ansible_collections.arista.eos.plugins.module_utils.network.eos.providers.providers import ( CliProvider, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/process.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/process.py index 79cecb29c..94af38eed 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/process.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/cli/config/bgp/process.py @@ -9,9 +9,7 @@ __metaclass__ = type import re from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_list, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list from ansible_collections.arista.eos.plugins.module_utils.network.eos.providers.cli.config.bgp.address_family import ( AddressFamily, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/module.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/module.py index 12d606b70..7aa8f0bf7 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/module.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/module.py @@ -10,9 +10,7 @@ from ansible.module_utils._text import to_text from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.connection import Connection -from ansible_collections.arista.eos.plugins.module_utils.network.eos.providers import ( - providers, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.providers import providers class NetworkModule(AnsibleModule): @@ -44,10 +42,7 @@ class NetworkModule(AnsibleModule): ) if not cls: - msg = ( - "unable to find suitable provider for network os %s" - % network_os - ) + msg = "unable to find suitable provider for network os %s" % network_os if self.fail_on_missing_provider: self.fail_json(msg=msg) else: diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/providers.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/providers.py index 31adec628..c3cebe8b9 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/providers.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/providers/providers.py @@ -14,9 +14,7 @@ from ansible.module_utils.six import itervalues from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( NetworkConfig, ) -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_list, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list _registered_providers = {} diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_address_family.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_address_family.py index 555ffd30e..87ec5c971 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_address_family.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_address_family.py @@ -40,9 +40,7 @@ def _tmplt_bgp_address_family(config_data): def _tmplt_bgp_params(config_data): command = "bgp" if config_data["bgp_params"].get("additional_paths"): - command += " additional-paths {additional_paths}".format( - **config_data["bgp_params"] - ) + command += " additional-paths {additional_paths}".format(**config_data["bgp_params"]) if config_data["bgp_params"]["additional_paths"] == "send": command += " any" elif config_data["bgp_params"].get("next_hop_address_family"): @@ -52,9 +50,7 @@ def _tmplt_bgp_params(config_data): elif config_data["bgp_params"].get("redistribute_internal"): command += " redistribute-internal" elif config_data["bgp_params"].get("route"): - command += " route install-map {route}".format( - **config_data["bgp_params"] - ) + command += " route install-map {route}".format(**config_data["bgp_params"]) return command @@ -66,9 +62,7 @@ def _tmplt_bgp_graceful_restart(config_data): def _tmplt_bgp_neighbor(config_data): command = "neighbor {peer}".format(**config_data["neighbor"]) if config_data["neighbor"].get("additional_paths"): - command += " additional-paths {additional_paths}".format( - **config_data["neighbor"] - ) + command += " additional-paths {additional_paths}".format(**config_data["neighbor"]) if config_data["neighbor"]["additional_paths"] == "send": command += "any" elif config_data["neighbor"].get("activate"): @@ -76,9 +70,7 @@ def _tmplt_bgp_neighbor(config_data): elif config_data["neighbor"].get("default_originate"): command += " default-originate" if config_data["neighbor"]["default_originate"].get("route_map"): - command += " route-map {route_map}".format( - **config_data["neighbor"]["default_originate"] - ) + command += " route-map " + config_data["neighbor"]["default_originate"]["route_map"] if config_data["neighbor"]["default_originate"].get("always"): command += " always" elif config_data["neighbor"].get("graceful_restart"): @@ -89,23 +81,17 @@ def _tmplt_bgp_neighbor(config_data): command += " next-hop addres-family ipv6" elif config_data["neighbor"].get("prefix_list"): command += " prefix-list {name} {direction}".format( - **config_data["neighbor"]["prefix_list"] + **config_data["neighbor"]["prefix_list"], ) elif config_data["neighbor"].get("route_map"): - command += " route-map {name} {direction}".format( - **config_data["neighbor"]["route_map"] - ) + command += " route-map {name} {direction}".format(**config_data["neighbor"]["route_map"]) elif config_data["neighbor"].get("weight"): command += " weight {weight}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("encapsulation"): - command += " encapsulation {transport}".format( - **config_data["neighbor"] - ) + command += " encapsulation {transport}".format(**config_data["neighbor"]) if config_data["neighbor"]["encapsulation"].get("source_interface"): - command += ( - " next-hop-self source-interface {source_interface}".format( - **config_data["neighbor"] - ) + command += " next-hop-self source-interface {source_interface}".format( + **config_data["neighbor"], ) return command diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_global.py index a1fcee400..d2c0b9f97 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/bgp_global.py @@ -50,10 +50,7 @@ def _tmplt_bgp_aggregate_address(config_data): def _tmplt_bgp_params(config_data): command = "bgp" if config_data["bgp_params"].get("additional_paths"): - command += ( - " additional-paths " - + config_data["bgp_params"]["additional_paths"] - ) + command += " additional-paths " + config_data["bgp_params"]["additional_paths"] if config_data["bgp_params"]["additional_paths"] == "send": command += " any" elif config_data["bgp_params"].get("advertise_inactive"): @@ -61,9 +58,7 @@ def _tmplt_bgp_params(config_data): elif config_data["bgp_params"].get("allowas_in"): command += " allowas-in" if config_data["bgp_params"]["allowas_in"].get("count"): - command += " {count}".format( - **config_data["bgp_params"]["allowas_in"] - ) + command += " {count}".format(**config_data["bgp_params"]["allowas_in"]) elif config_data["bgp_params"].get("always_compare_med"): command += " always-comapre-med" elif config_data["bgp_params"].get("asn"): @@ -72,9 +67,7 @@ def _tmplt_bgp_params(config_data): command += " auto-local-addr" elif config_data["bgp_params"].get("bestpath"): if config_data["bgp_params"]["bestpath"].get("as_path"): - command += " bestpath as-path {as_path}".format( - **config_data["bgp_params"]["bestpath"] - ) + command += " bestpath as-path {as_path}".format(**config_data["bgp_params"]["bestpath"]) elif config_data["bgp_params"]["bestpath"].get("ecmp_fast"): command += " bestpath ecmp-fast" elif config_data["bgp_params"]["bestpath"].get("med"): @@ -95,28 +88,20 @@ def _tmplt_bgp_params(config_data): elif config_data["bgp_params"].get("client_to_client"): command += " client-to-client" elif config_data["bgp_params"].get("cluster_id"): - command += " cluster-id {cluster_id}".format( - **config_data["bgp_params"] - ) + command += " cluster-id {cluster_id}".format(**config_data["bgp_params"]) elif config_data["bgp_params"].get("confederation"): command += " confederation" if config_data["bgp_params"]["confederation"].get("identifier"): - command += " identifier {identifier}".format( - **config_data["bgp_params"]["confederation"] - ) + command += " identifier " + config_data["bgp_params"]["confederation"]["identifier"] else: - command += " peers {peers}".format( - **config_data["bgp_params"]["confederation"] - ) + command += " peers {peers}".format(**config_data["bgp_params"]["confederation"]) elif config_data["bgp_params"].get("control_plane_filter"): command += " control-plane-filter default-allow" elif config_data["bgp_params"].get("convergence"): command += " convergence" if config_data["bgp_params"]["convergence"].get("slow_peer"): command += " slow-peer" - command += " time {time}".format( - **config_data["bgp_params"]["convergence"] - ) + command += " time {time}".format(**config_data["bgp_params"]["convergence"]) elif config_data["bgp_params"].get("default"): command += " default {default}".format(**config_data["bgp_params"]) elif config_data["bgp_params"].get("enforce_first_as"): @@ -124,9 +109,7 @@ def _tmplt_bgp_params(config_data): elif config_data["bgp_params"].get("host_routes"): command += " host-routes fib direct-install" elif config_data["bgp_params"].get("labeled_unicast"): - command += " labeled-unicast rib {labeled_unicast}".format( - **config_data["bgp_params"] - ) + command += " labeled-unicast rib {labeled_unicast}".format(**config_data["bgp_params"]) elif config_data["bgp_params"].get("listen"): # from eos 4.23 , 'bgp listen limit ' is replaced by 'dynamic peer max'. command = "dynamic peer max " @@ -134,29 +117,23 @@ def _tmplt_bgp_params(config_data): command += "{limit}".format(**config_data["bgp_params"]["listen"]) else: command += " range {address} peer group".format( - **config_data["bgp_params"]["listen"]["range"] + **config_data["bgp_params"]["listen"]["range"], ) if config_data["bgp_params"]["listen"]["range"]["peer_group"].get( "peer_filter", ): command += " {name} peer-filter {peer_filter}".format( - **config_data["bgp_params"]["listen"]["range"][ - "peer_group" - ] + **config_data["bgp_params"]["listen"]["range"]["peer_group"], ) else: command += " {name} remote-as {remote_as}".format( - **config_data["bgp_params"]["listen"]["range"][ - "peer_group" - ] + **config_data["bgp_params"]["listen"]["range"]["peer_group"], ) elif config_data["bgp_params"].get("log_neighbor_changes"): command += " log-neighbor-changes" elif config_data["bgp_params"].get("missing_policy"): - command += ( - " missing-policy direction {direction} action {action}".format( - **config_data["bgp_params"]["missing_policy"] - ) + command += " missing-policy direction {direction} action {action}".format( + **config_data["bgp_params"]["missing_policy"], ) elif config_data["bgp_params"].get("monitoring"): command += " monitoring" @@ -165,17 +142,13 @@ def _tmplt_bgp_params(config_data): elif config_data["bgp_params"].get("redistribute_internal"): command += " redistribute-internal" elif config_data["bgp_params"].get("route"): - command += " route install-map {route}".format( - **config_data["bgp_params"] - ) + command += " route install-map {route}".format(**config_data["bgp_params"]) elif config_data["bgp_params"].get("route_reflector"): command += " route-reflector preserve-attributes" if config_data["bgp_params"]["route_reflector"].get("preserve"): command += " always" elif config_data["bgp_params"].get("transport"): - command += " transport listen-port {transport}".format( - **config_data["bgp_params"] - ) + command += " transport listen-port {transport}".format(**config_data["bgp_params"]) return command @@ -238,13 +211,9 @@ def _tmplt_bgp_access_group(config_data): def _tmplt_bgp_maximum_paths(config_data): - command = "maximum-paths {max_equal_cost_paths}".format( - **config_data["maximum_paths"] - ) + command = "maximum-paths {max_equal_cost_paths}".format(**config_data["maximum_paths"]) if config_data["maximum_paths"].get("max_installed_ecmp_paths"): - command += " ecmp {max_installed_ecmp_paths}".format( - **config_data["maximum_paths"] - ) + command += " ecmp {max_installed_ecmp_paths}".format(**config_data["maximum_paths"]) return command @@ -265,24 +234,17 @@ def _tmplt_bgp_monitoring(config_data): def _tmplt_bgp_neighbor(config_data): command = "neighbor {neighbor_address}".format(**config_data["neighbor"]) if config_data["neighbor"].get("additional_paths"): - command += " additional-paths {additional_paths}".format( - **config_data["neighbor"] - ) + command += " additional-paths {additional_paths}".format(**config_data["neighbor"]) if config_data["neighbor"]["additional_paths"] == "send": command += "any" elif config_data["neighbor"].get("peer_group"): command += " peer group" - if ( - config_data["neighbor"]["peer_group"] - != config_data["neighbor"]["peer_group"] - ): + if config_data["neighbor"]["peer_group"] != config_data["neighbor"]["peer_group"]: command += config_data["neighbor"]["peer_group"] elif config_data["neighbor"].get("allowas_in"): command += " allowas-in" if config_data["neighbor"]["allowas_in"].get("count"): - command += " {count}".format( - **config_data["neighbor"]["allowas_in"] - ) + command += " {count}".format(**config_data["neighbor"]["allowas_in"]) elif config_data["neighbor"].get("auto_local_addr"): command += " auto-local-addr" elif config_data["neighbor"].get("bfd"): @@ -293,32 +255,26 @@ def _tmplt_bgp_neighbor(config_data): command += " default-originate" if config_data["neighbor"]["default_originate"].get("route_map"): command += " route-map {route_map}".format( - **config_data["neighbor"]["default_originate"] + **config_data["neighbor"]["default_originate"], ) if config_data["neighbor"]["default_originate"].get("always"): command += " always" elif config_data["neighbor"].get("description"): - command += " description {description}".format( - **config_data["neighbor"] - ) + command += " description {description}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("dont_capability_negotiate"): command += " dont-capability-negotiate" elif config_data["neighbor"].get("ebgp_multihop"): command += " ebgp-multiphop" if config_data["neighbor"]["ebgp_multihop"].get("ttl"): - command += " {ttl}".format( - **config_data["neighbor"]["ebgp_multihop"] - ) + command += " {ttl}".format(**config_data["neighbor"]["ebgp_multihop"]) elif config_data["neighbor"].get("encryption_password"): command += " password {type} {password}".format( - **config_data["neighbor"]["encryption_password"] + **config_data["neighbor"]["encryption_password"], ) elif config_data["neighbor"].get("enforce_first_as"): command += " enforce-first-as" elif config_data["neighbor"].get("export_localpref"): - command += " export-localpref {export_localpref}".format( - **config_data["neighbor"] - ) + command += " export-localpref {export_localpref}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("fall_over"): command += " fall-over bfd" elif config_data["neighbor"].get("graceful_restart"): @@ -326,69 +282,59 @@ def _tmplt_bgp_neighbor(config_data): elif config_data["neighbor"].get("graceful_restart_helper"): command += " graceful-restart-helper" elif config_data["neighbor"].get("idle_restart_timer"): - command += " idle-restart-timer {idle_restart_timer}".format( - **config_data["neighbor"] - ) + command += " idle-restart-timer {idle_restart_timer}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("import_localpref"): - command += " import-localpref {import_localpref}".format( - **config_data["neighbor"] - ) + command += " import-localpref {import_localpref}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("link_bandwidth"): command += " link-bandwidth" if config_data["neighbor"]["link_bandwidth"].get("auto"): command += " auto" if config_data["neighbor"]["link_bandwidth"].get("default"): - command += " default {default}".format( - **config_data["neighbor"]["link_bandwidth"] - ) + command += " default {default}".format(**config_data["neighbor"]["link_bandwidth"]) if config_data["neighbor"]["link_bandwidth"].get("update_delay"): command += " update-delay {update_delay}".format( - **config_data["neighbor"]["link_bandwidth"] + **config_data["neighbor"]["link_bandwidth"], ) elif config_data["neighbor"].get("local_as"): command += " local-as {as_number} no-prepend replace-as".format( - **config_data["neighbor"]["local_as"] + **config_data["neighbor"]["local_as"], ) if config_data["neighbor"]["local_as"].get("fallback"): command += " fallback" elif config_data["neighbor"].get("local_v6_addr"): - command += " local-v6-addr {local_v6_addr}".format( - **config_data["neighbor"] - ) + command += " local-v6-addr {local_v6_addr}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("maximum_accepted_routes"): command += " maximum-accepted-routes {count}".format( - **config_data["neighbor"]["maximum_accepted_routes"] + **config_data["neighbor"]["maximum_accepted_routes"], ) if config_data["neighbor"]["maximum_accepted_routes"].get( "warning_limit", ): command += " warning-limit {warning_limit}".format( - **config_data["neighbor"]["maximum_accepted_routes"] + **config_data["neighbor"]["maximum_accepted_routes"], ) elif config_data["neighbor"].get("maximum_received_routes"): command += " maximum-routes {count}".format( - **config_data["neighbor"]["maximum_received_routes"] + **config_data["neighbor"]["maximum_received_routes"], ) if config_data["neighbor"]["maximum_received_routes"].get( "warning_limit", ): - if config_data["neighbor"]["maximum_received_routes"][ - "warning_limit" - ].get("limit_count"): + if config_data["neighbor"]["maximum_received_routes"]["warning_limit"].get( + "limit_count", + ): command += " warning-limit {limit_count}".format( - **config_data["neighbor"]["maximum_received_routes"][ - "warning_limit" - ] + **config_data["neighbor"]["maximum_received_routes"]["warning_limit"], ) - if config_data["neighbor"]["maximum_received_routes"][ - "warning_limit" - ].get("limit_percent"): + if config_data["neighbor"]["maximum_received_routes"]["warning_limit"].get( + "limit_percent", + ): command += ( " warning-limit " + str( - config_data["neighbor"]["maximum_received_routes"][ - "warning_limit" - ]["limit_percent"], + config_data["neighbor"]["maximum_received_routes"]["warning_limit"][ + "limit_percent" + ], ) + " percent" ) @@ -405,9 +351,7 @@ def _tmplt_bgp_neighbor(config_data): elif config_data["neighbor"].get("next_hop_unchanged"): command += " next-hop-unchanged" elif config_data["neighbor"].get("next_hop_v6_address"): - command += " next-hop-v6-addr {next_hop_v6_address} in".format( - **config_data["neighbor"] - ) + command += " next-hop-v6-addr {next_hop_v6_address} in".format(**config_data["neighbor"]) elif config_data["neighbor"].get("out_delay"): command += " out-delay {out_delay}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("remote_as"): @@ -422,12 +366,10 @@ def _tmplt_bgp_neighbor(config_data): command += " peer-as {peer_as}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("prefix_list"): command += " prefix-list {name} {direction}".format( - **config_data["neighbor"]["prefix_list"] + **config_data["neighbor"]["prefix_list"], ) elif config_data["neighbor"].get("route_map"): - command += " route-map {name} {direction}".format( - **config_data["neighbor"]["route_map"] - ) + command += " route-map {name} {direction}".format(**config_data["neighbor"]["route_map"]) elif config_data["neighbor"].get("route_reflector_client"): command += " route-reflector-client" elif config_data["neighbor"].get("route_to_peer"): @@ -437,32 +379,17 @@ def _tmplt_bgp_neighbor(config_data): if config_data["neighbor"]["send_community"].get( "community_attribute", ): - command += ( - " " - + config_data["neighbor"]["send_community"][ - "community_attribute" - ] - ) + command += " " + config_data["neighbor"]["send_community"]["community_attribute"] if config_data["neighbor"]["send_community"].get("sub_attribute"): - command += ( - " " - + config_data["neighbor"]["send_community"]["sub_attribute"] - ) + command += " " + config_data["neighbor"]["send_community"]["sub_attribute"] if config_data["neighbor"]["send_community"].get( "link_bandwidth_attribute", ): - command += ( - " " - + config_data["neighbor"]["send_community"][ - "link_bandwidth_attribute" - ] - ) + command += " " + config_data["neighbor"]["send_community"]["link_bandwidth_attribute"] if config_data["neighbor"]["send_community"].get("speed"): command += " " + config_data["neighbor"]["send_community"]["speed"] if config_data["neighbor"]["send_community"].get("divide"): - command += ( - " " + config_data["neighbor"]["send_community"]["divide"] - ) + command += " " + config_data["neighbor"]["send_community"]["divide"] elif config_data["neighbor"].get("shutdown"): command += " shutdown" elif config_data["neighbor"].get("soft_reconfiguration"): @@ -474,19 +401,13 @@ def _tmplt_bgp_neighbor(config_data): if config_data["neighbor"]["transport"].get("connection_mode"): command += " connection-mode passive" else: - command += " remote-port {remote_port}".format( - **config_data["neighbor"]["transport"] - ) + command += " remote-port {remote_port}".format(**config_data["neighbor"]["transport"]) elif config_data["neighbor"].get("timers"): - command += " timers {keepalive} {holdtime}".format( - **config_data["neighbor"]["timers"] - ) + command += " timers {keepalive} {holdtime}".format(**config_data["neighbor"]["timers"]) elif config_data["neighbor"].get("ttl"): command += " ttl maximum-hops {ttl}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("update_source"): - command += " update-source {update_source}".format( - **config_data["neighbor"] - ) + command += " update-source {update_source}".format(**config_data["neighbor"]) elif config_data["neighbor"].get("weight"): command += " weight {weight}".format(**config_data["neighbor"]) return command @@ -523,9 +444,7 @@ def _tmplt_bgp_shutdown(config_data): def _tmplt_bgp_timers(config_data): - command = "timers bgp {keepalive} {holdtime}".format( - **config_data["timers"] - ) + command = "timers bgp {keepalive} {holdtime}".format(**config_data["timers"]) return command @@ -533,17 +452,11 @@ def _tmplt_bgp_ucmp(config_data): command = "ucmp" if "fec" in config_data["ucmp"]: command += " fec threshold trigger" - command += " {trigger} clear {clear} warning-only".format( - **config_data["ucmp"]["fec"] - ) + command += " {trigger} clear {clear} warning-only".format(**config_data["ucmp"]["fec"]) if "link_bandwidth" in config_data["ucmp"]: - command += " link-bandwidth {mode}".format( - **config_data["ucmp"]["link_bandwidth"] - ) + command += " link-bandwidth {mode}".format(**config_data["ucmp"]["link_bandwidth"]) if config_data["ucmp"]["link_bandwidth"].get("mode") == "update_delay": - command += " {update_delay}".format( - **config_data["ucmp"]["link_bandwidth"] - ) + command += " {update_delay}".format(**config_data["ucmp"]["link_bandwidth"]) if "mode" in config_data["ucmp"]: command += " mode 1" if config_data["ucmp"]["mode"].get("nexthops"): diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/logging_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/logging_global.py index ea7a6a0ba..11690b75c 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/logging_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/logging_global.py @@ -25,9 +25,7 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.r def _tmplt_logging_format(config_data): command = "" if "hostname" in config_data["format"]: - command = ( - "logging format hostname " + config_data["format"]["hostname"] - ) + command = "logging format hostname " + config_data["format"]["hostname"] if "sequence_numbers" in config_data["format"]: command = "logging format sequence-numbers" return command @@ -375,6 +373,7 @@ class Logging_globalTemplate(NetworkTemplate): re.VERBOSE, ), "setval": 'logging source-interface {{ source_interface }}', + "compval": "source_interface", "result": { "source_interface": "{{ val }}", }, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ntp_global.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ntp_global.py index 73359df4a..80e6ec84c 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ntp_global.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ntp_global.py @@ -74,7 +74,8 @@ def _tmplt_ntp_global_servers(config_data): if el.get("key_id"): command += " key {key_id}".format(**el) if el.get("local_interface"): - command += " local_interface {local_interface}".format(**el) + linterface = el.get("local_interface").replace(" ", "") + command += " local-interface " + linterface if el.get("maxpoll"): command += " maxpoll {maxpoll}".format(**el) if el.get("minpoll"): @@ -227,12 +228,12 @@ class Ntp_globalTemplate(NetworkTemplate): \s*(?P<prefer>prefer)* \s*(?P<burst>burst)* \s*(?P<iburst>iburst)* - \s*(?P<local_int>local-interface\s.+?)* \s*(?P<maxpoll>maxpoll\s\d+)* \s*(?P<minpoll>minpoll\s\d+)* \s*(?P<source>source\s.+?)* \s*(?P<version>version\s[1-4])* \s*(?P<key>key\s.+)* + (\s*local-interface\s(?P<local_int>\S+))? $""", re.VERBOSE, ), @@ -245,7 +246,7 @@ class Ntp_globalTemplate(NetworkTemplate): "burst": "{{ True if burst is defined }}", "iburst": "{{ True if iburst is defined }}", "key_id": "{{ key.split(" ")[1] if key is defined }}", - "local_interface": "{{ local_int.split(" ")[1:] if local_int is defined }}", + "local_interface": "{{ local_int.replace(' ', '') if local_int is defined }}", "maxpoll": "{{ maxpoll.split(" ")[1] if maxpoll is defined }}", "minpoll": "{{ minpoll.split(" ")[1] if minpoll is defined }}", "source": "{{ source.split(" ")[1] if source is defined }}", diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospf_interfaces.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospf_interfaces.py index 31ca82bce..80870b860 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospf_interfaces.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospf_interfaces.py @@ -30,9 +30,7 @@ def _tmplt_ospf_int_authentication(config_data): return command if "authentication_v3" in config_data: command = "ospfv3 authentication ipsec spi " - command += "{spi} {algorithm}".format( - **config_data["authentication_v3"] - ) + command += "{spi} {algorithm}".format(**config_data["authentication_v3"]) if "passphrase" in config_data["authentication_v3"]: command += " passphrase" if "keytype" in config_data["authentication_v3"]: @@ -40,18 +38,14 @@ def _tmplt_ospf_int_authentication(config_data): if "passphrase" not in config_data["authentication_v3"]: command += " {key}".format(**config_data["authentication_v3"]) else: - command += " {passphrase}".format( - **config_data["authentication_v3"] - ) + command += " {passphrase}".format(**config_data["authentication_v3"]) return command def _tmplt_ospf_int_encryption_v3(config_data): if "encryption" in config_data: command = "ospfv3 encryption ipsec spi ".format(**config_data) - command += "{spi} esp {encryption} {algorithm}".format( - **config_data["encryption"] - ) + command += "{spi} esp {encryption} {algorithm}".format(**config_data["encryption"]) if "passphrase" in config_data["encryption"]: command += " passphrase" if "keytype" in config_data["encryption"]: @@ -67,9 +61,7 @@ def _tmplt_ospf_int_authentication_key(config_data): if "authentication_key" in config_data: command = "ip ospf authentication-key" if "encryption" in config_data["authentication_key"]: - command += " {encryption} {key}".format( - **config_data["authentication_key"] - ) + command += " {encryption} {key}".format(**config_data["authentication_key"]) else: command += " {key}".format(**config_data["authentication_key"]) return command @@ -93,18 +85,12 @@ def _tmplt_ospf_int_bfd(config_data): def _tmplt_ospf_int_hello_interval(config_data): if "ip_params" in config_data: - command = "ospfv3 {afi} hello-interval {hello_interval}".format( - **config_data["ip_params"] - ) + command = "ospfv3 {afi} hello-interval {hello_interval}".format(**config_data["ip_params"]) else: if config_data["afi"] == "ipv4": - command = "ip ospf hello-interval {hello_interval}".format( - **config_data - ) + command = "ip ospf hello-interval {hello_interval}".format(**config_data) else: - command = "ospfv3 hello-interval {hello_interval}".format( - **config_data - ) + command = "ospfv3 hello-interval {hello_interval}".format(**config_data) return command @@ -121,9 +107,7 @@ def _tmplt_ospf_int_mtu_ignore(config_data): def _tmplt_ospf_int_network(config_data): if "ip_params" in config_data: - command = "ospfv3 {afi} network {network}".format( - **config_data["ip_params"] - ) + command = "ospfv3 {afi} network {network}".format(**config_data["ip_params"]) else: if config_data["afi"] == "ipv4": command = "ip ospf network {network}".format(**config_data) @@ -134,9 +118,7 @@ def _tmplt_ospf_int_network(config_data): def _tmplt_ospf_int_priority(config_data): if "ip_params" in config_data: - command = "ospfv3 {afi} priority {priority}".format( - **config_data["ip_params"] - ) + command = "ospfv3 {afi} priority {priority}".format(**config_data["ip_params"]) else: if config_data["afi"] == "ipv4": command = "ip ospf priority {priority}".format(**config_data) @@ -148,57 +130,38 @@ def _tmplt_ospf_int_priority(config_data): def _tmplt_ospf_int_retransmit_interval(config_data): if "ip_params" in config_data: command = ( - "ospfv3 {afi} retransmit-interval {retransmit_interval}".format( - **config_data["ip_params"] - ) + "ospfv3 " + + config_data["ip_params"]["afi"] + + " retransmit-interval " + + str(config_data["ip_params"]["retransmit_interval"]) ) else: if config_data["afi"] == "ipv4": - command = ( - "ip ospf retransmit-interval {retransmit_interval}".format( - **config_data - ) - ) + command = "ip ospf retransmit-interval {retransmit_interval}".format(**config_data) else: - command = ( - "ospfv3 retransmit-interval {retransmit_interval}".format( - **config_data - ) - ) + command = "ospfv3 retransmit-interval {retransmit_interval}".format(**config_data) return command def _tmplt_ospf_int_transmit_delay(config_data): if "ip_params" in config_data: - command = "ospfv3 {afi} transmit-delay {transmit_delay}".format( - **config_data["ip_params"] - ) + command = "ospfv3 {afi} transmit-delay {transmit_delay}".format(**config_data["ip_params"]) else: if config_data["afi"] == "ipv4": - command = "ip ospf transmit-delay {transmit_delay}".format( - **config_data - ) + command = "ip ospf transmit-delay {transmit_delay}".format(**config_data) else: - command = "ospfv3 transmit-delay {transmit_delay}".format( - **config_data - ) + command = "ospfv3 transmit-delay {transmit_delay}".format(**config_data) return command def _tmplt_ospf_int_dead_interval(config_data): if "ip_params" in config_data: - command = "ospfv3 {afi} dead-interval {dead_interval}".format( - **config_data["ip_params"] - ) + command = "ospfv3 {afi} dead-interval {dead_interval}".format(**config_data["ip_params"]) else: if config_data["afi"] == "ipv4": - command = "ip ospf dead-interval {dead_interval}".format( - **config_data - ) + command = "ip ospf dead-interval {dead_interval}".format(**config_data) else: - command = "ospfv3 dead-interval {dead_interval}".format( - **config_data - ) + command = "ospfv3 dead-interval {dead_interval}".format(**config_data) return command diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospfv3.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospfv3.py index 67e0b7787..afca25a1c 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospfv3.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/ospfv3.py @@ -42,9 +42,7 @@ def _tmplt_ospf_address_family_cmd(config_data): def _tmplt_ospf_adjacency_cmd(config_data): command = "adjacency exchange-start threshold" if "adjacency" in config_data: - command += " {threshold}".format( - **config_data["adjacency"]["exchange_start"] - ) + command += " {threshold}".format(**config_data["adjacency"]["exchange_start"]) return command @@ -52,17 +50,13 @@ def _tmplt_ospf_auto_cost(config_data): if "auto_cost" in config_data: command = "auto-cost" if "reference_bandwidth" in config_data["auto_cost"]: - command += " reference-bandwidth {reference_bandwidth}".format( - **config_data["auto_cost"] - ) + command += " reference-bandwidth " + config_data["auto_cost"]["reference_bandwidth"] return command def _tmplt_ospf_area_authentication(config_data): if "area_id" in config_data: - command = "area {area_id} authentication ipsec spi ".format( - **config_data - ) + command = "area {area_id} authentication ipsec spi ".format(**config_data) command += "{spi} {algorithm}".format(**config_data["authentication"]) if "passphrase" in config_data["authentication"]: command += " passphrase" @@ -86,9 +80,7 @@ def _tmplt_ospf_area_authentication(config_data): def _tmplt_ospf_area_encryption(config_data): if "area_id" in config_data: command = "area {area_id} encryption ipsec spi ".format(**config_data) - command += "{spi} esp {encryption} {algorithm}".format( - **config_data["encryption"] - ) + command += "{spi} esp {encryption} {algorithm}".format(**config_data["encryption"]) if "passphrase" in config_data["encryption"]: command += " passphrase" if ( @@ -113,24 +105,15 @@ def _tmplt_ospf_area_nssa(config_data): command = "area {area_id} nssa".format(**config_data) if "default_information_originate" in config_data["nssa"]: command += " default-information-originate" - if ( - "metric" - in config_data["nssa"]["default_information_originate"] - ): + if "metric" in config_data["nssa"]["default_information_originate"]: command += " metric {metric}".format( - **config_data["nssa"]["default_information_originate"] + **config_data["nssa"]["default_information_originate"], ) - if ( - "metric_type" - in config_data["nssa"]["default_information_originate"] - ): + if "metric_type" in config_data["nssa"]["default_information_originate"]: command += " metric-type {metric_type}".format( - **config_data["nssa"]["default_information_originate"] + **config_data["nssa"]["default_information_originate"], ) - if ( - "nssa_only" - in config_data["nssa"]["default_information_originate"] - ): + if "nssa_only" in config_data["nssa"]["default_information_originate"]: command += " nssa-only" if config_data["nssa"].get("nssa_only"): command += " nssa-only" @@ -177,17 +160,11 @@ def _tmplt_ospf_default_information(config_data): if "always" in config_data["default_information"]: command += " always" if "metric" in config_data["default_information"]: - command += " metric {metric}".format( - **config_data["default_information"] - ) + command += " metric {metric}".format(**config_data["default_information"]) if "metric_type" in config_data["default_information"]: - command += " metric-type {metric_type}".format( - **config_data["default_information"] - ) + command += " metric-type {metric_type}".format(**config_data["default_information"]) if "route_map" in config_data["default_information"]: - command += " route-map {route_map}".format( - **config_data["default_information"] - ) + command += " route-map {route_map}".format(**config_data["default_information"]) return command @@ -207,28 +184,22 @@ def _tmplt_ospf_max_metric(config_data): command += " router-lsa" if "external_lsa" in config_data["max_metric"]["router_lsa"]: command += " external-lsa" - if ( - "max_metric_value" - in config_data["max_metric"]["router_lsa"]["external_lsa"] - ): + if "max_metric_value" in config_data["max_metric"]["router_lsa"]["external_lsa"]: command += " {max_metric_value}".format( - **config_data["max_metric"]["router_lsa"]["external_lsa"] + **config_data["max_metric"]["router_lsa"]["external_lsa"], ) if "include_stub" in config_data["max_metric"]["router_lsa"]: if config_data["max_metric"]["router_lsa"].get("include_stub"): command += " include-stub" if "on_startup" in config_data["max_metric"]["router_lsa"]: command += " on-startup {wait_period}".format( - **config_data["max_metric"]["router_lsa"]["on_startup"] + **config_data["max_metric"]["router_lsa"]["on_startup"], ) if "summary_lsa" in config_data["max_metric"]["router_lsa"]: command += " summary-lsa" - if ( - "max_metric_value" - in config_data["max_metric"]["router_lsa"]["summary_lsa"] - ): + if "max_metric_value" in config_data["max_metric"]["router_lsa"]["summary_lsa"]: command += " {max_metric_value}".format( - **config_data["max_metric"]["router_lsa"]["summary_lsa"] + **config_data["max_metric"]["router_lsa"]["summary_lsa"], ) return command @@ -243,9 +214,7 @@ def _tmplt_ospf_redistribute(config_data): def _tmplt_ospf_timers_lsa(config_data): command = "" if "lsa" in config_data["timers"]: - command += "timers lsa {direction}".format( - **config_data["timers"]["lsa"] - ) + command += "timers lsa {direction}".format(**config_data["timers"]["lsa"]) if config_data["timers"]["lsa"]["direction"] == "rx": command += " min interval " else: @@ -263,9 +232,7 @@ def _tmplt_ospf_timers_spf(config_data): command = "" if "spf" in config_data["timers"]: command += "timers spf delay initial " - command += "{initial} {min} {max}".format( - **config_data["timers"]["spf"] - ) + command += "{initial} {min} {max}".format(**config_data["timers"]["spf"]) return command @@ -534,10 +501,8 @@ class Ospfv3Template(NetworkTemplate): "default_information_originate": { "set": "{{ True if def_origin is defined and metric is undefined and " "metric_type is undefined and nssa_only is undefined }}", - "metric": "{{ metric.split(" - ")[1]|int }}", - "metric_type": "{{ metric_type.split(" - ")[1]|int }}", + "metric": "{{ metric.split(" ")[1]|int }}", + "metric_type": "{{ metric_type.split(" ")[1]|int }}", "nssa_only": "{{ True if nssa_only is defined }}", }, "translate": "{{ True if translate is defined }}", @@ -682,8 +647,7 @@ class Ospfv3Template(NetworkTemplate): "originate": "{{ True if originate is defined }}", "always": "{{ True if always is defined }}", "metric": "{{ metric.split(" ")[1]|int }}", - "metric_type": "{{ metric_type.split(" - ")[1]|int }}", + "metric_type": "{{ metric_type.split(" ")[1]|int }}", "route_map": "{{ route_map.split(" ")[1] }}", }, }, diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/route_maps.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/route_maps.py index fb0eddfb6..f0cf52994 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/route_maps.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/route_maps.py @@ -71,9 +71,7 @@ def _tmplt_route_map_extcommunity_rt(config_data): def _tmplt_route_maps_subroutemap(config_data): command = "" if config_data["entries"].get("sub_route_map"): - command = ( - "sub-route-map " + config_data["entries"]["sub_route_map"]["name"] - ) + command = "sub-route-map " + config_data["entries"]["sub_route_map"]["name"] if config_data["entries"]["sub_route_map"].get("invert_result"): command += " invert-result" return command @@ -147,9 +145,7 @@ def _tmplt_route_map_match_aspath(config_data): def _tmplt_route_map_match_invert_aggregator_role(config_data): - config_data = config_data["entries"]["match"]["invert_result"][ - "aggregate_role" - ] + config_data = config_data["entries"]["match"]["invert_result"]["aggregate_role"] command = "match invert-result as-path aggregate-role contributor" if config_data.get("route_map"): command += " aggregator-attributes " + config_data["route_map"] @@ -204,10 +200,7 @@ def _tmplt_route_map_match_ip(config_data): if config_data.get("next_hop"): command += "next-hop prefix-list " + config_data["next_hop"] elif config_data.get("resolved_next_hop"): - command += ( - "resolved-next-hop prefix-list " - + config_data["resolved_next_hop"] - ) + command += "resolved-next-hop prefix-list " + config_data["resolved_next_hop"] return command @@ -219,10 +212,7 @@ def _tmplt_route_map_match_ipv6(config_data): if config_data.get("next_hop"): command += "next-hop prefix-list " + config_data["next_hop"] elif config_data.get("resolved_next_hop"): - command += ( - "resolved-next-hop prefix-list " - + config_data["resolved_next_hop"] - ) + command += "resolved-next-hop prefix-list " + config_data["resolved_next_hop"] return command diff --git a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/snmp_server.py b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/snmp_server.py index 52605a72e..ef83f506a 100644 --- a/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/snmp_server.py +++ b/ansible_collections/arista/eos/plugins/module_utils/network/eos/rm_templates/snmp_server.py @@ -334,16 +334,9 @@ def _tmplt_snmp_server_users_auth(config_data): command += " udp-port " + str(el["udp_port"]) command += " " + el["version"] if el.get("auth"): - command += ( - " " + el["auth"]["algorithm"] + " " + el["auth"]["auth_passphrase"] - ) + command += " " + el["auth"]["algorithm"] + " " + el["auth"]["auth_passphrase"] if el["auth"].get("encryption"): - command += ( - " priv " - + el["auth"]["encryption"] - + " " - + el["auth"]["priv_passphrase"] - ) + command += " priv " + el["auth"]["encryption"] + " " + el["auth"]["priv_passphrase"] return command @@ -360,9 +353,7 @@ def _tmplt_snmp_server_users_localized(config_data): el = el["localized"] command += " " + el["algorithm"] + " " + el["auth_passphrase"] if el.get("encryption"): - command += ( - " priv " + el["encryption"] + " " + el["priv_passphrase"] - ) + command += " priv " + el["encryption"] + " " + el["priv_passphrase"] return command diff --git a/ansible_collections/arista/eos/plugins/modules/eos_acl_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_acl_interfaces.py index e609a7c09..ec5ed843b 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_acl_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_acl_interfaces.py @@ -124,16 +124,16 @@ EXAMPLES = """ - name: Merge module attributes of given access-groups arista.eos.eos_acl_interfaces: config: - - name: Ethernet2 - access_groups: - - afi: ipv4 - acls: - name: acl01 - direction: in - - afi: ipv6 - acls: - name: acl03 - direction: out + - name: Ethernet2 + access_groups: + - afi: ipv4 + acls: + name: acl01 + direction: in + - afi: ipv6 + acls: + name: acl03 + direction: out state: merged # Commands Fired: @@ -171,12 +171,12 @@ EXAMPLES = """ - name: Replace module attributes of given access-groups arista.eos.eos_acl_interfaces: config: - - name: Ethernet2 - access_groups: - - afi: ipv4 - acls: - name: acl01 - direction: out + - name: Ethernet2 + access_groups: + - afi: ipv4 + acls: + name: acl01 + direction: out state: replaced # Commands Fired: @@ -215,12 +215,12 @@ EXAMPLES = """ - name: Override module attributes of given access-groups arista.eos.eos_acl_interfaces: config: - - name: Ethernet2 - access_groups: - - afi: ipv4 - acls: - name: acl01 - direction: out + - name: Ethernet2 + access_groups: + - afi: ipv4 + acls: + name: acl01 + direction: out state: overridden # Commands Fired: @@ -260,16 +260,16 @@ EXAMPLES = """ - name: Delete module attributes of given access-groups arista.eos.eos_acl_interfaces: config: - - name: Ethernet2 - access_groups: - - afi: ipv4 - acls: - name: acl01 - direction: in - - afi: ipv6 - acls: - name: acl03 - direction: out + - name: Ethernet2 + access_groups: + - afi: ipv4 + acls: + name: acl01 + direction: in + - afi: ipv6 + acls: + name: acl03 + direction: out state: deleted # Commands Fired: @@ -338,12 +338,12 @@ EXAMPLES = """ - name: Delete acls under afi arista.eos.eos_acl_interfaces: config: - - name: Ethernet3 - access_groups: - - afi: ipv4 - - name: Ethernet2 - access_groups: - - afi: ipv6 + - name: Ethernet3 + access_groups: + - afi: ipv4 + - name: Ethernet2 + access_groups: + - afi: ipv6 state: deleted # Commands Fired: @@ -363,8 +363,6 @@ EXAMPLES = """ # interface Ethernet2 # ip access-group acl01 in # interface Ethernet3 - - """ RETURN = """ before: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_acls.py b/ansible_collections/arista/eos/plugins/modules/eos_acls.py index 95c961d5a..fa2055b92 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_acls.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_acls.py @@ -486,17 +486,17 @@ EXAMPLES = """ - name: Merge provided configuration with device configuration arista.eos.eos_acls: config: - - afi: ipv4 - acls: - - name: test1 - aces: - - sequence: 35 - grant: deny - protocol: ospf - source: - subnet_address: 20.0.0.0/8 - destination: - any: true + - afi: ipv4 + acls: + - name: test1 + aces: + - sequence: 35 + grant: deny + protocol: ospf + source: + subnet_address: 20.0.0.0/8 + destination: + any: true state: merged # After state: @@ -528,14 +528,14 @@ EXAMPLES = """ - name: Merge to update the given configuration with an existing ace arista.eos.eos_acls: config: - - afi: ipv4 - acls: - - name: test1 - aces: - - sequence: 35 - log: true - ttl: - eq: 33 + - afi: ipv4 + acls: + - name: test1 + aces: + - sequence: 35 + log: true + ttl: + eq: 33 state: merged # After state: @@ -568,22 +568,20 @@ EXAMPLES = """ # ipv6 access-list test2 # 10 deny icmpv6 any any reject-route hop-limit eq 20 - - - name: Replace device configuration with provided configuration arista.eos.eos_acls: config: - - afi: ipv4 - acls: - - name: test1 - aces: - - sequence: 35 - grant: permit - protocol: ospf - source: - subnet_address: 20.0.0.0/8 - destination: - any: true + - afi: ipv4 + acls: + - name: test1 + aces: + - sequence: 35 + grant: permit + protocol: ospf + source: + subnet_address: 20.0.0.0/8 + destination: + any: true state: replaced # After state: @@ -599,7 +597,6 @@ EXAMPLES = """ # ipv6 access-list test2 # 10 deny icmpv6 any any reject-route hop-limit eq 20 - # Using overridden # Before state: @@ -618,21 +615,20 @@ EXAMPLES = """ # 10 deny icmpv6 any any reject-route hop-limit eq 20 - - name: override device configuration with provided configuration arista.eos.eos_acls: config: - - afi: ipv4 - acls: - - name: test1 - aces: - - sequence: 35 - grant: permit - protocol: ospf - source: - subnet_address: 20.0.0.0/8 - destination: - any: true + - afi: ipv4 + acls: + - name: test1 + aces: + - sequence: 35 + grant: permit + protocol: ospf + source: + subnet_address: 20.0.0.0/8 + destination: + any: true state: overridden # After state: @@ -661,9 +657,9 @@ EXAMPLES = """ - name: Delete provided configuration arista.eos.eos_acls: config: - - afi: ipv4 - acls: - - name: test1 + - afi: ipv4 + acls: + - name: test1 state: deleted # After state: @@ -688,64 +684,62 @@ EXAMPLES = """ # returns: - # arista.eos.eos_acls: # config: -# - afi: "ipv4" -# acls: -# - name: test1 -# aces: -# - sequence: 35 -# grant: "deny" -# protocol: "ospf" -# source: -# subnet_address: 20.0.0.0/8 -# destination: -# any: true -# - afi: "ipv6" -# acls: -# - name: test2 -# aces: -# - sequence: 40 -# grant: "permit" -# vlan: "55 0xE2" -# protocol: "icmpv6" -# log: true -# source: -# any: true -# destination: -# any: true - +# - afi: "ipv4" +# acls: +# - name: test1 +# aces: +# - sequence: 35 +# grant: "deny" +# protocol: "ospf" +# source: +# subnet_address: 20.0.0.0/8 +# destination: +# any: true +# - afi: "ipv6" +# acls: +# - name: test2 +# aces: +# - sequence: 40 +# grant: "permit" +# vlan: "55 0xE2" +# protocol: "icmpv6" +# log: true +# source: +# any: true +# destination: +# any: true # using rendered - name: Delete provided configuration arista.eos.eos_acls: config: - - afi: ipv4 - acls: - - name: test1 - aces: - - sequence: 35 - grant: deny - protocol: ospf - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - - afi: ipv6 - acls: - - name: test2 - aces: - - sequence: 40 - grant: permit - vlan: 55 0xE2 - protocol: icmpv6 - log: true - source: - any: true - destination: - any: true + - afi: ipv4 + acls: + - name: test1 + aces: + - sequence: 35 + grant: deny + protocol: ospf + source: + subnet_address: 20.0.0.0/8 + destination: + any: true + - afi: ipv6 + acls: + - name: test2 + aces: + - sequence: 40 + grant: permit + vlan: 55 0xE2 + protocol: icmpv6 + log: true + source: + any: true + destination: + any: true state: rendered # returns: @@ -755,7 +749,6 @@ EXAMPLES = """ # ip access-list test2 # 40 permit vlan 55 0xE2 icmpv6 any any log - # Using Parsed # parsed_acls.cfg @@ -832,7 +825,6 @@ EXAMPLES = """ # "afi": "ipv6" # } # ] - """ RETURN = """ before: @@ -868,9 +860,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.acls.acls import ( AclsArgs, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.acls.acls import ( - Acls, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.acls.acls import Acls def main(): diff --git a/ansible_collections/arista/eos/plugins/modules/eos_bgp.py b/ansible_collections/arista/eos/plugins/modules/eos_bgp.py index a9d01d60a..e740f6c2e 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_bgp.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_bgp.py @@ -273,67 +273,67 @@ EXAMPLES = """ router_id: 192.0.2.1 log_neighbor_changes: true neighbors: - - neighbor: 203.0.113.5 - remote_as: 64511 - timers: - keepalive: 300 - holdtime: 360 - - neighbor: 198.51.100.2 - remote_as: 64498 + - neighbor: 203.0.113.5 + remote_as: 64511 + timers: + keepalive: 300 + holdtime: 360 + - neighbor: 198.51.100.2 + remote_as: 64498 networks: - - prefix: 198.51.100.0 - route_map: RMAP_1 - - prefix: 192.0.2.0 - masklen: 23 - address_family: - - afi: ipv4 - safi: unicast - redistribute: - - protocol: isis + - prefix: 198.51.100.0 route_map: RMAP_1 + - prefix: 192.0.2.0 + masklen: 23 + address_family: + - afi: ipv4 + safi: unicast + redistribute: + - protocol: isis + route_map: RMAP_1 operation: merge - name: Configure BGP neighbors arista.eos.eos_bgp: config: bgp_as: 64496 neighbors: - - neighbor: 192.0.2.10 - remote_as: 64496 - description: IBGP_NBR_1 - ebgp_multihop: 100 - timers: - keepalive: 300 - holdtime: 360 - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 + - neighbor: 192.0.2.10 + remote_as: 64496 + description: IBGP_NBR_1 + ebgp_multihop: 100 + timers: + keepalive: 300 + holdtime: 360 + - neighbor: 192.0.2.15 + remote_as: 64496 + description: IBGP_NBR_2 + ebgp_multihop: 150 operation: merge - name: Configure root-level networks for BGP arista.eos.eos_bgp: config: bgp_as: 64496 networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - prefix: 203.0.113.32 - masklen: 27 - route_map: RMAP_2 + - prefix: 203.0.113.0 + masklen: 27 + route_map: RMAP_1 + - prefix: 203.0.113.32 + masklen: 27 + route_map: RMAP_2 operation: merge - name: Configure BGP neighbors under address family mode arista.eos.eos_bgp: config: bgp_as: 64496 address_family: - - afi: ipv4 - neighbors: - - neighbor: 203.0.113.10 - activate: yes - default_originate: true - - neighbor: 192.0.2.15 - activate: yes - graceful_restart: true + - afi: ipv4 + neighbors: + - neighbor: 203.0.113.10 + activate: true + default_originate: true + - neighbor: 192.0.2.15 + activate: true + graceful_restart: true operation: merge - name: remove bgp as 64496 from config arista.eos.eos_bgp: @@ -341,7 +341,6 @@ EXAMPLES = """ bgp_as: 64496 operation: delete """ - RETURN = """ commands: description: The list of configuration mode commands to send to the device diff --git a/ansible_collections/arista/eos/plugins/modules/eos_bgp_address_family.py b/ansible_collections/arista/eos/plugins/modules/eos_bgp_address_family.py index 67aaabef7..e281bf2b0 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_bgp_address_family.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_bgp_address_family.py @@ -234,46 +234,101 @@ options: """ EXAMPLES = """ +# Using Merged -# Using merged - -# Before state - +# Before state: +# ------------- # veos(config)#show running-config | section bgp # veos(config)# - - name: Merge provided configuration with device configuration - arista.eos.eos_bgp_address_family: - config: - as_number: "10" - address_family: - - afi: "ipv4" - redistribute: - - protocol: "ospfv3" - ospf_route: "external" - network: - - address: "1.1.1.0/24" - - address: "1.5.1.0/24" - route_map: "MAP01" - - afi: "ipv6" - bgp_params: - additional_paths: "receive" - neighbor: - - peer: "peer2" - default_originate: - always: True - - afi: "ipv6" - redistribute: - - protocol: "isis" - isis_level: "level-2" - route_target: - mode: "export" - target: "33:11" - vrf: "vrft" - state: merged +- name: Merge provided configuration with device configuration + arista.eos.eos_bgp_address_family: + config: + as_number: "10" + address_family: + - afi: "ipv4" + redistribute: + - protocol: "ospfv3" + ospf_route: "external" + network: + - address: "1.1.1.0/24" + - address: "1.5.1.0/24" + route_map: "MAP01" + - afi: "ipv6" + bgp_params: + additional_paths: "receive" + neighbor: + - peer: "peer2" + default_originate: + always: true + - afi: "ipv6" + redistribute: + - protocol: "isis" + isis_level: "level-2" + route_target: + mode: "export" + target: "33:11" + vrf: "vrft" + state: merged -# After state: +# Task output: +# ------------ +# before: {} +# +# commands: +# - router bgp 10 +# - address-family ipv4 +# - redistribute ospfv3 match external +# - network 1.1.1.0/24 +# - network 1.5.1.0/24 route-map MAP01 +# - exit +# - address-family ipv6 +# - neighbor peer2 default-originate always +# - bgp additional-paths receive +# - exit +# - vrf vrft +# - address-family ipv6 +# - redistribute isis level-2 +# - route-target export 33:11 +# - exit +# - exit +# +# after: +# address_family: +# - afi: ipv4 +# neighbor: +# - activate: true +# peer: 1.1.1.1 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# bgp_params: +# additional_paths: receive +# neighbor: +# - activate: true +# default_originate: +# always: true +# peer: peer2 +# - afi: ipv6 +# redistribute: +# - isis_level: level-2 +# protocol: isis +# route_target: +# action: export +# target: '33:11' +# vrf: vrft +# as_number: '10' +# "before": {}, +# "changed": true, + +# After state: +# ------------ # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -295,77 +350,11 @@ EXAMPLES = """ # address-family ipv6 # route-target export 33:11 # redistribute isis level-2 -# veos(config-router-bgp)# - -# Module Execution: -# "after": { -# "address_family": [ -# { -# "afi": "ipv4", -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "isis_level": "level-2", -# "protocol": "isis" -# } -# ], -# "route_target": { -# "mode": "export", -# "target": "33:11" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "before": {}, -# "changed": true, -# "commands": [ -# "router bgp 10", -# "address-family ipv4", -# "redistribute ospfv3 match external", -# "network 1.1.1.0/24", -# "network 1.5.1.0/24 route-map MAP01", -# "exit", -# "address-family ipv6", -# "neighbor peer2 default-originate always", -# "bgp additional-paths receive", -# "exit", -# "vrf vrft", -# "address-family ipv6", -# "redistribute isis level-2", -# "route-target export 33:11", -# "exit", -# "exit" -# ], - -# Using replaced: - -# Before State: +# Using replaced +# Before state: +# ------------- # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -387,27 +376,101 @@ EXAMPLES = """ # address-family ipv6 # route-target export 33:11 # redistribute isis level-2 -# veos(config-router-bgp)# -# - - name: Replace - arista.eos.eos_bgp_address_family: - config: - as_number: "10" - address_family: - - afi: "ipv6" - vrf: "vrft" - redistribute: - - protocol: "ospfv3" - ospf_route: "external" - - afi: "ipv6" - redistribute: - - protocol: "isis" - isis_level: "level-2" - state: replaced +- name: Replace running config section with provided config + arista.eos.eos_bgp_address_family: + config: + as_number: "10" + address_family: + - afi: "ipv6" + vrf: "vrft" + redistribute: + - protocol: "ospfv3" + ospf_route: "external" + - afi: "ipv6" + redistribute: + - protocol: "isis" + isis_level: "level-2" + state: replaced -# After State: +# Task output: +# ------------ +# before: +# address_family: +# - afi: ipv4 +# neighbor: +# - activate: true +# peer: 1.1.1.1 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# bgp_params: +# additional_paths: receive +# neighbor: +# - activate: true +# default_originate: +# always: true +# peer: peer2 +# - afi: ipv6 +# redistribute: +# - isis_level: level-2 +# protocol: isis +# route_target: +# action: export +# target: '33:11' +# vrf: vrft +# as_number: '10' +# +# commands: +# - router bgp 10 +# - vrf vrft +# - address-family ipv6 +# - redistribute ospfv3 match external +# - no redistribute isis level-2 +# - no route-target export 33:11 +# - exit +# - exit +# - address-family ipv6 +# - redistribute isis level-2 +# - no neighbor peer2 activate +# - no bgp additional-paths receive +# - exit +# +# after: +# address_family: +# - afi: ipv4 +# neighbor: +# - activate: true +# peer: 1.1.1.1 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# redistribute: +# - isis_level: level-2 +# protocol: isis +# - afi: ipv6 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# vrf: vrft +# as_number: '10' +# After state: +# ------------ # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -427,145 +490,11 @@ EXAMPLES = """ # vrf vrft # address-family ipv6 # redistribute ospfv3 match external -# veos(config-router-bgp)# -# -# -# # Module Execution: -# -# "after": { -# "address_family": [ -# { -# "afi": "ipv4", -# "neighbor": [ -# { -# "activate": true, -# "peer": "1.1.1.1" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "redistribute": [ -# { -# "isis_level": "level-2", -# "protocol": "isis" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ], -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "before": { -# "address_family": [ -# { -# "afi": "ipv4", -# "neighbor": [ -# { -# "activate": true, -# "peer": "1.1.1.1" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "activate": true, -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "isis_level": "level-2", -# "protocol": "isis" -# } -# ], -# "route_target": { -# "mode": "export", -# "target": "33:11" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "changed": true, -# "commands": [ -# "router bgp 10", -# "vrf vrft", -# "address-family ipv6", -# "redistribute ospfv3 match external", -# "no redistribute isis level-2", -# "no route-target export 33:11", -# "exit", -# "exit", -# "address-family ipv6", -# "redistribute isis level-2", -# "no neighbor peer2 activate", -# "no bgp additional-paths receive", -# "exit" -# ], # Using overridden (overriding af at global context): -# Before state: +# Before state: +# ------------- # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -585,23 +514,83 @@ EXAMPLES = """ # vrf vrft # address-family ipv6 # redistribute ospfv3 match external -# veos(config-router-bgp)# - - name: Overridden - arista.eos.eos_bgp_address_family: - config: - as_number: "10" - address_family: - - afi: "ipv4" - bgp_params: - additional_paths: "receive" - neighbor: - - peer: "peer2" - default_originate: - always: True - state: overridden +- name: Override running config with provided config + arista.eos.eos_bgp_address_family: + config: + as_number: "10" + address_family: + - afi: "ipv4" + bgp_params: + additional_paths: "receive" + neighbor: + - peer: "peer2" + default_originate: + always: true + state: overridden -# After State: + +# +# Task output: +# ------------ +# before: +# address_family: +# - afi: ipv4 +# neighbor: +# - activate: true +# peer: 1.1.1.1 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# redistribute: +# - isis_level: level-2 +# protocol: isis +# - afi: ipv6 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# vrf: vrft +# as_number: '10' +# +# commands: +# - router bgp 10 +# - address-family ipv4 +# - no redistribute ospfv3 match external +# - no network 1.1.1.0/24 +# - no network 1.5.1.0/24 route-map MAP01 +# - neighbor peer2 default-originate always +# - no neighbor 1.1.1.1 activate +# - bgp additional-paths receive +# - exit +# - no address-family ipv6 +# +# after: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# - afi: ipv6 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# vrf: vrft +# as_number: '10' + +# After state: +# ------------ # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -615,113 +604,11 @@ EXAMPLES = """ # vrf vrft # address-family ipv6 # redistribute ospfv3 match external -# veos(config-router-bgp)# -# -# Module Execution: -# -# "after": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ], -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "before": { -# "address_family": [ -# { -# "afi": "ipv4", -# "neighbor": [ -# { -# "activate": true, -# "peer": "1.1.1.1" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "redistribute": [ -# { -# "isis_level": "level-2", -# "protocol": "isis" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ], -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "changed": true, -# "commands": [ -# "router bgp 10", -# "address-family ipv4", -# "no redistribute ospfv3 match external", -# "no network 1.1.1.0/24", -# "no network 1.5.1.0/24 route-map MAP01", -# "neighbor peer2 default-originate always", -# "no neighbor 1.1.1.1 activate", -# "bgp additional-paths receive", -# "exit", -# "no address-family ipv6" -# ], # using Overridden (overridding af in vrf context): -# Before State: - +# Before state: +# ------------- # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -745,26 +632,101 @@ EXAMPLES = """ # route-target export 33:11 # redistribute isis level-2 # redistribute ospfv3 match external -# veos(config-router-bgp)# +- name: Override running config with provided config + arista.eos.eos_bgp_address_family: + config: + as_number: "10" + address_family: + - afi: "ipv4" + bgp_params: + additional_paths: "receive" + neighbor: + - peer: "peer2" + default_originate: + always: true + vrf: vrft + state: overridden - - name: Overridden - arista.eos.eos_bgp_address_family: - config: - as_number: "10" - address_family: - - afi: "ipv4" - bgp_params: - additional_paths: "receive" - neighbor: - - peer: "peer2" - default_originate: - always: True - vrf: vrft - state: overridden - -# After State: +# Task output: +# ------------ +# before: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# - afi: ipv6 +# redistribute: +# - isis_level: level-2 +# protocol: isis +# - ospf_route: external +# protocol: ospfv3 +# route_target: +# action: export +# target: '33:11' +# vrf: vrft +# as_number: '10' +# +# commands: +# - router bgp 10 +# - vrf vrft +# - address-family ipv4 +# - neighbor peer2 default-originate always +# - bgp additional-paths receive +# - exit +# - exit +# - vrf vrft +# - no address-family ipv6 +# +# after: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# vrf: vrft +# as_number: '10' +# After state: +# ------------ # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -785,146 +747,11 @@ EXAMPLES = """ # vrf vrft # address-family ipv4 # bgp additional-paths receive -# veos(config-router-bgp)# -# -# Module Execution: -# -# "after": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ] -# }, -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "before": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "isis_level": "level-2", -# "protocol": "isis" -# }, -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ], -# "route_target": { -# "mode": "export", -# "target": "33:11" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "changed": true, -# "commands": [ -# "router bgp 10", -# "vrf vrft", -# "address-family ipv4", -# "neighbor peer2 default-originate always", -# "bgp additional-paths receive", -# "exit", -# "exit", -# " vrf vrft", -# "no address-family ipv6" -# ], -# Using Deleted: +# Using deleted +# Before state: +# ------------- # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -946,20 +773,72 @@ EXAMPLES = """ # vrf vrft # address-family ipv4 # bgp additional-paths receive -# veos(config-router-bgp)# - - name: Delete - arista.eos.eos_bgp_address_family: - config: - as_number: "10" - address_family: - - afi: "ipv6" - vrf: "vrft" - - afi: "ipv6" - state: deleted +- name: Delete running config for provided afi + arista.eos.eos_bgp_address_family: + config: + as_number: "10" + address_family: + - afi: "ipv6" + vrf: "vrft" + - afi: "ipv6" + state: deleted -# After State: +# Task output: +# ------------ +# before: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# vrf: vrft +# as_number: '10' +# +# after: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# vrf: vrft +# as_number: '10' +# After state: +# ------------ # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -977,111 +856,12 @@ EXAMPLES = """ # vrf vrft # address-family ipv4 # bgp additional-paths receive -# veos(config-router-bgp)# -# -# Module Execution: -# -# "after": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# "before": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ] -# }, -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, -# Using parsed: -# parsed_bgp_address_family.cfg : +# Using parsed +# parsed.cfg +# ---------- # router bgp 10 # neighbor n2 peer group # neighbor n2 next-hop-unchanged @@ -1115,82 +895,52 @@ EXAMPLES = """ # address-family ipv6 # redistribute ospfv3 match external - - name: parse configs - arista.eos.eos_bgp_address_family: - running_config: "{{ lookup('file', './parsed_bgp_address_family.cfg') }}" - state: parsed +- name: parse running config and generate structred facts + arista.eos.eos_bgp_address_family: + running_config: "{{ lookup('file', './parsed_bgp_address_family.cfg') }}" + state: parsed -# Module Execution: -# "parsed": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "neighbor": [ -# { -# "next_hop_unchanged": true, -# "peer": "n2" -# } -# ], -# "redistribute": [ -# { -# "isis_level": "level-2", -# "protocol": "isis" -# } -# ] -# }, -# { -# "afi": "ipv4", -# "route_target": { -# "mode": "import", -# "target": "20:11" -# }, -# "vrf": "bgp_10" -# }, -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "vrf": "vrft" -# }, -# { -# "afi": "ipv6", -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ], -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# } -# } +# Task output: +# ------------ +# parsed: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv6 +# neighbor: +# - next_hop_unchanged: true +# peer: n2 +# redistribute: +# - isis_level: level-2 +# protocol: isis +# - afi: ipv4 +# route_target: +# action: import +# target: '20:11' +# vrf: bgp_10 +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# vrf: vrft +# - afi: ipv6 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# vrf: vrft +# as_number: '10' -# Using gathered: +# Using gathered -# Device config: +# running config +# -------------- # veos(config-router-bgp)#show running-config | section bgp # router bgp 10 # neighbor peer2 peer group @@ -1208,110 +958,134 @@ EXAMPLES = """ # vrf vrft # address-family ipv4 # bgp additional-paths receive -# veos(config-router-bgp)# - - - name: gather configs - arista.eos.eos_bgp_address_family: - state: gathered - -# Module Execution: -# "gathered": { -# "address_family": [ -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "neighbor": [ -# { -# "default_originate": { -# "always": true -# }, -# "peer": "peer2" -# } -# ], -# "network": [ -# { -# "address": "1.1.1.0/24" -# }, -# { -# "address": "1.5.1.0/24", -# "route_map": "MAP01" -# } -# ], -# "redistribute": [ -# { -# "ospf_route": "external", -# "protocol": "ospfv3" -# } -# ] -# }, -# { -# "afi": "ipv4", -# "bgp_params": { -# "additional_paths": "receive" -# }, -# "vrf": "vrft" -# } -# ], -# "as_number": "10" -# }, - -# using rendered: - - name: Render - arista.eos.eos_bgp_address_family: - config: - as_number: "10" - address_family: - - afi: "ipv4" - redistribute: - - protocol: "ospfv3" - ospf_route: "external" - network: - - address: "1.1.1.0/24" - - address: "1.5.1.0/24" - route_map: "MAP01" - - afi: "ipv6" - bgp_params: - additional_paths: "receive" - neighbor: - - peer: "peer2" - default_originate: - always: True - - afi: "ipv6" - redistribute: - - protocol: "isis" - isis_level: "level-2" - route_target: - mode: "export" - target: "33:11" - vrf: "vrft" +- name: gather running config + arista.eos.eos_bgp_address_family: + state: gathered - state: rendered +# Task output: +# ------------ +# gathered: +# address_family: +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# neighbor: +# - default_originate: +# always: true +# peer: peer2 +# network: +# - address: 1.1.1.0/24 +# - address: 1.5.1.0/24 +# route_map: MAP01 +# redistribute: +# - ospf_route: external +# protocol: ospfv3 +# - afi: ipv4 +# bgp_params: +# additional_paths: receive +# vrf: vrft +# as_number: '10' -# Module Execution: +# using rendered -# "rendered": [ -# "router bgp 10", -# "address-family ipv4", -# "redistribute ospfv3 match external", -# "network 1.1.1.0/24", -# "network 1.5.1.0/24 route-map MAP01", -# "exit", -# "address-family ipv6", -# "neighbor peer2 default-originate always", -# "bgp additional-paths receive", -# "exit", -# "vrf vrft", -# "address-family ipv6", -# "redistribute isis level-2", -# "route-target export 33:11", -# "exit", -# "exit" -# ] -# +- name: Render CLI commands for provided config + arista.eos.eos_bgp_address_family: + config: + as_number: "10" + address_family: + - afi: "ipv4" + redistribute: + - protocol: "ospfv3" + ospf_route: "external" + network: + - address: "1.1.1.0/24" + - address: "1.5.1.0/24" + route_map: "MAP01" + - afi: "ipv6" + bgp_params: + additional_paths: "receive" + neighbor: + - peer: "peer2" + default_originate: + always: true + - afi: "ipv6" + redistribute: + - protocol: "isis" + isis_level: "level-2" + route_target: + mode: "export" + target: "33:11" + vrf: "vrft" + state: rendered +# Task output: +# ------------ +# rendered: +# - router bgp 10 +# - address-family ipv4 +# - redistribute ospfv3 match external +# - network 1.1.1.0/24 +# - network 1.5.1.0/24 route-map MAP01 +# - exit +# - address-family ipv6 +# - neighbor peer2 default-originate always +# - bgp additional-paths receive +# - exit +# - vrf vrft +# - address-family ipv6 +# - redistribute isis level-2 +# - route-target export 33:11 +# - exit +# - exit +""" +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - router bgp 10 + - address-family ipv4 + - redistribute ospfv3 match external + - network 1.1.1.0/24 +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - router bgp 10 + - address-family ipv4 + - redistribute ospfv3 match external + - network 1.1.1.0/24 +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: dict + sample: > + This output will always be in the same format as the + module argspec. """ from ansible.module_utils.basic import AnsibleModule diff --git a/ansible_collections/arista/eos/plugins/modules/eos_bgp_global.py b/ansible_collections/arista/eos/plugins/modules/eos_bgp_global.py index 06168db54..b7034c11a 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_bgp_global.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_bgp_global.py @@ -91,7 +91,7 @@ options: type: dict suboptions: set: - description: When True, it is set. + description: When true, it is set. type: bool count: description: Number of local ASNs allowed in a BGP update. @@ -238,7 +238,7 @@ options: type: dict suboptions: set: - description: When True route_reflector is set. + description: When true route_reflector is set. type: bool preserve: description: preserve route attributes, overwriting route-map changes @@ -267,7 +267,7 @@ options: type: dict suboptions: set: - description: When True, graceful restart is set. + description: When true, graceful restart is set. type: bool restart_time: description: Set the max time needed to restart and come back up. @@ -340,7 +340,7 @@ options: type: dict suboptions: set: - description: When True, it is set. + description: When true, it is set. type: bool count: description: Number of local ASNs allowed in a BGP update. @@ -379,7 +379,7 @@ options: description: Time-to-live in the range 1-255 hops. type: int set: - description: If True, ttl is not set. + description: If true, ttl is not set. type: bool enforce_first_as: description: Enforce the First AS for EBGP routes(default). @@ -410,7 +410,7 @@ options: type: dict suboptions: set: - description: If True, set link bandwidth + description: If true, set link bandwidth type: bool auto: description: Enable link bandwidth auto generation for routes from this peer. @@ -505,7 +505,7 @@ options: type: dict suboptions: set: - description: If True, set remove_private_as. + description: If true, set remove_private_as. type: bool all: description: Remove private AS number. @@ -657,7 +657,7 @@ options: description: Route Target. type: str shutdown: - description: When True, shut down BGP. + description: When true, shut down BGP. type: bool timers: description: Timers. @@ -699,7 +699,7 @@ options: type: dict suboptions: set: - description: If True, ucmp mode is set to 1. + description: If true, ucmp mode is set to 1. type: bool nexthops: description: Value for total number UCMP nexthops. @@ -771,7 +771,7 @@ options: type: dict suboptions: set: - description: When True, it is set. + description: When true, it is set. type: bool count: description: Number of local ASNs allowed in a BGP update. @@ -918,7 +918,7 @@ options: type: dict suboptions: set: - description: When True route_reflector is set. + description: When true route_reflector is set. type: bool preserve: description: preserve route attributes, overwriting route-map changes @@ -947,7 +947,7 @@ options: type: dict suboptions: set: - description: When True, graceful restart is set. + description: When true, graceful restart is set. type: bool restart_time: description: Set the max time needed to restart and come back up. @@ -1003,7 +1003,7 @@ options: type: dict suboptions: set: - description: When True, it is set. + description: When true, it is set. type: bool count: description: Number of local ASNs allowed in a BGP update. @@ -1042,7 +1042,7 @@ options: description: Time-to-live in the range 1-255 hops. type: int set: - description: If True, ttl is not set. + description: If true, ttl is not set. type: bool enforce_first_as: description: Enforce the First AS for EBGP routes(default). @@ -1073,7 +1073,7 @@ options: type: dict suboptions: set: - description: If True, set link bandwidth + description: If true, set link bandwidth type: bool auto: description: Enable link bandwidth auto generation for routes from this peer. @@ -1168,7 +1168,7 @@ options: type: dict suboptions: set: - description: If True, set remove_private_as. + description: If true, set remove_private_as. type: bool all: description: Remove private AS number. @@ -1325,7 +1325,7 @@ options: description: Router id. type: str shutdown: - description: When True, shut down BGP. + description: When true, shut down BGP. type: bool timers: description: Timers. @@ -1367,7 +1367,7 @@ options: type: dict suboptions: set: - description: If True, ucmp mode is set to 1. + description: If true, ucmp mode is set to 1. type: bool nexthops: description: Value for total number UCMP nexthops. @@ -1406,72 +1406,156 @@ options: module for prior cleanup. - Refer to examples for more details. type: str - choices: [deleted, merged, purged, replaced, gathered, rendered, parsed] + choices: [deleted, merged, overridden, purged, replaced, gathered, rendered, parsed] default: merged """ EXAMPLES = """ -# Using merged -# Before state +# Using Merged +# Before state: +# ------------- # veos(config)#show running-config | section bgp # veos(config)# - - name: Merge provided configuration with device configuration - arista.eos.eos_bgp_global: - config: - as_number: "100" - bgp_params: - host_routes: True - convergence: - slow_peer: True - time: 6 - additional_paths: "send" - log_neighbor_changes: True - maximum_paths: - max_equal_cost_paths: 55 - aggregate_address: - - address: "1.2.1.0/24" - as_set: true - match_map: "match01" - - address: "5.2.1.0/24" - attribute_map: "attrmatch01" - advertise_only: true - redistribute: - - protocol: "static" - route_map: "map_static" - - protocol: "attached-host" - distance: - internal: 50 - neighbor: - - peer: "10.1.3.2" - allowas_in: - set: true - default_originate: - always: true - dont_capability_negotiate: true - export_localpref: 4000 - maximum_received_routes: - count: 500 - warning_limit: - limit_percent: 5 - next_hop_unchanged: true - prefix_list: - name: "prefix01" - direction: "out" - - neighbor_address: "peer1" - fall_over: true - link_bandwidth: - update_delay: 5 - monitoring: True - send_community: - community_attribute: "extended" - sub_attribute: "link-bandwidth" - link_bandwidth_attribute: "aggregate" - speed: "600" - vlan: 5 - state: merged +- name: Merge provided configuration with device configuration + arista.eos.eos_bgp_global: + config: + as_number: "100" + bgp_params: + host_routes: true + convergence: + slow_peer: true + time: 6 + additional_paths: "send" + log_neighbor_changes: true + maximum_paths: + max_equal_cost_paths: 55 + aggregate_address: + - address: "1.2.1.0/24" + as_set: true + match_map: "match01" + - address: "5.2.1.0/24" + attribute_map: "attrmatch01" + advertise_only: true + redistribute: + - protocol: "static" + route_map: "map_static" + - protocol: "attached-host" + distance: + internal: 50 + neighbor: + - peer: "10.1.3.2" + allowas_in: + set: true + default_originate: + always: true + dont_capability_negotiate: true + export_localpref: 4000 + maximum_received_routes: + count: 500 + warning_limit: + limit_percent: 5 + next_hop_unchanged: true + prefix_list: + name: "prefix01" + direction: "out" + - neighbor_address: "peer1" + fall_over: true + link_bandwidth: + update_delay: 5 + monitoring: true + send_community: + community_attribute: "extended" + sub_attribute: "link-bandwidth" + link_bandwidth_attribute: "aggregate" + speed: "600" + vlan: 5 + state: merged + +# Task output: +# ------------ +# before: {} +# +# commands: +# - router bgp 100 +# - neighbor 10.1.3.2 allowas-in +# - neighbor 10.1.3.2 default-originate always +# - neighbor 10.1.3.2 dont-capability-negotiate +# - neighbor 10.1.3.2 export-localpref 4000 +# - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# - neighbor 10.1.3.2 next-hop-unchanged +# - neighbor 10.1.3.2 prefix-list prefix01 out +# - neighbor peer1 fall-over bfd +# - neighbor peer1 link-bandwidth update-delay 5 +# - neighbor peer1 monitoring +# - neighbor peer1 send-community extended link-bandwidth aggregate 600 +# - redistribute static route-map map_static +# - redistribute attached-host +# - aggregate-address 1.2.1.0/24 as-set match-map match01 +# - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# - bgp host-routes fib direct-install +# - bgp convergence slow-peer time 6 +# - bgp additional-paths send any +# - bgp log-neighbor-changes +# - maximum-paths 55 +# - distance bgp 50 +# - vlan 5 +# +# after: +# aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - fall_over: true +# link_bandwidth: +# set: true +# update_delay: 5 +# maximum_received_routes: +# count: 12000 +# monitoring: true +# neighbor_address: peer1 +# peer_group: peer1 +# send_community: +# community_attribute: extended +# link_bandwidth_attribute: aggregate +# speed: '600' +# sub_attribute: link-bandwidth +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vlan: 5 -# After State: +# After state: +# ------------ # veos(config)#show running-config | section bgp # router bgp 100 # bgp convergence slow-peer time 6 @@ -1499,120 +1583,11 @@ EXAMPLES = """ # ! # address-family ipv4 # neighbor 10.1.3.2 prefix-list prefix01 out -# veos(config)# -# -# Module Execution: -# -# "after": { -# "aggregate_address": [ -# { -# "address": "1.2.1.0/24", -# "as_set": true, -# "match_map": "match01" -# }, -# { -# "address": "5.2.1.0/24", -# "advertise_only": true, -# "attribute_map": "attrmatch01" -# } -# ], -# "as_number": "100", -# "bgp_params": { -# "additional_paths": "send", -# "convergence": { -# "slow_peer": true, -# "time": 6 -# } -# }, -# "distance": { -# "external": 50, -# "internal": 50, -# "local": 50 -# }, -# "maximum_paths": { -# "max_equal_cost_paths": 55 -# }, -# "neighbor": [ -# { -# "fall_over": true, -# "link_bandwidth": { -# "set": true, -# "update_delay": 5 -# }, -# "maximum_received_routes": { -# "count": 12000 -# }, -# "monitoring": true, -# "peer": "peer1", -# "peer_group": "peer1", -# "send_community": { -# "community_attribute": "extended", -# "link_bandwidth_attribute": "aggregate", -# "speed": "600", -# "sub_attribute": "link-bandwidth" -# } -# }, -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "export_localpref": 4000, -# "maximum_received_routes": { -# "count": 500, -# "warning_limit": { -# "limit_percent": 5 -# } -# }, -# "next_hop_unchanged": true, -# "peer": "10.1.3.2" -# } -# ], -# "redistribute": [ -# { -# "protocol": "static", -# "route_map": "map_static" -# }, -# { -# "protocol": "attached-host" -# } -# ], -# "vlan": 5 -# }, -# "before": {}, -# "changed": true, -# "commands": [ -# "router bgp 100", -# "neighbor 10.1.3.2 allowas-in", -# "neighbor 10.1.3.2 default-originate always", -# "neighbor 10.1.3.2 dont-capability-negotiate", -# "neighbor 10.1.3.2 export-localpref 4000", -# "neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent", -# "neighbor 10.1.3.2 next-hop-unchanged", -# "neighbor 10.1.3.2 prefix-list prefix01 out", -# "neighbor peer1 fall-over bfd", -# "neighbor peer1 link-bandwidth update-delay 5", -# "neighbor peer1 monitoring", -# "neighbor peer1 send-community extended link-bandwidth aggregate 600", -# "redistribute static route-map map_static", -# "redistribute attached-host", -# "aggregate-address 1.2.1.0/24 as-set match-map match01", -# "aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only", -# "bgp host-routes fib direct-install", -# "bgp convergence slow-peer time 6", -# "bgp additional-paths send any", -# "bgp log-neighbor-changes", -# "maximum-paths 55", -# "distance bgp 50", -# "vlan 5" -# ], # Using replaced: # Before state: +# ------------- # veos(config)#show running-config | section bgp # router bgp 100 # bgp convergence slow-peer time 6 @@ -1647,66 +1622,215 @@ EXAMPLES = """ # neighbor 12.1.3.2 allowas-in 3 # neighbor 12.1.3.2 default-originate always # neighbor 12.1.3.2 maximum-routes 12000 -# veos(config)# - - name: replace provided configuration with device configuration - arista.eos.eos_bgp_global: - config: - as_number: "100" - bgp_params: - host_routes: True - convergence: - slow_peer: True - time: 6 - additional_paths: "send" - log_neighbor_changes: True - vrfs: - - vrf: "vrf01" - maximum_paths: - max_equal_cost_paths: 55 - aggregate_address: - - address: "1.2.1.0/24" - as_set: true - match_map: "match01" - - address: "5.2.1.0/24" - attribute_map: "attrmatch01" - advertise_only: true - redistribute: - - protocol: "static" - route_map: "map_static" - - protocol: "attached-host" - distance: - internal: 50 - neighbor: - - neighbor_address: "10.1.3.2" - allowas_in: - set: true - default_originate: - always: true - dont_capability_negotiate: true - export_localpref: 4000 - maximum_received_routes: - count: 500 - warning_limit: - limit_percent: 5 - next_hop_unchanged: true - prefix_list: - name: "prefix01" - direction: "out" - - neighbor_address: "peer1" - fall_over: true - link_bandwidth: - update_delay: 5 - monitoring: True - send_community: - community_attribute: "extended" - sub_attribute: "link-bandwidth" - link_bandwidth_attribute: "aggregate" - speed: "600" - state: replaced +- name: replace provided configuration with device configuration + arista.eos.eos_bgp_global: + config: + as_number: "100" + bgp_params: + host_routes: true + convergence: + slow_peer: true + time: 6 + additional_paths: "send" + log_neighbor_changes: true + vrfs: + - vrf: "vrf01" + maximum_paths: + max_equal_cost_paths: 55 + aggregate_address: + - address: "1.2.1.0/24" + as_set: true + match_map: "match01" + - address: "5.2.1.0/24" + attribute_map: "attrmatch01" + advertise_only: true + redistribute: + - protocol: "static" + route_map: "map_static" + - protocol: "attached-host" + distance: + internal: 50 + neighbor: + - neighbor_address: "10.1.3.2" + allowas_in: + set: true + default_originate: + always: true + dont_capability_negotiate: true + export_localpref: 4000 + maximum_received_routes: + count: 500 + warning_limit: + limit_percent: 5 + next_hop_unchanged: true + prefix_list: + name: "prefix01" + direction: "out" + - neighbor_address: "peer1" + fall_over: true + link_bandwidth: + update_delay: 5 + monitoring: true + send_community: + community_attribute: "extended" + sub_attribute: "link-bandwidth" + link_bandwidth_attribute: "aggregate" + speed: "600" + state: replaced -# After State: +# Task output: +# ------------ +# before: +# aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - fall_over: true +# link_bandwidth: +# set: true +# update_delay: 5 +# maximum_received_routes: +# count: 12000 +# monitoring: true +# neighbor_address: peer1 +# peer_group: peer1 +# send_community: +# community_attribute: extended +# link_bandwidth_attribute: aggregate +# speed: '600' +# sub_attribute: link-bandwidth +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vlan: 5 +# vrfs: +# - neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# maximum_received_routes: +# count: 12000 +# neighbor_address: 12.1.3.2 +# route_target: +# action: import +# target: '54:11' +# vrf: vrf01 +# +# commands: +# - router bgp 100 +# - vrf vrf01 +# - no route-target import 54:11 +# - neighbor 10.1.3.2 allowas-in +# - neighbor 10.1.3.2 default-originate always +# - neighbor 10.1.3.2 dont-capability-negotiate +# - neighbor 10.1.3.2 export-localpref 4000 +# - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# - neighbor 10.1.3.2 next-hop-unchanged +# - neighbor 10.1.3.2 prefix-list prefix01 out +# - neighbor peer1 fall-over bfd +# - neighbor peer1 link-bandwidth update-delay 5 +# - neighbor peer1 monitoring +# - neighbor peer1 send-community extended link-bandwidth aggregate 600 +# - no neighbor 12.1.3.2 +# - redistribute static route-map map_static +# - redistribute attached-host +# - aggregate-address 1.2.1.0/24 as-set match-map match01 +# - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# - maximum-paths 55 +# - distance bgp 50 +# - exit +# - no neighbor peer1 peer group +# - no neighbor peer1 link-bandwidth update-delay 5 +# - no neighbor peer1 fall-over bfd +# - no neighbor peer1 monitoring +# - no neighbor peer1 send-community extended link-bandwidth aggregate 600 +# - no neighbor peer1 maximum-routes 12000 +# - no neighbor 10.1.3.2 +# - no redistribute static route-map map_static +# - no redistribute attached-host +# - no aggregate-address 1.2.1.0/24 as-set match-map match01 +# - no aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# - bgp host-routes fib direct-install +# - bgp log-neighbor-changes +# - no distance bgp 50 50 50 +# - no maximum-paths 55 +# - no vlan 5 +# +# after: +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# vrfs: +# - aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vrf: vrf01 +# +# After state: +# ------------ # veos(config)#show running-config | section bgp # router bgp 100 # bgp convergence slow-peer time 6 @@ -1728,225 +1852,255 @@ EXAMPLES = """ # ! # address-family ipv4 # neighbor 10.1.3.2 prefix-list prefix01 out -# veos(config)# -# + +# Using overridden: +# (Note: Overridden and replaced operations are identitical) + +# Before state: +# ------------- +# veos(config)#show running-config | section bgp +# router bgp 100 +# bgp convergence slow-peer time 6 +# distance bgp 50 50 50 +# maximum-paths 55 +# bgp additional-paths send any +# neighbor peer1 peer group +# neighbor peer1 link-bandwidth update-delay 5 +# neighbor peer1 fall-over bfd +# neighbor peer1 monitoring +# neighbor peer1 send-community extended link-bandwidth aggregate 600 +# neighbor peer1 maximum-routes 12000 +# neighbor 10.1.3.2 export-localpref 4000 +# neighbor 10.1.3.2 next-hop-unchanged +# neighbor 10.1.3.2 dont-capability-negotiate +# neighbor 10.1.3.2 allowas-in 3 +# neighbor 10.1.3.2 default-originate always +# neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# aggregate-address 1.2.1.0/24 as-set match-map match01 +# aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# redistribute static route-map map_static +# redistribute attached-host +# ! +# vlan 5 +# ! +# address-family ipv4 +# neighbor 10.1.3.2 prefix-list prefix01 out +# ! +# vrf vrf01 +# route-target import 54:11 +# neighbor 12.1.3.2 dont-capability-negotiate +# neighbor 12.1.3.2 allowas-in 3 +# neighbor 12.1.3.2 default-originate always +# neighbor 12.1.3.2 maximum-routes 12000 + +- name: override running configuration with configuration + arista.eos.eos_bgp_global: + config: + as_number: "100" + bgp_params: + host_routes: true + convergence: + slow_peer: true + time: 6 + additional_paths: "send" + log_neighbor_changes: true + vrfs: + - vrf: "vrf01" + maximum_paths: + max_equal_cost_paths: 55 + aggregate_address: + - address: "1.2.1.0/24" + as_set: true + match_map: "match01" + - address: "5.2.1.0/24" + attribute_map: "attrmatch01" + advertise_only: true + redistribute: + - protocol: "static" + route_map: "map_static" + - protocol: "attached-host" + distance: + internal: 50 + neighbor: + - neighbor_address: "10.1.3.2" + allowas_in: + set: true + default_originate: + always: true + dont_capability_negotiate: true + export_localpref: 4000 + maximum_received_routes: + count: 500 + warning_limit: + limit_percent: 5 + next_hop_unchanged: true + prefix_list: + name: "prefix01" + direction: "out" + - neighbor_address: "peer1" + fall_over: true + link_bandwidth: + update_delay: 5 + monitoring: true + send_community: + community_attribute: "extended" + sub_attribute: "link-bandwidth" + link_bandwidth_attribute: "aggregate" + speed: "600" + state: overridden + +# Task output: +# ------------ +# before: +# aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - fall_over: true +# link_bandwidth: +# set: true +# update_delay: 5 +# maximum_received_routes: +# count: 12000 +# monitoring: true +# neighbor_address: peer1 +# peer_group: peer1 +# send_community: +# community_attribute: extended +# link_bandwidth_attribute: aggregate +# speed: '600' +# sub_attribute: link-bandwidth +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vlan: 5 +# vrfs: +# - neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# maximum_received_routes: +# count: 12000 +# neighbor_address: 12.1.3.2 +# route_target: +# action: import +# target: '54:11' +# vrf: vrf01 # -# Module Execution: +# commands: +# - router bgp 100 +# - vrf vrf01 +# - no route-target import 54:11 +# - neighbor 10.1.3.2 allowas-in +# - neighbor 10.1.3.2 default-originate always +# - neighbor 10.1.3.2 dont-capability-negotiate +# - neighbor 10.1.3.2 export-localpref 4000 +# - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# - neighbor 10.1.3.2 next-hop-unchanged +# - neighbor 10.1.3.2 prefix-list prefix01 out +# - neighbor peer1 fall-over bfd +# - neighbor peer1 link-bandwidth update-delay 5 +# - neighbor peer1 monitoring +# - neighbor peer1 send-community extended link-bandwidth aggregate 600 +# - no neighbor 12.1.3.2 +# - redistribute static route-map map_static +# - redistribute attached-host +# - aggregate-address 1.2.1.0/24 as-set match-map match01 +# - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# - maximum-paths 55 +# - distance bgp 50 +# - exit +# - no neighbor peer1 peer group +# - no neighbor peer1 link-bandwidth update-delay 5 +# - no neighbor peer1 fall-over bfd +# - no neighbor peer1 monitoring +# - no neighbor peer1 send-community extended link-bandwidth aggregate 600 +# - no neighbor peer1 maximum-routes 12000 +# - no neighbor 10.1.3.2 +# - no redistribute static route-map map_static +# - no redistribute attached-host +# - no aggregate-address 1.2.1.0/24 as-set match-map match01 +# - no aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# - bgp host-routes fib direct-install +# - bgp log-neighbor-changes +# - no distance bgp 50 50 50 +# - no maximum-paths 55 +# - no vlan 5 # -# "after": { -# "as_number": "100", -# "bgp_params": { -# "additional_paths": "send", -# "convergence": { -# "slow_peer": true, -# "time": 6 -# } -# }, -# "vrfs": [ -# { -# "aggregate_address": [ -# { -# "address": "1.2.1.0/24", -# "as_set": true, -# "match_map": "match01" -# }, -# { -# "address": "5.2.1.0/24", -# "advertise_only": true, -# "attribute_map": "attrmatch01" -# } -# ], -# "distance": { -# "external": 50, -# "internal": 50, -# "local": 50 -# }, -# "maximum_paths": { -# "max_equal_cost_paths": 55 -# }, -# "neighbor": [ -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "export_localpref": 4000, -# "maximum_received_routes": { -# "count": 500, -# "warning_limit": { -# "limit_percent": 5 -# } -# }, -# "next_hop_unchanged": true, -# "peer": "10.1.3.2" -# } -# ], -# "redistribute": [ -# { -# "protocol": "static", -# "route_map": "map_static" -# }, -# { -# "protocol": "attached-host" -# } -# ], -# "vrf": "vrf01" -# } -# ] -# }, -# "before": { -# "aggregate_address": [ -# { -# "address": "1.2.1.0/24", -# "as_set": true, -# "match_map": "match01" -# }, -# { -# "address": "5.2.1.0/24", -# "advertise_only": true, -# "attribute_map": "attrmatch01" -# } -# ], -# "as_number": "100", -# "bgp_params": { -# "additional_paths": "send", -# "convergence": { -# "slow_peer": true, -# "time": 6 -# } -# }, -# "distance": { -# "external": 50, -# "internal": 50, -# "local": 50 -# }, -# "maximum_paths": { -# "max_equal_cost_paths": 55 -# }, -# "neighbor": [ -# { -# "fall_over": true, -# "link_bandwidth": { -# "set": true, -# "update_delay": 5 -# }, -# "maximum_received_routes": { -# "count": 12000 -# }, -# "monitoring": true, -# "peer": "peer1", -# "peer_group": "peer1", -# "send_community": { -# "community_attribute": "extended", -# "link_bandwidth_attribute": "aggregate", -# "speed": "600", -# "sub_attribute": "link-bandwidth" -# } -# }, -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "export_localpref": 4000, -# "maximum_received_routes": { -# "count": 500, -# "warning_limit": { -# "limit_percent": 5 -# } -# }, -# "next_hop_unchanged": true, -# "peer": "10.1.3.2" -# } -# ], -# "redistribute": [ -# { -# "protocol": "static", -# "route_map": "map_static" -# }, -# { -# "protocol": "attached-host" -# } -# ], -# "vlan": 5, -# "vrfs": [ -# { -# "neighbor": [ -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "maximum_received_routes": { -# "count": 12000 -# }, -# "peer": "12.1.3.2" -# } -# ], -# "route_target": { -# "action": "import", -# "target": "54:11" -# }, -# "vrf": "vrf01" -# } -# ] -# }, -# "changed": true, -# "commands": [ -# "router bgp 100", -# "vrf vrf01", -# "no route-target import 54:11", -# "neighbor 10.1.3.2 allowas-in", -# "neighbor 10.1.3.2 default-originate always", -# "neighbor 10.1.3.2 dont-capability-negotiate", -# "neighbor 10.1.3.2 export-localpref 4000", -# "neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent", -# "neighbor 10.1.3.2 next-hop-unchanged", -# "neighbor 10.1.3.2 prefix-list prefix01 out", -# "neighbor peer1 fall-over bfd", -# "neighbor peer1 link-bandwidth update-delay 5", -# "neighbor peer1 monitoring", -# "neighbor peer1 send-community extended link-bandwidth aggregate 600", -# "no neighbor 12.1.3.2", -# "redistribute static route-map map_static", -# "redistribute attached-host", -# "aggregate-address 1.2.1.0/24 as-set match-map match01", -# "aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only", -# "maximum-paths 55", -# "distance bgp 50", -# "exit", -# "no neighbor peer1 peer group", -# "no neighbor peer1 link-bandwidth update-delay 5", -# "no neighbor peer1 fall-over bfd", -# "no neighbor peer1 monitoring", -# "no neighbor peer1 send-community extended link-bandwidth aggregate 600", -# "no neighbor peer1 maximum-routes 12000", -# "no neighbor 10.1.3.2", -# "no redistribute static route-map map_static", -# "no redistribute attached-host", -# "no aggregate-address 1.2.1.0/24 as-set match-map match01", -# "no aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only", -# "bgp host-routes fib direct-install", -# "bgp log-neighbor-changes", -# "no distance bgp 50 50 50", -# "no maximum-paths 55", -# "no vlan 5" -# ], +# after: +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# vrfs: +# - aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vrf: vrf01 # - -# Using replaced (in presence of address_family under vrf): -# Before State: - -#veos(config)#show running-config | section bgp +# After state: +# ------------ +# veos(config)#show running-config | section bgp # router bgp 100 # bgp convergence slow-peer time 6 # bgp additional-paths send any @@ -1967,82 +2121,11 @@ EXAMPLES = """ # ! # address-family ipv4 # neighbor 10.1.3.2 prefix-list prefix01 out -# ! -# address-family ipv6 -# redistribute dhcp -# veos(config)# - - - name: Replace - arista.eos.eos_bgp_global: - config: - as_number: "100" - graceful_restart: - set: True - router_id: "1.1.1.1" - timers: - keepalive: 2 - holdtime: 5 - ucmp: - mode: - set: True - vlan_aware_bundle: "bundle1 bundle2 bundle3" - state: replaced - -# Module Execution: - -# fatal: [192.168.122.113]: FAILED! => { -# "changed": false, -# "invocation": { -# "module_args": { -# "config": { -# "access_group": null, -# "aggregate_address": null, -# "as_number": "100", -# "bgp_params": null, -# "default_metric": null, -# "distance": null, -# "graceful_restart": { -# "restart_time": null, -# "set": true, -# "stalepath_time": null -# }, -# "graceful_restart_helper": null, -# "maximum_paths": null, -# "monitoring": null, -# "neighbor": null, -# "network": null, -# "redistribute": null, -# "route_target": null, -# "router_id": "1.1.1.1", -# "shutdown": null, -# "timers": { -# "holdtime": 5, -# "keepalive": 2 -# }, -# "ucmp": { -# "fec": null, -# "link_bandwidth": null, -# "mode": { -# "nexthops": null, -# "set": true -# } -# }, -# "update": null, -# "vlan": null, -# "vlan_aware_bundle": "bundle1 bundle2 bundle3", -# "vrfs": null -# }, -# "running_config": null, -# "state": "replaced" -# } -# }, -# "msg": "Use the _bgp_af module to delete the address_family under vrf, before replacing/deleting the vrf." -# } # Using deleted: # Before state: - +# ------------- # veos(config)#show running-config | section bgp # router bgp 100 # bgp convergence slow-peer time 6 @@ -2063,100 +2146,73 @@ EXAMPLES = """ # redistribute attached-host # ! - - name: Delete configuration - arista.eos.eos_bgp_global: - config: - as_number: "100" - state: deleted - -# After State: +- name: Delete configuration + arista.eos.eos_bgp_global: + config: + as_number: "100" + state: deleted -# veos(config)#show running-config | section bgp -# router bgp 100 -# +# Task output: +# ------------ +# before: +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# vrfs: +# - aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vrf: vrf01 # -# Module Execution: +# commands: +# - router bgp 100 +# - no vrf vrf01 +# - no bgp convergence slow-peer time 6 +# - no bgp additional-paths send any # -# "after": { -# "as_number": "100" -# }, -# "before": { -# "as_number": "100", -# "bgp_params": { -# "additional_paths": "send", -# "convergence": { -# "slow_peer": true, -# "time": 6 -# } -# }, -# "vrfs": [ -# { -# "aggregate_address": [ -# { -# "address": "1.2.1.0/24", -# "as_set": true, -# "match_map": "match01" -# }, -# { -# "address": "5.2.1.0/24", -# "advertise_only": true, -# "attribute_map": "attrmatch01" -# } -# ], -# "distance": { -# "external": 50, -# "internal": 50, -# "local": 50 -# }, -# "maximum_paths": { -# "max_equal_cost_paths": 55 -# }, -# "neighbor": [ -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "export_localpref": 4000, -# "maximum_received_routes": { -# "count": 500, -# "warning_limit": { -# "limit_percent": 5 -# } -# }, -# "next_hop_unchanged": true, -# "peer": "10.1.3.2" -# } -# ], -# "redistribute": [ -# { -# "protocol": "static", -# "route_map": "map_static" -# }, -# { -# "protocol": "attached-host" -# } -# ], -# "vrf": "vrf01" -# } -# ] -# }, -# "changed": true, -# "commands": [ -# "router bgp 100", -# "no vrf vrf01", -# "no bgp convergence slow-peer time 6", -# "no bgp additional-paths send any" -# ], +# after: +# as_number: '100' + # +# After state: +# ------------ +# veos(config)#show running-config | section bgp +# router bgp 100 # Using purged: # Before state: - +# ------------- # veos(config)#show running-config | section bgp # router bgp 100 # bgp convergence slow-peer time 6 @@ -2191,130 +2247,450 @@ EXAMPLES = """ # neighbor 12.1.3.2 allowas-in 3 # neighbor 12.1.3.2 default-originate always # neighbor 12.1.3.2 maximum-routes 12000 -# veos(config)# - - name: Purge configuration - arista.eos.eos_bgp_global: - config: - as_number: "100" - state: purged +- name: Purge configuration + arista.eos.eos_bgp_global: + config: + as_number: "100" + state: purged + -# After State: +# Task output: +# ------------ +# before: +# aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - fall_over: true +# link_bandwidth: +# set: true +# update_delay: 5 +# maximum_received_routes: +# count: 12000 +# monitoring: true +# neighbor_address: peer1 +# peer_group: peer1 +# send_community: +# community_attribute: extended +# link_bandwidth_attribute: aggregate +# speed: '600' +# sub_attribute: link-bandwidth +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vlan: 5 +# vrfs: +# - neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# maximum_received_routes: +# count: 12000 +# neighbor_address: 12.1.3.2 +# route_target: +# action: import +# target: '54:11' +# vrf: vrf01 +# "changed": true, +# +# commands: +# - no router bgp 100 +# +# after: {} +# After state: +# ------------ # veos(config)#show running-config | section bgp # veos(config)# -# Module Execution: +# Using rendered -# "after": {}, -# "before": { -# "aggregate_address": [ -# { -# "address": "1.2.1.0/24", -# "as_set": true, -# "match_map": "match01" -# }, -# { -# "address": "5.2.1.0/24", -# "advertise_only": true, -# "attribute_map": "attrmatch01" -# } -# ], -# "as_number": "100", -# "bgp_params": { -# "additional_paths": "send", -# "convergence": { -# "slow_peer": true, -# "time": 6 -# } -# }, -# "distance": { -# "external": 50, -# "internal": 50, -# "local": 50 -# }, -# "maximum_paths": { -# "max_equal_cost_paths": 55 -# }, -# "neighbor": [ -# { -# "fall_over": true, -# "link_bandwidth": { -# "set": true, -# "update_delay": 5 -# }, -# "maximum_received_routes": { -# "count": 12000 -# }, -# "monitoring": true, -# "peer": "peer1", -# "peer_group": "peer1", -# "send_community": { -# "community_attribute": "extended", -# "link_bandwidth_attribute": "aggregate", -# "speed": "600", -# "sub_attribute": "link-bandwidth" -# } -# }, -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "export_localpref": 4000, -# "maximum_received_routes": { -# "count": 500, -# "warning_limit": { -# "limit_percent": 5 -# } -# }, -# "next_hop_unchanged": true, -# "peer": "10.1.3.2" -# } -# ], -# "redistribute": [ -# { -# "protocol": "static", -# "route_map": "map_static" -# }, -# { -# "protocol": "attached-host" -# } -# ], -# "vlan": 5, -# "vrfs": [ -# { -# "neighbor": [ -# { -# "allowas_in": { -# "count": 3 -# }, -# "default_originate": { -# "always": true -# }, -# "dont_capability_negotiate": true, -# "maximum_received_routes": { -# "count": 12000 -# }, -# "peer": "12.1.3.2" -# } -# ], -# "route_target": { -# "action": "import", -# "target": "54:11" -# }, -# "vrf": "vrf01" -# } -# ] -# }, -# "changed": true, -# "commands": [ -# "no router bgp 100" -# ], +- name: Render command lines for provided configuration + arista.eos.eos_bgp_global: + config: + as_number: "100" + bgp_params: + host_routes: true + convergence: + slow_peer: true + time: 6 + additional_paths: "send" + log_neighbor_changes: true + maximum_paths: + max_equal_cost_paths: 55 + aggregate_address: + - address: "1.2.1.0/24" + as_set: true + match_map: "match01" + - address: "5.2.1.0/24" + attribute_map: "attrmatch01" + advertise_only: true + redistribute: + - protocol: "static" + route_map: "map_static" + - protocol: "attached-host" + distance: + internal: 50 + neighbor: + - peer: "10.1.3.2" + allowas_in: + set: true + default_originate: + always: true + dont_capability_negotiate: true + export_localpref: 4000 + maximum_received_routes: + count: 500 + warning_limit: + limit_percent: 5 + next_hop_unchanged: true + prefix_list: + name: "prefix01" + direction: "out" + - neighbor_address: "peer1" + fall_over: true + link_bandwidth: + update_delay: 5 + monitoring: true + send_community: + community_attribute: "extended" + sub_attribute: "link-bandwidth" + link_bandwidth_attribute: "aggregate" + speed: "600" + vlan: 5 + state: rendered + +# Task output: +# ------------ +# rendered: +# - router bgp 100 +# - neighbor 10.1.3.2 allowas-in +# - neighbor 10.1.3.2 default-originate always +# - neighbor 10.1.3.2 dont-capability-negotiate +# - neighbor 10.1.3.2 export-localpref 4000 +# - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# - neighbor 10.1.3.2 next-hop-unchanged +# - neighbor 10.1.3.2 prefix-list prefix01 out +# - neighbor peer1 fall-over bfd +# - neighbor peer1 link-bandwidth update-delay 5 +# - neighbor peer1 monitoring +# - neighbor peer1 send-community extended link-bandwidth aggregate 600 +# - redistribute static route-map map_static +# - redistribute attached-host +# - aggregate-address 1.2.1.0/24 as-set match-map match01 +# - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# - bgp host-routes fib direct-install +# - bgp convergence slow-peer time 6 +# - bgp additional-paths send any +# - bgp log-neighbor-changes +# - maximum-paths 55 +# - distance bgp 50 +# - vlan 5 + + +# Using parsed + +# parsed.cfg +# ---------- +# router bgp 100 +# bgp convergence slow-peer time 6 +# distance bgp 50 50 50 +# maximum-paths 55 +# bgp additional-paths send any +# neighbor peer1 peer group +# neighbor peer1 link-bandwidth update-delay 5 +# neighbor peer1 fall-over bfd +# neighbor peer1 monitoring +# neighbor peer1 send-community extended link-bandwidth aggregate 600 +# neighbor peer1 maximum-routes 12000 +# neighbor 10.1.3.2 export-localpref 4000 +# neighbor 10.1.3.2 next-hop-unchanged +# neighbor 10.1.3.2 dont-capability-negotiate +# neighbor 10.1.3.2 allowas-in 3 +# neighbor 10.1.3.2 default-originate always +# neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# aggregate-address 1.2.1.0/24 as-set match-map match01 +# aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# redistribute static route-map map_static +# redistribute attached-host +# ! +# vlan 5 +# ! +# address-family ipv4 +# neighbor 10.1.3.2 prefix-list prefix01 out +# ! +# vrf vrf01 +# route-target import 54:11 +# neighbor 12.1.3.2 dont-capability-negotiate +# neighbor 12.1.3.2 allowas-in 3 +# neighbor 12.1.3.2 default-originate always +# neighbor 12.1.3.2 maximum-routes 12000 + +- name: Parse externally provided BGP config + arista.eos.eos_bgp_global: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + +# Task output: +# ------------ + +# parsed: +# aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - fall_over: true +# link_bandwidth: +# set: true +# update_delay: 5 +# maximum_received_routes: +# count: 12000 +# monitoring: true +# neighbor_address: peer1 +# peer_group: peer1 +# send_community: +# community_attribute: extended +# link_bandwidth_attribute: aggregate +# speed: '600' +# sub_attribute: link-bandwidth +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vlan: 5 +# vrfs: +# - neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# maximum_received_routes: +# count: 12000 +# neighbor_address: 12.1.3.2 +# route_target: +# action: import +# target: '54:11' +# vrf: vrf01 + +# Using gathered + +# existing config +# veos(config)#show running-config | section bgp +# router bgp 100 +# bgp convergence slow-peer time 6 +# distance bgp 50 50 50 +# maximum-paths 55 +# bgp additional-paths send any +# neighbor peer1 peer group +# neighbor peer1 link-bandwidth update-delay 5 +# neighbor peer1 fall-over bfd +# neighbor peer1 monitoring +# neighbor peer1 send-community extended link-bandwidth aggregate 600 +# neighbor peer1 maximum-routes 12000 +# neighbor 10.1.3.2 export-localpref 4000 +# neighbor 10.1.3.2 next-hop-unchanged +# neighbor 10.1.3.2 dont-capability-negotiate +# neighbor 10.1.3.2 allowas-in 3 +# neighbor 10.1.3.2 default-originate always +# neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent +# aggregate-address 1.2.1.0/24 as-set match-map match01 +# aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only +# redistribute static route-map map_static +# redistribute attached-host +# ! +# vlan 5 +# ! +# address-family ipv4 +# neighbor 10.1.3.2 prefix-list prefix01 out +# ! +# vrf vrf01 +# route-target import 54:11 +# neighbor 12.1.3.2 dont-capability-negotiate +# neighbor 12.1.3.2 allowas-in 3 +# neighbor 12.1.3.2 default-originate always +# neighbor 12.1.3.2 maximum-routes 12000 + +- name: Gather BGP facts using gathered + arista.eos.eos_bgp_global: + state: gathered +# Task output: +# ------------ +# gathered: +# aggregate_address: +# - address: 1.2.1.0/24 +# as_set: true +# match_map: match01 +# - address: 5.2.1.0/24 +# advertise_only: true +# attribute_map: attrmatch01 +# as_number: '100' +# bgp_params: +# additional_paths: send +# convergence: +# slow_peer: true +# time: 6 +# distance: +# external: 50 +# internal: 50 +# local: 50 +# maximum_paths: +# max_equal_cost_paths: 55 +# neighbor: +# - fall_over: true +# link_bandwidth: +# set: true +# update_delay: 5 +# maximum_received_routes: +# count: 12000 +# monitoring: true +# neighbor_address: peer1 +# peer_group: peer1 +# send_community: +# community_attribute: extended +# link_bandwidth_attribute: aggregate +# speed: '600' +# sub_attribute: link-bandwidth +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# export_localpref: 4000 +# maximum_received_routes: +# count: 500 +# warning_limit: +# limit_percent: 5 +# neighbor_address: 10.1.3.2 +# next_hop_unchanged: true +# redistribute: +# - protocol: static +# route_map: map_static +# - protocol: attached-host +# vlan: 5 +# vrfs: +# - neighbor: +# - allowas_in: +# count: 3 +# default_originate: +# always: true +# dont_capability_negotiate: true +# maximum_received_routes: +# count: 12000 +# neighbor_address: 12.1.3.2 +# route_target: +# action: import +# target: '54:11' +# vrf: vrf01 +""" +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The resulting configuration model invocation. + returned: when changed + type: dict + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: + - router bgp 100 + - neighbor 10.1.3.2 allowas-in + - neighbor 10.1.3.2 default-originate always + - neighbor 10.1.3.2 dont-capability-negotiate +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - router bgp 100 + - neighbor 10.1.3.2 allowas-in + - neighbor 10.1.3.2 default-originate always + - neighbor 10.1.3.2 dont-capability-negotiate +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: dict + sample: > + This output will always be in the same format as the + module argspec. """ from ansible.module_utils.basic import AnsibleModule @@ -2339,6 +2715,7 @@ def main(): required_if=[ ["state", "merged", ["config"]], ["state", "replaced", ["config"]], + ["state", "overridden", ["config"]], ["state", "rendered", ["config"]], ["state", "parsed", ["running_config"]], ], diff --git a/ansible_collections/arista/eos/plugins/modules/eos_command.py b/ansible_collections/arista/eos/plugins/modules/eos_command.py index 437e3bc63..5b52ae4ff 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_command.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_command.py @@ -154,23 +154,23 @@ EXAMPLES = r""" - name: run multiple commands on remote nodes arista.eos.eos_command: commands: - - show version - - show interfaces + - show version + - show interfaces - name: run multiple commands and evaluate the output arista.eos.eos_command: commands: - - show version - - show interfaces + - show version + - show interfaces wait_for: - - result[0] contains Arista - - result[1] contains Loopback0 + - result[0] contains Arista + - result[1] contains Loopback0 - name: run commands and specify the output format arista.eos.eos_command: commands: - - command: show version - output: json + - command: show version + output: json - name: check whether the switch is in maintenance mode arista.eos.eos_command: @@ -180,8 +180,8 @@ EXAMPLES = r""" - name: check whether the switch is in maintenance mode using json output arista.eos.eos_command: commands: - - command: show maintenance - output: json + - command: show maintenance + output: json wait_for: result[0].units.System.state eq 'underMaintenance' - name: check whether the switch is in maintenance, with 8 retries @@ -197,10 +197,10 @@ EXAMPLES = r""" need to be escaped. arista.eos.eos_command: commands: - - command: reload power - prompt: \[confirm\] - answer: y - newline: false + - command: reload power + prompt: \[confirm\] + answer: y + newline: false """ RETURN = """ @@ -227,9 +227,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import ( Conditional, ) -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - to_lines, -) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_lines from ansible_collections.arista.eos.plugins.module_utils.network.eos.eos import ( run_commands, diff --git a/ansible_collections/arista/eos/plugins/modules/eos_config.py b/ansible_collections/arista/eos/plugins/modules/eos_config.py index 0c8271adc..5aa8e7ceb 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_config.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_config.py @@ -118,7 +118,7 @@ options: playbook root directory or role root directory, if playbook is part of an ansible role. If the directory does not exist, it is created. type: bool - default: no + default: false running_config: description: - The module, by default, will connect to the remote device and retrieve the current @@ -139,7 +139,7 @@ options: the running-config is append with the all keyword. When the value is set to false, the command is issued without the all keyword type: bool - default: no + default: false save_when: description: - When changes are made to the device running-configuration, the changes are not @@ -206,7 +206,7 @@ options: backup_options: description: - This is a dict object containing configurable options related to backup file - path. The value of this option is read only when C(backup) is set to I(yes), + path. The value of this option is read only when C(backup) is set to I(true), if C(backup) is set to I(no) this option will be silently ignored. suboptions: filename: @@ -237,10 +237,10 @@ EXAMPLES = """ - name: load an acl into the device arista.eos.eos_config: lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log + - 10 permit ip host 192.0.2.1 any log + - 20 permit ip host 192.0.2.2 any log + - 30 permit ip host 192.0.2.3 any log + - 40 permit ip host 192.0.2.4 any log parents: ip access-list test before: no ip access-list test replace: block @@ -251,7 +251,7 @@ EXAMPLES = """ - name: render a Jinja2 template onto an Arista switch arista.eos.eos_config: - backup: yes + backup: true src: eos_template.j2 - name: diff the running config against a master config @@ -262,15 +262,13 @@ EXAMPLES = """ - name: for idempotency, use full-form commands arista.eos.eos_config: lines: - # - shut - - shutdown - # parents: int eth1 + - shutdown parents: interface Ethernet1 - name: configurable backup path arista.eos.eos_config: src: eos_template.j2 - backup: yes + backup: true backup_options: filename: backup.cfg dir_path: /home/user @@ -289,27 +287,27 @@ updates: sample: ['hostname switch01', 'interface Ethernet1', 'no shutdown'] backup_path: description: The full path to the backup file - returned: when backup is yes + returned: when backup is true type: str sample: /playbooks/ansible/backup/eos_config.2016-07-16@22:28:34 filename: description: The name of the backup file - returned: when backup is yes and filename is not specified in backup options + returned: when backup is true and filename is not specified in backup options type: str sample: eos_config.2016-07-16@22:28:34 shortname: description: The full path to the backup file excluding the timestamp - returned: when backup is yes and filename is not specified in backup options + returned: when backup is true and filename is not specified in backup options type: str sample: /playbooks/ansible/backup/eos_config date: description: The date extracted from the backup file name - returned: when backup is yes + returned: when backup is true type: str sample: "2016-07-16" time: description: The time extracted from the backup file name - returned: when backup is yes + returned: when backup is true type: str sample: "22:28:34" """ @@ -407,9 +405,9 @@ def main(): mutually_exclusive = [("lines", "src"), ("parents", "src")] required_if = [ - ("match", "strict", ["lines"]), - ("match", "exact", ["lines"]), - ("replace", "block", ["lines"]), + ("match", "strict", ["lines", "src"], True), + ("match", "exact", ["lines", "src"], True), + ("replace", "block", ["lines", "src"], True), ("replace", "config", ["src"]), ("diff_against", "intended", ["intended_config"]), ("diff_against", "validate_config", ["intended_config"]), @@ -442,9 +440,7 @@ def main(): msg="Cannot diff against sessions when sessions are disabled. Please change diff_against to another value", ) - if module.params["backup"] or ( - module._diff and module.params["diff_against"] == "running" - ): + if module.params["backup"] or (module._diff and module.params["diff_against"] == "running"): contents = get_config(module, flags=flags) config = NetworkConfig(indent=1, contents=contents) if module.params["backup"]: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_eapi.py b/ansible_collections/arista/eos/plugins/modules/eos_eapi.py index 2b3add753..2779465dc 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_eapi.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_eapi.py @@ -139,9 +139,9 @@ EXAMPLES = """ state: started http: false https_port: 9443 - local_http: yes + local_http: true local_http_port: 80 - socket: yes + socket: true - name: Shutdown eAPI access arista.eos.eos_eapi: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_facts.py b/ansible_collections/arista/eos/plugins/modules/eos_facts.py index f404d54bb..697b0c559 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_facts.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_facts.py @@ -59,12 +59,12 @@ EXAMPLES = """ - name: Gather only the config and default facts arista.eos.eos_facts: gather_subset: - - config + - config - name: Do not gather hardware facts arista.eos.eos_facts: gather_subset: - - '!hardware' + - '!hardware' - name: Gather legacy and resource facts arista.eos.eos_facts: @@ -74,10 +74,10 @@ EXAMPLES = """ - name: Gather only the interfaces resource facts and no legacy facts - arista.eos.eos_facts: gather_subset: - - '!all' - - '!min' + - '!all' + - '!min' gather_network_resources: - - interfaces + - interfaces - name: Gather all resource facts and minimal legacy facts arista.eos.eos_facts: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_hostname.py b/ansible_collections/arista/eos/plugins/modules/eos_hostname.py index dddadb71a..1f91dd337 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_hostname.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_hostname.py @@ -166,7 +166,7 @@ EXAMPLES = """ # Using state: gathered # Before state: # ------------- -#test#show running-config | section ^hostname +# test#show running-config | section ^hostname # hostname eosTest # Gathered play: # -------------- diff --git a/ansible_collections/arista/eos/plugins/modules/eos_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_interfaces.py index c7d0ae021..a2118dbaa 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_interfaces.py @@ -36,13 +36,14 @@ DOCUMENTATION = """ module: eos_interfaces short_description: Interfaces resource module description: -- This module manages the interface attributes of Arista EOS interfaces. + - This module manages the interface attributes of Arista EOS interfaces. version_added: 1.0.0 author: -- Nathaniel Case (@qalthos) + - Nathaniel Case (@Qalthos) notes: -- Tested against Arista EOS 4.24.6F -- This module works with connection C(network_cli). See the L(EOS Platform Options,../network/user_guide/platform_eos.html). + - Tested against Arista EOS 4.24.6F + - This module works with connection C(network_cli). + See U(https://docs.ansible.com/ansible/latest/network/user_guide/platform_eos.html) options: config: description: The provided configuration @@ -51,260 +52,350 @@ options: suboptions: name: description: - - Full name of the interface, e.g. GigabitEthernet1. + - Full name of the interface, e.g. GigabitEthernet1. type: str required: True description: description: - - Interface description + - Interface description type: str duplex: description: - - Interface link status. Applicable for Ethernet interfaces only. - - Values other than C(auto) must also set I(speed). - - Ignored when I(speed) is set above C(1000). + - Interface link status. Applicable for Ethernet interfaces only. + - Values other than C(auto) must also set I(speed). + - Ignored when I(speed) is set above C(1000). type: str enabled: default: true description: - - Administrative state of the interface. - - Set the value to C(true) to administratively enable the interface or C(false) - to disable it. + - Administrative state of the interface. + - Set the value to C(true) to administratively enable the interface or C(false) + to disable it. type: bool mtu: description: - - MTU for a specific interface. Must be an even number between 576 and 9216. - Applicable for Ethernet interfaces only. + - MTU for a specific interface. Must be an even number between 576 and 9216. + Applicable for Ethernet interfaces only. type: int speed: description: - - Interface link speed. Applicable for Ethernet interfaces only. + - Interface link speed. Applicable for Ethernet interfaces only. type: str mode: description: - - Manage Layer2 or Layer3 state of the interface. Applicable for Ethernet - and port channel interfaces only. + - Manage Layer2 or Layer3 state of the interface. Applicable for Ethernet + and port channel interfaces only. choices: - - layer2 - - layer3 + - layer2 + - layer3 type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the EOS device by - executing the command B(show running-config | section ^interface). - - The state I(parsed) reads the configuration from C(running_config) option and - transforms it into Ansible structured data as per the resource module's argspec - and the value is then returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the EOS device by + executing the command B(show running-config | section ^interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: choices: - - merged - - replaced - - overridden - - deleted - - parsed - - rendered - - gathered + - merged + - replaced + - overridden + - deleted + - parsed + - rendered + - gathered default: merged description: - - The state of the configuration after module completion. + - The state of the configuration after module completion. type: str - """ EXAMPLES = """ - # Using merged # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# description "Interface 1" # ! # interface Ethernet2 # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route - name: Merge provided configuration with device configuration arista.eos.eos_interfaces: config: - - name: Ethernet1 - enabled: true - mode: layer3 - - name: Ethernet2 - description: Configured by Ansible - enabled: false + - name: Ethernet1 + enabled: true + mode: layer3 + - name: Ethernet2 + description: Configured by Ansible + enabled: false state: merged +# Task Output +# ----------- +# +# before: +# - enabled: true +# name: Ethernet1 +# - enabled: true +# name: Ethernet2 +# - enabled: true +# name: Management1 +# commands: +# - interface Ethernet1 +# - no switchport +# - interface Ethernet2 +# - shutdown +# - description Configured by Ansible +# after: +# - enabled: true +# mode: layer3 +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# description "Interface 1" # no switchport # ! # interface Ethernet2 -# description "Configured by Ansible" +# description Configured by Ansible # shutdown # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route # Using replaced # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# description "Interface 1" +# no switchport # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route - name: Replaces device configuration of listed interfaces with provided configuration arista.eos.eos_interfaces: config: - - name: Ethernet1 - enabled: true - - name: Ethernet2 - description: Configured by Ansible - enabled: false + - name: Ethernet1 + enabled: true + - name: Ethernet2 + description: Configured by Ansible + enabled: false state: replaced +# Task Output +# ----------- +# +# before: +# - enabled: true +# mode: layer3 +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 +# commands: +# - interface Ethernet1 +# - switchport +# after: +# - enabled: true +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # ! # interface Ethernet2 -# description "Configured by Ansible" +# description Configured by Ansible # shutdown # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route # Using overridden # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# description "Interface 1" # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route - name: Overrides all device configuration with provided configuration arista.eos.eos_interfaces: config: - - name: Ethernet1 - enabled: true - - name: Ethernet2 - description: Configured by Ansible - enabled: false + - name: Ethernet1 + enabled: true + - name: Ethernet2 + description: Configured by Ansible + enabled: false state: overridden +# Task Output +# ----------- +# +# before: +# - enabled: true +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 +# commands: +# - interface Management1 +# - no shutdown +# after: +# - enabled: true +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # ! # interface Ethernet2 -# description "Configured by Ansible" +# description Configured by Ansible # shutdown # ! # interface Management1 # ip address dhcp -# ! +# dhcp client accept default-route # Using deleted # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# description "Interface 1" -# no switchport # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route - name: Delete or return interface parameters to default settings arista.eos.eos_interfaces: config: - - name: Ethernet1 + - name: Ethernet1 state: deleted +# Task Output +# ----------- +# +# before: +# - enabled: true +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 +# commands: +# - interface Ethernet1 +# - no shutdown +# after: +# - enabled: true +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # ! # interface Management1 -# description "Management interface" # ip address dhcp -# ! +# dhcp client accept default-route # Using rendered -- name: Use Rendered to convert the structured data to native config +- name: Render the provided configuration into platform specific configuration lines arista.eos.eos_interfaces: config: - - name: Ethernet1 - enabled: true - mode: layer3 - - name: Ethernet2 - description: Configured by Ansible - enabled: false - state: merged - -# Output: -# ------------ - -# - "interface Ethernet1" -# - "description "Interface 1"" -# - "no swithcport" -# - "interface Ethernet2" -# - "description "Configured by Ansible"" -# - "shutdown" -# - "interface Management1" -# - "description "Management interface"" -# - "ip address dhcp" - -# Using parsed -# parsed.cfg - + - name: Ethernet1 + enabled: true + mode: layer3 + - name: Ethernet2 + description: Configured by Ansible + enabled: false + state: rendered + +# Module Execution Result: +# ------------------------ +# +# rendered: +# - interface Ethernet1 +# - no shutdown +# - no switchport +# - interface Ethernet2 +# - shutdown +# - description Configured by Ansible + +# Using Parsed + +# File: parsed.cfg +# ---------------- +# # interface Ethernet1 # description "Interface 1" # ! @@ -313,64 +404,101 @@ EXAMPLES = """ # shutdown # ! -- name: Use parsed to convert native configs to structured data +- name: Parse the commands for provided configuration arista.eos.interfaces: running_config: "{{ lookup('file', 'parsed.cfg') }}" state: parsed -# Output +# Module Execution Result: +# ------------------------ +# # parsed: -# - name: Ethernet1 -# enabled: True -# mode: layer2 -# - name: Ethernet2 -# description: 'Configured by Ansible' -# enabled: False -# mode: layer2 - -# Using gathered: - -# Existing config on the device -# ----------------------------- +# - name: Ethernet1 +# enabled: True +# mode: layer2 +# - name: Ethernet2 +# description: 'Configured by Ansible' +# enabled: False +# mode: layer2 + +# Using Gathered + +# Before state: +# ------------- +# +# test#show running-config | section interface # interface Ethernet1 -# description "Interface 1" # ! # interface Ethernet2 -# description "Configured by Ansible" +# description Configured by Ansible # shutdown # ! +# interface Management1 +# ip address dhcp +# dhcp client accept default-route - name: Gather interfaces facts from the device arista.eos.interfaces: state: gathered -# output +# Module Execution Result: +# ------------------------ +# # gathered: -# - name: Ethernet1 -# enabled: True -# mode: layer2 -# - name: Ethernet2 -# description: 'Configured by Ansible' -# enabled: False -# mode: layer2 +# - enabled: true +# name: Ethernet1 +# - description: Configured by Ansible +# enabled: false +# name: Ethernet2 +# - enabled: true +# name: Management1 """ RETURN = """ before: - description: The configuration as structured data prior to module invocation. - returned: always + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: dict - sample: The configuration returned will always be in the same format of the parameters above. + sample: > + This output will always be in the same format as the + module argspec. after: - description: The configuration as structured data after module completion. + description: The resulting configuration after module execution. returned: when changed type: dict - sample: The configuration returned will always be in the same format of the parameters above. + sample: > + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. - returned: always + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - interface Ethernet1 + - no shutdown + - no switchport +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - interface Ethernet1 + - no shutdown + - no switchport +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) type: list - sample: ['interface Ethernet2', 'shutdown', 'speed 10full'] + sample: > + This output will always be in the same format as the + module argspec. """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_l2_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_l2_interfaces.py index 863a2cf2a..23057d6dc 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_l2_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_l2_interfaces.py @@ -34,13 +34,15 @@ __metaclass__ = type DOCUMENTATION = """ module: eos_l2_interfaces short_description: L2 interfaces resource module -description: This module provides declarative management of Layer-2 interface on Arista +description: + This module provides declarative management of Layer-2 interface on Arista EOS devices. version_added: 1.0.0 -author: Nathaniel Case (@qalthos) +author: Nathaniel Case (@Qalthos) notes: -- Tested against Arista EOS 4.24.6F -- This module works with connection C(network_cli). See the L(EOS Platform Options,../network/user_guide/platform_eos.html). + - Tested against Arista EOS 4.24.6F + - This module works with connection C(network_cli). + See U(https://docs.ansible.com/ansible/latest/network/user_guide/platform_eos.html) options: config: description: A dictionary of Layer-2 interface options @@ -49,275 +51,375 @@ options: suboptions: name: description: - - Full name of interface, e.g. Ethernet1. + - Full name of interface, e.g. Ethernet1. type: str required: true access: description: - - Switchport mode access command to configure the interface as a layer 2 access. + - Switchport mode access command to configure the interface as a layer 2 access. type: dict suboptions: vlan: description: - - Configure given VLAN in access port. It's used as the access VLAN ID. + - Configure given VLAN in access port. It's used as the access VLAN ID. type: int trunk: description: - - Switchport mode trunk command to configure the interface as a Layer 2 trunk. + - Switchport mode trunk command to configure the interface as a Layer 2 trunk. type: dict suboptions: native_vlan: description: - - Native VLAN to be configured in trunk port. It is used as the trunk - native VLAN ID. + - Native VLAN to be configured in trunk port. It is used as the trunk + native VLAN ID. type: int trunk_allowed_vlans: description: - - List of allowed VLANs in a given trunk port. These are the only VLANs - that will be configured on the trunk. + - List of allowed VLANs in a given trunk port. These are the only VLANs + that will be configured on the trunk. type: list elements: str mode: description: - - Mode in which interface needs to be configured. - - Access mode is not shown in interface facts, so idempotency will not be - maintained for switchport mode access and every time the output will come - as changed=True. + - Mode in which interface needs to be configured. + - Access mode is not shown in interface facts, so idempotency will not be + maintained for switchport mode access and every time the output will come + as changed=True. type: str choices: - - access - - trunk + - access + - trunk running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the EOS device by - executing the command B(show running-config | section ^interface). - - The state I(parsed) reads the configuration from C(running_config) option and - transforms it into Ansible structured data as per the resource module's argspec - and the value is then returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the EOS device by + executing the command B(show running-config | section ^interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: choices: - - merged - - replaced - - overridden - - deleted - - parsed - - rendered - - gathered + - merged + - replaced + - overridden + - deleted + - parsed + - rendered + - gathered default: merged description: - - The state of the configuration after module completion + - The state of the configuration after module completion type: str - """ EXAMPLES = """ - # Using merged # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# switchport access vlan 20 # ! # interface Ethernet2 -# switchport trunk native vlan 20 -# switchport mode trunk +# description Configured by Ansible +# shutdown # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route - name: Merge provided configuration with device configuration. arista.eos.eos_l2_interfaces: config: - - name: Ethernet1 - mode: trunk - trunk: - native_vlan: 10 - - name: Ethernet2 - mode: access - access: - vlan: 30 + - name: Ethernet1 + mode: trunk + trunk: + native_vlan: 10 + - name: Ethernet2 + mode: access + access: + vlan: 30 state: merged +# Task Output +# ----------- +# +# before: +# - name: Ethernet1 +# - name: Ethernet2 +# - name: Management1 +# commands: +# - interface Ethernet1 +# - switchport mode trunk +# - switchport trunk native vlan 10 +# - interface Ethernet2 +# - switchport mode access +# - switchport access vlan 30 +# after: +# - mode: trunk +# name: Ethernet1 +# trunk: +# native_vlan: 10 +# - access: +# vlan: 30 +# name: Ethernet2 +# - name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # switchport trunk native vlan 10 # switchport mode trunk # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # switchport access vlan 30 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route # Using replaced # Before state: # ------------- # -# veos2#show running-config | s int +# test#show running-config | section interface # interface Ethernet1 -# switchport access vlan 20 +# switchport trunk native vlan 10 +# switchport mode trunk # ! # interface Ethernet2 -# switchport trunk native vlan 20 -# switchport mode trunk +# description Configured by Ansible +# shutdown +# switchport access vlan 30 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route - name: Replace device configuration of specified L2 interfaces with provided configuration. arista.eos.eos_l2_interfaces: config: - - name: Ethernet1 - mode: trunk - trunk: - native_vlan: 20 - trunk_allowed_vlans: 5-10, 15 + - name: Ethernet1 + mode: trunk + trunk: + native_vlan: 20 + trunk_allowed_vlans: 5-10, 15 state: replaced +# Task Output +# ----------- +# +# before: +# - mode: trunk +# name: Ethernet1 +# trunk: +# native_vlan: 10 +# - access: +# vlan: 30 +# name: Ethernet2 +# - name: Management1 +# commands: +# - interface Ethernet1 +# - switchport trunk native vlan 20 +# - switchport trunk allowed vlan 10,15,5,6,7,8,9 +# after: +# - mode: trunk +# name: Ethernet1 +# trunk: +# native_vlan: 20 +# trunk_allowed_vlans: +# - 5-10 +# - '15' +# - access: +# vlan: 30 +# name: Ethernet2 +# - name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # switchport trunk native vlan 20 # switchport trunk allowed vlan 5-10,15 # switchport mode trunk # ! # interface Ethernet2 -# switchport trunk native vlan 20 -# switchport mode trunk +# description Configured by Ansible +# shutdown +# switchport access vlan 30 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route # Using overridden # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# switchport access vlan 20 -# ! -# interface Ethernet2 # switchport trunk native vlan 20 +# switchport trunk allowed vlan 5-10,15 # switchport mode trunk # ! +# interface Ethernet2 +# description Configured by Ansible +# shutdown +# switchport access vlan 30 +# ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route - name: Override device configuration of all L2 interfaces on device with provided configuration. arista.eos.eos_l2_interfaces: config: - - name: Ethernet2 - mode: access - access: - vlan: 30 + - name: Ethernet2 + mode: access + access: + vlan: 30 state: overridden +# Task Output +# ----------- +# +# before: +# - mode: trunk +# name: Ethernet1 +# trunk: +# native_vlan: 20 +# trunk_allowed_vlans: +# - 5-10 +# - '15' +# - access: +# vlan: 30 +# name: Ethernet2 +# - name: Management1 +# commands: +# - interface Ethernet1 +# - no switchport mode +# - no switchport trunk allowed vlan +# - no switchport trunk native vlan +# - interface Ethernet2 +# - switchport mode access +# after: +# - name: Ethernet1 +# - access: +# vlan: 30 +# name: Ethernet2 +# - name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # switchport access vlan 30 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route # Using deleted # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# switchport access vlan 20 # ! # interface Ethernet2 -# switchport trunk native vlan 20 -# switchport mode trunk +# description Configured by Ansible +# shutdown +# switchport access vlan 30 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config -# ! +# dhcp client accept default-route - name: Delete EOS L2 interfaces as in given arguments. arista.eos.eos_l2_interfaces: config: - - name: Ethernet1 - - name: Ethernet2 + - name: Ethernet1 + - name: Ethernet2 state: deleted +# Task Output +# ----------- +# +# before: +# - name: Ethernet1 +# - access: +# vlan: 30 +# name: Ethernet2 +# - name: Management1 +# commands: +# - interface Ethernet2 +# - no switchport access vlan +# after: +# - name: Ethernet1 +# - name: Ethernet2 +# - name: Management1 + # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route # using rendered - name: Use Rendered to convert the structured data to native config arista.eos.eos_l2_interfaces: config: - - name: Ethernet1 - mode: trunk - trunk: - native_vlan: 10 - - name: Ethernet2 - mode: access - access: - vlan: 30 - state: merged - -# Output : -# ------------ + - name: Ethernet1 + mode: trunk + trunk: + native_vlan: 10 + - name: Ethernet2 + mode: access + access: + vlan: 30 + state: rendered + +# Module Execution Result: +# ------------------------ +# +# rendered: +# - interface Ethernet1 +# - switchport mode trunk +# - switchport trunk native vlan 10 +# - interface Ethernet2 +# - switchport mode access +# - switchport access vlan 30 + +# Using parsed + +# File: parsed.cfg +# ---------------- # -# - "interface Ethernet1" -# - "switchport trunk native vlan 10" -# - "switchport mode trunk" -# - "interface Ethernet2" -# - "switchport access vlan 30" -# - "interface Management1" -# - "ip address dhcp" -# - "ipv6 address auto-config" - - -# using parsed - -# parsed.cfg - # interface Ethernet1 # switchport trunk native vlan 10 # switchport mode trunk @@ -326,25 +428,28 @@ EXAMPLES = """ # switchport access vlan 30 # ! -- name: Use parsed to convert native configs to structured data +- name: Parse the commands for provided configuration arista.eos.l2_interfaces: running_config: "{{ lookup('file', 'parsed.cfg') }}" state: parsed -# Output: -# parsed: -# - name: Ethernet1 -# mode: trunk -# trunk: -# native_vlan: 10 -# - name: Ethernet2 -# mode: access -# access: -# vlan: 30 - +# Module Execution Result: +# ------------------------ +# +# parsed: +# - name: Ethernet1 +# mode: trunk +# trunk: +# native_vlan: 10 +# - name: Ethernet2 +# mode: access +# access: +# vlan: 30 + +# Using gathered -# Using gathered: -# Existing config on the device: +# Before state: +# ------------- # # veos#show running-config | section interface # interface Ethernet1 @@ -358,35 +463,66 @@ EXAMPLES = """ - name: Gather interfaces facts from the device arista.eos.l2_interfaces: state: gathered -# output: -# gathered: -# - name: Ethernet1 -# mode: trunk -# trunk: -# native_vlan: 10 -# - name: Ethernet2 -# mode: access -# access: -# vlan: 30 +# Module Execution Result: +# ------------------------ +# +# gathered: +# - name: Ethernet1 +# mode: trunk +# trunk: +# native_vlan: 10 +# - name: Ethernet2 +# mode: access +# access: +# vlan: 30 """ RETURN = """ before: - description: The configuration as structured data prior to module invocation. - returned: always - type: list - sample: The configuration returned will always be in the same format of the parameters above. + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. after: - description: The configuration as structured data after module completion. + description: The resulting configuration after module execution. returned: when changed - type: list - sample: The configuration returned will always be in the same format of the parameters above. + type: dict + sample: > + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. - returned: always + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - interface Ethernet1 + - switchport mode trunk + - switchport access vlan 20 +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - interface Ethernet1 + - switchport mode trunk + - switchport access vlan 20 +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) type: list - sample: ['interface Ethernet2', 'switchport access vlan 20'] + sample: > + This output will always be in the same format as the + module argspec. """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_l3_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_l3_interfaces.py index 93da7612c..f55d11069 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_l3_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_l3_interfaces.py @@ -35,15 +35,17 @@ __metaclass__ = type DOCUMENTATION = """ module: eos_l3_interfaces short_description: L3 interfaces resource module -description: This module provides declarative management of Layer 3 interfaces on +description: + This module provides declarative management of Layer 3 interfaces on Arista EOS devices. version_added: 1.0.0 -author: Nathaniel Case (@qalthos) +author: Nathaniel Case (@Qalthos) notes: -- Tested against Arista EOS 4.24.6F -- This module works with connection C(network_cli). See the L(EOS Platform Options,../network/user_guide/platform_eos.html). - 'eos_l2_interfaces/eos_interfaces' should be used for preparing the interfaces , before applying L3 configurations using - this module (eos_l3_interfaces). + - Tested against Arista EOS 4.24.6F + - This module works with connection C(network_cli). + See U(https://docs.ansible.com/ansible/latest/network/user_guide/platform_eos.html) + 'eos_l2_interfaces/eos_interfaces' should be used for preparing the interfaces, + before applying L3 configurations using this module (eos_l3_interfaces). options: config: description: A dictionary of Layer 3 interface options @@ -52,233 +54,337 @@ options: suboptions: name: description: - - Full name of the interface, i.e. Ethernet1. + - Full name of the interface, i.e. Ethernet1. type: str required: true ipv4: description: - - List of IPv4 addresses to be set for the Layer 3 interface mentioned in - I(name) option. + - List of IPv4 addresses to be set for the Layer 3 interface mentioned in + I(name) option. type: list elements: dict suboptions: address: description: - - IPv4 address to be set in the format <ipv4 address>/<mask> eg. 192.0.2.1/24, - or C(dhcp) to query DHCP for an IP address. + - IPv4 address to be set in the format <ipv4 address>/<mask> eg. 192.0.2.1/24, + or C(dhcp) to query DHCP for an IP address. type: str secondary: description: - - Whether or not this address is a secondary address. + - Whether or not this address is a secondary address. type: bool virtual: description: - - Whether or not this address is a virtual address. + - Whether or not this address is a virtual address. type: bool ipv6: description: - - List of IPv6 addresses to be set for the Layer 3 interface mentioned in - I(name) option. + - List of IPv6 addresses to be set for the Layer 3 interface mentioned in + I(name) option. type: list elements: dict suboptions: address: description: - - IPv6 address to be set in the address format is <ipv6 address>/<mask> - eg. 2001:db8:2201:1::1/64 or C(auto-config) to use SLAAC to chose an - address. + - IPv6 address to be set in the address format is <ipv6 address>/<mask> + eg. 2001:db8:2201:1::1/64 or C(auto-config) to use SLAAC to chose an + address. type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the EOS device by - executing the command B(show running-config | section ^interface). - - The state I(parsed) reads the configuration from C(running_config) option and - transforms it into Ansible structured data as per the resource module's argspec - and the value is then returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the EOS device by + executing the command B(show running-config | section ^interface). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: - - The state of the configuration after module completion + - The state of the configuration after module completion type: str choices: - - merged - - replaced - - overridden - - deleted - - parsed - - gathered - - rendered + - merged + - replaced + - overridden + - deleted + - parsed + - gathered + - rendered default: merged - """ EXAMPLES = """ - -# Using deleted +# Using merged # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# ip address 192.0.2.12/24 # ! # interface Ethernet2 -# ipv6 address 2001:db8::1/64 +# description Configured by Ansible +# shutdown # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route -- name: Delete L3 attributes of given interfaces. +- name: Merge provided configuration with device configuration. arista.eos.eos_l3_interfaces: config: - - name: Ethernet1 - - name: Ethernet2 - state: deleted + - name: Ethernet1 + ipv4: + - address: 198.51.100.14/24 + - name: Ethernet2 + ipv4: + - address: 203.0.113.27/24 + state: merged + +# Task Output +# ----------- +# +# before: +# - name: Ethernet1 +# - name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 +# commands: +# - interface Ethernet1 +# - ip address 198.51.100.14/24 +# - interface Ethernet2 +# - ip address 203.0.113.27/24 +# after: +# - ipv4: +# - address: 198.51.100.14/24 +# name: Ethernet1 +# - ipv4: +# - address: 203.0.113.27/24 +# name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 +# ip address 198.51.100.14/24 # ! # interface Ethernet2 +# description Configured by Ansible +# shutdown +# ip address 203.0.113.27/24 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route - -# Using merged +# Using overridden # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# ip address 192.0.2.12/24 +# ip address 198.51.100.14/24 # ! # interface Ethernet2 -# ipv6 address 2001:db8::1/64 +# ip address 203.0.113.27/24 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route -- name: Merge provided configuration with device configuration. +- name: Override device configuration of all L2 interfaces on device with provided + configuration. arista.eos.eos_l3_interfaces: config: - - name: Ethernet1 - ipv4: - - address: 198.51.100.14/24 - - name: Ethernet2 - ipv4: - - address: 203.0.113.27/24 - state: merged + - name: Ethernet1 + ipv6: + - address: 2001:db8:feed::1/96 + - name: Ethernet2 + ipv4: + - address: 203.0.113.27/24 + - ipv4: + - address: dhcp + name: Management1 + state: overridden + +# Task Output +# ----------- +# +# before: +# - ipv4: +# - address: 198.51.100.14/24 +# name: Ethernet1 +# - ipv4: +# - address: 203.0.113.27/24 +# name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 +# commands: +# - interface Ethernet1 +# - ipv6 address 2001:db8:feed::1/96 +# - no ip address +# after: +# - ipv6: +# - address: 2001:db8:feed::1/96 +# name: Ethernet1 +# - ipv4: +# - address: 203.0.113.27/24 +# name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# ip address 198.51.100.14/24 +# ipv6 address 2001:db8:feed::1/96 # ! # interface Ethernet2 # ip address 203.0.113.27/24 -# ipv6 address 2001:db8::1/64 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route - -# Using overridden +# Using replaced # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# ip address 192.0.2.12/24 +# ipv6 address 2001:db8:feed::1/96 # ! # interface Ethernet2 -# ipv6 address 2001:db8::1/64 +# ip address 203.0.113.27/24 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route -- name: Override device configuration of all L2 interfaces on device with provided - configuration. +- name: Replace device configuration of specified L2 interfaces with provided configuration. arista.eos.eos_l3_interfaces: config: - - name: Ethernet1 - ipv6: - - address: 2001:db8:feed::1/96 - - name: Management1 - ipv4: - - address: dhcp - ipv6: auto-config - state: overridden + - name: Ethernet2 + ipv4: + - address: 203.0.113.27/24 + state: replaced + +# Task Output +# ----------- +# +# before: +# - ipv6: +# - address: 2001:db8:feed::1/96 +# name: Ethernet1 +# - ipv4: +# - address: 203.0.113.27/24 +# name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 +# commands: +# - interface Ethernet2 +# - ip address 203.0.113.28/24 +# after: +# - ipv6: +# - address: 2001:db8:feed::1/96 +# name: Ethernet1 +# - ipv4: +# - address: 203.0.113.28/24 +# name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 # ipv6 address 2001:db8:feed::1/96 # ! # interface Ethernet2 +# ip address 203.0.113.28/24 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route - -# Using replaced +# Using deleted # Before state: # ------------- # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# ip address 192.0.2.12/24 +# ipv6 address 2001:db8:feed::1/96 # ! # interface Ethernet2 -# ipv6 address 2001:db8::1/64 +# ip address 203.0.113.28/24 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route -- name: Replace device configuration of specified L2 interfaces with provided configuration. +- name: Delete L3 attributes of given interfaces. arista.eos.eos_l3_interfaces: config: - - name: Ethernet2 - ipv4: - - address: 203.0.113.27/24 - state: replaced + - name: Ethernet1 + - name: Ethernet2 + state: deleted + +# Task Output +# ----------- +# +# before: +# - ipv6: +# - address: 2001:db8:feed::1/96 +# name: Ethernet1 +# - ipv4: +# - address: 203.0.113.28/24 +# name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 +# commands: +# - interface Ethernet1 +# - no ipv6 address 2001:db8:feed::1/96 +# - interface Ethernet2 +# - no ip address +# after: +# - name: Ethernet1 +# - name: Ethernet2 +# - ipv4: +# - address: dhcp +# name: Management1 # After state: # ------------ # -# veos#show running-config | section interface +# test#show running-config | section interface # interface Ethernet1 -# ip address 192.0.2.12/24 # ! # interface Ethernet2 -# ip address 203.0.113.27/24 # ! # interface Management1 # ip address dhcp -# ipv6 address auto-config +# dhcp client accept default-route -# Using parsed: +# Using Parsed -# parsed.cfg -# ------------ +# File: parsed.cfg +# ---------------- # # veos#show running-config | section interface # interface Ethernet1 @@ -293,41 +399,45 @@ EXAMPLES = """ running_config: "{{ lookup('file', 'parsed.cfg') }}" state: parsed -# Output: - +# Module Execution Result: +# ------------------------ +# # parsed: -# - name: Ethernet1 -# ipv4: -# - address: 198.51.100.14/24 -# - name: Ethernet2 -# ipv4: -# - address: 203.0.113.27/24 +# - name: Ethernet1 +# ipv4: +# - address: 198.51.100.14/24 +# - name: Ethernet2 +# ipv4: +# - address: 203.0.113.27/24 # Using rendered: - name: Use Rendered to convert the structured data to native config arista.eos.eos_l3_interfaces: config: - - name: Ethernet1 - ipv4: - - address: 198.51.100.14/24 - - name: Ethernet2 - ipv4: - - address: 203.0.113.27/24 + - name: Ethernet1 + ipv4: + - address: 198.51.100.14/24 + - name: Ethernet2 + ipv4: + - address: 203.0.113.27/24 state: rendered -# Output -# ------------ -#rendered: -# - "interface Ethernet1" -# - "ip address 198.51.100.14/24" -# - "interface Ethernet2" -# - "ip address 203.0.113.27/24" +# Module Execution Result: +# ------------------------ +# +# rendered: +# - interface Ethernet1 +# - ip address 198.51.100.14/24 +# - interface Ethernet2 +# - ip address 203.0.113.27/24 # using gathered: -# Native COnfig: -# veos#show running-config | section interface +# Before state: +# ------------- +# +# test#show running-config | section interface # interface Ethernet1 # ip address 198.51.100.14/24 # ! @@ -339,36 +449,62 @@ EXAMPLES = """ arista.eos.l3_interfaces: state: gathered -# gathered: -# - name: Ethernet1 -# ipv4: -# - address: 198.51.100.14/24 -# - name: Ethernet2 -# ipv4: -# - address: 203.0.113.27/24 - - +# Module Execution Result: +# ------------------------ +# +# gathered: +# - name: Ethernet1 +# ipv4: +# - address: 198.51.100.14/24 +# - name: Ethernet2 +# ipv4: +# - address: 203.0.113.27/24 """ RETURN = """ before: - description: The configuration as structured data prior to module invocation. - returned: always - type: list + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. + This output will always be in the same format as the + module argspec. after: - description: The configuration as structured data after module completion. + description: The resulting configuration after module execution. returned: when changed - type: list + type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. - returned: always + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list - sample: ['interface Ethernet2', 'ip address 192.0.2.12/24'] + sample: + - interface Ethernet1 + - ip address 198.51.100.14/24 + - ipv6 address 2001:db8:feed::1/96 +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - interface Ethernet1 + - ip address 198.51.100.14/24 + - ipv6 address 2001:db8:feed::1/96 +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_lacp.py b/ansible_collections/arista/eos/plugins/modules/eos_lacp.py index d79ca8805..dfc6e82f7 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_lacp.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_lacp.py @@ -140,7 +140,7 @@ EXAMPLES = """ # veos# show running-config | include lacp # -#Using rendered: +# Using rendered: - name: Use Rendered to convert the structured data to native config arista.eos.eos_lacp: @@ -184,7 +184,6 @@ EXAMPLES = """ # system: # priority: 10 # - """ RETURN = """ before: @@ -214,9 +213,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.lacp.lacp import ( LacpArgs, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.lacp.lacp import ( - Lacp, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.lacp.lacp import Lacp def main(): diff --git a/ansible_collections/arista/eos/plugins/modules/eos_lacp_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_lacp_interfaces.py index 47a3662e8..1b895c43a 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_lacp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_lacp_interfaces.py @@ -110,10 +110,10 @@ EXAMPLES = """ - name: Merge provided configuration with device configuration arista.eos.eos_lacp_interfaces: config: - - name: Ethernet1 - rate: fast - - name: Ethernet2 - rate: normal + - name: Ethernet1 + rate: fast + - name: Ethernet2 + rate: normal state: merged # @@ -135,7 +135,6 @@ EXAMPLES = """ # Before state # ------------ # -# # veos#show run | section ^interface # interface Ethernet1 # lacp port-priority 30 @@ -146,8 +145,8 @@ EXAMPLES = """ configuration arista.eos.eos_lacp_interfaces: config: - - name: Ethernet1 - rate: fast + - name: Ethernet1 + rate: fast state: replaced # @@ -179,8 +178,8 @@ EXAMPLES = """ - name: Override the LACP configuration of all the interfaces with provided configuration arista.eos.eos_lacp_interfaces: config: - - name: Ethernet1 - rate: fast + - name: Ethernet1 + rate: fast state: overridden # @@ -226,10 +225,10 @@ EXAMPLES = """ - name: Use Rendered to convert the structured data to native config arista.eos.eos_lacp_interfaces: config: - - name: Ethernet1 - rate: fast - - name: Ethernet2 - rate: normal + - name: Ethernet1 + rate: fast + - name: Ethernet2 + rate: normal state: rendered # @@ -276,7 +275,6 @@ EXAMPLES = """ # - name: Ethernet1 # - name: Ethernet2 # rate: fast - """ RETURN = """ before: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_lag_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_lag_interfaces.py index 471652772..2a58f796f 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_lag_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_lag_interfaces.py @@ -112,10 +112,10 @@ EXAMPLES = """ - name: Merge provided LAG attributes with existing device configuration arista.eos.eos_lag_interfaces: config: - - name: 5 - members: - - member: Ethernet2 - mode: on + - name: 5 + members: + - member: Ethernet2 + mode: on state: merged # After state: @@ -141,10 +141,10 @@ EXAMPLES = """ - name: Replace all device configuration of specified LAGs with provided configuration arista.eos.eos_lag_interfaces: config: - - name: 5 - members: - - member: Ethernet2 - mode: on + - name: 5 + members: + - member: Ethernet2 + mode: on state: replaced # After state: @@ -169,10 +169,10 @@ EXAMPLES = """ - name: Override all device configuration of all LAG attributes with provided configuration arista.eos.eos_lag_interfaces: config: - - name: 10 - members: - - member: Ethernet2 - mode: on + - name: 10 + members: + - member: Ethernet2 + mode: on state: overridden # After state: @@ -198,9 +198,9 @@ EXAMPLES = """ - name: Delete LAG attributes of the given interfaces. arista.eos.eos_lag_interfaces: config: - - name: 5 - members: - - member: Ethernet1 + - name: 5 + members: + - member: Ethernet1 state: deleted # After state: @@ -238,12 +238,12 @@ EXAMPLES = """ - name: Use Rendered to convert the structured data to native config arista.eos.eos_lag_interfaces: config: - - name: 5 - members: - - member: Ethernet2 - mode: on - - member: Ethernet1 - mode: on + - name: 5 + members: + - member: Ethernet2 + mode: on + - member: Ethernet1 + mode: on state: rendered # ----------- # Output @@ -277,7 +277,6 @@ EXAMPLES = """ # mode: on # - member: Ethernet1 # mode: on - """ RETURN = """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_lldp_global.py b/ansible_collections/arista/eos/plugins/modules/eos_lldp_global.py index a98535c66..7dbf6d17d 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_lldp_global.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_lldp_global.py @@ -282,7 +282,6 @@ EXAMPLES = """ # management_address: False # port_description: False # system_description: True - """ RETURN = """ before: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_lldp_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_lldp_interfaces.py index 6b5aae118..0ea9e7045 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_lldp_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_lldp_interfaces.py @@ -103,10 +103,10 @@ EXAMPLES = """ - name: Merge provided configuration with running configuration arista.eos.eos_lldp_interfaces: config: - - name: Ethernet1 - transmit: false - - name: Ethernet2 - transmit: false + - name: Ethernet1 + transmit: false + - name: Ethernet2 + transmit: false state: merged # @@ -140,8 +140,8 @@ EXAMPLES = """ configuration arista.eos.eos_lldp_interfaces: config: - - name: Ethernet1 - transmit: false + - name: Ethernet1 + transmit: false state: replaced # @@ -173,8 +173,8 @@ EXAMPLES = """ - name: Override the LLDP configuration of all the interfaces with provided configuration arista.eos.eos_lldp_interfaces: config: - - name: Ethernet1 - transmit: false + - name: Ethernet1 + transmit: false state: overridden # @@ -221,10 +221,10 @@ EXAMPLES = """ - name: Use Rendered to convert the structured data to native config arista.eos.eos_lldp_interfaces: config: - - name: Ethernet1 - transmit: false - - name: Ethernet2 - transmit: false + - name: Ethernet1 + transmit: false + - name: Ethernet2 + transmit: false state: rendered # @@ -282,7 +282,6 @@ EXAMPLES = """ # transmit: False # - name: Ethernet2 # transmit: False - """ RETURN = """ before: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_logging.py b/ansible_collections/arista/eos/plugins/modules/eos_logging.py index b2b9106f6..845af44d5 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_logging.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_logging.py @@ -150,8 +150,8 @@ EXAMPLES = """ - name: Configure logging using aggregate arista.eos.eos_logging: aggregate: - - {dest: console, level: warnings} - - {dest: buffered, size: 480000} + - {dest: console, level: warnings} + - {dest: buffered, size: 480000} state: present """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_logging_global.py b/ansible_collections/arista/eos/plugins/modules/eos_logging_global.py index a614dcb8e..c744f1644 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_logging_global.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_logging_global.py @@ -240,31 +240,29 @@ options: default: merged """ EXAMPLES = """ - # Using merged - # Before state # test(config)#show running-config | section logging # test(config)# - - name: Merge provided configuration with device configuration - arista.eos.eos_logging_global: - config: - hosts: - - name: "host01" - protocol: "tcp" - - name: "11.11.11.1" - port: 25 - vrfs: - - name: "vrf01" - source_interface: "Ethernet1" - - name: "vrf02" - hosts: - - name: "hostvrf1" - protocol: "tcp" - - name: "24.1.1.1" - port: "33" +- name: Merge provided configuration with device configuration + arista.eos.eos_logging_global: + config: + hosts: + - name: "host01" + protocol: "tcp" + - name: "11.11.11.1" + port: 25 + vrfs: + - name: "vrf01" + source_interface: "Ethernet1" + - name: "vrf02" + hosts: + - name: "hostvrf1" + protocol: "tcp" + - name: "24.1.1.1" + port: "33" # After State: @@ -338,25 +336,25 @@ EXAMPLES = """ # logging level AAA alerts # test(config)# - - name: Repalce - arista.eos.eos_logging_global: - config: - synchronous: - set: True - trap: - severity: "critical" - hosts: - - name: "host02" - protocol: "tcp" - vrfs: - - name: "vrf03" - source_interface: "Vlan100" - - name: "vrf04" - hosts: - - name: "hostvrf1" - protocol: "tcp" - - state: replaced +- name: Repalce + arista.eos.eos_logging_global: + config: + synchronous: + set: true + trap: + severity: "critical" + hosts: + - name: "host02" + protocol: "tcp" + vrfs: + - name: "vrf03" + source_interface: "Vlan100" + - name: "vrf04" + hosts: + - name: "hostvrf1" + protocol: "tcp" + + state: replaced # After State: # test(config)#show running-config | section logging @@ -377,7 +375,7 @@ EXAMPLES = """ # } # ], # "synchronous": { -# "set": True +# "set": true # }, # "trap": { # "severity": "critical" @@ -487,25 +485,25 @@ EXAMPLES = """ # logging level AAA alerts # test(config)# - - name: Repalce - arista.eos.eos_logging_global: - config: - synchronous: - set: True - trap: - severity: "critical" - hosts: - - name: "host02" - protocol: "tcp" - vrfs: - - name: "vrf03" - source_interface: "Vlan100" - - name: "vrf04" - hosts: - - name: "hostvrf1" - protocol: "tcp" - - state: overridden +- name: Repalce + arista.eos.eos_logging_global: + config: + synchronous: + set: true + trap: + severity: "critical" + hosts: + - name: "host02" + protocol: "tcp" + vrfs: + - name: "vrf03" + source_interface: "Vlan100" + - name: "vrf04" + hosts: + - name: "hostvrf1" + protocol: "tcp" + + state: overridden # After State: # test(config)#show running-config | section logging @@ -526,7 +524,7 @@ EXAMPLES = """ # } # ], # "synchronous": { -# "set": True +# "set": true # }, # "trap": { # "severity": "critical" @@ -634,10 +632,10 @@ EXAMPLES = """ # logging vrf vrf03 source-interface Vlan100 # test(config)# - - name: Delete all logging configs - arista.eos.eos_logging_global: - state: deleted - become: yes +- name: Delete all logging configs + arista.eos.eos_logging_global: + state: deleted + become: true # After state: # test(config)#show running-config | section logging @@ -726,10 +724,10 @@ EXAMPLES = """ # ! # logging level AAA alerts - - name: parse configs - arista.eos.eos_logging_global: - running_config: "{{ lookup('file', './parsed.cfg') }}" - state: parsed +- name: parse configs + arista.eos.eos_logging_global: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed # Module Execution # "parsed": { @@ -800,9 +798,9 @@ EXAMPLES = """ # logging level AAA alerts # test(config)# - - name: gather configs - arista.eos.eos_logging_global: - state: gathered +- name: gather configs + arista.eos.eos_logging_global: + state: gathered # Module Execution: # "gathered": { @@ -859,35 +857,35 @@ EXAMPLES = """ # # Using rendered: - - name: Render provided configuration - arista.eos.eos_logging_global: - config: - format: - timestamp: - traditional: - timezone: True - level: - facility: "AAA" - severity: "alerts" - persistent: - size: 4096 - policy: - invert_result: True - match_list: "list01" - hosts: - - name: "host01" - protocol: "tcp" - - name: "11.11.11.1" - port: 25 - vrfs: - - name: "vrf01" - source_interface: "Ethernet1" - - name: "vrf02" - hosts: - - name: "hostvrf1" - protocol: "tcp" - - name: "24.1.1.1" - port: "33" +- name: Render provided configuration + arista.eos.eos_logging_global: + config: + format: + timestamp: + traditional: + timezone: true + level: + facility: "AAA" + severity: "alerts" + persistent: + size: 4096 + policy: + invert_result: true + match_list: "list01" + hosts: + - name: "host01" + protocol: "tcp" + - name: "11.11.11.1" + port: 25 + vrfs: + - name: "vrf01" + source_interface: "Ethernet1" + - name: "vrf02" + hosts: + - name: "hostvrf1" + protocol: "tcp" + - name: "24.1.1.1" + port: "33" # Module Execution: # "rendered": [ @@ -902,7 +900,6 @@ EXAMPLES = """ # "logging policy match invert-result match-list list01 discard" # ] # - """ from ansible.module_utils.basic import AnsibleModule diff --git a/ansible_collections/arista/eos/plugins/modules/eos_ntp_global.py b/ansible_collections/arista/eos/plugins/modules/eos_ntp_global.py index cb89f3a9d..325e97a22 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_ntp_global.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_ntp_global.py @@ -107,7 +107,7 @@ options: server: description: Hostname or A.B.C.D or A:B:C:D:E:F:G:H. type: str - required: True + required: true burst: description: Send a burst of packets instead of the usual one. type: bool @@ -164,51 +164,51 @@ options: - parsed default: merged """ -EXAMPLES = """ +EXAMPLES = """ # Using merged -# Before state - +# Before state: +# ------------- # localhost(config)#show running-config | section ntp # localhost(config)# - - name: Merge provided configuration with device configuration - arista.eos.eos_ntp_global: - config: - authenticate: - enable: true - authentication_keys: - - id: 2 - algorithm: "sha1" - encryption: 7 - key: "123456" - - id: 23 - algorithm: "md5" - encryption: 7 - key: "123456" - local_interface: "Ethernet1" - qos_dscp: 10 - trusted_key: 23 - servers: - - server: "10.1.1.1" - vrf: "vrf01" - burst: True - prefer: True - - server: "25.1.1.1" - vrf: "vrf01" - maxpoll: 15 - key_id: 2 - serve: - access_lists: - - afi: "ip" - acls: - - acl_name: "acl01" - direction: "in" - - afi: "ipv6" - acls: - - acl_name: "acl02" - direction: "in" +- name: Merge provided configuration with device configuration + arista.eos.eos_ntp_global: + config: + authenticate: + enable: true + authentication_keys: + - id: 2 + algorithm: "sha1" + encryption: 7 + key: "123456" + - id: 23 + algorithm: "md5" + encryption: 7 + key: "123456" + local_interface: "Ethernet1" + qos_dscp: 10 + trusted_key: 23 + servers: + - server: "10.1.1.1" + vrf: "vrf01" + burst: true + prefer: true + - server: "25.1.1.1" + vrf: "vrf01" + maxpoll: 15 + key_id: 2 + serve: + access_lists: + - afi: "ip" + acls: + - acl_name: "acl01" + direction: "in" + - afi: "ipv6" + acls: + - acl_name: "acl02" + direction: "in" # After State @@ -317,28 +317,29 @@ EXAMPLES = """ # ntp serve ipv6 access-group acl02 in # localhost(config)# - - name: Replace - arista.eos.eos_ntp_global: - config: - qos_dscp: 15 - authentication_keys: - - id: 2 - algorithm: "md5" - encryption: 7 - key: "123456" - servers: - - server: "11.21.1.1" - vrf: "vrf01" - burst: True - prefer: True - minpoll: 13 - serve: - access_lists: - - afi: "ip" - acls: - - acl_name: "acl03" - direction: "in" - state: replaced +- name: Replace + arista.eos.eos_ntp_global: + config: + qos_dscp: 15 + authentication_keys: + - id: 2 + algorithm: "md5" + encryption: 7 + key: "123456" + servers: + - server: "11.21.1.1" + vrf: "vrf01" + burst: true + prefer: true + minpoll: 13 + serve: + access_lists: + - afi: "ip" + acls: + - acl_name: "acl03" + direction: "in" + state: replaced + # After State: # localhost(config)#show running-config | section ntp # ntp authentication-key 2 md5 7 123456 @@ -473,28 +474,29 @@ EXAMPLES = """ # ntp serve ipv6 access-group acl02 in # localhost(config)# - - name: Replace - arista.eos.eos_ntp_global: - config: - qos_dscp: 15 - authentication_keys: - - id: 2 - algorithm: "md5" - encryption: 7 - key: "123456" - servers: - - server: "11.21.1.1" - vrf: "vrf01" - burst: True - prefer: True - minpoll: 13 - serve: - access_lists: - - afi: "ip" - acls: - - acl_name: "acl03" - direction: "in" - state: overridden +- name: Replace + arista.eos.eos_ntp_global: + config: + qos_dscp: 15 + authentication_keys: + - id: 2 + algorithm: "md5" + encryption: 7 + key: "123456" + servers: + - server: "11.21.1.1" + vrf: "vrf01" + burst: true + prefer: true + minpoll: 13 + serve: + access_lists: + - afi: "ip" + acls: + - acl_name: "acl03" + direction: "in" + state: overridden + # After State: # localhost(config)#show running-config | section ntp # ntp authentication-key 2 md5 7 123456 @@ -630,9 +632,9 @@ EXAMPLES = """ # ntp serve ipv6 access-group acl02 in # localhost(config)# - - name: Delete ntp-global - arista.eos.eos_ntp_global: - state: deleted +- name: Delete ntp-global + arista.eos.eos_ntp_global: + state: deleted # After State: # localhost(config)#show running-config | section ntp @@ -736,12 +738,13 @@ EXAMPLES = """ # ntp serve ip access-group acl01 in # ntp serve ipv6 access-group acl02 in - - name: parse configs - arista.eos.eos_ntp_global: - running_config: "{{ lookup('file', './parsed_ntp_global.cfg') }}" - state: parsed - tags: - - parsed +- name: parse configs + arista.eos.eos_ntp_global: + running_config: "{{ lookup('file', './parsed_ntp_global.cfg') }}" + state: parsed + tags: + - parsed + # Module Execution # "parsed": { # "authenticate": { @@ -825,13 +828,14 @@ EXAMPLES = """ # ntp serve ipv6 access-group acl02 in # localhost(config)# +- name: gather configs + arista.eos.eos_ntp_global: + state: gathered + tags: + - gathered - - name: gather configs - arista.eos.eos_ntp_global: - state: gathered - tags: - - gathered # Module Execution + # "gathered": { # "authenticate": { # "enable": true @@ -899,47 +903,45 @@ EXAMPLES = """ # } # } - # using rendered: - - name: Render provided configuration - arista.eos.eos_ntp_global: - config: - authenticate: - enable: true - authentication_keys: - - id: 2 - algorithm: "sha1" - encryption: 7 - key: "123456" - - id: 23 - algorithm: "md5" - encryption: 7 - key: "123456" - local_interface: "Ethernet1" - qos_dscp: 10 - trusted_key: 23 - servers: - - server: "10.1.1.1" - vrf: "vrf01" - burst: True - prefer: True - - server: "25.1.1.1" - vrf: "vrf01" - maxpoll: 15 - key_id: 2 - serve: - access_lists: - - afi: "ip" - acls: - - acl_name: "acl01" - direction: "in" - - afi: "ipv6" - acls: - - acl_name: "acl02" - direction: "in" - state: rendered - become: yes +- name: Render provided configuration + arista.eos.eos_ntp_global: + config: + authenticate: + enable: true + authentication_keys: + - id: 2 + algorithm: "sha1" + encryption: 7 + key: "123456" + - id: 23 + algorithm: "md5" + encryption: 7 + key: "123456" + local_interface: "Ethernet1" + qos_dscp: 10 + trusted_key: 23 + servers: + - server: "10.1.1.1" + vrf: "vrf01" + burst: true + prefer: true + - server: "25.1.1.1" + vrf: "vrf01" + maxpoll: 15 + key_id: 2 + serve: + access_lists: + - afi: "ip" + acls: + - acl_name: "acl01" + direction: "in" + - afi: "ipv6" + acls: + - acl_name: "acl02" + direction: "in" + state: rendered # Module Execution: # "rendered": [ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_ospf_interfaces.py b/ansible_collections/arista/eos/plugins/modules/eos_ospf_interfaces.py index 29ad037f7..8a28820c5 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_ospf_interfaces.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_ospf_interfaces.py @@ -59,7 +59,7 @@ options: - Address Family Identifier (AFI) for OSPF settings on the interfaces. type: str choices: ['ipv4', 'ipv6'] - required: True + required: true area: description: - Area associated with interface. @@ -70,7 +70,7 @@ options: description: - Area ID as a decimal or IP address format. type: str - required: True + required: true authentication_v2: description: - Authentication settings on the interface. @@ -181,7 +181,7 @@ options: - Address Family Identifier (AFI) for OSPF settings on the interfaces. type: str choices: ['ipv4', 'ipv6'] - required: True + required: true area: description: - Area associated with interface. @@ -192,7 +192,7 @@ options: description: - Area ID as a decimal or IP address format. type: str - required: True + required: true bfd: description: Enable BFD. type: bool @@ -210,7 +210,7 @@ options: type: int mtu_ignore: description: - - if True, Disable MTU check for Database Description packets. + - if true, Disable MTU check for Database Description packets. type: bool network: description: @@ -252,7 +252,7 @@ options: type: str mtu_ignore: description: - - if True, Disable MTU check for Database Description packets. + - if true, Disable MTU check for Database Description packets. type: bool network: description: @@ -308,31 +308,59 @@ EXAMPLES = """ # Using merged -# Before state - +# Before state: +# ------------- # veos(config)#show running-config | section interface | ospf # veos(config)# - - name: Merge provided configuration with device configuration - arista.eos.eos_ospf_interfaces: - config: - - name: "Vlan1" - address_family: - - afi: "ipv4" - area: - area_id: "0.0.0.50" - cost: 500 - mtu_ignore: True - - afi: "ipv6" - dead_interval: 44 - ip_params: - - afi: "ipv6" - mtu_ignore: True - network: "point-to-point" - state: merged - -# After State - +- name: Merge provided configuration with device configuration + arista.eos.eos_ospf_interfaces: + config: + - name: "Vlan1" + address_family: + - afi: "ipv4" + area: + area_id: "0.0.0.50" + cost: 500 + mtu_ignore: true + - afi: "ipv6" + dead_interval: 44 + ip_params: + - afi: "ipv6" + mtu_ignore: true + network: "point-to-point" + state: merged + +# Task output: +# ------------ +# before: [] +# +# commands: +# - interface Vlan1 +# - ip ospf area 0.0.0.50 +# - ip ospf cost 500 +# - ip ospf mtu-ignore +# - ospfv3 dead-interval 44 +# - ospfv3 ipv6 mtu-ignore +# - ospfv3 ipv6 network point-to-point +# +# after: +# - address_family: +# - afi: ipv4 +# area: +# area_id: 0.0.0.50 +# cost: 500 +# mtu_ignore: true +# - afi: ipv6 +# dead_interval: 44 +# ip_params: +# - afi: ipv6 +# mtu_ignore: true +# network: point-to-point +# name: Vlan1 + +# After state: +# ------------ # veos(config)#show running-config | section interface | ospf # interface Vlan1 # ip ospf cost 500 @@ -341,74 +369,11 @@ EXAMPLES = """ # ospfv3 dead-interval 44 # ospfv3 ipv6 network point-to-point # ospfv3 ipv6 mtu-ignore -# veos(config)# -# -# -# Module Execution: -# -# "after": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.50" -# }, -# "cost": 500, -# "mtu_ignore": True -# }, -# { -# "afi": "ipv6", -# "dead_interval": 44, -# "ip_params": [ -# { -# "afi": "ipv6", -# "mtu_ignore": True, -# "network": "point-to-point" -# } -# ] -# } -# ], -# "name": "Vlan1" -# } -# ], -# "before": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# } -# ], -# "changed": True, -# "commands": [ -# "interface Vlan1", -# "ip ospf area 0.0.0.50", -# "ip ospf cost 500", -# "ip ospf mtu-ignore", -# "ospfv3 dead-interval 44", -# "ospfv3 ipv6 mtu-ignore", -# "ospfv3 ipv6 network point-to-point" -# ], -# # Using replaced -#--------------- - -# Before State: +# Before state: +# ------------- # veos(config)#show running-config | section interface | ospf # interface Vlan1 # ip ospf cost 500 @@ -431,26 +396,100 @@ EXAMPLES = """ # ospfv3 ipv4 hello-interval 45 # ospfv3 ipv4 retransmit-interval 100 # ospfv3 ipv4 area 0.0.0.6 -# veos(config)# - - - - name: Replace device configuration with provided configuration - arista.eos.eos_ospf_interfaces: - config: - - name: "Vlan1" - address_family: - - afi: "ipv6" - cost: 44 - bfd: True - ip_params: - - afi: "ipv6" - mtu_ignore: True - network: "point-to-point" - dead_interval: 56 - state: replaced - -# After State: +- name: Replace device configuration with provided configuration + arista.eos.eos_ospf_interfaces: + config: + - name: "Vlan1" + address_family: + - afi: "ipv6" + cost: 44 + bfd: true + ip_params: + - afi: "ipv6" + mtu_ignore: true + network: "point-to-point" + dead_interval: 56 + state: replaced + +# Task output: +# ------------ +# before: +# - address_family: +# - afi: ipv4 +# area: +# area_id: 0.0.0.50 +# cost: 500 +# dead_interval: 29 +# hello_interval: 66 +# mtu_ignore: true +# - afi: ipv6 +# cost: 106 +# dead_interval: 44 +# hello_interval: 77 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.5 +# priority: 45 +# - afi: ipv6 +# mtu_ignore: true +# network: point-to-point +# passive_interface: true +# retransmit_interval: 115 +# transmit_delay: 100 +# name: Vlan1 +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 +# +# commands: +# - interface Vlan1 +# - no ip ospf cost 500 +# - no ip ospf dead-interval 29 +# - no ip ospf hello-interval 66 +# - no ip ospf mtu-ignore +# - no ip ospf area 0.0.0.50 +# - ospfv3 cost 44 +# - ospfv3 bfd +# - ospfv3 authentication ipsec spi 30 md5 passphrase 7 7hl8FV3lZ6H1mAKpjL47hQ== +# - no ospfv3 ipv4 priority 45 +# - no ospfv3 ipv4 area 0.0.0.5 +# - ospfv3 ipv6 dead-interval 56 +# - no ospfv3 ipv6 passive-interface +# - no ospfv3 ipv6 retransmit-interval 115 +# - no ospfv3 hello-interval 77 +# - no ospfv3 dead-interval 44 +# - no ospfv3 transmit-delay 100 +# +# after: +# - address_family: +# - afi: ipv6 +# bfd: true +# cost: 44 +# ip_params: +# - afi: ipv6 +# mtu_ignore: true +# network: point-to-point +# name: Vlan1 +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 + +# After state: +# ------------ # veos(config)#show running-config | section interface | ospf # interface Vlan1 # ospfv3 bfd @@ -463,149 +502,11 @@ EXAMPLES = """ # ospfv3 ipv4 hello-interval 45 # ospfv3 ipv4 retransmit-interval 100 # ospfv3 ipv4 area 0.0.0.6 -# veos(config)# -# -# Module Execution: -# -# "after": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "bfd": True, -# "cost": 44, -# "ip_params": [ -# { -# "afi": "ipv6", -# "mtu_ignore": True, -# "network": "point-to-point" -# } -# ] -# } -# ], -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ], -# "before": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.50" -# }, -# "cost": 500, -# "dead_interval": 29, -# "hello_interval": 66, -# "mtu_ignore": True -# }, -# { -# "afi": "ipv6", -# "cost": 106, -# "dead_interval": 44, -# "hello_interval": 77, -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.5" -# }, -# "priority": 45 -# }, -# { -# "afi": "ipv6", -# "mtu_ignore": True, -# "network": "point-to-point", -# "passive_interface": True, -# "retransmit_interval": 115 -# } -# ], -# "transmit_delay": 100 -# } -# ], -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ], -# "changed": True, -# "commands": [ -# "interface Vlan1", -# "no ip ospf cost 500", -# "no ip ospf dead-interval 29", -# "no ip ospf hello-interval 66", -# "no ip ospf mtu-ignore", -# "no ip ospf area 0.0.0.50", -# "ospfv3 cost 44", -# "ospfv3 bfd", -# "ospfv3 authentication ipsec spi 30 md5 passphrase 7 7hl8FV3lZ6H1mAKpjL47hQ==", -# "no ospfv3 ipv4 priority 45", -# "no ospfv3 ipv4 area 0.0.0.5", -# "ospfv3 ipv6 dead-interval 56", -# "no ospfv3 ipv6 passive-interface", -# "no ospfv3 ipv6 retransmit-interval 115", -# "no ospfv3 hello-interval 77", -# "no ospfv3 dead-interval 44", -# "no ospfv3 transmit-delay 100" -# ], -# -# Using overidden: -# ---------------- +# Using overidden -# Before State: +# Before state: +# ------------- # veos(config)#show running-config | section interface | ospf # interface Vlan1 # ip ospf dead-interval 29 @@ -627,25 +528,89 @@ EXAMPLES = """ # ospfv3 ipv4 hello-interval 45 # ospfv3 ipv4 retransmit-interval 100 # ospfv3 ipv4 area 0.0.0.6 -# veos(config)# - - - name: Override device configuration with provided configuration - arista.eos.eos_ospf_interfaces: - config: - - name: "Vlan1" - address_family: - - afi: "ipv6" - cost: 44 - bfd: True - ip_params: - - afi: "ipv6" - mtu_ignore: True - network: "point-to-point" - dead_interval: 56 - state: overridden - -# After State: +- name: Override device configuration with provided configuration + arista.eos.eos_ospf_interfaces: + config: + - name: "Vlan1" + address_family: + - afi: "ipv6" + cost: 44 + bfd: true + ip_params: + - afi: "ipv6" + mtu_ignore: true + network: "point-to-point" + dead_interval: 56 + state: overridden + +# Task output: +# ------------ +# before: +# - address_family: +# - afi: ipv4 +# dead_interval: 29 +# hello_interval: 66 +# mtu_ignore: true +# - afi: ipv6 +# bfd: true +# cost: 106 +# hello_interval: 77 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.5 +# priority: 45 +# - afi: ipv6 +# dead_interval: 56 +# mtu_ignore: true +# network: point-to-point +# passive_interface: true +# retransmit_interval: 115 +# transmit_delay: 100 +# name: Vlan1 +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 +# +# commands: +# - interface Vlan2 +# - no ospfv3 ipv4 hello-interval 45 +# - no ospfv3 ipv4 retransmit-interval 100 +# - no ospfv3 ipv4 area 0.0.0.6 +# - interface Vlan1 +# - no ip ospf dead-interval 29 +# - no ip ospf hello-interval 66 +# - no ip ospf mtu-ignore +# - ospfv3 cost 44 +# - ospfv3 authentication ipsec spi 30 md5 passphrase 7 7hl8FV3lZ6H1mAKpjL47hQ== +# - no ospfv3 ipv4 priority 45 +# - no ospfv3 ipv4 area 0.0.0.5 +# - no ospfv3 ipv6 passive-interface +# - no ospfv3 ipv6 retransmit-interval 115 +# - no ospfv3 hello-interval 77 +# - no ospfv3 transmit-delay 100 +# +# after: +# - address_family: +# - afi: ipv6 +# bfd: true +# cost: 44 +# ip_params: +# - afi: ipv6 +# dead_interval: 56 +# mtu_ignore: true +# network: point-to-point +# name: Vlan1 + +# After state: +# ------------ # veos(config)#show running-config | section interface | ospf # interface Vlan1 # ospfv3 bfd @@ -654,133 +619,11 @@ EXAMPLES = """ # ospfv3 ipv6 dead-interval 56 # ospfv3 ipv6 network point-to-point # ospfv3 ipv6 mtu-ignore -# veos(config)# -# -# -# Module Execution: -# -# "after": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "bfd": True, -# "cost": 44, -# "ip_params": [ -# { -# "afi": "ipv6", -# "dead_interval": 56, -# "mtu_ignore": True, -# "network": "point-to-point" -# } -# ] -# } -# ], -# "name": "Vlan1" -# }, -# { -# "name": "Vlan2" -# } -# ], -# "before": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "dead_interval": 29, -# "hello_interval": 66, -# "mtu_ignore": True -# }, -# { -# "afi": "ipv6", -# "bfd": True, -# "cost": 106, -# "hello_interval": 77, -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.5" -# }, -# "priority": 45 -# }, -# { -# "afi": "ipv6", -# "dead_interval": 56, -# "mtu_ignore": True, -# "network": "point-to-point", -# "passive_interface": True, -# "retransmit_interval": 115 -# } -# ], -# "transmit_delay": 100 -# } -# ], -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ], -# "changed": True, -# "commands": [ -# "interface Vlan2", -# "no ospfv3 ipv4 hello-interval 45", -# "no ospfv3 ipv4 retransmit-interval 100", -# "no ospfv3 ipv4 area 0.0.0.6", -# "interface Vlan1", -# "no ip ospf dead-interval 29", -# "no ip ospf hello-interval 66", -# "no ip ospf mtu-ignore", -# "ospfv3 cost 44", -# "ospfv3 authentication ipsec spi 30 md5 passphrase 7 7hl8FV3lZ6H1mAKpjL47hQ==", -# "no ospfv3 ipv4 priority 45", -# "no ospfv3 ipv4 area 0.0.0.5", -# "no ospfv3 ipv6 passive-interface", -# "no ospfv3 ipv6 retransmit-interval 115", -# "no ospfv3 hello-interval 77", -# "no ospfv3 transmit-delay 100" -# ], -# -# Using deleted: -#-------------- - -# before State: +# Using deleted +# Before state: +# ------------- # veos(config)#show running-config | section interface | ospf # interface Vlan1 # ip ospf dead-interval 29 @@ -802,146 +645,88 @@ EXAMPLES = """ # ospfv3 ipv4 hello-interval 45 # ospfv3 ipv4 retransmit-interval 100 # ospfv3 ipv4 area 0.0.0.6 -# veos(config)# - - name: Delete device configuration - arista.eos.eos_ospf_interfaces: - config: - - name: "Vlan1" - state: deleted - -# After State: +- name: Delete provided ospf interface config + arista.eos.eos_ospf_interfaces: + config: + - name: "Vlan1" + state: deleted +# Task output: +# ------------ +# before: +# - address_family: +# - afi: ipv4 +# dead_interval: 29 +# hello_interval: 66 +# mtu_ignore: true +# - afi: ipv6 +# bfd: true +# cost: 106 +# hello_interval: 77 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.5 +# priority: 45 +# - afi: ipv6 +# dead_interval: 56 +# mtu_ignore: true +# network: point-to-point +# passive_interface: true +# retransmit_interval: 115 +# transmit_delay: 100 +# name: Vlan1 +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 + +# commands: +# - interface Vlan1 +# - no ip ospf dead-interval 29 +# - no ip ospf hello-interval 66 +# - no ip ospf mtu-ignore +# - no ospfv3 bfd +# - no ospfv3 cost 106 +# - no ospfv3 hello-interval 77 +# - no ospfv3 transmit-delay 100 +# - no ospfv3 ipv4 priority 45 +# - no ospfv3 ipv4 area 0.0.0.5 +# - no ospfv3 ipv6 passive-interface +# - no ospfv3 ipv6 dead-interval 56 +# - no ospfv3 ipv6 retransmit-interval 115 +# - no ospfv3 ipv6 network point-to-point +# - no ospfv3 ipv6 mtu-ignore +# +# after: +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 + +# After state: +# ------------ # veos#show running-config | section interface | ospf # interface Vlan2 # ospfv3 ipv4 hello-interval 45 # ospfv3 ipv4 retransmit-interval 100 # ospfv3 ipv4 area 0.0.0.6 -# -# Module Execution: -# -# "after": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ], -# "before": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "dead_interval": 29, -# "hello_interval": 66, -# "mtu_ignore": True -# }, -# { -# "afi": "ipv6", -# "bfd": True, -# "cost": 106, -# "hello_interval": 77, -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.5" -# }, -# "priority": 45 -# }, -# { -# "afi": "ipv6", -# "dead_interval": 56, -# "mtu_ignore": True, -# "network": "point-to-point", -# "passive_interface": True, -# "retransmit_interval": 115 -# } -# ], -# "transmit_delay": 100 -# } -# ], -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ], -# "changed": True, -# "commands": [ -# "interface Vlan1", -# "no ip ospf dead-interval 29", -# "no ip ospf hello-interval 66", -# "no ip ospf mtu-ignore", -# "no ospfv3 bfd", -# "no ospfv3 cost 106", -# "no ospfv3 hello-interval 77", -# "no ospfv3 transmit-delay 100", -# "no ospfv3 ipv4 priority 45", -# "no ospfv3 ipv4 area 0.0.0.5", -# "no ospfv3 ipv6 passive-interface", -# "no ospfv3 ipv6 dead-interval 56", -# "no ospfv3 ipv6 retransmit-interval 115", -# "no ospfv3 ipv6 network point-to-point", -# "no ospfv3 ipv6 mtu-ignore" -# ], -# -# Using parsed: -# ------------ +# Using parsed -# parsed.cfg: +# parsed.cfg # ---------- - # interface Vlan1 # ip ospf dead-interval 29 # ip ospf hello-interval 66 @@ -965,73 +750,50 @@ EXAMPLES = """ # ospfv3 ipv4 area 0.0.0.6 # - - name: parse configs - arista.eos.eos_ospf_interfaces: - running_config: "{{ lookup('file', './parsed.cfg') }}" - state: parsed +- name: parse provided config into structured facts + arista.eos.eos_ospf_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed -# Module Execution: -# "parsed": [ -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "cost": 500, -# "dead_interval": 29, -# "hello_interval": 66, -# "mtu_ignore": True -# }, -# { -# "afi": "ipv6", -# "bfd": True, -# "cost": 106, -# "hello_interval": 77, -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.5" -# }, -# "priority": 45 -# }, -# { -# "afi": "ipv6", -# "dead_interval": 56, -# "mtu_ignore": True, -# "network": "point-to-point", -# "passive_interface": True, -# "retransmit_interval": 115 -# } -# ], -# "transmit_delay": 100 -# } -# ], -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ] +# Task output: +# ------------ +# parsed: +# - address_family: +# - afi: ipv4 +# cost: 500 +# dead_interval: 29 +# hello_interval: 66 +# mtu_ignore: true +# - afi: ipv6 +# bfd: true +# cost: 106 +# hello_interval: 77 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.5 +# priority: 45 +# - afi: ipv6 +# dead_interval: 56 +# mtu_ignore: true +# network: point-to-point +# passive_interface: true +# retransmit_interval: 115 +# transmit_delay: 100 +# name: Vlan1 +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 # Using gathered: -# Device COnfig: - +# Device config: # veos#show running-config | section interface | ospf # interface Vlan1 # ip ospf cost 500 @@ -1054,149 +816,155 @@ EXAMPLES = """ # ospfv3 ipv4 hello-interval 45 # ospfv3 ipv4 retransmit-interval 100 # ospfv3 ipv4 area 0.0.0.6 -# veos# - - - name: gather configs - arista.eos.eos_ospf_interfaces: - state: gathered - -# Module Execution: -# -# "gathered": [ -# { -# "name": "Ethernet1" -# }, -# { -# "name": "Ethernet2" -# }, -# { -# "name": "Management1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.50" -# }, -# "cost": 500, -# "dead_interval": 29, -# "hello_interval": 66, -# "mtu_ignore": True -# }, -# { -# "afi": "ipv6", -# "cost": 106, -# "hello_interval": 77, -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.5" -# }, -# "priority": 45 -# }, -# { -# "afi": "ipv6", -# "dead_interval": 56, -# "mtu_ignore": True, -# "network": "point-to-point", -# "passive_interface": True, -# "retransmit_interval": 115 -# } -# ], -# "transmit_delay": 100 -# } -# ], -# "name": "Vlan1" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "ip_params": [ -# { -# "afi": "ipv4", -# "area": { -# "area_id": "0.0.0.6" -# }, -# "hello_interval": 45, -# "retransmit_interval": 100 -# } -# ] -# } -# ], -# "name": "Vlan2" -# } -# ], -# - -# Using rendered: -# -------------- - - - name: Render provided configuration - arista.eos.eos_ospf_interfaces: - config: - - name: "Vlan1" - address_family: - - afi: "ipv4" - dead_interval: 29 - mtu_ignore: True - hello_interval: 66 - - afi: "ipv6" - hello_interval: 77 - cost : 106 - transmit_delay: 100 - ip_params: - - afi: "ipv6" - retransmit_interval: 115 - dead_interval: 56 - passive_interface: True - - afi: "ipv4" - area: - area_id: "0.0.0.5" - priority: 45 - - name: "Vlan2" - address_family: - - afi: "ipv6" - ip_params: - - afi: "ipv4" - area: - area_id: "0.0.0.6" - hello_interval: 45 - retransmit_interval: 100 - - afi: "ipv4" - message_digest_key: - key_id: 200 - encryption: 7 - key: "hkdfhtu==" - - state: rendered - -# Module Execution: -# -# "rendered": [ -# "interface Vlan1", -# "ip ospf dead-interval 29", -# "ip ospf mtu-ignore", -# "ip ospf hello-interval 66", -# "ospfv3 hello-interval 77", -# "ospfv3 cost 106", -# "ospfv3 transmit-delay 100", -# "ospfv3 ipv4 area 0.0.0.5", -# "ospfv3 ipv4 priority 45", -# "ospfv3 ipv6 retransmit-interval 115", -# "ospfv3 ipv6 dead-interval 56", -# "ospfv3 ipv6 passive-interface", -# "interface Vlan2", -# "ip ospf message-digest-key 200 md5 7 hkdfhtu==", -# "ospfv3 ipv4 area 0.0.0.6", -# "ospfv3 ipv4 hello-interval 45", -# "ospfv3 ipv4 retransmit-interval 100" -# ] -# +- name: gather runnig config + arista.eos.eos_ospf_interfaces: + state: gathered +# Task output: +# ------------ +# gathered: +# - address_family: +# - afi: ipv4 +# area: +# area_id: 0.0.0.50 +# cost: 500 +# dead_interval: 29 +# hello_interval: 66 +# mtu_ignore: true +# - afi: ipv6 +# cost: 106 +# hello_interval: 77 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.5 +# priority: 45 +# - afi: ipv6 +# dead_interval: 56 +# mtu_ignore: true +# network: point-to-point +# passive_interface: true +# retransmit_interval: 115 +# transmit_delay: 100 +# name: Vlan1 +# - address_family: +# - afi: ipv6 +# ip_params: +# - afi: ipv4 +# area: +# area_id: 0.0.0.6 +# hello_interval: 45 +# retransmit_interval: 100 +# name: Vlan2 + +# Using rendered + +- name: Render provided configuration + arista.eos.eos_ospf_interfaces: + config: + - name: "Vlan1" + address_family: + - afi: "ipv4" + dead_interval: 29 + mtu_ignore: true + hello_interval: 66 + - afi: "ipv6" + hello_interval: 77 + cost: 106 + transmit_delay: 100 + ip_params: + - afi: "ipv6" + retransmit_interval: 115 + dead_interval: 56 + passive_interface: true + - afi: "ipv4" + area: + area_id: "0.0.0.5" + priority: 45 + - name: "Vlan2" + address_family: + - afi: "ipv6" + ip_params: + - afi: "ipv4" + area: + area_id: "0.0.0.6" + hello_interval: 45 + retransmit_interval: 100 + - afi: "ipv4" + message_digest_key: + key_id: 200 + encryption: 7 + key: "hkdfhtu==" + + state: rendered + +# Task output: +# ------------ +# rendered: +# - interface Vlan1 +# - ip ospf dead-interval 29 +# - ip ospf mtu-ignore +# - ip ospf hello-interval 66 +# - ospfv3 hello-interval 77 +# - ospfv3 cost 106 +# - ospfv3 transmit-delay 100 +# - ospfv3 ipv4 area 0.0.0.5 +# - ospfv3 ipv4 priority 45 +# - ospfv3 ipv6 retransmit-interval 115 +# - ospfv3 ipv6 dead-interval 56 +# - ospfv3 ipv6 passive-interface +# - interface Vlan2 +# - ip ospf message-digest-key 200 md5 7 hkdfhtu== +# - ospfv3 ipv4 area 0.0.0.6 +# - ospfv3 ipv4 hello-interval 45 +# - ospfv3 ipv4 retransmit-interval 100 +""" +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: list + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - interface Vlan1 + - ip ospf dead-interval 29 + - ip ospf mtu-ignore +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - interface Vlan1 + - ip ospf dead-interval 29 + - ip ospf mtu-ignore +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: list + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: list + sample: > + This output will always be in the same format as the + module argspec. """ from ansible.module_utils.basic import AnsibleModule diff --git a/ansible_collections/arista/eos/plugins/modules/eos_ospfv2.py b/ansible_collections/arista/eos/plugins/modules/eos_ospfv2.py index 470efb023..ae2610371 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_ospfv2.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_ospfv2.py @@ -186,7 +186,7 @@ options: description: Interface range. type: str default: - description: If True, Set all interfaces to passive by default + description: If true, Set all interfaces to passive by default type: bool point_to_point: description: Configure Point-to-point specific features. @@ -385,7 +385,7 @@ options: description: Configure the default metric for redistributed routes type: int dn_bit_ignore: - description: If True, Disable dn-bit check for Type-3 LSAs in non-default + description: If true, Disable dn-bit check for Type-3 LSAs in non-default VRFs. type: bool graceful_restart: @@ -400,7 +400,7 @@ options: description: When true sets the grace_fulrestart config alone. type: bool graceful_restart_helper: - description: If True, Enable graceful restart helper. + description: If true, Enable graceful restart helper. type: bool shutdown: description: Disable the OSPF instance. @@ -525,82 +525,168 @@ EXAMPLES = """ # Using merged # Before state: -# ------------ +# ------------- # localhost#show running-config | section ospf # localhost# - - name: replace Ospf configs - arista.eos.eos_ospfv2: - config: - - processes: - - process_id: 1 - adjacency: - exchange_start: - threshold: 20045623 - areas: - - filter: - address: "10.1.1.0/24" - id: "0.0.0.2" - - id: "0.0.0.50" - range: - address: "172.20.0.0/16" - cost: 34 - default_information: - metric: 100 - metric_type: 1 - originate: True - distance: - intra_area: 85 - max_lsa: - count: 8000 - ignore_count: 3 - ignore_time: 6 - reset_time: 20 - threshold: 40 - networks: - - area: "0.0.0.0" - prefix: 10.10.2.0/24 - - area: "0.0.0.0" - prefix: "10.10.3.0/24" - redistribute: - - routes: "static" - router_id: "170.21.0.4" - - process_id: 2 - vrf: "vrf01" - areas: - - id: "0.0.0.9" - default_cost: 20 - max_lsa: - count: 8000 - ignore_count: 3 - ignore_time: 6 - reset_time: 20 - threshold: 40 - networks: - - area: "0.0.0.0" - prefix: 10.10.2.0/24 - - area: "0.0.0.0" - prefix: "10.10.3.0/24" - redistribute: - - routes: "static" - router_id: "170.21.0.4" - - process_id: 2 - vrf: "vrf01" - areas: - - id: "0.0.0.9" - default_cost: 20 - max_lsa: - count: 8000 - ignore_count: 3 - ignore_time: 6 - reset_time: 20 - threshold: 40 - - process_id: 3 - vrf: "vrf02" - redistribute: - - routes: "connected" +- name: Merge provided config into running config + arista.eos.eos_ospfv2: + config: + - processes: + - process_id: 1 + adjacency: + exchange_start: + threshold: 20045623 + areas: + - filter: + address: "10.1.1.0/24" + id: "0.0.0.2" + - id: "0.0.0.50" + range: + address: "172.20.0.0/16" + cost: 34 + default_information: + metric: 100 + metric_type: 1 + originate: true + distance: + intra_area: 85 + max_lsa: + count: 8000 + ignore_count: 3 + ignore_time: 6 + reset_time: 20 + threshold: 40 + networks: + - area: "0.0.0.0" + prefix: 10.10.2.0/24 + - area: "0.0.0.0" + prefix: "10.10.3.0/24" + redistribute: + - routes: "static" + router_id: "170.21.0.4" + - process_id: 2 + vrf: "vrf01" + areas: + - id: "0.0.0.9" + default_cost: 20 + max_lsa: + count: 8000 + ignore_count: 3 + ignore_time: 6 + reset_time: 20 + threshold: 40 + networks: + - area: "0.0.0.0" + prefix: 10.10.2.0/24 + - area: "0.0.0.0" + prefix: "10.10.3.0/24" + redistribute: + - routes: "static" + router_id: "170.21.0.4" + - process_id: 2 + vrf: "vrf01" + areas: + - id: "0.0.0.9" + default_cost: 20 + max_lsa: + count: 8000 + ignore_count: 3 + ignore_time: 6 + reset_time: 20 + threshold: 40 + - process_id: 3 + vrf: "vrf02" + redistribute: + - routes: "connected" + +# Task output: +# ------------ +# before: {} + +# commands +# - router ospf 1 +# - adjacency exchange-start threshold 20045623 +# - area 0.0.0.2 filter 10.1.1.0/24 +# - area 0.0.0.50 range 172.20.0.0/16 cost 34 +# - default-information originate metric 100 metric-type 1 +# - distance ospf intra-area 85 +# - max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20 +# - network 10.10.2.0/24 area 0.0.0.0 +# - network 10.10.3.0/24 area 0.0.0.0 +# - redistribute static +# - router-id 170.21.0.4 +# - exit +# - router ospf 2 vrf vrf01 +# - area 0.0.0.9 default-cost 20 +# - max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20 +# - network 10.10.2.0/24 area 0.0.0.0 +# - network 10.10.3.0/24 area 0.0.0.0 +# - redistribute static +# - router-id 170.21.0.4 +# - exit +# - router ospf 2 vrf vrf01 +# - area 0.0.0.9 default-cost 20 +# - max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20 +# - exit +# - router ospf 3 vrf vrf02 +# - redistribute connected +# - exit +# +# after: +# processes: +# - adjacency: +# exchange_start: +# threshold: 20045623 +# areas: +# - area_id: 0.0.0.2 +# filter: +# address: 10.1.1.0/24 +# - area_id: 0.0.0.50 +# range: +# address: 172.20.0.0/16 +# cost: 34 +# default_information: +# metric: 100 +# metric_type: 1 +# originate: true +# distance: +# intra_area: 85 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# networks: +# - area: 0.0.0.0 +# prefix: 10.10.2.0/24 +# - area: 0.0.0.0 +# prefix: 10.10.3.0/24 +# process_id: 1 +# redistribute: +# - routes: static +# router_id: 170.21.0.4 +# - areas: +# - area_id: 0.0.0.9 +# default_cost: 20 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# process_id: 2 +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 # After state: +# ------------ # localhost#show running-config | section ospf # router ospf 1 # router-id 170.21.0.4 @@ -621,103 +707,11 @@ EXAMPLES = """ # router ospf 3 vrf vrf02 # redistribute connected # max-lsa 12000 -# localhost# -# -# "processes": [ -# { -# "adjacency": { -# "exchange_start": { -# "threshold": 20045623 -# } -# }, -# "areas": [ -# { -# "filter": { -# "address": "10.1.1.0/24" -# }, -# "id": "0.0.0.2" -# }, -# { -# "id": "0.0.0.50", -# "range": { -# "address": "172.20.0.0/16", -# "cost": 34 -# } -# } -# ], -# "default_information": { -# "metric": 100, -# "metric_type": 1, -# "originate": true -# }, -# "distance": { -# "intra_area": 85 -# }, -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "networks": [ -# { -# "area": "0.0.0.0", -# "prefix": "10.10.2.0/24" -# }, -# { -# "area": "0.0.0.0", -# "prefix": "10.10.3.0/24" -# } -# ], -# "process_id": 1, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "router_id": "170.21.0.4" -# }, -# { -# "areas": [ -# { -# "default_cost": 20, -# "id": "0.0.0.9" -# } -# ], -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "process_id": 2, -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] -# - -# Using replaced: -# -------------- +# Using replaced # Before State: - +# ------------- # localhost#show running-config | section ospf # router ospf 1 # router-id 170.21.0.4 @@ -738,210 +732,130 @@ EXAMPLES = """ # router ospf 3 vrf vrf02 # redistribute connected # max-lsa 12000 -# localhost# # -# "before": [ -# { -# "processes": [ -# { -# "adjacency": { -# "exchange_start": { -# "threshold": 20045623 -# } -# }, -# "areas": [ -# { -# "filter": { -# "address": "10.1.1.0/24" -# }, -# "id": "0.0.0.2" -# }, -# { -# "id": "0.0.0.50", -# "range": { -# "address": "172.20.0.0/16", -# "cost": 34 -# } -# } -# ], -# "default_information": { -# "metric": 100, -# "metric_type": 1, -# "originate": true -# }, -# "distance": { -# "intra_area": 85 -# }, -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "networks": [ -# { -# "area": "0.0.0.0", -# "prefix": "10.10.2.0/24" -# }, -# { -# "area": "0.0.0.0", -# "prefix": "10.10.3.0/24" -# } -# ], -# "process_id": 1, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "router_id": "170.21.0.4" -# }, -# { -# "areas": [ -# { -# "default_cost": 20, -# "id": "0.0.0.9" -# } -# ], -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "process_id": 2, -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] -# - - name: replace Ospf configs - arista.eos.eos_ospfv2: - config: - - processes: - - process_id: 2 - vrf: "vrf01" - point_to_point: True - redistribute: - - routes: "isis" - isis_level: "level-1" - - state: replaced +- name: replace Ospf configs + arista.eos.eos_ospfv2: + config: + - processes: + - process_id: 2 + vrf: "vrf01" + point_to_point: true + redistribute: + - routes: "isis" + isis_level: "level-1" + state: replaced -# After State: -# ----------- -# "router ospf 2 vrf vrf01", -# "no area 0.0.0.9 default-cost 20", -# "no max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20", -# "point-to-point routes", -# "redistribute isis level-1" +# Task output: +# ------------ +# before: +# processes: +# - adjacency: +# exchange_start: +# threshold: 20045623 +# areas: +# - area_id: 0.0.0.2 +# filter: +# address: 10.1.1.0/24 +# - area_id: 0.0.0.50 +# range: +# address: 172.20.0.0/16 +# cost: 34 +# default_information: +# metric: 100 +# metric_type: 1 +# originate: true +# distance: +# intra_area: 85 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# networks: +# - area: 0.0.0.0 +# prefix: 10.10.2.0/24 +# - area: 0.0.0.0 +# prefix: 10.10.3.0/24 +# process_id: 1 +# redistribute: +# - routes: static +# router_id: 170.21.0.4 +# - areas: +# - area_id: 0.0.0.9 +# default_cost: 20 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# process_id: 2 +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 # -# "after": [ -# { -# "processes": [ -# { -# "adjacency": { -# "exchange_start": { -# "threshold": 20045623 -# } -# }, -# "areas": [ -# { -# "filter": { -# "address": "10.1.1.0/24" -# }, -# "id": "0.0.0.2" -# }, -# { -# "id": "0.0.0.50", -# "range": { -# "address": "172.20.0.0/16", -# "cost": 34 -# } -# } -# ], -# "default_information": { -# "metric": 100, -# "metric_type": 1, -# "originate": true -# }, -# "distance": { -# "intra_area": 85 -# }, -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "networks": [ -# { -# "area": "0.0.0.0", -# "prefix": "10.10.2.0/24" -# }, -# { -# "area": "0.0.0.0", -# "prefix": "10.10.3.0/24" -# } -# ], -# "process_id": 1, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "router_id": "170.21.0.4" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 2, -# "redistribute": [ -# { -# "isis_level": "level-1", -# "routes": "isis" -# } -# ], -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] +# commands: +# - router ospf 2 vrf vrf01 +# - no area 0.0.0.9 default-cost 20 +# - no max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20 +# - point-to-point routes +# - redistribute isis level-1 # +# after: +# processes: +# - adjacency: +# exchange_start: +# threshold: 20045623 +# areas: +# - area_id: 0.0.0.2 +# filter: +# address: 10.1.1.0/24 +# - area_id: 0.0.0.50 +# range: +# address: 172.20.0.0/16 +# cost: 34 +# default_information: +# metric: 100 +# metric_type: 1 +# originate: true +# distance: +# intra_area: 85 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# networks: +# - area: 0.0.0.0 +# prefix: 10.10.2.0/24 +# - area: 0.0.0.0 +# prefix: 10.10.3.0/24 +# process_id: 1 +# redistribute: +# - routes: static +# router_id: 170.21.0.4 +# - max_lsa: +# count: 12000 +# process_id: 2 +# redistribute: +# - isis_level: level-1 +# routes: isis +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 -# Using overridden: -# ---------------- - -# Before State: +# After state: +# ------------ # localhost#show running-config | section ospf # router ospf 1 # router-id 170.21.0.4 @@ -962,135 +876,123 @@ EXAMPLES = """ # router ospf 3 vrf vrf02 # redistribute connected # max-lsa 12000 -# localhost# -# -# "before": [ -# { -# "processes": [ -# { -# "adjacency": { -# "exchange_start": { -# "threshold": 20045623 -# } -# }, -# "areas": [ -# { -# "filter": { -# "address": "10.1.1.0/24" -# }, -# "id": "0.0.0.2" -# }, -# { -# "id": "0.0.0.50", -# "range": { -# "address": "172.20.0.0/16", -# "cost": 34 -# } -# } -# ], -# "default_information": { -# "metric": 100, -# "metric_type": 1, -# "originate": true -# }, -# "distance": { -# "intra_area": 85 -# }, -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "networks": [ -# { -# "area": "0.0.0.0", -# "prefix": "10.10.2.0/24" -# }, -# { -# "area": "0.0.0.0", -# "prefix": "10.10.3.0/24" -# } -# ], -# "process_id": 1, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "router_id": "170.21.0.4" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 2, -# "redistribute": [ -# { -# "isis_level": "level-1", -# "routes": "isis" -# } -# ], -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] - - name: override Ospf configs - arista.eos.eos_ospfv2: - config: - - processes: - - process_id: 2 - vrf: "vrf01" - redistribute: - - routes: "connected" +# Using overridden + +# Before state: +# ------------- +# localhost#show running-config | section ospf +# router ospf 1 +# router-id 170.21.0.4 +# distance ospf intra-area 85 +# redistribute static +# area 0.0.0.2 filter 10.1.1.0/24 +# area 0.0.0.50 range 172.20.0.0/16 cost 34 +# network 10.10.2.0/24 area 0.0.0.0 +# network 10.10.3.0/24 area 0.0.0.0 +# max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20 +# adjacency exchange-start threshold 20045623 +# default-information originate metric 100 metric-type 1 +# ! +# router ospf 2 vrf vrf01 +# redistribute isis level-1 +# max-lsa 12000 +# ! +# router ospf 3 vrf vrf02 +# redistribute connected +# max-lsa 12000 - state: override +- name: override running config with provided config + arista.eos.eos_ospfv2: + config: + - processes: + - process_id: 2 + vrf: "vrf01" + redistribute: + - routes: "connected" + state: overriden -# After State: +# Task output: +# ------------ -# "no router ospf 1", -# "no router ospf 3", -# "router ospf 2 vrf vrf01", -# "no max-lsa 12000", -# "no redistribute isis level-1", -# "redistribute connected" +# before: +# processes: +# - adjacency: +# exchange_start: +# threshold: 20045623 +# areas: +# - area_id: 0.0.0.2 +# filter: +# address: 10.1.1.0/24 +# - area_id: 0.0.0.50 +# range: +# address: 172.20.0.0/16 +# cost: 34 +# default_information: +# metric: 100 +# metric_type: 1 +# originate: true +# distance: +# intra_area: 85 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# networks: +# - area: 0.0.0.0 +# prefix: 10.10.2.0/24 +# - area: 0.0.0.0 +# prefix: 10.10.3.0/24 +# process_id: 1 +# redistribute: +# - routes: static +# router_id: 170.21.0.4 +# - max_lsa: +# count: 12000 +# process_id: 2 +# redistribute: +# - isis_level: level-1 +# routes: isis +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 +# +# commands: +# - no router ospf 1 +# - no router ospf 3 +# - router ospf 2 vrf vrf01 +# - no max-lsa 12000 +# - no redistribute isis level-1 +# - redistribute connected # -# "after": [ -# { -# "processes": [ -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 2, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf01" -# } -# ] -# } -# ] +# after: +# processes: +# - max_lsa: +# count: 12000 +# process_id: 2 +# redistribute: +# - isis_level: level-1 +# routes: isis +# vrf: vrf01 -# Using Deleted: +# After state: +# ------------ +# localhost#show running-config | section ospf +# router ospf 2 vrf vrf01 +# redistribute isis level-1 +# max-lsa 12000 +# ! + +# Using deleted +# Before state: +# ------------- # localhost#show running-config | section ospf # router ospf 1 # router-id 170.21.0.4 @@ -1112,157 +1014,108 @@ EXAMPLES = """ # router ospf 3 vrf vrf02 # redistribute connected # max-lsa 12000 -# localhost# # -# "before": [ -# { -# "processes": [ -# { -# "adjacency": { -# "exchange_start": { -# "threshold": 20045623 -# } -# }, -# "areas": [ -# { -# "filter": { -# "address": "10.1.1.0/24" -# }, -# "id": "0.0.0.2" -# }, -# { -# "id": "0.0.0.50", -# "range": { -# "address": "172.20.0.0/16", -# "cost": 34 -# } -# } -# ], -# "default_information": { -# "metric": 100, -# "metric_type": 1, -# "originate": true -# }, -# "distance": { -# "intra_area": 85 -# }, -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "networks": [ -# { -# "area": "0.0.0.0", -# "prefix": "10.10.2.0/24" -# }, -# { -# "area": "0.0.0.0", -# "prefix": "10.10.3.0/24" -# } -# ], -# "process_id": 1, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "router_id": "170.21.0.4" -# }, -# { -# "areas": [ -# { -# "default_cost": 20, -# "id": "0.0.0.9" -# } -# ], -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "process_id": 2, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] - - - name: Delete Ospf configs - arista.eos.eos_ospfv2: - config: - - processes: - - process_id: 1 - - state: deleted +- name: Delete OSPF config + arista.eos.eos_ospfv2: + config: + processes: + - process_id: 1 + state: deleted -# After State: -# Commands: -# "no router ospf 1" +# Task output: +# ------------ +# before: +# processes: +# - adjacency: +# exchange_start: +# threshold: 20045623 +# areas: +# - area_id: 0.0.0.2 +# filter: +# address: 10.1.1.0/24 +# - area_id: 0.0.0.50 +# range: +# address: 172.20.0.0/16 +# cost: 34 +# default_information: +# metric: 100 +# metric_type: 1 +# originate: true +# distance: +# intra_area: 85 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# networks: +# - area: 0.0.0.0 +# prefix: 10.10.2.0/24 +# - area: 0.0.0.0 +# prefix: 10.10.3.0/24 +# process_id: 1 +# redistribute: +# - routes: static +# router_id: 170.21.0.4 +# - areas: +# - area_id: 0.0.0.9 +# default_cost: 20 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# process_id: 2 +# redistribute: +# - routes: connected +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 +# +# commands: +# - no router ospf 1 +# +# after: +# processes: +# - areas: +# - area_id: 0.0.0.9 +# default_cost: 20 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# process_id: 2 +# redistribute: +# - routes: connected +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 -# "after": [ -# { -# "processes": [ -# { -# "areas": [ -# { -# "default_cost": 20, -# "id": "0.0.0.9" -# } -# ], -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "process_id": 2, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] +# After state: +# ------------ +# localhost#show running-config | section ospf +# router ospf 2 vrf vrf01 +# redistribute connected +# area 0.0.0.9 default-cost 20 +# max-lsa 8000 40 ignore-time 6 ignore-count 3 reset-time 20 +# ! +# router ospf 3 vrf vrf02 +# redistribute connected +# max-lsa 12000 -# Using gathered: +# Using gathered # localhost#show running-config | section ospf # router ospf 2 vrf vrf01 # redistribute connected @@ -1272,54 +1125,36 @@ EXAMPLES = """ # router ospf 3 vrf vrf02 # redistribute connected # max-lsa 12000 -# localhost# - - name: replace Ospf configs - arista.eos.eos_ospfv2: - state: gathered +- name: replace Ospf configs + arista.eos.eos_ospfv2: + state: gathered -# "gathered": [ -# { -# "processes": [ -# { -# "areas": [ -# { -# "default_cost": 20, -# "id": "0.0.0.9" -# } -# ], -# "max_lsa": { -# "count": 8000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "process_id": 2, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf01" -# }, -# { -# "max_lsa": { -# "count": 12000 -# }, -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] +# Task output: +# ------------ +# gathered: +# processes: +# - areas: +# - area_id: 0.0.0.9 +# default_cost: 20 +# max_lsa: +# count: 8000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# process_id: 2 +# redistribute: +# - routes: connected +# vrf: vrf01 +# - max_lsa: +# count: 12000 +# process_id: 3 +# redistribute: +# - routes: connected +# vrf: vrf02 -# Using parsed: +# Using parsed # ------------ # parsed.cfg @@ -1340,185 +1175,211 @@ EXAMPLES = """ # router ospf 3 vrf vrf02 # redistribute static - - name: Parse Ospf configs - arista.eos.eos_ospfv2: - running_config: "{{ lookup('file', './parsed.cfg') }}" - state: parsed +- name: Parse running config and display structured facts + arista.eos.eos_ospfv2: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed -# "parsed": [ -# { -# "processes": [ -# { -# "adjacency": { -# "exchange_start": { -# "threshold": 20045623 -# } -# }, -# "areas": [ -# { -# "filter": { -# "address": "10.1.1.0/24" -# }, -# "id": "0.0.0.2" -# }, -# { -# "id": "0.0.0.50", -# "range": { -# "address": "172.20.0.0/16", -# "cost": 34 -# } -# } -# ], -# "default_information": { -# "metric": 100, -# "metric_type": 1, -# "originate": true -# }, -# "distance": { -# "intra_area": 85 -# }, -# "max_lsa": { -# "count": 80000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "networks": [ -# { -# "area": "0.0.0.0", -# "prefix": "10.10.2.0/24" -# }, -# { -# "area": "0.0.0.0", -# "prefix": "10.10.3.0/24" -# } -# ], -# "process_id": 1, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "router_id": "170.21.0.4" -# }, -# { -# "areas": [ -# { -# "default_cost": 20, -# "id": "0.0.0.9" -# } -# ], -# "max_lsa": { -# "count": 80000, -# "ignore_count": 3, -# "ignore_time": 6, -# "reset_time": 20, -# "threshold": 40 -# }, -# "process_id": 2, -# "vrf": "vrf01," -# }, -# { -# "process_id": 3, -# "redistribute": [ -# { -# "routes": "static" -# } -# ], -# "vrf": "vrf02" -# } -# ] -# } -# ] - -# Using rendered: -# -------------- +# Task output: +# ------------ +# parsed: +# processes: +# - adjacency: +# exchange_start: +# threshold: 20045623 +# areas: +# - area_id: 0.0.0.2 +# filter: +# address: 10.1.1.0/24 +# - area_id: 0.0.0.50 +# range: +# address: 172.20.0.0/16 +# cost: 34 +# default_information: +# metric: 100 +# metric_type: 1 +# originate: true +# distance: +# intra_area: 85 +# max_lsa: +# count: 80000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# networks: +# - area: 0.0.0.0 +# prefix: 10.10.2.0/24 +# - area: 0.0.0.0 +# prefix: 10.10.3.0/24 +# process_id: 1 +# redistribute: +# - routes: static +# router_id: 170.21.0.4 +# - areas: +# - area_id: 0.0.0.9 +# default_cost: 20 +# max_lsa: +# count: 80000 +# ignore_count: 3 +# ignore_time: 6 +# reset_time: 20 +# threshold: 40 +# process_id: 2 +# vrf: vrf01, +# - process_id: 3 +# redistribute: +# - routes: static +# vrf: vrf02 - - name: replace Ospf configs - arista.eos.eos_ospfv2: - config: - - processes: - - process_id: 1 - adjacency: - exchange_start: - threshold: 20045623 - areas: - - filter: - address: 10.1.1.0/24 - id: 0.0.0.2 - - id: 0.0.0.50 - range: - address: 172.20.0.0/16 - cost: 34 - default_information: - metric: 100 - metric_type: 1 - originate: true - distance: - intra_area: 85 - max_lsa: - count: 8000 - ignore_count: 3 - ignore_time: 6 - reset_time: 20 - threshold: 40 - networks: - - area: 0.0.0.0 - prefix: 10.10.2.0/24 - - area: 0.0.0.0 - prefix: 10.10.3.0/24 - redistribute: - - routes: static - router_id: 170.21.0.4 - state: rendered +# Using rendered -# "rendered": [ -# "router ospf 1", -# "adjacency exchange-start threshold 20045623", -# "area 0.0.0.2 filter 10.1.1.0/24", -# "area 0.0.0.50 range 172.20.0.0/16 cost 34", -# "default-information originate metric 100 metric-type 1", -# "distance ospf intra-area 85", -# "max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20", -# "network 10.10.2.0/24 area 0.0.0.0", -# "network 10.10.3.0/24 area 0.0.0.0", -# "redistribute static", -# "router-id 170.21.0.4" -# ] -# +- name: replace Ospf configs + arista.eos.eos_ospfv2: + config: + processes: + - process_id: 1 + adjacency: + exchange_start: + threshold: 20045623 + areas: + - filter: + address: "10.1.1.0/24" + area_id: "0.0.0.2" + - area_id: "0.0.0.50" + range: + address: "172.20.0.0/16" + cost: 34 + default_information: + metric: 100 + metric_type: 1 + originate: true + distance: + intra_area: 85 + max_lsa: + count: 8000 + ignore_count: 3 + ignore_time: 6 + reset_time: 20 + threshold: 40 + networks: + - area: "0.0.0.0" + prefix: 10.10.2.0/24 + - area: "0.0.0.0" + prefix: "10.10.3.0/24" + redistribute: + - routes: "static" + router_id: "170.21.0.4" + - process_id: 2 + vrf: "vrf01" + areas: + - area_id: "0.0.0.9" + default_cost: 20 + max_lsa: + count: 8000 + ignore_count: 3 + ignore_time: 6 + reset_time: 20 + threshold: 40 + networks: + - area: "0.0.0.0" + prefix: 10.10.2.0/24 + - area: "0.0.0.0" + prefix: "10.10.3.0/24" + redistribute: + - routes: "static" + router_id: "170.21.0.4" + - process_id: 2 + vrf: "vrf01" + areas: + - area_id: "0.0.0.9" + default_cost: 20 + max_lsa: + count: 8000 + ignore_count: 3 + ignore_time: 6 + reset_time: 20 + threshold: 40 + - process_id: 3 + vrf: "vrf02" + redistribute: + - routes: "connected" + state: rendered +# rendered: +# - router ospf 1 +# - adjacency exchange-start threshold 20045623 +# - area 0.0.0.2 filter 10.1.1.0/24 +# - area 0.0.0.50 range 172.20.0.0/16 cost 34 +# - default-information originate metric 100 metric-type 1 +# - distance ospf intra-area 85 +# - max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20 +# - network 10.10.2.0/24 area 0.0.0.0 +# - network 10.10.3.0/24 area 0.0.0.0 +# - redistribute static +# - router-id 170.21.0.4 +# - exit +# - router ospf 2 vrf vrf01 +# - area 0.0.0.9 default-cost 20 +# - max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20 +# - network 10.10.2.0/24 area 0.0.0.0 +# - network 10.10.3.0/24 area 0.0.0.0 +# - redistribute static +# - router-id 170.21.0.4 +# - exit +# - router ospf 2 vrf vrf01 +# - area 0.0.0.9 default-cost 20 +# - max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20 +# - exit +# - router ospf 3 vrf vrf02 +# - redistribute connected +# - exit """ RETURN = """ before: - description: The configuration prior to the model invocation. - returned: always + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. - type: list + This output will always be in the same format as the + module argspec. after: - description: The resulting configuration model invocation. + description: The resulting configuration after module execution. returned: when changed + type: dict sample: > - The configuration returned will always be in the same format - of the parameters above. - type: list + This output will always be in the same format as the + module argspec. commands: description: The set of commands pushed to the remote device. - returned: always + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list - sample: ["router ospf 1", - "adjacency exchange-start threshold 20045623", - "area 0.0.0.2 filter 10.1.1.0/24", - "area 0.0.0.50 range 172.20.0.0/16 cost 34", - "default-information originate metric 100 metric-type 1", - "distance ospf intra-area 85", - "max-lsa 8000 40 ignore-count 3 ignore-time 6 reset-time 20", - "network 10.10.2.0/24 area 0.0.0.0", - "network 10.10.3.0/24 area 0.0.0.0", - "redistribute static", - "router-id 170.21.0.4"] + sample: + - router ospf 1 + - adjacency exchange-start threshold 20045623 + - area 0.0.0.2 filter 10.1.1.0/24 +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - router ospf 1 + - adjacency exchange-start threshold 20045623 + - area 0.0.0.2 filter 10.1.1.0/24 +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: dict + sample: > + This output will always be in the same format as the + module argspec. """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_ospfv3.py b/ansible_collections/arista/eos/plugins/modules/eos_ospfv3.py index 8c1845262..c1194f767 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_ospfv3.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_ospfv3.py @@ -97,10 +97,10 @@ options: type: str choices: ['md5', 'sha1'] encrypt_key: - description: If False, key string is not encrypted + description: If false, key string is not encrypted type: bool hidden_key: - description: If True, Specifies that a HIDDEN key will follow. + description: If true, Specifies that a HIDDEN key will follow. type: bool key: description: 128 bit MD5 key or 140 bit SHA1 key. @@ -124,10 +124,10 @@ options: type: str choices: ['sha1', 'md5'] encrypt_key: - description: If False, key string is not encrypted + description: If false, key string is not encrypted type: bool hidden_key: - description: If True, Specifies that a HIDDEN key will follow. + description: If true, Specifies that a HIDDEN key will follow. type: bool key: description: 128 bit MD5 key or 140 bit SHA1 key. @@ -153,7 +153,7 @@ options: description: Limit default advertisement to this NSSA area. type: bool set: - description: True if only default information orignate is set + description: true if only default information orignate is set type: bool no_summary: description: Filter all type-3 LSAs in the nssa area. @@ -165,17 +165,17 @@ options: description: Enable LSA translation. type: bool set: - description: True if only nssa is set + description: true if only nssa is set type: bool stub: description: Stub area. type: dict suboptions: set: - description: True if only stub is set. + description: true if only stub is set. type: bool summary_lsa: - description: If False , Filter all type-3 LSAs in the stub area. + description: If false , Filter all type-3 LSAs in the stub area. type: bool bfd: @@ -200,7 +200,7 @@ options: description: When true sets the grace_fulrestart config alone. type: bool graceful_restart_helper: - description: If True, Enable graceful restart helper. + description: If true, Enable graceful restart helper. type: bool log_adjacency_changes: description: To configure link-state changes and transitions of OSPFv3 @@ -387,10 +387,10 @@ options: type: str choices: ['md5', 'sha1'] encrypt_key: - description: If False, key string is not encrypted + description: If false, key string is not encrypted type: bool hidden_key: - description: If True, Specifies that a HIDDEN key will follow. + description: If true, Specifies that a HIDDEN key will follow. type: bool key: description: 128 bit MD5 key or 140 bit SHA1 key. @@ -414,10 +414,10 @@ options: type: str choices: ['sha1', 'md5'] encrypt_key: - description: If False, key string is not encrypted + description: If false, key string is not encrypted type: bool hidden_key: - description: If True, Specifies that a HIDDEN key will follow. + description: If true, Specifies that a HIDDEN key will follow. type: bool key: description: 128 bit MD5 key or 140 bit SHA1 key. @@ -443,7 +443,7 @@ options: description: Limit default advertisement to this NSSA area. type: bool set: - description: True if only default information orignate is set + description: true if only default information orignate is set type: bool no_summary: description: Filter all type-3 LSAs in the nssa area. @@ -455,7 +455,7 @@ options: description: Enable LSA translation. type: bool set: - description: True if only nssa is set + description: true if only nssa is set type: bool ranges: description: Configure route summarization. @@ -482,10 +482,10 @@ options: type: dict suboptions: set: - description: True if only stub is set + description: true if only stub is set type: bool summary_lsa: - description: If False , Filter all type-3 LSAs in the stub area. + description: If false , Filter all type-3 LSAs in the stub area. type: bool bfd: @@ -534,7 +534,7 @@ options: description: When true sets the grace_fulrestart config alone. type: bool graceful_restart_helper: - description: If True, Enable graceful restart helper. + description: If true, Enable graceful restart helper. type: bool log_adjacency_changes: description: To configure link-state changes and transitions of OSPFv3 @@ -703,30 +703,59 @@ EXAMPLES = """ # Using merged -# Before state - +# Before state: +# ------------- # veos#show running-config | section ospfv3 # veos# +- name: Merge the provided configuration with the existing running configuration + arista.eos.eos_ospfv3: + config: + processes: + - address_family: + - timers: + lsa: 22 + graceful_restart: + grace_period: 35 + afi: "ipv6" + timers: + pacing: 55 + fips_restrictions: true + router_id: "2.2.2.2" + vrf: "vrfmerge" + state: merged - - arista.eos.eos_ospfv3: - config: - processes: - - address_family: - - timers: - lsa: 22 - graceful_restart: - grace_period: 35 - afi: "ipv6" - timers: - pacing: 55 - fips_restrictions: True - router_id: "2.2.2.2" - vrf: "vrfmerge" - - -# After state +# Task output: +# ------------ +# before: {} +# +# commands: +# - router ospfv3 vrf vrfmerge +# - address-family ipv6 +# - graceful-restart grace-period 35 +# - timers lsa arrival 22 +# - exit +# - timers pacing flood 55 +# - fips restrictions +# - router-id 2.2.2.2 +# - exit +# +# after: +# processes: +# - address_family: +# - afi: ipv6 +# fips_restrictions: true +# graceful_restart: +# grace_period: 35 +# fips_restrictions: true +# router_id: 2.2.2.2 +# timers: +# pacing: 55 +# vrf: vrfmerge + +# After state: +# ------------ # veos#show running-config | section ospfv3 # router ospfv3 vrf vrfmerge # router-id 2.2.2.2 @@ -738,52 +767,11 @@ EXAMPLES = """ # fips restrictions # timers lsa arrival 22 # graceful-restart grace-period 35 -# veos# - -# Module Execution -# "after": { -# "processes": [ -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "fips_restrictions": true, -# "graceful_restart": { -# "grace_period": 35 -# }, -# "timers": { -# "lsa": 22 -# } -# } -# ], -# "fips_restrictions": true, -# "router_id": "2.2.2.2", -# "timers": { -# "pacing": 55 -# }, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "before": {}, -# "changed": true, -# "commands": [ -# "router ospfv3 vrf vrfmerge", -# "address-family ipv6", -# "graceful-restart grace-period 35", -# "timers lsa arrival 22", -# "exit", -# "timers pacing flood 55", -# "fips restrictions", -# "router-id 2.2.2.2", -# "exit" -# ], - # using replaced -# before state - +# Before state: +# ------------- # veos#show running-config | section ospfv3 # router ospfv3 # fips restrictions @@ -798,27 +786,89 @@ EXAMPLES = """ # fips restrictions # timers lsa arrival 22 # graceful-restart grace-period 35 -# veos# - - - - arista.eos.eos_ospfv3: - config: - processes: - - areas: - - area_id: "0.0.0.0" - encryption: - spi: 43 - encryption: "null" - algorithm: "md5" - encrypt_key: False - passphrase: "7hl8FV3lZ6H1mAKpjL47hQ==" - vrf: "default" - address_family: - - afi: "ipv4" - router_id: "7.1.1.1" - state: replaced -# After state +- name: Replace a section of running config with provided config + arista.eos.eos_ospfv3: + config: + processes: + - areas: + - area_id: "0.0.0.0" + encryption: + spi: 43 + encryption: "null" + algorithm: "md5" + encrypt_key: false + passphrase: "7hl8FV3lZ6H1mAKpjL47hQ==" + vrf: "default" + address_family: + - afi: "ipv4" + router_id: "7.1.1.1" + state: replaced + +# Task output: +# ------------ +# before: +# processes: +# - areas: +# - area_id: 0.0.0.0 +# encryption: +# algorithm: md5 +# encryption: 'null' +# hidden_key: true +# passphrase: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER +# spi: 43 +# fips_restrictions: true +# vrf: default +# - address_family: +# - afi: ipv6 +# fips_restrictions: true +# graceful_restart: +# grace_period: 35 +# fips_restrictions: true +# router_id: 2.2.2.2 +# timers: +# pacing: 55 +# vrf: vrfmerge +# +# commands: +# - router ospfv3 vrf vrfmerge +# - address-family ipv6 +# - no fips restrictions +# - no graceful-restart +# - no timers lsa arrival 22 +# - area 0.0.0.3 range 10.1.2.2/24 advertise +# - area 0.0.0.3 range 60.1.1.1 255.255.0.0 cost 30 +# - exit +# - passive-interface default +# - no router-id +# - no fips restrictions +# - no timers pacing flood 55 +# - exit +# +# after: +# processes: +# - areas: +# - area_id: 0.0.0.0 +# encryption: +# algorithm: md5 +# encryption: 'null' +# hidden_key: true +# passphrase: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER +# spi: 43 +# vrf: default +# - address_family: +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# passive_interface: true +# vrf: vrfmerge + +# After state: +# ------------ # veos#show running-config | section ospfv3 # router ospfv3 # area 0.0.0.0 encryption ipsec spi 43 esp null md5 passphrase 7 h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4= @@ -829,112 +879,11 @@ EXAMPLES = """ # address-family ipv6 # area 0.0.0.3 range 10.1.2.0/24 # area 0.0.0.3 range 60.1.0.0/16 cost 30 -# veos# - -# Module execution - -# "after": { -# "processes": [ -# { -# "areas": [ -# { -# "area_id": "0.0.0.0", -# "encryption": { -# "algorithm": "md5", -# "encryption": "null", -# "hidden_key": true, -# "passphrase": "h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4=" -# } -# } -# ], -# "vrf": "default" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ] -# } -# ], -# "passive_interface": true, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "before": { -# "processes": [ -# { -# "areas": [ -# { -# "area_id": "0.0.0.0", -# "encryption": { -# "algorithm": "md5", -# "encryption": "null", -# "hidden_key": true, -# "passphrase": "h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4=" -# } -# } -# ], -# "fips_restrictions": true, -# "vrf": "default" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "fips_restrictions": true, -# "graceful_restart": { -# "grace_period": 35 -# }, -# "timers": { -# "lsa": 22 -# } -# } -# ], -# "fips_restrictions": true, -# "router_id": "2.2.2.2", -# "timers": { -# "pacing": 55 -# }, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "changed": true, -# "commands": [ -# "router ospfv3 vrf vrfmerge", -# "address-family ipv6", -# "no fips restrictions", -# "no graceful-restart", -# "no timers lsa arrival 22", -# "area 0.0.0.3 range 10.1.2.2/24 advertise", -# "area 0.0.0.3 range 60.1.1.1 255.255.0.0 cost 30", -# "exit", -# "passive-interface default", -# "no router-id", -# "no fips restrictions", -# "no timers pacing flood 55", -# "exit" -# ], - # using overridden -# before state - +# Before state: +# ------------- # veos#show running-config | section ospfv3 # router ospfv3 # area 0.0.0.0 encryption ipsec spi 43 esp null md5 passphrase 7 h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4= @@ -945,28 +894,75 @@ EXAMPLES = """ # address-family ipv6 # area 0.0.0.3 range 10.1.2.0/24 # area 0.0.0.3 range 60.1.0.0/16 cost 30 -# veos# - - - - arista.eos.eos_ospfv3: - config: - processes: - - address_family: - - areas: - - area_id: "0.0.0.3" - ranges: - - address: 10.1.2.2/24 - advertise: True - - address: 60.1.1.1 - subnet_mask: 255.255.0.0 - cost: 30 - afi: "ipv6" - passive_interface: True - vrf: "vrfmerge" - state: overridden - -# After state +- name: Override running config with provided config + arista.eos.eos_ospfv3: + config: + processes: + - address_family: + - areas: + - area_id: "0.0.0.3" + ranges: + - address: 10.1.2.2/24 + advertise: true + - address: 60.1.1.1 + subnet_mask: 255.255.0.0 + cost: 30 + afi: "ipv6" + passive_interface: true + vrf: "vrfmerge" + state: overridden + +# Task output: +# ------------ +# before: +# processes: +# - areas: +# - area_id: 0.0.0.0 +# encryption: +# algorithm: md5 +# encryption: 'null' +# hidden_key: true +# passphrase: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER +# spi: 43 +# vrf: default +# - address_family: +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# passive_interface: true +# vrf: vrfmerge +# +# commands: +# - no router ospfv3 +# - router ospfv3 vrf vrfmerge +# - address-family ipv6 +# - no area 0.0.0.3 range 10.1.2.0/24 +# - no area 0.0.0.3 range 60.1.0.0/16 cost 30 +# - area 0.0.0.3 range 10.1.2.2/24 advertise +# - area 0.0.0.3 range 60.1.1.1 255.255.0.0 cost 30 +# - exit +# - exit +# +# after: +# processes: +# - address_family: +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# passive_interface: true +# vrf: vrfmerge + +# After state: +# ------------ # veos#show running-config | section ospfv3 # router ospfv3 vrf vrfmerge # passive-interface default @@ -974,97 +970,11 @@ EXAMPLES = """ # address-family ipv6 # area 0.0.0.3 range 10.1.2.0/24 # area 0.0.0.3 range 60.1.0.0/16 cost 30 -# veos# - - - -# Module execution - -# "after": { -# "processes": [ -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ] -# } -# ], -# "passive_interface": true, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "before": { -# "processes": [ -# { -# "areas": [ -# { -# "area_id": "0.0.0.0", -# "encryption": { -# "algorithm": "md5", -# "encryption": "null", -# "hidden_key": true, -# "passphrase": "h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4=" -# } -# } -# ], -# "vrf": "default" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ] -# } -# ], -# "passive_interface": true, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "changed": true, -# "commands": [ -# "no router ospfv3", -# "router ospfv3 vrf vrfmerge", -# "address-family ipv6", -# "no area 0.0.0.3 range 10.1.2.0/24", -# "no area 0.0.0.3 range 60.1.0.0/16 cost 30", -# "area 0.0.0.3 range 10.1.2.2/24 advertise", -# "area 0.0.0.3 range 60.1.1.1 255.255.0.0 cost 30", -# "exit", -# "exit" -# ], # using deleted -# Before state - +# Before state: +# ------------- # veos#show running-config | section ospfv3 # router ospfv3 # area 0.0.0.0 encryption ipsec spi 43 esp null md5 passphrase 7 h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4= @@ -1081,17 +991,56 @@ EXAMPLES = """ # address-family ipv6 # area 0.0.0.3 range 10.1.2.0/24 # area 0.0.0.3 range 60.1.0.0/16 cost 30 -# veos# +- name: Delete OSPFv3 config + arista.eos.eos_ospfv3: + config: + state: deleted + +# Task output: +# ------------ + +# before: +# processes: +# - areas: +# - area_id: 0.0.0.0 +# encryption: +# algorithm: md5 +# encryption: 'null' +# hidden_key: true +# passphrase: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER +# spi: 43 +# vrf: default +# - address_family: +# - afi: ipv4 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# redistribute: +# - routes: connected +# - route_map: MAP01 +# routes: static +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# passive_interface: true +# vrf: vrfmerge +# +# commands: +# +# - no router ospfv3 +# +# after: {} - - arista.eos.eos_ospfv3: - config: - processes: - - vrf: "default" - state: deleted - -# After state - +# After state: +# ------------ # veos#show running-config | section ospfv3 # router ospfv3 vrf vrfmerge # passive-interface default @@ -1105,139 +1054,10 @@ EXAMPLES = """ # address-family ipv6 # area 0.0.0.3 range 10.1.2.0/24 # area 0.0.0.3 range 60.1.0.0/16 cost 30 -# veos# - - -# Module execution -# "after": { -# "processes": [ -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ], -# "redistribute": [ -# { -# "routes": "connected" -# }, -# { -# "route_map": "MAP01", -# "routes": "static" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ] -# } -# ], -# "passive_interface": true, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "before": { -# "processes": [ -# { -# "areas": [ -# { -# "area_id": "0.0.0.0", -# "encryption": { -# "algorithm": "md5", -# "encryption": "null", -# "hidden_key": true, -# "passphrase": "h8pZp9eprTYjjoY/NKFFe0Ei7x03Y7dyLotRhI0a5t4=" -# } -# } -# ], -# "vrf": "default" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ], -# "redistribute": [ -# { -# "routes": "connected" -# }, -# { -# "route_map": "MAP01", -# "routes": "static" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ] -# } -# ], -# "passive_interface": true, -# "vrf": "vrfmerge" -# } -# ] -# }, -# "changed": true, -# "commands": [ -# "no router ospfv3" -# ], # using parsed # parsed_ospfv3.cfg - # router ospfv3 # fips restrictions # area 0.0.0.20 stub @@ -1284,159 +1104,101 @@ EXAMPLES = """ # timers spf delay initial 56 56 56 # timers out-delay 10 - - - arista.eos.eos_ospfv3: - running_config: "{{ lookup('file', './parsed_ospfv3.cfg') }}" - state: parsed - -# Module execution - -# "parsed": { -# "processes": [ -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "fips_restrictions": true, -# "redistribute": [ -# { -# "routes": "connected" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "fips_restrictions": true, -# "router_id": "10.1.1.1" -# } -# ], -# "adjacency": { -# "exchange_start": { -# "threshold": 11 -# } -# }, -# "areas": [ -# { -# "area_id": "0.0.0.20", -# "authentication": { -# "algorithm": "sha1", -# "hidden_key": true, -# "passphrase": "4O8T3zo4xBdRWXBnsnK934o9SEb+jEhHUN6+xzZgCo2j9EnQBUvtwNxxLEmYmm6w", -# "spi": 33 -# }, -# "stub": { -# "set": true -# } -# }, -# { -# "area_id": "0.0.0.40", -# "default_cost": 45, -# "stub": { -# "set": true -# } -# } -# ], -# "fips_restrictions": true, -# "timers": { -# "pacing": 7 -# }, -# "vrf": "default" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "fips_restrictions": true, -# "maximum_paths": 100, -# "passive_interface": true, -# "redistribute": [ -# { -# "route_map": "MAP01", -# "routes": "connected" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.10", -# "nssa": { -# "no_summary": true -# } -# } -# ], -# "default_information": { -# "originate": true, -# "route_map": "DefaultRouteFilter" -# }, -# "fips_restrictions": true, -# "max_metric": { -# "router_lsa": { -# "external_lsa": { -# "max_metric_value": 25 -# }, -# "summary_lsa": { -# "set": true -# } -# } -# } -# } -# ], -# "areas": [ -# { -# "area_id": "0.0.0.0", -# "encryption": { -# "algorithm": "sha1", -# "encryption": "null", -# "hidden_key": true, -# "passphrase": "7hl8FV3lZ6H1mAKpjL47hQ==" -# } -# } -# ], -# "bfd": { -# "all_interfaces": true -# }, -# "fips_restrictions": true, -# "log_adjacency_changes": { -# "detail": true -# }, -# "vrf": "vrf01" -# }, -# { -# "address_family": [ -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.1", -# "stub": { -# "set": true -# } -# } -# ], -# "distance": 200, -# "fips_restrictions": true, -# "router_id": "10.17.0.3", -# "timers": { -# "out_delay": 10, -# "spf": { -# "initial": 56, -# "max": 56, -# "min": 56, -# } -# } -# } -# ], -# "fips_restrictions": true, -# "vrf": "vrf02" -# } -# ] +- name: Parse the provided config + arista.eos.eos_ospfv3: + running_config: "{{ lookup('file', './parsed_ospfv3.cfg') }}" + state: parsed + +# Task output: +# ------------ +# parsed: +# processes: +# - address_family: +# - afi: ipv4 +# fips_restrictions: true +# redistribute: +# - routes: connected +# - afi: ipv6 +# fips_restrictions: true +# router_id: 10.1.1.1 +# adjacency: +# exchange_start: +# threshold: 11 +# areas: +# - area_id: 0.0.0.20 +# authentication: +# algorithm: sha1 +# hidden_key: true +# passphrase: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER +# spi: 33 +# stub: +# set: true +# - area_id: 0.0.0.40 +# default_cost: 45 +# stub: +# set: true +# fips_restrictions: true +# timers: +# pacing: 7 +# vrf: default +# - address_family: +# - afi: ipv4 +# fips_restrictions: true +# maximum_paths: 100 +# passive_interface: true +# redistribute: +# - route_map: MAP01 +# routes: connected +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.10 +# nssa: +# no_summary: true +# default_information: +# originate: true +# route_map: DefaultRouteFilter +# fips_restrictions: true +# max_metric: +# router_lsa: +# external_lsa: +# max_metric_value: 25 +# summary_lsa: +# set: true +# areas: +# - area_id: 0.0.0.0 +# encryption: +# algorithm: sha1 +# encryption: 'null' +# hidden_key: true +# passphrase: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER +# spi: 256 +# bfd: +# all_interfaces: true +# fips_restrictions: true +# log_adjacency_changes: +# detail: true +# vrf: vrf01 +# - address_family: +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.1 +# stub: +# set: true +# distance: 200 +# fips_restrictions: true +# router_id: 10.17.0.3 +# timers: +# out_delay: 10 +# spf: +# initial: 56 +# max: 56 +# min: 56 +# fips_restrictions: true +# vrf: vrf02 # using gathered -# native config - +# native config: # veos#show running-config | section ospfv3 # router ospfv3 vrf vrfmerge # passive-interface default @@ -1450,100 +1212,115 @@ EXAMPLES = """ # address-family ipv6 # area 0.0.0.3 range 10.1.2.0/24 # area 0.0.0.3 range 60.1.0.0/16 cost 30 -# veos# - - - - arista.eos.eos_ospfv3: - state: gathered -# module execution +- name: Gather running configuration + arista.eos.eos_ospfv3: + state: gathered + +# Task output: +# ------------ +# gathered: +# processes: +# - address_family: +# - afi: ipv4 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# redistribute: +# - routes: connected +# - route_map: MAP01 +# routes: static +# - afi: ipv6 +# areas: +# - area_id: 0.0.0.3 +# ranges: +# - address: 10.1.2.0/24 +# - address: 60.1.0.0/16 +# cost: 30 +# passive_interface: true +# vrf: vrfmerge -# "gathered": { -# "processes": [ -# { -# "address_family": [ -# { -# "afi": "ipv4", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ], -# "redistribute": [ -# { -# "routes": "connected" -# }, -# { -# "route_map": "MAP01", -# "routes": "static" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "areas": [ -# { -# "area_id": "0.0.0.3", -# "ranges": [ -# { -# "address": "10.1.2.0/24" -# }, -# { -# "address": "60.1.0.0/16", -# "cost": 30 -# } -# ] -# } -# ] -# } -# ], -# "passive_interface": true, -# "vrf": "vrfmerge" -# } -# ] # using rendered - - arista.eos.eos_ospfv3: - config: - processes: - - address_family: - - timers: - lsa: 22 - graceful_restart: - grace_period: 35 - afi: "ipv6" - timers: - pacing: 55 - fips_restrictions: True - router_id: "2.2.2.2" - vrf: "vrfmerge" - state: rendered - -# module execution - -# "rendered": [ -# "router ospfv3 vrf vrfmerge", -# "address-family ipv6", -# "graceful-restart grace-period 35", -# "timers lsa arrival 22", -# "exit", -# "timers pacing flood 55", -# "fips restrictions", -# "router-id 2.2.2.2", -# "exit" -# ] - - +- name: render CLI commands for provided config + arista.eos.eos_ospfv3: + config: + processes: + - address_family: + - timers: + lsa: 22 + graceful_restart: + grace_period: 35 + afi: "ipv6" + timers: + pacing: 55 + fips_restrictions: true + router_id: "2.2.2.2" + vrf: "vrfmerge" + state: rendered + +# Task output: +# ------------ +# rendered: +# - router ospfv3 vrf vrfmerge +# - address-family ipv6 +# - graceful-restart grace-period 35 +# - timers lsa arrival 22 +# - exit +# - timers pacing flood 55 +# - fips restrictions +# - router-id 2.2.2.2 +# - exit +""" +RETURN = """ +before: + description: The configuration prior to the module execution. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +after: + description: The resulting configuration after module execution. + returned: when changed + type: dict + sample: > + This output will always be in the same format as the + module argspec. +commands: + description: The set of commands pushed to the remote device. + returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) + type: list + sample: + - router ospfv3 vrf vrfmerge + - address-family ipv6 + - graceful-restart grace-period 35 +rendered: + description: The provided configuration in the task rendered in device-native format (offline). + returned: when I(state) is C(rendered) + type: list + sample: + - router ospfv3 vrf vrfmerge + - address-family ipv6 + - graceful-restart grace-period 35 +gathered: + description: Facts about the network resource gathered from the remote device as structured data. + returned: when I(state) is C(gathered) + type: dict + sample: > + This output will always be in the same format as the + module argspec. +parsed: + description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. + returned: when I(state) is C(parsed) + type: dict + sample: > + This output will always be in the same format as the + module argspec. """ from ansible.module_utils.basic import AnsibleModule diff --git a/ansible_collections/arista/eos/plugins/modules/eos_prefix_lists.py b/ansible_collections/arista/eos/plugins/modules/eos_prefix_lists.py index dffd65527..88aa40c5a 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_prefix_lists.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_prefix_lists.py @@ -112,43 +112,88 @@ options: """ EXAMPLES = """ # Using merged + + # Before state # veos#show running-config | section prefix-lists # veos# - - name: Merge provided configuration with device configuration - arista.eos.eos_prefix_lists: - config: - - afi: "ipv4" - prefix_lists: - - name: "v401" - entries: - - sequence: 25 - action: "deny" - address: "45.55.4.0/24" - - sequence: 100 - action: "permit" - address: "11.11.2.0/24" - match: - masklen: 32 - operator: "ge" - - name: "v402" - entries: - - action: "deny" - address: "10.1.1.0/24" - sequence: 10 - match: - masklen: 32 - operator: "ge" - - afi: "ipv6" - prefix_lists: - - name: "v601" - entries: - - sequence: 125 - action: "deny" - address: "5000:1::/64" - -# After State +- name: Merge provided configuration with device configuration + arista.eos.eos_prefix_lists: + config: + - afi: "ipv4" + prefix_lists: + - name: "v401" + entries: + - sequence: 25 + action: "deny" + address: "45.55.4.0/24" + - sequence: 100 + action: "permit" + address: "11.11.2.0/24" + match: + masklen: 32 + operator: "ge" + - name: "v402" + entries: + - action: "deny" + address: "10.1.1.0/24" + sequence: 10 + match: + masklen: 32 + operator: "ge" + - afi: "ipv6" + prefix_lists: + - name: "v601" + entries: + - sequence: 125 + action: "deny" + address: "5000:1::/64" + +# Task Output +# ------------- +# before: {} +# commands: +# - ipv6 prefix-list v601 +# - seq 125 deny 5000:1::/64 +# - ip prefix-list v401 +# - seq 25 deny 45.55.4.0/24 +# - seq 100 permit 11.11.2.0/24 ge 32 +# - ip prefix-list v402 +# - seq 10 deny 10.1.1.0/24 ge 32 +# after: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 + + +# After state: +# ------------ # veos# # veos#show running-config | section prefix-list # ip prefix-list v401 @@ -161,81 +206,13 @@ EXAMPLES = """ # ipv6 prefix-list v601 # seq 125 deny 5000:1::/64 # veos# -# -# Module Execution: -# "after": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], -# "before": {}, -# "changed": true, -# "commands": [ -# "ipv6 prefix-list v601", -# "seq 125 deny 5000:1::/64", -# "ip prefix-list v401", -# "seq 25 deny 45.55.4.0/24", -# "seq 100 permit 11.11.2.0/24 ge 32", -# "ip prefix-list v402", -# "seq 10 deny 10.1.1.0/24 ge 32" -# ], -# -# using merged: + +# Using merged: # Failure scenario : 'merged' should not be used when an existing prefix-list (sequence number) # is to be modified. -# Before State: + # veos#show running-config | section prefix-list # ip prefix-list v401 # seq 25 deny 45.55.4.0/24 @@ -248,118 +225,89 @@ EXAMPLES = """ # seq 125 deny 5000:1::/64 # veos# - - name: Merge provided configuration with device configuration - arista.eos.eos_prefix_lists: - config: - - afi: "ipv4" - prefix_lists: - - name: "v401" - entries: - - sequence: 25 - action: "deny" - address: "45.55.4.0/24" - match: - masklen: 32 - operator: "ge" - - sequence: 100 - action: "permit" - address: "11.11.2.0/24" - match: - masklen: 32 - operator: "ge" - - name: "v402" - entries: - - action: "deny" - address: "10.1.1.0/24" - sequence: 10 - match: - masklen: 32 - operator: "ge" - - afi: "ipv6" - prefix_lists: - - name: "v601" - entries: - - sequence: 125 - action: "deny" - address: "5000:1::/64" - state: merged - -# Module Execution: -# fatal: [192.168.122.113]: FAILED! => { -# "changed": false, -# "invocation": { -# "module_args": { -# "config": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "resequence": null, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "resequence": null, -# "sequence": 100 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "resequence": null, -# "sequence": 10 -# } -# ], -# "name": "v402" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "match": null, -# "resequence": null, -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], -# "running_config": null, -# "state": "merged" -# } -# }, -# "msg": "Sequence number 25 is already present. Use replaced/overridden operation to change the configuration" -# } -# +- name: Merge provided configuration with device configuration + arista.eos.eos_prefix_lists: + config: + - afi: "ipv4" + prefix_lists: + - name: "v401" + entries: + - sequence: 25 + action: "deny" + address: "45.55.4.0/24" + match: + masklen: 32 + operator: "ge" + - sequence: 100 + action: "permit" + address: "11.11.2.0/24" + match: + masklen: 32 + operator: "ge" + - name: "v402" + entries: + - action: "deny" + address: "10.1.1.0/24" + sequence: 10 + match: + masklen: 32 + operator: "ge" + - afi: "ipv6" + prefix_lists: + - name: "v601" + entries: + - sequence: 125 + action: "deny" + address: "5000:1::/64" + state: merged + +# Task Output +# ------------- +# changed: false +# invocation: +# module_args: +# config: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# resequence: +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# resequence: +# sequence: 100 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# resequence: +# sequence: 10 +# name: v402 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# match: +# resequence: +# sequence: 125 +# name: v601 +# running_config: +# state: merged +# msg: Sequence number 25 is already present. Use replaced/overridden operation to change +# the configuration + # Using Replaced: @@ -375,26 +323,94 @@ EXAMPLES = """ # ipv6 prefix-list v601 # seq 125 deny 5000:1::/64 # veos# - - name: Replace - arista.eos.eos_prefix_lists: - config: - - afi: "ipv4" - prefix_lists: - - name: "v401" - entries: - - sequence: 25 - action: "deny" - address: "45.55.4.0/24" - match: - masklen: 32 - operator: "ge" - - sequence: 200 - action: "permit" - address: "200.11.2.0/24" - match: - masklen: 32 - operator: "ge" - state: replaced + + +- name: Replace Provided configuration with given configuration + arista.eos.eos_prefix_lists: + config: + - afi: "ipv4" + prefix_lists: + - name: "v401" + entries: + - sequence: 25 + action: "deny" + address: "45.55.4.0/24" + match: + masklen: 32 + operator: "ge" + - sequence: 200 + action: "permit" + address: "200.11.2.0/24" + match: + masklen: 32 + operator: "ge" + state: replaced + + +# Task Output +# ------------- +# before: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 +# commands: +# - ip prefix-list v401 +# - no seq 25 +# - seq 25 deny 45.55.4.0/24 ge 32 +# - seq 200 permit 200.11.2.0/24 ge 32 +# - no seq 100 +# - no ip prefix-list v402 +# after: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 25 +# - action: permit +# address: 200.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 200 +# name: v401 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 + + # After State: # veos#show running-config | section prefix-list # ip prefix-list v401 @@ -406,121 +422,12 @@ EXAMPLES = """ # veos# # # -# Module Execution: -# -# "after": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "200.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 200 -# } -# ], -# "name": "v401" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], -# "before": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], -# "changed": true, -# "commands": [ -# "ip prefix-list v401", -# "no seq 25", -# "seq 25 deny 45.55.4.0/24 ge 32", -# "seq 200 permit 200.11.2.0/24 ge 32", -# "no seq 100", -# "no ip prefix-list v402" -# ], + # Using overridden: -# Before State: + +# Before State: # veos#show running-config | section prefix-list # ip prefix-list v401 # seq 25 deny 45.55.4.0/24 ge 32 @@ -534,29 +441,103 @@ EXAMPLES = """ # seq 125 deny 5000:1::/64 # veos# +- name: Override + arista.eos.eos_prefix_lists: + config: + - afi: "ipv4" + prefix_lists: + - name: "v401" + entries: + - sequence: 25 + action: "deny" + address: "45.55.4.0/24" + - sequence: 300 + action: "permit" + address: "30.11.2.0/24" + match: + masklen: 32 + operator: "ge" + - name: "v403" + entries: + - action: "deny" + address: "10.1.1.0/24" + sequence: 10 + state: overridden + + +# Task Output +# ------------- +# before: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# - action: permit +# address: 200.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 200 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 +# commands: +# - no ipv6 prefix-list v601 +# - ip prefix-list v401 +# - seq 25 deny 45.55.4.0/24 +# - seq 300 permit 30.11.2.0/24 ge 32 +# - no seq 100 +# - no seq 200 +# - ip prefix-list v403 +# - seq 10 deny 10.1.1.0/24 +# - no ip prefix-list v402 +# after: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 25 +# - action: permit +# address: 30.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 300 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# sequence: 10 +# name: v403 - - name: Override - arista.eos.eos_prefix_lists: - config: - - afi: "ipv4" - prefix_lists: - - name: "v401" - entries: - - sequence: 25 - action: "deny" - address: "45.55.4.0/24" - - sequence: 300 - action: "permit" - address: "30.11.2.0/24" - match: - masklen: 32 - operator: "ge" - - name: "v403" - entries: - - action: "deny" - address: "10.1.1.0/24" - sequence: 10 - state: overridden # After State # veos# @@ -568,134 +549,10 @@ EXAMPLES = """ # ip prefix-list v403 # seq 10 deny 10.1.1.0/24 # veos# -# -# -# Module Execution: -# "after": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "30.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 300 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "sequence": 10 -# } -# ], -# "name": "v403" -# } -# ] -# } -# ], -# "before": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# }, -# { -# "action": "permit", -# "address": "200.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 200 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], -# "changed": true, -# "commands": [ -# "no ipv6 prefix-list v601", -# "ip prefix-list v401", -# "seq 25 deny 45.55.4.0/24", -# "seq 300 permit 30.11.2.0/24 ge 32", -# "no seq 100", -# "no seq 200", -# "ip prefix-list v403", -# "seq 10 deny 10.1.1.0/24", -# "no ip prefix-list v402" -# ], -# # Using deleted: -# Before State: +# Before State: # veos#show running-config | section prefix-list # ip prefix-list v401 # seq 25 deny 45.55.4.0/24 ge 32 @@ -712,12 +569,95 @@ EXAMPLES = """ # seq 125 deny 5000:1::/64 # veos# - - name: Delete device configuration - arista.eos.eos_prefix_lists: - config: - - afi: "ipv6" - state: deleted - +- name: Delete device configuration + arista.eos.eos_prefix_lists: + config: + - afi: "ipv6" + state: deleted + +# Task Output +# ------------- +# before: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# - action: permit +# address: 30.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 300 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# sequence: 10 +# name: v403 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 +# commands: +# - no ipv6 prefix-list v601 +# after: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# - action: permit +# address: 30.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 300 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# sequence: 10 +# name: v403 # after State: # veos#show running-config | section prefix-list @@ -732,158 +672,12 @@ EXAMPLES = """ # ip prefix-list v403 # seq 10 deny 10.1.1.0/24 # -# -# Module Execution: -# "after": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# }, -# { -# "action": "permit", -# "address": "30.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 300 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "sequence": 10 -# } -# ], -# "name": "v403" -# } -# ] -# } -# ], -# "before": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# }, -# { -# "action": "permit", -# "address": "30.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 300 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "sequence": 10 -# } -# ], -# "name": "v403" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], -# "changed": true, -# "commands": [ -# "no ipv6 prefix-list v601" -# ], -# + # Using deleted -# Before state: + +# Before state: # veos#show running-config | section prefix-list # ip prefix-list v401 # seq 25 deny 45.55.4.0/24 ge 32 @@ -897,88 +691,63 @@ EXAMPLES = """ # seq 10 deny 10.1.1.0/24 # veos# - - name: Delete device configuration - arista.eos.eos_prefix_lists: - state: deleted +- name: Delete device configuration + arista.eos.eos_prefix_lists: + state: deleted + + +# Task Output +# ------------- +# before: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# - action: permit +# address: 30.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 300 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# sequence: 10 +# name: v403 +# commands: +# - no ip prefix-list v401 +# - no ip prefix-list v402 +# - no ip prefix-list v403 +# after: {} # After State: # veos#show running-config | section prefix-list # veos# -# -# Module Execution: -# "after": {}, -# "before": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# }, -# { -# "action": "permit", -# "address": "30.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 300 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "sequence": 10 -# } -# ], -# "name": "v403" -# } -# ] -# } -# ], -# "changed": true, -# "commands": [ -# "no ip prefix-list v401", -# "no ip prefix-list v402", -# "no ip prefix-list v403" -# ], -# + # Using parsed: + + # parse_prefix_lists.cfg # ip prefix-list v401 # seq 25 deny 45.55.4.0/24 @@ -990,99 +759,81 @@ EXAMPLES = """ # ipv6 prefix-list v601 # seq 125 deny 5000:1::/64 # - - name: parse configs - arista.eos.eos_prefix_lists: - running_config: "{{ lookup('file', './parsed_prefix_lists.cfg') }}" - state: parsed - -# Module Execution: -# "parsed": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "sequence": 10 -# } -# ], -# "name": "v402" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ] + + +- name: parse configs + arista.eos.eos_prefix_lists: + running_config: "{{ lookup('file', './parsed_prefix_lists.cfg') }}" + state: parsed + + +# Task Output +# ------------- +# parsed: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# sequence: 10 +# name: v402 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 + # Using rendered: - - name: Render provided configuration - arista.eos.eos_prefix_lists: - config: - - afi: "ipv4" - prefix_lists: - - name: "v401" - entries: - - sequence: 25 - action: "deny" - address: "45.55.4.0/24" - - sequence: 200 - action: "permit" - address: "200.11.2.0/24" - match: - masklen: 32 - operator: "ge" - - name: "v403" - entries: - - action: "deny" - address: "10.1.1.0/24" - sequence: 10 - state: rendered - -# Module Execution: -# "rendered": [ -# "ip prefix-list v401", -# "seq 25 deny 45.55.4.0/24", -# "seq 200 permit 200.11.2.0/24 ge 32", -# "ip prefix-list v403", -# "seq 10 deny 10.1.1.0/24" -# ] -# + +- name: Render provided configuration + arista.eos.eos_prefix_lists: + config: + - afi: "ipv4" + prefix_lists: + - name: "v401" + entries: + - sequence: 25 + action: "deny" + address: "45.55.4.0/24" + - sequence: 200 + action: "permit" + address: "200.11.2.0/24" + match: + masklen: 32 + operator: "ge" + - name: "v403" + entries: + - action: "deny" + address: "10.1.1.0/24" + sequence: 10 + state: rendered + +# Task Output +# ------------- +# rendered: +# - ip prefix-list v401 +# - seq 25 deny 45.55.4.0/24 +# - seq 200 permit 200.11.2.0/24 ge 32 +# - ip prefix-list v403 +# - seq 10 deny 10.1.1.0/24 # using gathered: + + # Device config: # veos#show running-config | section prefix-list # ip prefix-list v401 @@ -1096,69 +847,95 @@ EXAMPLES = """ # seq 125 deny 5000:1::/64 # veos# - - name: gather configs - arista.eos.eos_prefix_lists: - state: gathered - -# Module Execution: -# -# "gathered": [ -# { -# "afi": "ipv4", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "45.55.4.0/24", -# "sequence": 25 -# }, -# { -# "action": "permit", -# "address": "11.11.2.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 100 -# } -# ], -# "name": "v401" -# }, -# { -# "entries": [ -# { -# "action": "deny", -# "address": "10.1.1.0/24", -# "match": { -# "masklen": 32, -# "operator": "ge" -# }, -# "sequence": 10 -# } -# ], -# "name": "v402" -# } -# ] -# }, -# { -# "afi": "ipv6", -# "prefix_lists": [ -# { -# "entries": [ -# { -# "action": "deny", -# "address": "5000:1::/64", -# "sequence": 125 -# } -# ], -# "name": "v601" -# } -# ] -# } -# ], - +- name: gather configs + arista.eos.eos_prefix_lists: + state: gathered + +# Task Output +# ------------- +# gathered: +# - afi: ipv4 +# prefix_lists: +# - entries: +# - action: deny +# address: 45.55.4.0/24 +# sequence: 25 +# - action: permit +# address: 11.11.2.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 100 +# name: v401 +# - entries: +# - action: deny +# address: 10.1.1.0/24 +# match: +# masklen: 32 +# operator: ge +# sequence: 10 +# name: v402 +# - afi: ipv6 +# prefix_lists: +# - entries: +# - action: deny +# address: 5000:1::/64 +# sequence: 125 +# name: v601 """ +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +after: + description: The resulting configuration model invocation. + returned: when changed + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: + - ip prefix-list v401 + - seq 25 deny 45.55.4.0/24 + - seq 200 permit 200.11.2.0/24 ge 32 + - ip prefix-list v403 + - seq 10 deny 10.1.1.0/24 +rendered: + description: The set of CLI commands generated from the value in C(config) option + returned: When C(state) is I(rendered) + type: list + sample: > + - ip prefix-list v401 + - seq 25 deny 45.55.4.0/24 + - seq 200 permit 200.11.2.0/24 ge 32 + - ip prefix-list v403 + - seq 10 deny 10.1.1.0/24 +gathered: + description: The configuration as structured data transformed for the running configuration + fetched from remote host + returned: When C(state) is I(gathered) + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +parsed: + description: The configuration as structured data transformed for the value of + C(running_config) option + returned: When C(state) is I(parsed) + type: list + sample: > + The configuration returned will always be in the same format + of the parameters above. +""" + from ansible.module_utils.basic import AnsibleModule diff --git a/ansible_collections/arista/eos/plugins/modules/eos_route_maps.py b/ansible_collections/arista/eos/plugins/modules/eos_route_maps.py index 3b1869547..76bdc6c37 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_route_maps.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_route_maps.py @@ -70,7 +70,7 @@ options: description: Source route map name. type: str overwrite: - description: if True, overwrite existing config. + description: if true, overwrite existing config. type: bool action: description: Action for matching routes @@ -420,39 +420,39 @@ EXAMPLES = """ # veos#show running-config | section route-map # veos# - - name: Merge provided configuration with device configuration - arista.eos.eos_route_maps: - config: - - route_map: "mapmerge" - entries: - - description: "merged_map" - action: "permit" - sequence: 10 - match: - router_id: 22 - - description: "newmap" - action: "deny" - sequence: 25 - continue_sequence: 45 - match: - interface: "Ethernet1" - - route_map: "mapmerge2" - entries: - - sub_route_map: - name: "mapmerge" - action: "deny" - sequence: 45 - set: - metric: - value: 25 - add: "igp-metric" - as_path: - prepend: - last_as: 2 - match: - ipv6: - resolved_next_hop: "list1" - state: merged +- name: Merge provided configuration with device configuration + arista.eos.eos_route_maps: + config: + - route_map: "mapmerge" + entries: + - description: "merged_map" + action: "permit" + sequence: 10 + match: + router_id: 22 + - description: "newmap" + action: "deny" + sequence: 25 + continue_sequence: 45 + match: + interface: "Ethernet1" + - route_map: "mapmerge2" + entries: + - sub_route_map: + name: "mapmerge" + action: "deny" + sequence: 45 + set: + metric: + value: 25 + add: "igp-metric" + as_path: + prepend: + last_as: 2 + match: + ipv6: + resolved_next_hop: "list1" + state: merged # After State: @@ -475,7 +475,6 @@ EXAMPLES = """ # route-map test permit 10 # veos# - # Module Execution: # "after": [ @@ -570,26 +569,26 @@ EXAMPLES = """ # ! # veos# - - name: Replace - arista.eos.eos_route_maps: - config: - - route_map: "mapmerge" - entries: - - action: "permit" - sequence: 10 - match: - ipv6: - resolved_next_hop: "listr" - - action: "deny" - sequence: 90 - set: - extcommunity: - rt: - vpn: "22:11" - delete: True - ip: - unchanged: True - state: replaced +- name: Replace + arista.eos.eos_route_maps: + config: + - route_map: "mapmerge" + entries: + - action: "permit" + sequence: 10 + match: + ipv6: + resolved_next_hop: "listr" + - action: "deny" + sequence: 90 + set: + extcommunity: + rt: + vpn: "22:11" + delete: true + ip: + unchanged: true + state: replaced # After State: @@ -781,22 +780,22 @@ EXAMPLES = """ # route-map test permit 10 # veos# - - name: Override - arista.eos.eos_route_maps: - config: - - route_map: "mapmerge" - entries: - - action: "permit" - sequence: 10 - match: - ipv6: - resolved_next_hop: "listr" - - action: "deny" - sequence: 90 - set: - metric: - igp_param: "igp-nexthop-cost" - state: overridden +- name: Override + arista.eos.eos_route_maps: + config: + - route_map: "mapmerge" + entries: + - action: "permit" + sequence: 10 + match: + ipv6: + resolved_next_hop: "listr" + - action: "deny" + sequence: 90 + set: + metric: + igp_param: "igp-nexthop-cost" + state: overridden # After State: @@ -946,14 +945,14 @@ EXAMPLES = """ # set as-path prepend last-as 2 # veos# - - name: Delete route-map - arista.eos.eos_route_maps: - config: - - route_map: "mapmerge" - state: deleted - become: yes - tags: - - deleted1 +- name: Delete route-map + arista.eos.eos_route_maps: + config: + - route_map: "mapmerge" + state: deleted + become: true + tags: + - deleted1 # After State: @@ -1087,11 +1086,13 @@ EXAMPLES = """ # set as-path prepend last-as 2 # veos# - - name: Delete all route-maps - arista.eos.eos_route_maps: - state: deleted +- name: Delete all route-maps + arista.eos.eos_route_maps: + state: deleted # After State: +# ------------ + # veos#show running-config | section route-map # veos# # @@ -1177,9 +1178,9 @@ EXAMPLES = """ # set as-path prepend last-as 2 # veos# - - name: gather configs - arista.eos.eos_route_maps: - state: gathered +- name: gather configs + arista.eos.eos_route_maps: + state: gathered # Module Execution: # "gathered": [ @@ -1237,43 +1238,45 @@ EXAMPLES = """ # Using rendered: - - name: Render provided configuration - arista.eos.eos_route_maps: - config: - - route_map: "mapmerge" - entries: - - description: "merged_map" - action: "permit" - sequence: 10 - match: - router_id: 22 - set: - bgp: 20 - - description: "newmap" - action: "deny" - sequence: 25 - continue_sequence: 45 - match: - interface: "Ethernet1" - - route_map: "mapmerge2" - entries: - - sub_route_map: - name: "mapmerge" - action: "deny" - sequence: 45 - set: - metric: - value: 25 - add: "igp-metric" - as_path: - prepend: - last_as: 2 - match: - ipv6: - resolved_next_hop: "list1" - state: rendered +- name: Render provided configuration + arista.eos.eos_route_maps: + config: + - route_map: "mapmerge" + entries: + - description: "merged_map" + action: "permit" + sequence: 10 + match: + router_id: 22 + set: + bgp: 20 + - description: "newmap" + action: "deny" + sequence: 25 + continue_sequence: 45 + match: + interface: "Ethernet1" + - route_map: "mapmerge2" + entries: + - sub_route_map: + name: "mapmerge" + action: "deny" + sequence: 45 + set: + metric: + value: 25 + add: "igp-metric" + as_path: + prepend: + last_as: 2 + match: + ipv6: + resolved_next_hop: "list1" + state: rendered + +# Task output: +# ------------ -# Module Execution: # "rendered": [ # "route-map mapmerge permit 10", # "match router-id prefix-list 22", @@ -1309,10 +1312,10 @@ EXAMPLES = """ # set metric 25 +igp-metric # set as-path prepend last-as 2 - - name: parse configs - arista.eos.eos_route_maps: - running_config: "{{ lookup('file', './parsed.cfg') }}" - state: parsed +- name: parse configs + arista.eos.eos_route_maps: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed # Module Execution: # "parsed": [ @@ -1370,9 +1373,6 @@ EXAMPLES = """ # "route_map": "mapmerge2" # } # ] - - - """ from ansible.module_utils.basic import AnsibleModule diff --git a/ansible_collections/arista/eos/plugins/modules/eos_snmp_server.py b/ansible_collections/arista/eos/plugins/modules/eos_snmp_server.py index b702c8a46..74162c1c2 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_snmp_server.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_snmp_server.py @@ -434,7 +434,7 @@ options: description: Maximum number of notifications in the log type: int objects: - description: when True Disable implementation of a group of objects + description: when true Disable implementation of a group of objects type: dict suboptions: mac_address_tables: @@ -556,59 +556,61 @@ options: choices: [deleted, merged, overridden, replaced, gathered, rendered, parsed] default: merged """ + EXAMPLES = """ # Using merged: + # Before State # eos#show running-config | section snmp-server # eos# - - name: merge given snmp_server configuration - arista.eos.eos_snmp_server: - config: - communities: - - name: "comm3" - acl_v6: "list1" - view: "view1" - - name: "comm4" - acl_v4: "list3" - view: "view1" - - name: "comm5" - acl_v4: "list4" - ro: True - contact: "admin" - engineid: - remote: - host: 1.1.1.1 - id: "1234567" - groups: - - group: "group1" - version: "v1" - read: "view1" - - group: "group2" - version: "v3" - auth_privacy: "priv" - notify: "view1" - write: "view2" - hosts: - - host: "host02" - user: "user01" - udp_port: 23 - version: "2c" - - host: "host01" - user: "user01" - udp_port: 23 - version: "3 priv" - traps: - capacity: - arista_hardware_utilization_alert: True - bgp: - enabled: True - external_alarm: - arista_external_alarm_deasserted_notif: True - arista_external_alarm_asserted_notif: True - vrfs: - - vrf: "vrf01" - local_interface: "Ethernet1" +- name: merge given snmp_server configuration + arista.eos.eos_snmp_server: + config: + communities: + - name: "comm3" + acl_v6: "list1" + view: "view1" + - name: "comm4" + acl_v4: "list3" + view: "view1" + - name: "comm5" + acl_v4: "list4" + ro: true + contact: "admin" + engineid: + remote: + host: 1.1.1.1 + id: "1234567" + groups: + - group: "group1" + version: "v1" + read: "view1" + - group: "group2" + version: "v3" + auth_privacy: "priv" + notify: "view1" + write: "view2" + hosts: + - host: "host02" + user: "user01" + udp_port: 23 + version: "2c" + - host: "host01" + user: "user01" + udp_port: 23 + version: "3 priv" + traps: + capacity: + arista_hardware_utilization_alert: true + bgp: + enabled: true + external_alarm: + arista_external_alarm_deasserted_notif: true + arista_external_alarm_asserted_notif: true + vrfs: + - vrf: "vrf01" + local_interface: "Ethernet1" # After state # eos#show running-config | section snmp-server @@ -715,6 +717,7 @@ EXAMPLES = """ # # Using replaced: + # Before State: # eos#show running-config | section snmp-server # snmp-server community comm3 view view1 ipv6 list1 @@ -730,29 +733,29 @@ EXAMPLES = """ # snmp-server enable traps capacity arista-hardware-utilization-alert # snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif - - name: Replace given snmp_server configuration - become: true - register: result - arista.eos.eos_snmp_server: &replaced - state: replaced - config: - communities: - - name: "comm3" - acl_v6: "list1" - view: "view1" - - name: "replacecomm" - acl_v4: "list4" - extension: - root_oid: "123456" - script_location: "flash:" - traps: - test: - arista_test_notification: True - bgp: - enabled: True - vrfs: - - vrf: "vrf_replace" - local_interface: "Ethernet1" +- name: Replace given snmp_server configuration + become: true + register: result + arista.eos.eos_snmp_server: &replaced + state: replaced + config: + communities: + - name: "comm3" + acl_v6: "list1" + view: "view1" + - name: "replacecomm" + acl_v4: "list4" + extension: + root_oid: "123456" + script_location: "flash:" + traps: + test: + arista_test_notification: true + bgp: + enabled: true + vrfs: + - vrf: "vrf_replace" + local_interface: "Ethernet1" # After State: @@ -901,27 +904,27 @@ EXAMPLES = """ # snmp-server enable traps capacity arista-hardware-utilization-alert # snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif - - name: Override given snmp_server configuration - arista.eos.eos_snmp_server: - state: overridden - config: - communities: - - name: "comm3" - acl_v6: "list1" - view: "view1" - - name: "replacecomm" - acl_v4: "list4" - extension: - root_oid: "123456" - script_location: "flash:" - traps: - test: - arista_test_notification: True - bgp: - enabled: True - vrfs: - - vrf: "vrf_replace" - local_interface: "Ethernet1" +- name: Override given snmp_server configuration + arista.eos.eos_snmp_server: + state: overridden + config: + communities: + - name: "comm3" + acl_v6: "list1" + view: "view1" + - name: "replacecomm" + acl_v4: "list4" + extension: + root_oid: "123456" + script_location: "flash:" + traps: + test: + arista_test_notification: true + bgp: + enabled: true + vrfs: + - vrf: "vrf_replace" + local_interface: "Ethernet1" # After State: @@ -1070,9 +1073,9 @@ EXAMPLES = """ # snmp-server enable traps capacity arista-hardware-utilization-alert # snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif - - name: Delete given snmp_server configuration - arista.eos.eos_snmp_server: - state: deleted +- name: Delete given snmp_server configuration + arista.eos.eos_snmp_server: + state: deleted # After State: # eos#show running-config | section snmp-server @@ -1182,10 +1185,10 @@ EXAMPLES = """ # snmp-server enable traps external-alarm arista-external-alarm-asserted-notif # snmp-server enable traps external-alarm arista-external-alarm-deasserted-notif - - name: Provide the running configuration for parsing (config to be parsed) - arista.eos.eos_snmp_server: - running_config: "{{ lookup('file', '_parsed.cfg') }}" - state: parsed +- name: Provide the running configuration for parsing (config to be parsed) + arista.eos.eos_snmp_server: + running_config: "{{ lookup('file', '_parsed.cfg') }}" + state: parsed # Module Execution: # "parsed": { @@ -1258,54 +1261,54 @@ EXAMPLES = """ # } # Using rendered: - - name: Render given snmp_server configuration - arista.eos.eos_snmp_server: - state: "rendered" - config: - communities: - - name: "comm3" - acl_v6: "list1" - view: "view1" - - name: "comm4" - acl_v4: "list3" - view: "view1" - - name: "comm5" - acl_v4: "list4" - ro: True - contact: "admin" - engineid: - remote: - host: 1.1.1.1 - id: "1234567" - groups: - - group: "group1" - version: "v1" - read: "view1" - - group: "group2" - version: "v3" - auth_privacy: "priv" - notify: "view1" - write: "view2" - hosts: - - host: "host02" - user: "user01" - udp_port: 23 - version: "2c" - - host: "host01" - user: "user01" - udp_port: 23 - version: "3 priv" - traps: - capacity: - arista_hardware_utilization_alert: True - bgp: - enabled: True - external_alarm: - arista_external_alarm_deasserted_notif: True - arista_external_alarm_asserted_notif: True - vrfs: - - vrf: "vrf01" - local_interface: "Ethernet1" +- name: Render given snmp_server configuration + arista.eos.eos_snmp_server: + state: "rendered" + config: + communities: + - name: "comm3" + acl_v6: "list1" + view: "view1" + - name: "comm4" + acl_v4: "list3" + view: "view1" + - name: "comm5" + acl_v4: "list4" + ro: true + contact: "admin" + engineid: + remote: + host: 1.1.1.1 + id: "1234567" + groups: + - group: "group1" + version: "v1" + read: "view1" + - group: "group2" + version: "v3" + auth_privacy: "priv" + notify: "view1" + write: "view2" + hosts: + - host: "host02" + user: "user01" + udp_port: 23 + version: "2c" + - host: "host01" + user: "user01" + udp_port: 23 + version: "3 priv" + traps: + capacity: + arista_hardware_utilization_alert: true + bgp: + enabled: true + external_alarm: + arista_external_alarm_deasserted_notif: true + arista_external_alarm_asserted_notif: true + vrfs: + - vrf: "vrf01" + local_interface: "Ethernet1" # Module Execution: # "rendered": [ @@ -1340,10 +1343,10 @@ EXAMPLES = """ # snmp-server enable traps capacity arista-hardware-utilization-alert # snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif - - name: Gathered the provided configuration with the exisiting running configuration - arista.eos.eos_snmp_server: - config: - state: gathered +- name: Gathered the provided configuration with the exisiting running configuration + arista.eos.eos_snmp_server: + config: + state: gathered # Module Execution: # "gathered": { @@ -1414,7 +1417,6 @@ EXAMPLES = """ # } # ] # }, - """ RETURN = """ diff --git a/ansible_collections/arista/eos/plugins/modules/eos_static_routes.py b/ansible_collections/arista/eos/plugins/modules/eos_static_routes.py index 5b291b12d..56427b6c5 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_static_routes.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_static_routes.py @@ -161,6 +161,7 @@ options: """ EXAMPLES = """ + # Using deleted # Before State: @@ -174,204 +175,83 @@ EXAMPLES = """ # ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1 # veos(config)# + - name: Delete afi arista.eos.eos_static_routes: config: - - vrf: testvrf - address_families: - - afi: ipv4 + - vrf: testvrf + address_families: + - afi: ipv4 state: deleted -# "after": [ -# { -# "address_families": [ -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5222:5::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "2222:6::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# }, -# { -# "admin_distance": 55, -# "interface": "Ethernet1" -# }, -# { -# "admin_distance": 90, -# "description": "testroute1", -# "interface": "Null0" -# } -# ] -# } -# ] -# } -# ], -# "vrf": "testvrf" -# } -# ], -# "before": [ -# { -# "address_families": [ -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5222:5::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "22.65.1.0/24", -# "next_hops": [ -# { -# "admin_distance": 90, -# "description": "testroute", -# "interface": "Null0" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "2222:6::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# }, -# { -# "admin_distance": 55, -# "interface": "Ethernet1" -# }, -# { -# "admin_distance": 90, -# "description": "testroute1", -# "interface": "Null0" -# } -# ] -# } -# ] -# } -# ], -# "vrf": "testvrf" -# } -# ], -# "changed": true, -# "commands": [ -# "no ip route vrf testvrf 22.65.1.0/24 Null0 90 name testroute" -# ], + +# Task Output +# ------------- +# before: +# - address_families: +# - afi: ipv6 +# routes: +# - dest: 5222:5::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 22.65.1.0/24 +# next_hops: +# - admin_distance: 90 +# description: testroute +# interface: Null0 +# - afi: ipv6 +# routes: +# - dest: 2222:6::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - admin_distance: 55 +# interface: Ethernet1 +# - admin_distance: 90 +# description: testroute1 +# interface: Null0 +# vrf: testvrf +# commands: +# - no ip route vrf testvrf 22.65.1.0/24 Null0 90 name testroute +# after: +# - address_families: +# - afi: ipv6 +# routes: +# - dest: 5222:5::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - address_families: +# - afi: ipv6 +# routes: +# - dest: 2222:6::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - admin_distance: 55 +# interface: Ethernet1 +# - admin_distance: 90 +# description: testroute1 +# interface: Null0 +# vrf: testvrf + # After State # ___________ - # veos(config)#show running-config | grep route # ipv6 route 5222:5::/64 Management1 4312:100::1 # ipv6 route vrf testvrf 2222:6::/64 Management1 4312:100::1 # ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55 # ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1 -# + # Using merged -# Before : [ -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "165.10.1.0/24", -# "next_hops": [ -# { -# "admin_distance": 100, -# "interface": "Ethernet1" -# } -# ] -# }, -# { -# "dest": "172.17.252.0/24", -# "next_hops": [ -# { -# "nexthop_grp": "testgroup" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5001::/64", -# "next_hops": [ -# { -# "admin_distance": 50, -# "interface": "Ethernet1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "130.1.122.0/24", -# "next_hops": [ -# { -# "interface": "Ethernet1", -# "tag": 50 -# } -# ] -# } -# ] -# } -# ], -# "vrf": "testvrf" -# } -# ] -# + # Before State # ------------- # veos(config)#show running-config | grep "route" @@ -381,99 +261,84 @@ EXAMPLES = """ # ipv6 route 5001::/64 Ethernet1 50 # veos(config)# + - name: Merge new static route configuration arista.eos.eos_static_routes: config: - - vrf: testvrf - address_families: - - afi: ipv6 - routes: - - dest: 2211::0/64 - next_hop: - - forward_router_address: 100:1::2 - interface: Ethernet1 + - vrf: testvrf + address_families: + - afi: ipv6 + routes: + - dest: 2211::0/64 + next_hop: + - forward_router_address: 100:1::2 + interface: Ethernet1 state: merged + +# Task Output +# ------------- +# before: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 165.10.1.0/24 +# next_hops: +# - admin_distance: 100 +# interface: Ethernet1 +# - dest: 172.17.252.0/24 +# next_hops: +# - nexthop_grp: testgroup +# - afi: ipv6 +# routes: +# - dest: 5001::/64 +# next_hops: +# - admin_distance: 50 +# interface: Ethernet1 +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 130.1.122.0/24 +# next_hops: +# - interface: Ethernet1 +# tag: 50 +# vrf: testvrf +# commands: +# - ipv6 route 2211::/64 Ethernet1 100:1::2 +# after: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 165.10.1.0/24 +# next_hops: +# - admin_distance: 100 +# interface: Ethernet1 +# - dest: 172.17.252.0/24 +# next_hops: +# - nexthop_grp: testgroup +# - afi: ipv6 +# routes: +# - dest: 5001::/64 +# next_hops: +# - admin_distance: 50 +# interface: Ethernet1 +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 130.1.122.0/24 +# next_hops: +# - interface: Ethernet1 +# tag: 50 +# - afi: ipv6 +# routes: +# - dest: 2211::0/64 +# next_hops: +# - aforward_router_address: "100:1::2" +# interface: Ethernet1 +# vrf: testvrf + # After State # ----------- - -#After [ -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "165.10.1.0/24", -# "next_hops": [ -# { -# "admin_distance": 100, -# "interface": "Ethernet1" -# } -# ] -# }, -# { -# "dest": "172.17.252.0/24", -# "next_hops": [ -# { -# "nexthop_grp": "testgroup" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5001::/64", -# "next_hops": [ -# { -# "admin_distance": 50, -# "interface": "Ethernet1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "130.1.122.0/24", -# "next_hops": [ -# { -# "interface": "Ethernet1", -# "tag": 50 -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "2211::0/64", -# "next_hops": [ -# { -# "aforward_router_address": 100:1::2 -# "interface": "Ethernet1" -# } -# ] -# } -# ] -# } - -# ], -# "vrf": "testvrf" -# } -# ] -# # veos(config)#show running-config | grep "route" # ip route 165.10.1.0/24 Ethernet1 100 # ip route 172.17.252.0/24 Nexthop-Group testgroup @@ -488,68 +353,6 @@ EXAMPLES = """ # Before State # ------------- - -# "before": [ -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "165.10.1.0/24", -# "next_hops": [ -# { -# "admin_distance": 100, -# "interface": "Ethernet1" -# } -# ] -# }, -# { -# "dest": "172.17.252.0/24", -# "next_hops": [ -# { -# "nexthop_grp": "testgroup" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5001::/64", -# "next_hops": [ -# { -# "admin_distance": 50, -# "interface": "Ethernet1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "130.1.122.0/24", -# "next_hops": [ -# { -# "interface": "Ethernet1", -# "tag": 50 -# } -# ] -# } -# ] -# } -# ], -# "vrf": "testvrf" -# } -# ] # veos(config)#show running-config | grep "route" # ip route 165.10.1.0/24 Ethernet1 100 # ip route 172.17.252.0/24 Nexthop-Group testgroup @@ -557,39 +360,63 @@ EXAMPLES = """ # ipv6 route 5001::/64 Ethernet1 50 # veos(config)# + - name: Overridden static route configuration arista.eos.eos_static_routes: config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.2.2.0/24 - next_hop: - - interface: Ethernet1 + - address_families: + - afi: ipv4 + routes: + - dest: 10.2.2.0/24 + next_hop: + - interface: Ethernet1 state: replaced + +# Task Output +# ------------- +# before: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 165.10.1.0/24 +# next_hops: +# - admin_distance: 100 +# interface: Ethernet1 +# - dest: 172.17.252.0/24 +# next_hops: +# - nexthop_grp: testgroup +# - afi: ipv6 +# routes: +# - dest: 5001::/64 +# next_hops: +# - admin_distance: 50 +# interface: Ethernet1 +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 130.1.122.0/24 +# next_hops: +# - interface: Ethernet1 +# tag: 50 +# vrf: testvrf +# commands: +# - no ip route 165.10.1.0/24 Ethernet1 100 +# - no ip route 172.17.252.0/24 Nexthop-Group testgroup +# - no ip route vrf testvrf 130.1.122.0/24 Ethernet1 tag 50 +# - no ipv6 route 5001::/64 Ethernet1 50 +# - ip route 10.2.2.0/24 Ethernet1 +# after: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 10.2.2.0/24 +# next_hops: +# - interface: Ethernet1 + + # After State # ----------- - -# "after": [ -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "10.2.2.0/24", -# "next_hops": [ -# { -# "interface": "Ethernet1" -# } -# ] -# } -# ] -# } -# ] -# } -# ] # veos(config)#show running-config | grep "route" # ip route 10.2.2.0/24 Ethernet1 # veos(config)# @@ -599,7 +426,6 @@ EXAMPLES = """ # Before State # ------------- - # ip route 10.2.2.0/24 Ethernet1 # ip route 10.2.2.0/24 64.1.1.1 label 17 33 # ip route 33.33.33.0/24 Nexthop-Group testgrp @@ -609,108 +435,102 @@ EXAMPLES = """ # ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55 # ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1 -# [ -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "10.2.2.0/24", -# "next_hops": [ -# { -# "interface": "Ethernet1" -# }, -# { -# "admin_distance": 33, -# "interface": "64.1.1.1", -# "mpls_label": 17 -# } -# ] -# }, -# { -# "dest": "33.33.33.0/24", -# "next_hops": [ -# { -# "nexthop_grp": "testgrp" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5222:5::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "22.65.1.0/24", -# "next_hops": [ -# { -# "admin_distance": 90, -# "description": "testroute", -# "interface": "Null0" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "2222:6::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# }, -# { -# "admin_distance": 90, -# "description": "testroute1", -# "interface": "Null0" -# } -# ] -# } -# ] -# } -# ], -# "vrf": "testvrf" -# } -# ] - name: Replace nexthop arista.eos.eos_static_routes: config: - - vrf: testvrf - address_families: - - afi: ipv6 - routes: - - dest: 2222:6::/64 - next_hops: - - admin_distance: 55 - interface: Ethernet1 + - vrf: testvrf + address_families: + - afi: ipv6 + routes: + - dest: 2222:6::/64 + next_hops: + - admin_distance: 56 + interface: Ethernet1 state: replaced + +# Task Output +# ------------- +# before: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 10.2.2.0/24 +# next_hops: +# - interface: Ethernet1 +# - admin_distance: 33 +# interface: 64.1.1.1 +# mpls_label: 17 +# - dest: 33.33.33.0/24 +# next_hops: +# - nexthop_grp: testgrp +# - afi: ipv6 +# routes: +# - dest: 5222:5::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 22.65.1.0/24 +# next_hops: +# - admin_distance: 90 +# description: testroute +# interface: Null0 +# - afi: ipv6 +# routes: +# - dest: 2222:6::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - admin_distance: 90 +# description: testroute1 +# interface: Null0 +# vrf: testvrf +# commands: +# - no ipv6 route vrf testvrf 2222:6::/64 Management1 4312:100::1 +# - no ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55 +# - no ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1 +# - ipv6 route vrf testvrf 2222:6::/64 Ethernet1 56 +# after: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 10.2.2.0/24 +# next_hops: +# - interface: Ethernet1 +# - admin_distance: 33 +# interface: 64.1.1.1 +# mpls_label: 17 +# - dest: 33.33.33.0/24 +# next_hops: +# - nexthop_grp: testgrp +# - afi: ipv6 +# routes: +# - dest: 5222:5::/64 +# next_hops: +# - forward_router_address: 4312:100::1 +# interface: Management1 +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 22.65.1.0/24 +# next_hops: +# - admin_distance: 90 +# description: testroute +# interface: Null0 +# - afi: ipv6 +# routes: +# - dest: 2222:6::/64 +# next_hops: +# - admin_distance: 56 +# interface: Ethernet1 +# vrf: testvrf + # After State # ----------- - # veos(config)#show running-config | grep route # ip route 10.2.2.0/24 Ethernet1 # ip route 10.2.2.0/24 64.1.1.1 label 17 33 @@ -719,86 +539,9 @@ EXAMPLES = """ # ipv6 route 5222:5::/64 Management1 4312:100::1 # ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55 -# "after": [ -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "10.2.2.0/24", -# "next_hops": [ -# { -# "interface": "Ethernet1" -# }, -# { -# "admin_distance": 33, -# "interface": "64.1.1.1", -# "mpls_label": 17 -# } -# ] -# }, -# { -# "dest": "33.33.33.0/24", -# "next_hops": [ -# { -# "nexthop_grp": "testgrp" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "5222:5::/64", -# "next_hops": [ -# { -# "forward_router_address": "4312:100::1", -# "interface": "Management1" -# } -# ] -# } -# ] -# } -# ] -# }, -# { -# "address_families": [ -# { -# "afi": "ipv4", -# "routes": [ -# { -# "dest": "22.65.1.0/24", -# "next_hops": [ -# { -# "admin_distance": 90, -# "description": "testroute", -# "interface": "Null0" -# } -# ] -# } -# ] -# }, -# { -# "afi": "ipv6", -# "routes": [ -# { -# "dest": "2222:6::/64", -# "next_hops": [ -# { -# "admin_distance": 55, -# "interface": "Ethernet1" -# } -# ] -# } -# ] -# } -# ], -# "vrf": "testvrf" -# } -# ] + +# Using Gathered + # Before State # ------------- @@ -812,22 +555,22 @@ EXAMPLES = """ arista.eos.eos_static_routes: state: gathered -# returns : -# arista.eos.eos_static_routes: -# config: -# - address_families: -# - afi: ipv4 -# routes: -# - dest: 165.10.1.0/24 -# next_hop: -# - forward_router_address: 10.1.1.2 -# interface: "Ethernet1" -# admin_distance: 100 -# - afi: ipv6 -# routes: -# - dest: 5001::/64 -# next_hop: -# - interface: "Ethernet1" +# Task Output +# ------------- +# gathered: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 165.10.1.0/24 +# next_hop: +# - forward_router_address: 10.1.1.2 +# interface: Ethernet1 +# admin_distance: 100 +# - afi: ipv6 +# routes: +# - dest: 5001::/64 +# next_hop: +# - interface: Ethernet1 # Using rendered @@ -848,12 +591,45 @@ EXAMPLES = """ # next_hop: # - interface: "Ethernet1" -# returns: +# Task Output +# ------------- +# rendered: +# - ip route 165.10.1.0/24 Ethernet1 10.1.1.2 100 +# - ipv6 route 5001::/64 Ethernet1 + + +# Using parsed: + + +# parse_static_routes.cfg # ip route 165.10.1.0/24 Ethernet1 10.1.1.2 100 # ipv6 route 5001::/64 Ethernet1 +# +- name: parse configs + arista.eos.eos_static_routes: + running_config: "{{ lookup('file', './parse_static_routes.cfg') }}" + state: parsed + + +# Task Output +# ------------- +# parsed: +# - address_families: +# - afi: ipv4 +# routes: +# - dest: 165.10.1.0/24 +# next_hop: +# - forward_router_address: 10.1.1.2 +# interface: Ethernet1 +# admin_distance: 100 +# - afi: ipv6 +# routes: +# - dest: 5001::/64 +# next_hop: +# - interface: Ethernet1 """ RETURN = """ before: @@ -876,40 +652,14 @@ commands: type: list sample: - ip route vrf vrf1 192.2.2.0/24 125.2.3.1 93 + - ipv6 route 5001::/64 Ethernet1 rendered: description: The set of CLI commands generated from the value in C(config) option returned: When C(state) is I(rendered) type: list sample: > - "address_families": [ - { - "afi": "ipv4", - "routes": [ - { - "dest": "192.2.2.0/24", - "next_hops": [ - { - "admin_distance": 93, - "description": null, - "forward_router_address": null, - "interface": "125.2.3.1", - "mpls_label": null, - "nexthop_grp": null, - "tag": null, - "track": null, - "vrf": null - } - ] - } - ] - } - ], - "vrf": "vrf1" - } - ], - "running_config": null, - "state": "rendered" - } + - ip route 165.10.1.0/24 Ethernet1 10.1.1.2 100 + - ipv6 route 5001::/64 Ethernet1 gathered: description: The configuration as structured data transformed for the running configuration fetched from remote host diff --git a/ansible_collections/arista/eos/plugins/modules/eos_system.py b/ansible_collections/arista/eos/plugins/modules/eos_system.py index 9fb1aca9f..b38d9772d 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_system.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_system.py @@ -96,22 +96,22 @@ EXAMPLES = """ - name: configure DNS lookup sources with VRF support arista.eos.eos_system: lookup_source: - - interface: Management1 - vrf: mgmt - - interface: Ethernet1 - vrf: myvrf + - interface: Management1 + vrf: mgmt + - interface: Ethernet1 + vrf: myvrf - name: configure name servers arista.eos.eos_system: name_servers: - - 8.8.8.8 - - 8.8.4.4 + - 8.8.8.8 + - 8.8.4.4 - name: configure name servers with VRF support arista.eos.eos_system: name_servers: - - {server: 8.8.8.8, vrf: mgmt} - - {server: 8.8.4.4, vrf: mgmt} + - {server: 8.8.8.8, vrf: mgmt} + - {server: 8.8.4.4, vrf: mgmt} """ RETURN = """ @@ -199,13 +199,11 @@ def map_obj_to_commands(want, have, module): ) values = (item["vrf"], item["interface"]) commands.append( - "no ip domain lookup vrf %s source-interface %s" - % values, + "no ip domain lookup vrf %s source-interface %s" % values, ) else: commands.append( - "no ip domain lookup source-interface %s" - % item["interface"], + "no ip domain lookup source-interface %s" % item["interface"], ) # handle lookup_source items to be added @@ -218,13 +216,11 @@ def map_obj_to_commands(want, have, module): ) values = (item["vrf"], item["interface"]) commands.append( - "ip domain lookup vrf %s source-interface %s" - % values, + "ip domain lookup vrf %s source-interface %s" % values, ) else: commands.append( - "ip domain lookup source-interface %s" - % item["interface"], + "ip domain lookup source-interface %s" % item["interface"], ) if want["name_servers"]: diff --git a/ansible_collections/arista/eos/plugins/modules/eos_user.py b/ansible_collections/arista/eos/plugins/modules/eos_user.py index 519892daf..464b8ec75 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_user.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_user.py @@ -169,13 +169,13 @@ EXAMPLES = """ - name: remove all users except admin arista.eos.eos_user: - purge: yes + purge: true - name: set multiple users to privilege level 15 arista.eos.eos_user: aggregate: - - name: netop - - name: netend + - name: netop + - name: netend privilege: 15 state: present diff --git a/ansible_collections/arista/eos/plugins/modules/eos_vlans.py b/ansible_collections/arista/eos/plugins/modules/eos_vlans.py index 7c834a3ac..a038722ba 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_vlans.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_vlans.py @@ -104,7 +104,7 @@ EXAMPLES = """ - name: Delete attributes of the given VLANs. arista.eos.eos_vlans: config: - - vlan_id: 20 + - vlan_id: 20 state: deleted # After state: @@ -130,8 +130,8 @@ EXAMPLES = """ - name: Merge given VLAN attributes with device configuration arista.eos.eos_vlans: config: - - vlan_id: 20 - state: suspend + - vlan_id: 20 + state: suspend state: merged # After state: @@ -161,8 +161,8 @@ EXAMPLES = """ - name: Override device configuration of all VLANs with provided configuration arista.eos.eos_vlans: config: - - vlan_id: 20 - state: suspend + - vlan_id: 20 + state: suspend state: overridden # After state: @@ -188,8 +188,8 @@ EXAMPLES = """ - name: Replace all attributes of specified VLANs with provided configuration arista.eos.eos_vlans: config: - - vlan_id: 20 - state: suspend + - vlan_id: 20 + state: suspend state: replaced # After state: @@ -230,10 +230,10 @@ EXAMPLES = """ - name: Use Rendered to convert the structured data to native config arista.eos.eos_vlans: config: - - vlan_id: 10 - name: ten - - vlan_id: 20 - state: suspend + - vlan_id: 10 + name: ten + - vlan_id: 20 + state: suspend state: rendered # Output: @@ -265,7 +265,6 @@ EXAMPLES = """ # name: ten # - vlan_id: 20 # state: suspend - """ RETURN = """ before: @@ -295,9 +294,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.arista.eos.plugins.module_utils.network.eos.argspec.vlans.vlans import ( VlansArgs, ) -from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.vlans.vlans import ( - Vlans, -) +from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.vlans.vlans import Vlans def main(): diff --git a/ansible_collections/arista/eos/plugins/modules/eos_vrf.py b/ansible_collections/arista/eos/plugins/modules/eos_vrf.py index 705796512..556ef3233 100644 --- a/ansible_collections/arista/eos/plugins/modules/eos_vrf.py +++ b/ansible_collections/arista/eos/plugins/modules/eos_vrf.py @@ -127,7 +127,7 @@ EXAMPLES = """ name: test rd: 1:200 interfaces: - - Ethernet2 + - Ethernet2 state: present - name: Delete VRFs @@ -138,20 +138,20 @@ EXAMPLES = """ - name: Create aggregate of VRFs with purge arista.eos.eos_vrf: aggregate: - - name: test4 - rd: 1:204 - - name: test5 - rd: 1:205 + - name: test4 + rd: 1:204 + - name: test5 + rd: 1:205 state: present - purge: yes + purge: true - name: Delete aggregate of VRFs arista.eos.eos_vrf: aggregate: - - name: test2 - - name: test3 - - name: test4 - - name: test5 + - name: test2 + - name: test3 + - name: test4 + - name: test5 state: absent """ @@ -226,8 +226,7 @@ def map_obj_to_commands(updates, module): commands.append("vrf %s" % w["name"]) elif set(w["interfaces"]) != obj_in_have["interfaces"]: missing_interfaces = list( - set(w["interfaces"]) - - set(obj_in_have["interfaces"]), + set(w["interfaces"]) - set(obj_in_have["interfaces"]), ) for i in missing_interfaces: @@ -298,9 +297,7 @@ def map_params_to_obj(module): if item.get("interfaces"): item["interfaces"] = [ - intf.replace(" ", "").lower() - for intf in item.get("interfaces") - if intf + intf.replace(" ", "").lower() for intf in item.get("interfaces") if intf ] if item.get("associated_interfaces"): @@ -318,14 +315,12 @@ def map_params_to_obj(module): "state": module.params["state"], "rd": module.params["rd"], "interfaces": [ - intf.replace(" ", "").lower() - for intf in module.params["interfaces"] + intf.replace(" ", "").lower() for intf in module.params["interfaces"] ] if module.params["interfaces"] else [], "associated_interfaces": [ - intf.replace(" ", "").lower() - for intf in module.params["associated_interfaces"] + intf.replace(" ", "").lower() for intf in module.params["associated_interfaces"] ] if module.params["associated_interfaces"] else [], @@ -357,8 +352,7 @@ def check_declarative_intent_params(want, module, result): interfaces = obj_in_have.get("interfaces") if interfaces is not None and i not in interfaces: module.fail_json( - msg="Interface %s not configured on vrf %s" - % (i, w["name"]), + msg="Interface %s not configured on vrf %s" % (i, w["name"]), ) diff --git a/ansible_collections/arista/eos/plugins/terminal/eos.py b/ansible_collections/arista/eos/plugins/terminal/eos.py index 8ea27e296..e6ceb5762 100644 --- a/ansible_collections/arista/eos/plugins/terminal/eos.py +++ b/ansible_collections/arista/eos/plugins/terminal/eos.py @@ -27,9 +27,7 @@ import re from ansible.errors import AnsibleConnectionFailure from ansible.module_utils._text import to_bytes, to_text -from ansible_collections.ansible.netcommon.plugins.plugin_utils.terminal_base import ( - TerminalBase, -) +from ansible_collections.ansible.netcommon.plugins.plugin_utils.terminal_base import TerminalBase class TerminalModule(TerminalBase): @@ -89,8 +87,7 @@ class TerminalModule(TerminalBase): prompt = self._get_prompt() if prompt is None or not prompt.endswith(b"#"): raise AnsibleConnectionFailure( - "failed to elevate privilege to enable mode still at prompt [%s]" - % prompt, + "failed to elevate privilege to enable mode still at prompt [%s]" % prompt, ) except AnsibleConnectionFailure as e: prompt = self._get_prompt() |