From 6a161ed8f263e152ebfd227e669a51773de5a028 Mon Sep 17 00:00:00 2001 From: omnom62 Date: Sun, 31 May 2026 07:25:03 +1000 Subject: updated tests --- README.md | 25 - docs/vyos.rest.vyos_bgp_address_family_module.rst | 780 ------------- docs/vyos.rest.vyos_bgp_global_module.rst | 573 ---------- docs/vyos.rest.vyos_config_file_module.rst | 234 ---- docs/vyos.rest.vyos_configure_module.rst | 290 ----- docs/vyos.rest.vyos_facts_module.rst | 185 --- docs/vyos.rest.vyos_firewall_global_module.rst | 752 ------------ docs/vyos.rest.vyos_firewall_interfaces_module.rst | 345 ------ docs/vyos.rest.vyos_firewall_rules_module.rst | 822 ------------- docs/vyos.rest.vyos_generate_module.rst | 191 ---- docs/vyos.rest.vyos_image_module.rst | 227 ---- docs/vyos.rest.vyos_interfaces_module.rst | 452 -------- docs/vyos.rest.vyos_l3_interfaces_module.rst | 470 -------- docs/vyos.rest.vyos_lag_interfaces_module.rst | 393 ------- docs/vyos.rest.vyos_lldp_interfaces_module.rst | 389 ------- docs/vyos.rest.vyos_ospf_interfaces_module.rst | 570 ---------- docs/vyos.rest.vyos_ospfv2_module.rst | 1202 -------------------- docs/vyos.rest.vyos_ospfv3_module.rst | 490 -------- docs/vyos.rest.vyos_ping_module.rst | 332 ------ docs/vyos.rest.vyos_prefix_lists_module.rst | 454 -------- docs/vyos.rest.vyos_reset_module.rst | 191 ---- docs/vyos.rest.vyos_show_module.rst | 210 ---- docs/vyos.rest.vyos_static_routes_module.rst | 505 -------- docs/vyos.rest.vyos_system_module.rst | 244 ---- docs/vyos.rest.vyos_user_module.rst | 564 --------- docs/vyos.rest.vyos_vlan_module.rst | 360 ------ plugins/httpapi/vyos.py | 8 +- plugins/module_utils/vyos.py | 113 +- plugins/module_utils/vyos_rest.py | 48 +- plugins/modules/vyos_ntp_global.py | 13 +- .../targets/vyos_banner/defaults/main.yaml | 3 + .../targets/vyos_banner/tasks/httpapi.yaml | 21 + .../targets/vyos_banner/tasks/main.yaml | 5 + .../tests/httpapi/_populate_config.yaml | 11 + .../vyos_banner/tests/httpapi/_remove_config.yaml | 5 + .../targets/vyos_banner/tests/httpapi/deleted.yaml | 28 + .../vyos_banner/tests/httpapi/gathered.yaml | 20 + .../targets/vyos_banner/tests/httpapi/merged.yaml | 32 + .../integration/targets/vyos_banner/vars/main.yaml | 2 + .../targets/vyos_hostname/defaults/main.yaml | 3 + .../targets/vyos_hostname/tasks/httpapi.yaml | 21 + .../targets/vyos_hostname/tasks/main.yaml | 5 + .../tests/httpapi/_populate_config.yaml | 6 + .../tests/httpapi/_remove_config.yaml | 7 + .../vyos_hostname/tests/httpapi/gathered.yaml | 19 + .../vyos_hostname/tests/httpapi/merged.yaml | 30 + .../vyos_hostname/tests/httpapi/replaced.yaml | 30 + .../targets/vyos_hostname/vars/main.yaml | 2 + .../targets/vyos_lldp_global/defaults/main.yaml | 3 + .../targets/vyos_lldp_global/tasks/httpapi.yaml | 21 + .../targets/vyos_lldp_global/tasks/main.yaml | 5 + .../tests/httpapi/_populate_config.yaml | 13 + .../tests/httpapi/_remove_config.yaml | 5 + .../vyos_lldp_global/tests/httpapi/deleted.yaml | 28 + .../vyos_lldp_global/tests/httpapi/gathered.yaml | 20 + .../vyos_lldp_global/tests/httpapi/merged.yaml | 36 + .../vyos_lldp_global/tests/httpapi/replaced.yaml | 35 + .../targets/vyos_lldp_global/vars/main.yaml | 2 + .../targets/vyos_logging_global/defaults/main.yaml | 3 + .../targets/vyos_logging_global/tasks/httpapi.yaml | 21 + .../targets/vyos_logging_global/tasks/main.yaml | 136 +-- .../tests/httpapi/_populate_config.yaml | 21 + .../tests/httpapi/_remove_config.yaml | 5 + .../vyos_logging_global/tests/httpapi/deleted.yaml | 28 + .../tests/httpapi/gathered.yaml | 20 + .../vyos_logging_global/tests/httpapi/merged.yaml | 44 + .../tests/httpapi/replaced.yaml | 33 + .../targets/vyos_logging_global/vars/main.yaml | 2 + .../targets/vyos_prefix_lists.old/aliases | 1 + .../targets/vyos_prefix_lists.old/tasks/main.yaml | 144 +++ .../targets/vyos_prefix_lists/defaults/main.yaml | 3 + .../targets/vyos_prefix_lists/tasks/httpapi.yaml | 21 + .../targets/vyos_prefix_lists/tasks/main.yaml | 147 +-- .../tests/httpapi/_populate_config.yaml | 28 + .../tests/httpapi/_remove_config.yaml | 5 + .../vyos_prefix_lists/tests/httpapi/deleted.yaml | 28 + .../vyos_prefix_lists/tests/httpapi/gathered.yaml | 20 + .../vyos_prefix_lists/tests/httpapi/merged.yaml | 42 + .../vyos_prefix_lists/tests/httpapi/replaced.yaml | 37 + .../targets/vyos_prefix_lists/vars/main.yaml | 2 + .../targets/vyos_route_maps/defaults/main.yaml | 3 + .../targets/vyos_route_maps/tasks/httpapi.yaml | 21 + .../targets/vyos_route_maps/tasks/main.yaml | 136 +-- .../tests/httpapi/_populate_config.yaml | 17 + .../tests/httpapi/_remove_config.yaml | 5 + .../vyos_route_maps/tests/httpapi/deleted.yaml | 28 + .../vyos_route_maps/tests/httpapi/gathered.yaml | 20 + .../vyos_route_maps/tests/httpapi/merged.yaml | 40 + .../vyos_route_maps/tests/httpapi/replaced.yaml | 36 + .../targets/vyos_route_maps/vars/main.yaml | 2 + .../targets/vyos_snmp_server/defaults/main.yaml | 3 + .../targets/vyos_snmp_server/tasks/httpapi.yaml | 21 + .../targets/vyos_snmp_server/tasks/main.yaml | 5 + .../tests/httpapi/_populate_config.yaml | 15 + .../tests/httpapi/_remove_config.yaml | 5 + .../vyos_snmp_server/tests/httpapi/deleted.yaml | 28 + .../vyos_snmp_server/tests/httpapi/gathered.yaml | 20 + .../vyos_snmp_server/tests/httpapi/merged.yaml | 38 + .../vyos_snmp_server/tests/httpapi/replaced.yaml | 34 + .../targets/vyos_snmp_server/vars/main.yaml | 2 + 100 files changed, 1374 insertions(+), 11746 deletions(-) delete mode 100644 docs/vyos.rest.vyos_bgp_address_family_module.rst delete mode 100644 docs/vyos.rest.vyos_bgp_global_module.rst delete mode 100644 docs/vyos.rest.vyos_config_file_module.rst delete mode 100644 docs/vyos.rest.vyos_configure_module.rst delete mode 100644 docs/vyos.rest.vyos_facts_module.rst delete mode 100644 docs/vyos.rest.vyos_firewall_global_module.rst delete mode 100644 docs/vyos.rest.vyos_firewall_interfaces_module.rst delete mode 100644 docs/vyos.rest.vyos_firewall_rules_module.rst delete mode 100644 docs/vyos.rest.vyos_generate_module.rst delete mode 100644 docs/vyos.rest.vyos_image_module.rst delete mode 100644 docs/vyos.rest.vyos_interfaces_module.rst delete mode 100644 docs/vyos.rest.vyos_l3_interfaces_module.rst delete mode 100644 docs/vyos.rest.vyos_lag_interfaces_module.rst delete mode 100644 docs/vyos.rest.vyos_lldp_interfaces_module.rst delete mode 100644 docs/vyos.rest.vyos_ospf_interfaces_module.rst delete mode 100644 docs/vyos.rest.vyos_ospfv2_module.rst delete mode 100644 docs/vyos.rest.vyos_ospfv3_module.rst delete mode 100644 docs/vyos.rest.vyos_ping_module.rst delete mode 100644 docs/vyos.rest.vyos_prefix_lists_module.rst delete mode 100644 docs/vyos.rest.vyos_reset_module.rst delete mode 100644 docs/vyos.rest.vyos_show_module.rst delete mode 100644 docs/vyos.rest.vyos_static_routes_module.rst delete mode 100644 docs/vyos.rest.vyos_system_module.rst delete mode 100644 docs/vyos.rest.vyos_user_module.rst delete mode 100644 docs/vyos.rest.vyos_vlan_module.rst create mode 100644 tests/integration/targets/vyos_banner/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_banner/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_banner/tasks/main.yaml create mode 100644 tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml create mode 100644 tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_banner/vars/main.yaml create mode 100644 tests/integration/targets/vyos_hostname/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_hostname/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_hostname/tasks/main.yaml create mode 100644 tests/integration/targets/vyos_hostname/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_hostname/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_hostname/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_hostname/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_hostname/tests/httpapi/replaced.yaml create mode 100644 tests/integration/targets/vyos_hostname/vars/main.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tasks/main.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tests/httpapi/deleted.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/tests/httpapi/replaced.yaml create mode 100644 tests/integration/targets/vyos_lldp_global/vars/main.yaml create mode 100644 tests/integration/targets/vyos_logging_global/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tests/httpapi/deleted.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_logging_global/tests/httpapi/replaced.yaml create mode 100644 tests/integration/targets/vyos_logging_global/vars/main.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists.old/aliases create mode 100644 tests/integration/targets/vyos_prefix_lists.old/tasks/main.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.yaml create mode 100644 tests/integration/targets/vyos_prefix_lists/vars/main.yaml create mode 100644 tests/integration/targets/vyos_route_maps/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tests/httpapi/deleted.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_route_maps/tests/httpapi/replaced.yaml create mode 100644 tests/integration/targets/vyos_route_maps/vars/main.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/defaults/main.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tasks/main.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tests/httpapi/_populate_config.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tests/httpapi/_remove_config.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tests/httpapi/merged.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml create mode 100644 tests/integration/targets/vyos_snmp_server/vars/main.yaml diff --git a/README.md b/README.md index ccc953b..2430ebb 100644 --- a/README.md +++ b/README.md @@ -12,37 +12,12 @@ Name | Description Name | Description --- | --- [vyos.rest.vyos_banner](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_banner_module.rst)|Manage multiline banners on VyOS devices via REST API. -[vyos.rest.vyos_bgp_address_family](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_bgp_address_family_module.rst)|BGP Address Family resource module via REST API. -[vyos.rest.vyos_bgp_global](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_bgp_global_module.rst)|Manage BGP global configuration on VyOS via the REST API. -[vyos.rest.vyos_config_file](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_config_file_module.rst)|Save or load VyOS configuration files via the REST API. -[vyos.rest.vyos_configure](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_configure_module.rst)|Manage VyOS device configuration via the REST API. -[vyos.rest.vyos_facts](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_facts_module.rst)|Get facts about VyOS devices via REST API. -[vyos.rest.vyos_firewall_global](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_firewall_global_module.rst)|Firewall global resource module via REST API. -[vyos.rest.vyos_firewall_interfaces](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_firewall_interfaces_module.rst)|Firewall interfaces resource module via REST API. -[vyos.rest.vyos_firewall_rules](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_firewall_rules_module.rst)|Manage firewall rules on VyOS via the REST API. -[vyos.rest.vyos_generate](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_generate_module.rst)|Execute generate commands on a VyOS device via REST API. [vyos.rest.vyos_hostname](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_hostname_module.rst)|Manage the system hostname on a VyOS device via the REST API. -[vyos.rest.vyos_image](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_image_module.rst)|Manage VyOS system images via the REST API. -[vyos.rest.vyos_interfaces](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_interfaces_module.rst)|Manage interface attributes on a VyOS device via the REST API. -[vyos.rest.vyos_l3_interfaces](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_l3_interfaces_module.rst)|Manage L3 interface attributes on VyOS via the REST API. -[vyos.rest.vyos_lag_interfaces](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_lag_interfaces_module.rst)|LAG/bonding interfaces resource module via REST API. [vyos.rest.vyos_lldp_global](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_lldp_global_module.rst)|Manage LLDP global configuration on VyOS via REST API. -[vyos.rest.vyos_lldp_interfaces](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_lldp_interfaces_module.rst)|LLDP interfaces resource module via REST API. [vyos.rest.vyos_logging_global](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_logging_global_module.rst)|Manage syslog configuration on VyOS devices using REST API [vyos.rest.vyos_ntp_global](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_ntp_global_module.rst)|Manage NTP configuration on VyOS devices using REST API -[vyos.rest.vyos_ospf_interfaces](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_ospf_interfaces_module.rst)|OSPF Interfaces Resource Module via REST API. -[vyos.rest.vyos_ospfv2](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_ospfv2_module.rst)|OSPFv2 resource module via REST API. -[vyos.rest.vyos_ospfv3](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_ospfv3_module.rst)|OSPFv3 resource module via REST API. -[vyos.rest.vyos_ping](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_ping_module.rst)|Test reachability using ping via VyOS REST API. -[vyos.rest.vyos_prefix_lists](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_prefix_lists_module.rst)|Manage prefix-list configuration on VyOS devices using REST API -[vyos.rest.vyos_reset](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_reset_module.rst)|Execute reset commands on a VyOS device via REST API. [vyos.rest.vyos_route_maps](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_route_maps_module.rst)|Manage route-map configuration on VyOS devices using REST API -[vyos.rest.vyos_show](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_show_module.rst)|Execute op-mode show commands on a VyOS device via REST API. [vyos.rest.vyos_snmp_server](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_snmp_server_module.rst)|Manage SNMP server configuration on VyOS devices using REST API -[vyos.rest.vyos_static_routes](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_static_routes_module.rst)|Manage static routes on VyOS via the REST API. -[vyos.rest.vyos_system](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_system_module.rst)|Manage system settings on VyOS via the REST API. -[vyos.rest.vyos_user](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_user_module.rst)|Manage local users on VyOS via the REST API. -[vyos.rest.vyos_vlan](https://github.com/vyos/vyos.rest/blob/main/docs/vyos.rest.vyos_vlan_module.rst)|Manage VLANs on VyOS network devices via REST API. diff --git a/docs/vyos.rest.vyos_bgp_address_family_module.rst b/docs/vyos.rest.vyos_bgp_address_family_module.rst deleted file mode 100644 index 8718293..0000000 --- a/docs/vyos.rest.vyos_bgp_address_family_module.rst +++ /dev/null @@ -1,780 +0,0 @@ -.. _vyos.rest.vyos_bgp_address_family_module: - - -********************************* -vyos.rest.vyos_bgp_address_family -********************************* - -**BGP Address Family resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages BGP address-family configuration (networks, redistribute, aggregate-address, per-neighbor AFI settings) via the VyOS HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- dictionary -
-
- -
BGP address-family configuration.
-
-
- address_family - -
- list - / elements=dictionary -
-
- -
Global address-family parameters.
-
-
- afi - -
- string -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Address family (ipv4 or ipv6).
-
-
- aggregate_address - -
- list - / elements=dictionary -
-
- -
List of BGP aggregate networks.
-
-
- as_set - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- prefix - -
- string -
-
- -
-
- summary_only - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- networks - -
- list - / elements=dictionary -
-
- -
Networks to originate.
-
-
- backdoor - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- path_limit - -
- integer -
-
- -
-
- prefix - -
- string -
-
- -
-
- route_map - -
- string -
-
- -
-
- redistribute - -
- list - / elements=dictionary -
-
- -
Protocols to redistribute.
-
-
- metric - -
- integer -
-
- -
-
- protocol - -
- string -
-
-
    Choices: -
  • connected
  • -
  • kernel
  • -
  • ospf
  • -
  • ospfv3
  • -
  • rip
  • -
  • ripng
  • -
  • static
  • -
-
-
-
- route_map - -
- string -
-
- -
-
- table - -
- string -
-
- -
-
- as_number - -
- integer - / required -
-
- -
Local AS number.
-
-
- neighbors - -
- list - / elements=dictionary -
-
- -
Per-neighbor address-family settings.
-
-
- address_family - -
- list - / elements=dictionary -
-
- -
-
- afi - -
- string -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
-
- allowas_in - -
- integer -
-
- -
-
- as_override - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- nexthop_self - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- remove_private_as - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- route_map - -
- dictionary -
-
- -
Route-map settings.
-
-
- export_map - -
- string -
-
- -
-
- import_map - -
- string -
-
- -
-
- soft_reconfiguration - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- neighbor_address - -
- string -
-
- -
Neighbor IP.
-
-
- hostname - -
- string - / required -
-
- -
Device IP or FQDN.
-
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • deleted
  • -
  • gathered
  • -
-
-
Desired state.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- dictionary -
-
when changed -
Config after module ran.
-
-
-
- before - -
- dictionary -
-
always -
Config before module ran.
-
-
-
- commands - -
- list -
-
always -
Commands issued.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_bgp_global_module.rst b/docs/vyos.rest.vyos_bgp_global_module.rst deleted file mode 100644 index 4c91b4a..0000000 --- a/docs/vyos.rest.vyos_bgp_global_module.rst +++ /dev/null @@ -1,573 +0,0 @@ -.. _vyos.rest.vyos_bgp_global_module: - - -************************* -vyos.rest.vyos_bgp_global -************************* - -**Manage BGP global configuration on VyOS via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages BGP global parameters on VyOS devices using the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_bgp_global`` but uses the HTTP API. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- config - -
- dictionary -
-
- -
BGP global configuration.
-
-
- as_number - -
- integer - / required -
-
- -
Local BGP AS number.
-
-
- neighbors - -
- list - / elements=dictionary -
-
- -
List of BGP neighbor configurations.
-
-
- description - -
- string -
-
- -
Neighbor description.
-
-
- ebgp_multihop - -
- integer -
-
- -
Maximum hops for eBGP sessions.
-
-
- neighbor - -
- string - / required -
-
- -
Neighbor IP address.
-
-
- password - -
- string -
-
- -
MD5 authentication password.
-
-
- remote_as - -
- integer -
-
- -
Neighbor's AS number.
-
-
- shutdown - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
Whether to administratively shut down the neighbor.
-
-
- update_source - -
- string -
-
- -
Local interface or address for BGP session.
-
-
- networks - -
- list - / elements=dictionary -
-
- -
List of networks to originate.
-
-
- prefix - -
- string - / required -
-
- -
Network prefix to advertise.
-
-
- route_map - -
- string -
-
- -
Route map to apply.
-
-
- redistribute - -
- list - / elements=dictionary -
-
- -
List of protocols to redistribute into BGP.
-
-
- metric - -
- integer -
-
- -
Metric for redistributed routes.
-
-
- protocol - -
- string - / required -
-
-
    Choices: -
  • connected
  • -
  • kernel
  • -
  • ospf
  • -
  • ospfv3
  • -
  • rip
  • -
  • ripng
  • -
  • static
  • -
-
-
Protocol to redistribute.
-
-
- route_map - -
- string -
-
- -
Route map to apply.
-
-
- router_id - -
- string -
-
- -
BGP router ID (IPv4 address).
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • deleted
  • -
  • gathered
  • -
-
-
{'merged': 'Merge BGP config with existing.'}
-
{'replaced': 'Replace entire BGP config.'}
-
{'deleted': 'Remove BGP configuration.'}
-
{'gathered': 'Read BGP config from device.'}
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - -See Also --------- - -.. seealso:: - - :ref:`vyos.vyos.vyos_bgp_global_module` - The official documentation on the **vyos.vyos.vyos_bgp_global** module. - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- dictionary -
-
when changed -
BGP config after the module ran.
-
-
-
- before - -
- dictionary -
-
always -
BGP config before the module ran.
-
-
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-
- gathered - -
- dictionary -
-
when state is gathered -
BGP config read from device (state=gathered).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_config_file_module.rst b/docs/vyos.rest.vyos_config_file_module.rst deleted file mode 100644 index a1f0dba..0000000 --- a/docs/vyos.rest.vyos_config_file_module.rst +++ /dev/null @@ -1,234 +0,0 @@ -.. _vyos.rest.vyos_config_file_module: - - -************************** -vyos.rest.vyos_config_file -************************** - -**Save or load VyOS configuration files via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages VyOS configuration persistence via the HTTPS REST API (``/config-file`` endpoint). -- Use *op=save* to write the running configuration to a file. -- Use *op=load* to load a configuration from a file and apply it. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- file - -
- string -
-
- -
Path on the VyOS device for save/load target.
-
If omitted for save, the device uses its default boot config path.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- op - -
- string -
-
-
    Choices: -
  • save ←
  • -
  • load
  • -
-
-
save - Save the running configuration to file or the default /config/config.boot.
-
load - Load and commit the configuration from file.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - - -Examples --------- - -.. code-block:: yaml - - - name: Save running config (default location) - vyos.rest.vyos_config_file: - hostname: 192.168.1.1 - api_key: MY-KEY - op: save - - - name: Save running config to a custom file - vyos.rest.vyos_config_file: - hostname: 192.168.1.1 - api_key: MY-KEY - op: save - file: /config/backups/config.boot.bak - - - name: Load a configuration from file - vyos.rest.vyos_config_file: - hostname: 192.168.1.1 - api_key: MY-KEY - op: load - file: /config/backups/config.boot.bak - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- output - -
- string -
-
success -
Text output from the config-file operation.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_configure_module.rst b/docs/vyos.rest.vyos_configure_module.rst deleted file mode 100644 index e896fcc..0000000 --- a/docs/vyos.rest.vyos_configure_module.rst +++ /dev/null @@ -1,290 +0,0 @@ -.. _vyos.rest.vyos_configure_module: - - -************************ -vyos.rest.vyos_configure -************************ - -**Manage VyOS device configuration via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Sends one or more ``set`` or ``delete`` configuration commands to a VyOS device via its HTTPS REST API (``/configure`` endpoint). -- Each command in *commands* is executed and committed atomically. -- Supports Ansible check-mode (``check_mode=yes``) - no changes are applied. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- commands - -
- list - / elements=raw - / required -
-
- -
List of VyOS configuration commands.
-
Each item may be either a plain string in VyOS CLI syntax (e.g. set interfaces ethernet eth0 description 'WAN') or a dict with keys op, path, and optionally value.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- save - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Whether to save the configuration to disk after a successful commit.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - -Notes ------ - -.. note:: - - The VyOS HTTP API must be enabled on the device before using this module. - - Enable with ``set service https api keys id key `` and ``set service https api rest``, then ``commit && save``. - - Tested against VyOS 1.3 and 1.4. - - -See Also --------- - -.. seealso:: - - :ref:`vyos.rest.vyos_retrieve_module` - The official documentation on the **vyos.rest.vyos_retrieve** module. - :ref:`vyos.rest.vyos_show_module` - The official documentation on the **vyos.rest.vyos_show** module. - - -Examples --------- - -.. code-block:: yaml - - - name: Set hostname via REST API - vyos.rest.vyos_configure: - hostname: 192.168.1.1 - api_key: MY-KEY - commands: - - "set system host-name vyos-router" - - - name: Configure an interface description and address - vyos.rest.vyos_configure: - hostname: 192.168.1.1 - api_key: MY-KEY - commands: - - "set interfaces ethernet eth1 description 'UPLINK'" - - "set interfaces ethernet eth1 address 10.0.0.1/30" - save: true - - - name: Delete a static route using dict syntax - vyos.rest.vyos_configure: - hostname: 192.168.1.1 - api_key: MY-KEY - commands: - - op: delete - path: ["protocols", "static", "route", "192.0.2.0/24"] - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- changed - -
- boolean -
-
always -
Whether the device configuration was modified.
-
-
-
- commands_sent - -
- list - / elements=dictionary -
-
always -
The list of commands dispatched to the API.
-
-
Sample:
-
[{'op': 'set', 'path': ['system', 'host-name'], 'value': 'vyos-router'}]
-
-
- saved - -
- boolean -
-
always -
Whether the configuration was saved to disk.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_facts_module.rst b/docs/vyos.rest.vyos_facts_module.rst deleted file mode 100644 index 23c385f..0000000 --- a/docs/vyos.rest.vyos_facts_module.rst +++ /dev/null @@ -1,185 +0,0 @@ -.. _vyos.rest.vyos_facts_module: - - -******************** -vyos.rest.vyos_facts -******************** - -**Get facts about VyOS devices via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Collects facts from VyOS devices using the HTTPS REST API. -- Returns system info and optionally per-resource configuration facts. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- available_network_resources - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
When true, return a list of available resource names.
-
-
- gather_network_resources - -
- list - / elements=string -
-
- -
Which network resource facts to gather.
-
-
- gather_subset - -
- list - / elements=string -
-
- Default:
["min"]
-
-
Restrict facts to a subset. Use all, default, config, or min.
-
-
- hostname - -
- string - / required -
-
- -
Device IP or FQDN.
-
-
- port - -
- integer -
-
- Default:
443
-
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_firewall_global_module.rst b/docs/vyos.rest.vyos_firewall_global_module.rst deleted file mode 100644 index 581e912..0000000 --- a/docs/vyos.rest.vyos_firewall_global_module.rst +++ /dev/null @@ -1,752 +0,0 @@ -.. _vyos.rest.vyos_firewall_global_module: - - -****************************** -vyos.rest.vyos_firewall_global -****************************** - -**Firewall global resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages global VyOS firewall parameters (groups, ICMP redirect policy, source validation, ping policy) via the HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- dictionary -
-
- -
Global firewall configuration.
-
-
- config_trap - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
SNMP trap on firewall config changes.
-
-
- group - -
- dictionary -
-
- -
Firewall object groups.
-
-
- address_group - -
- list - / elements=dictionary -
-
- -
-
- afi - -
- string -
-
-
    Choices: -
  • ipv4 ←
  • -
  • ipv6
  • -
-
-
-
- description - -
- string -
-
- -
-
- members - -
- list - / elements=dictionary -
-
- -
List of IP addresses or ranges.
-
-
- address - -
- string -
-
- -
-
- name - -
- string - / required -
-
- -
-
- network_group - -
- list - / elements=dictionary -
-
- -
-
- description - -
- string -
-
- -
-
- members - -
- list - / elements=dictionary -
-
- -
List of network prefixes.
-
-
- address - -
- string -
-
- -
-
- name - -
- string - / required -
-
- -
-
- port_group - -
- list - / elements=dictionary -
-
- -
-
- description - -
- string -
-
- -
-
- members - -
- list - / elements=dictionary -
-
- -
List of port numbers or ranges.
-
-
- port - -
- string -
-
- -
-
- name - -
- string - / required -
-
- -
-
- ping - -
- dictionary -
-
- -
ICMP echo policy.
-
-
- all - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- broadcast - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- route_redirects - -
- list - / elements=dictionary -
-
- -
ICMP redirect / source-route options per AFI.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
-
- icmp_redirects - -
- dictionary -
-
- -
-
- receive - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- send - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- ip_src_route - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- validation - -
- string -
-
-
    Choices: -
  • strict
  • -
  • loose
  • -
  • disable
  • -
-
-
Source-validation policy (strict/loose/disable).
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • deleted
  • -
  • gathered
  • -
-
-
Desired state.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- dictionary -
-
when changed -
-
-
- before - -
- dictionary -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_firewall_interfaces_module.rst b/docs/vyos.rest.vyos_firewall_interfaces_module.rst deleted file mode 100644 index e1efc1d..0000000 --- a/docs/vyos.rest.vyos_firewall_interfaces_module.rst +++ /dev/null @@ -1,345 +0,0 @@ -.. _vyos.rest.vyos_firewall_interfaces_module: - - -********************************** -vyos.rest.vyos_firewall_interfaces -********************************** - -**Firewall interfaces resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Attaches or detaches named firewall rule sets to/from interface directions (in/out/local) using the VyOS HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- list - / elements=dictionary -
-
- -
List of interface firewall attachment configurations.
-
-
- access_rules - -
- list - / elements=dictionary -
-
- -
Firewall rule sets per AFI.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Address family.
-
-
- rules - -
- list - / elements=dictionary -
-
- -
Rule sets and directions.
-
-
- direction - -
- string - / required -
-
-
    Choices: -
  • in
  • -
  • local
  • -
  • out
  • -
-
-
Traffic direction.
-
-
- name - -
- string -
-
- -
Rule set name.
-
-
- name - -
- string - / required -
-
- -
Interface name.
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
Desired state.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
-
-
- before - -
- list -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_firewall_rules_module.rst b/docs/vyos.rest.vyos_firewall_rules_module.rst deleted file mode 100644 index b95891a..0000000 --- a/docs/vyos.rest.vyos_firewall_rules_module.rst +++ /dev/null @@ -1,822 +0,0 @@ -.. _vyos.rest.vyos_firewall_rules_module: - - -***************************** -vyos.rest.vyos_firewall_rules -***************************** - -**Manage firewall rules on VyOS via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages VyOS firewall rule sets and individual rules using the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_firewall_rules`` but uses the HTTP API. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- config - -
- list - / elements=dictionary -
-
- -
List of firewall rule set configurations.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Address family.
-
-
- rule_sets - -
- list - / elements=dictionary -
-
- -
List of named rule sets.
-
-
- default_action - -
- string -
-
-
    Choices: -
  • drop ←
  • -
  • reject
  • -
  • accept
  • -
-
-
Default action for unmatched traffic.
-
-
- description - -
- string -
-
- -
Rule set description.
-
-
- name - -
- string - / required -
-
- -
Rule set name.
-
-
- rules - -
- list - / elements=dictionary -
-
- -
List of firewall rules.
-
-
- action - -
- string -
-
-
    Choices: -
  • drop
  • -
  • reject
  • -
  • accept
  • -
  • inspect
  • -
-
-
Rule action.
-
-
- description - -
- string -
-
- -
Rule description.
-
-
- destination - -
- dictionary -
-
- -
Destination match criteria.
-
-
- address - -
- string -
-
- -
Destination IP address or network.
-
-
- group - -
- dictionary -
-
- -
Address or network group.
-
-
- address_group - -
- string -
-
- -
-
- network_group - -
- string -
-
- -
-
- port - -
- string -
-
- -
Destination port or port range.
-
-
- enabled - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Whether the rule is active.
-
-
- number - -
- integer - / required -
-
- -
Rule number (1-999999).
-
-
- protocol - -
- string -
-
- -
Protocol (e.g. tcp, udp, icmp, all).
-
-
- source - -
- dictionary -
-
- -
Source match criteria.
-
-
- address - -
- string -
-
- -
Source IP address or network.
-
-
- group - -
- dictionary -
-
- -
Address or network group.
-
-
- address_group - -
- string -
-
- -
-
- network_group - -
- string -
-
- -
-
- port - -
- string -
-
- -
Source port or port range.
-
-
- state - -
- dictionary -
-
- -
Connection state matching.
-
-
- established - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- invalid - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- new - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- related - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
{'merged': 'Add/update listed rule sets and rules.'}
-
{'replaced': 'Replace listed rule sets entirely.'}
-
{'overridden': 'Replace the entire firewall rule config.'}
-
{'deleted': 'Remove listed (or all) rule sets.'}
-
{'gathered': 'Read firewall rule config from device.'}
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - -See Also --------- - -.. seealso:: - - :ref:`vyos.vyos.vyos_firewall_rules_module` - The official documentation on the **vyos.vyos.vyos_firewall_rules** module. - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
Firewall rule config after the module ran.
-
-
-
- before - -
- list -
-
always -
Firewall rule config before the module ran.
-
-
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-
- gathered - -
- list -
-
when state is gathered -
Firewall config read from device (state=gathered).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_generate_module.rst b/docs/vyos.rest.vyos_generate_module.rst deleted file mode 100644 index f972ee7..0000000 --- a/docs/vyos.rest.vyos_generate_module.rst +++ /dev/null @@ -1,191 +0,0 @@ -.. _vyos.rest.vyos_generate_module: - - -*********************** -vyos.rest.vyos_generate -*********************** - -**Execute generate commands on a VyOS device via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Sends a ``generate`` operational command to a VyOS device via the HTTPS REST API (``/generate`` endpoint). -- Commonly used to generate WireGuard keypairs, TLS certificates, etc. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- path - -
- list - / elements=string - / required -
-
- -
Generate command tokens.
-
E.g. ["wireguard", "default-keypair"].
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- output - -
- string -
-
success -
Text output produced by the generate command (may be empty).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_image_module.rst b/docs/vyos.rest.vyos_image_module.rst deleted file mode 100644 index 3dd396d..0000000 --- a/docs/vyos.rest.vyos_image_module.rst +++ /dev/null @@ -1,227 +0,0 @@ -.. _vyos.rest.vyos_image_module: - - -******************** -vyos.rest.vyos_image -******************** - -**Manage VyOS system images via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Adds or removes VyOS system images using the HTTPS REST API (``/image`` endpoint). -- Use *state=present* to download and install an image from a URL. -- Use *state=absent* to delete an installed image by name. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- name - -
- string -
-
- -
Version name of the image to remove (e.g. 1.4-rolling-202401010000).
-
Required when state=absent.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- state - -
- string - / required -
-
-
    Choices: -
  • present
  • -
  • absent
  • -
-
-
{'present': 'Download and install the image from url.'}
-
{'absent': 'Delete the image specified by name.'}
-
-
- timeout - -
- integer -
-
- Default:
300
-
-
Request timeout in seconds. Image downloads can take several minutes; increase this value accordingly.
-
-
- url - -
- string -
-
- -
HTTP(S) URL of the VyOS .iso file to install.
-
Required when state=present.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- output - -
- string -
-
success -
Text output from the image add/delete operation.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_interfaces_module.rst b/docs/vyos.rest.vyos_interfaces_module.rst deleted file mode 100644 index fbaca26..0000000 --- a/docs/vyos.rest.vyos_interfaces_module.rst +++ /dev/null @@ -1,452 +0,0 @@ -.. _vyos.rest.vyos_interfaces_module: - - -************************* -vyos.rest.vyos_interfaces -************************* - -**Manage interface attributes on a VyOS device via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages interface base attributes (description, MTU, enabled state, VIFs, duplex, speed) on VyOS devices using the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_interfaces`` but uses HTTP API. -- Supports Ethernet, Bonding, VXLAN, Loopback, and Virtual Tunnel interfaces. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- config - -
- list - / elements=dictionary -
-
- -
List of interface configurations.
-
-
- description - -
- string -
-
- -
Interface description.
-
-
- duplex - -
- string -
-
-
    Choices: -
  • auto
  • -
  • full
  • -
  • half
  • -
-
-
Duplex mode. Only for Ethernet interfaces.
-
-
- enabled - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Administrative state. true = up, false = admin-down.
-
-
- mtu - -
- integer -
-
- -
MTU in bytes. Applicable for Ethernet, Bonding, VXLAN, VTI.
-
-
- name - -
- string - / required -
-
- -
Full interface name (e.g. eth0, bond0, vti1, vxlan2).
-
-
- speed - -
- string -
-
- -
Link speed. Only for Ethernet interfaces.
-
-
- vifs - -
- list - / elements=dictionary -
-
- -
List of VLAN sub-interface configurations.
-
-
- description - -
- string -
-
- -
VIF description.
-
-
- enabled - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Administrative state of the VIF.
-
-
- vlan_id - -
- integer - / required -
-
- -
802.1Q VLAN ID.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
{'merged': 'Merge the provided config with existing interface config.'}
-
{'replaced': 'Replace per-interface config with provided values.'}
-
{'overridden': 'Override all interface config with provided values.'}
-
{'deleted': 'Delete interface config for listed interfaces (or all).'}
-
{'gathered': 'Read current interface config from device.'}
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - -See Also --------- - -.. seealso:: - - :ref:`vyos.vyos.vyos_interfaces_module` - The official documentation on the **vyos.vyos.vyos_interfaces** module. - :ref:`vyos.rest.vyos_l3_interfaces_module` - The official documentation on the **vyos.rest.vyos_l3_interfaces** module. - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
Interface configuration after the module ran.
-
-
-
- before - -
- list -
-
always -
Interface configuration before the module ran.
-
-
-
- commands - -
- list -
-
always -
REST API set/delete commands issued.
-
-
-
- gathered - -
- list -
-
when state is gathered -
Interface config read from device (state=gathered).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_l3_interfaces_module.rst b/docs/vyos.rest.vyos_l3_interfaces_module.rst deleted file mode 100644 index ffc50ca..0000000 --- a/docs/vyos.rest.vyos_l3_interfaces_module.rst +++ /dev/null @@ -1,470 +0,0 @@ -.. _vyos.rest.vyos_l3_interfaces_module: - - -**************************** -vyos.rest.vyos_l3_interfaces -**************************** - -**Manage L3 interface attributes on VyOS via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages IPv4 and IPv6 addresses on VyOS interfaces via the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_l3_interfaces`` but uses the HTTP API. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- config - -
- list - / elements=dictionary -
-
- -
List of L3 interface configurations.
-
-
- ipv4 - -
- list - / elements=dictionary -
-
- -
List of IPv4 address assignments.
-
-
- address - -
- string - / required -
-
- -
IPv4 address in CIDR notation or dhcp.
-
-
- ipv6 - -
- list - / elements=dictionary -
-
- -
List of IPv6 address assignments.
-
-
- address - -
- string - / required -
-
- -
IPv6 address in CIDR notation or dhcpv6 or autoconf.
-
-
- name - -
- string - / required -
-
- -
Full interface name (e.g. eth0, eth1).
-
-
- vifs - -
- list - / elements=dictionary -
-
- -
VLAN sub-interface L3 settings.
-
-
- ipv4 - -
- list - / elements=dictionary -
-
- -
IPv4 addresses for this VIF.
-
-
- address - -
- string - / required -
-
- -
-
- ipv6 - -
- list - / elements=dictionary -
-
- -
IPv6 addresses for this VIF.
-
-
- address - -
- string - / required -
-
- -
-
- vlan_id - -
- integer - / required -
-
- -
802.1Q VLAN ID.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
{'merged': 'Add addresses to the interface (preserve existing).'}
-
{'replaced': 'Replace all addresses on each listed interface.'}
-
{'overridden': 'Replace all addresses on all interfaces.'}
-
{'deleted': 'Remove all addresses from listed (or all) interfaces.'}
-
{'gathered': 'Read L3 config from device without changes.'}
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - -See Also --------- - -.. seealso:: - - :ref:`vyos.vyos.vyos_l3_interfaces_module` - The official documentation on the **vyos.vyos.vyos_l3_interfaces** module. - :ref:`vyos.rest.vyos_interfaces_module` - The official documentation on the **vyos.rest.vyos_interfaces** module. - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
L3 interface config after the module ran.
-
-
-
- before - -
- list -
-
always -
L3 interface config before the module ran.
-
-
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-
- gathered - -
- list -
-
when state is gathered -
L3 config read from device (state=gathered).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_lag_interfaces_module.rst b/docs/vyos.rest.vyos_lag_interfaces_module.rst deleted file mode 100644 index 39edaa1..0000000 --- a/docs/vyos.rest.vyos_lag_interfaces_module.rst +++ /dev/null @@ -1,393 +0,0 @@ -.. _vyos.rest.vyos_lag_interfaces_module: - - -***************************** -vyos.rest.vyos_lag_interfaces -***************************** - -**LAG/bonding interfaces resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages Link Aggregation Group (LAG/bond) interfaces on VyOS via REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- list - / elements=dictionary -
-
- -
List of LAG interface configurations.
-
-
- arp_monitor - -
- dictionary -
-
- -
ARP monitoring settings.
-
-
- interval - -
- integer -
-
- -
Monitoring interval in ms.
-
-
- target - -
- list - / elements=string -
-
- -
Target IP addresses.
-
-
- hash_policy - -
- string -
-
-
    Choices: -
  • layer2
  • -
  • layer2+3
  • -
  • layer3+4
  • -
-
-
Transmit hash policy.
-
-
- members - -
- list - / elements=dictionary -
-
- -
Member interfaces.
-
-
- member - -
- string -
-
- -
Interface name.
-
-
- mode - -
- string -
-
-
    Choices: -
  • 802.3ad
  • -
  • active-backup
  • -
  • broadcast
  • -
  • round-robin
  • -
  • transmit-load-balance
  • -
  • adaptive-load-balance
  • -
  • xor-hash
  • -
-
-
Bonding mode.
-
-
- name - -
- string - / required -
-
- -
Bond interface name (e.g. bond0).
-
-
- primary - -
- string -
-
- -
Primary interface name.
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
Desired state.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
-
-
- before - -
- list -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_lldp_interfaces_module.rst b/docs/vyos.rest.vyos_lldp_interfaces_module.rst deleted file mode 100644 index 59d25d1..0000000 --- a/docs/vyos.rest.vyos_lldp_interfaces_module.rst +++ /dev/null @@ -1,389 +0,0 @@ -.. _vyos.rest.vyos_lldp_interfaces_module: - - -****************************** -vyos.rest.vyos_lldp_interfaces -****************************** - -**LLDP interfaces resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages per-interface LLDP settings (enable/disable, location) on VyOS via the HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- list - / elements=dictionary -
-
- -
List of LLDP interface configurations.
-
-
- enable - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Enable LLDP on this interface (default true).
-
-
- location - -
- dictionary -
-
- -
LLDP-MED location data.
-
-
- coordinate_based - -
- dictionary -
-
- -
-
- altitude - -
- integer -
-
- -
-
- datum - -
- string -
-
-
    Choices: -
  • WGS84
  • -
  • NAD83
  • -
  • MLLW
  • -
-
-
-
- latitude - -
- string - / required -
-
- -
-
- longitude - -
- string - / required -
-
- -
-
- elin - -
- string -
-
- -
Emergency ELIN number (10-25 digits).
-
-
- name - -
- string - / required -
-
- -
Interface name.
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
-
-
- before - -
- list -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_ospf_interfaces_module.rst b/docs/vyos.rest.vyos_ospf_interfaces_module.rst deleted file mode 100644 index 7447c4e..0000000 --- a/docs/vyos.rest.vyos_ospf_interfaces_module.rst +++ /dev/null @@ -1,570 +0,0 @@ -.. _vyos.rest.vyos_ospf_interfaces_module: - - -****************************** -vyos.rest.vyos_ospf_interfaces -****************************** - -**OSPF Interfaces Resource Module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages per-interface OSPF parameters (cost, hello/dead timers, authentication, passive mode, etc.) for both OSPFv2 and OSPFv3 via the VyOS HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- list - / elements=dictionary -
-
- -
List of OSPF interface configurations.
-
-
- address_family - -
- list - / elements=dictionary -
-
- -
OSPF settings per address family.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Address family (ipv4=OSPFv2, ipv6=OSPFv3).
-
-
- authentication - -
- dictionary -
-
- -
-
- md5_key - -
- dictionary -
-
- -
-
- key - -
- string -
-
- -
-
- key_id - -
- integer -
-
- -
-
- plaintext_password - -
- string -
-
- -
-
- bandwidth - -
- integer -
-
- -
-
- cost - -
- integer -
-
- -
-
- dead_interval - -
- integer -
-
- -
-
- hello_interval - -
- integer -
-
- -
-
- ifmtu - -
- integer -
-
- -
-
- instance - -
- string -
-
- -
-
- mtu_ignore - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- network - -
- string -
-
- -
-
- passive - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- priority - -
- integer -
-
- -
-
- retransmit_interval - -
- integer -
-
- -
-
- transmit_delay - -
- integer -
-
- -
-
- name - -
- string -
-
- -
Interface name.
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
-
-
- before - -
- list -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_ospfv2_module.rst b/docs/vyos.rest.vyos_ospfv2_module.rst deleted file mode 100644 index f487ac7..0000000 --- a/docs/vyos.rest.vyos_ospfv2_module.rst +++ /dev/null @@ -1,1202 +0,0 @@ -.. _vyos.rest.vyos_ospfv2_module: - - -********************* -vyos.rest.vyos_ospfv2 -********************* - -**OSPFv2 resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages OSPFv2 (OSPF for IPv4) configuration on VyOS via HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- dictionary -
-
- -
OSPFv2 configuration.
-
-
- areas - -
- list - / elements=dictionary -
-
- -
-
- area_id - -
- string -
-
- -
-
- area_type - -
- dictionary -
-
- -
-
- normal - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- nssa - -
- dictionary -
-
- -
-
- default_cost - -
- integer -
-
- -
-
- no_summary - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- set - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- translate - -
- string -
-
-
    Choices: -
  • always
  • -
  • candidate
  • -
  • never
  • -
-
-
-
- stub - -
- dictionary -
-
- -
-
- default_cost - -
- integer -
-
- -
-
- no_summary - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- set - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- authentication - -
- string -
-
-
    Choices: -
  • plaintext-password
  • -
  • md5
  • -
-
-
-
- network - -
- list - / elements=dictionary -
-
- -
-
- address - -
- string -
-
- -
-
- range - -
- list - / elements=dictionary -
-
- -
-
- address - -
- string -
-
- -
-
- cost - -
- integer -
-
- -
-
- not_advertise - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- substitute - -
- string -
-
- -
-
- shortcut - -
- string -
-
-
    Choices: -
  • default
  • -
  • disable
  • -
  • enable
  • -
-
-
-
- auto_cost - -
- dictionary -
-
- -
-
- reference_bandwidth - -
- integer -
-
- -
-
- default_information - -
- dictionary -
-
- -
-
- originate - -
- dictionary -
-
- -
-
- always - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- metric - -
- integer -
-
- -
-
- metric_type - -
- integer -
-
- -
-
- route_map - -
- string -
-
- -
-
- log_adjacency_changes - -
- string -
-
-
    Choices: -
  • detail
  • -
-
-
-
- max_metric - -
- dictionary -
-
- -
-
- router_lsa - -
- dictionary -
-
- -
-
- administrative - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- on_shutdown - -
- integer -
-
- -
-
- on_startup - -
- integer -
-
- -
-
- mpls_te - -
- dictionary -
-
- -
-
- enabled - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- router_address - -
- string -
-
- -
-
- neighbor - -
- list - / elements=dictionary -
-
- -
-
- neighbor_id - -
- string -
-
- -
-
- poll_interval - -
- integer -
-
- -
-
- priority - -
- integer -
-
- -
-
- parameters - -
- dictionary -
-
- -
-
- abr_type - -
- string -
-
-
    Choices: -
  • cisco
  • -
  • ibm
  • -
  • shortcut
  • -
  • standard
  • -
-
-
-
- opaque_lsa - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- rfc1583_compatibility - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- router_id - -
- string -
-
- -
-
- passive_interface - -
- list - / elements=string -
-
- -
-
- redistribute - -
- list - / elements=dictionary -
-
- -
-
- metric - -
- integer -
-
- -
-
- metric_type - -
- integer -
-
- -
-
- route_map - -
- string -
-
- -
-
- route_type - -
- string -
-
-
    Choices: -
  • bgp
  • -
  • connected
  • -
  • kernel
  • -
  • rip
  • -
  • static
  • -
-
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • deleted
  • -
  • gathered
  • -
-
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- dictionary -
-
when changed -
-
-
- before - -
- dictionary -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_ospfv3_module.rst b/docs/vyos.rest.vyos_ospfv3_module.rst deleted file mode 100644 index 4b78c59..0000000 --- a/docs/vyos.rest.vyos_ospfv3_module.rst +++ /dev/null @@ -1,490 +0,0 @@ -.. _vyos.rest.vyos_ospfv3_module: - - -********************* -vyos.rest.vyos_ospfv3 -********************* - -**OSPFv3 resource module via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages OSPFv3 (OSPF for IPv6) configuration on VyOS via HTTPS REST API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- config - -
- dictionary -
-
- -
OSPFv3 configuration.
-
-
- areas - -
- list - / elements=dictionary -
-
- -
-
- area_id - -
- string -
-
- -
-
- export_list - -
- string -
-
- -
-
- import_list - -
- string -
-
- -
-
- interface - -
- list - / elements=dictionary -
-
- -
Interfaces in this area.
-
-
- name - -
- string -
-
- -
-
- range - -
- list - / elements=dictionary -
-
- -
-
- address - -
- string -
-
- -
-
- advertise - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- not_advertise - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes
  • -
-
-
-
- parameters - -
- dictionary -
-
- -
-
- router_id - -
- string -
-
- -
-
- redistribute - -
- list - / elements=dictionary -
-
- -
-
- route_map - -
- string -
-
- -
-
- route_type - -
- string -
-
-
    Choices: -
  • bgp
  • -
  • connected
  • -
  • kernel
  • -
  • ripng
  • -
  • static
  • -
-
-
-
- hostname - -
- string - / required -
-
- -
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • deleted
  • -
  • gathered
  • -
-
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- dictionary -
-
when changed -
-
-
- before - -
- dictionary -
-
always -
-
-
- commands - -
- list -
-
always -
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_ping_module.rst b/docs/vyos.rest.vyos_ping_module.rst deleted file mode 100644 index 315a395..0000000 --- a/docs/vyos.rest.vyos_ping_module.rst +++ /dev/null @@ -1,332 +0,0 @@ -.. _vyos.rest.vyos_ping_module: - - -******************* -vyos.rest.vyos_ping -******************* - -**Test reachability using ping via VyOS REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Sends an ICMP ping via the VyOS HTTPS REST API (/show endpoint) and checks reachability. Mirrors ``vyos.vyos.vyos_ping``. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- count - -
- integer -
-
- Default:
5
-
-
Number of packets to send.
-
-
- dest - -
- string - / required -
-
- -
Destination IP address or hostname.
-
-
- hostname - -
- string - / required -
-
- -
-
- interval - -
- integer -
-
- -
Interval between pings in seconds.
-
-
- port - -
- integer -
-
- Default:
443
-
-
-
- size - -
- integer -
-
- -
Packet size in bytes.
-
-
- source - -
- string -
-
- -
Source interface or IP address.
-
-
- state - -
- string -
-
-
    Choices: -
  • present ←
  • -
  • absent
  • -
-
-
present = expect success; absent = expect failure.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- ttl - -
- integer -
-
- -
Time-to-live value.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- commands - -
- list -
-
always -
Ping command tokens sent to the API.
-
-
-
- packet_loss - -
- string -
-
always -
Packet loss percentage string.
-
-
-
- packets_rx - -
- integer -
-
always -
Packets received.
-
-
-
- packets_tx - -
- integer -
-
always -
Packets transmitted.
-
-
-
- rtt - -
- dictionary -
-
when available -
RTT statistics dict (min/avg/max/mdev).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_prefix_lists_module.rst b/docs/vyos.rest.vyos_prefix_lists_module.rst deleted file mode 100644 index 53321c9..0000000 --- a/docs/vyos.rest.vyos_prefix_lists_module.rst +++ /dev/null @@ -1,454 +0,0 @@ -.. _vyos.rest.vyos_prefix_lists_module: - - -*************************** -vyos.rest.vyos_prefix_lists -*************************** - -**Manage prefix-list configuration on VyOS devices using REST API** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages IPv4 and IPv6 prefix lists on VyOS via the REST API. -- Uses REST API (``connection=httpapi``) instead of CLI. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- config - -
- list - / elements=dictionary -
-
- -
List of prefix-list configurations grouped by address family.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Address family identifier.
-
-
- prefix_lists - -
- list - / elements=dictionary -
-
- -
Named prefix lists.
-
-
- description - -
- string -
-
- -
Prefix list description.
-
-
- entries - -
- list - / elements=dictionary -
-
- -
Prefix list rules.
-
-
- action - -
- string -
-
-
    Choices: -
  • permit
  • -
  • deny
  • -
-
-
Permit or deny.
-
-
- description - -
- string -
-
- -
Rule description.
-
-
- ge - -
- integer -
-
- -
Minimum prefix length.
-
-
- le - -
- integer -
-
- -
Maximum prefix length.
-
-
- prefix - -
- string -
-
- -
Network prefix to match.
-
-
- sequence - -
- integer - / required -
-
- -
Rule sequence number.
-
-
- name - -
- string - / required -
-
- -
Prefix list name.
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
Desired state of the prefix-list configuration.
-
merged adds or updates entries without removing existing ones.
-
replaced replaces each named prefix list mentioned in config.
-
overridden replaces all prefix lists for the given AFIs.
-
deleted removes prefix lists. Without config removes all.
-
gathered returns current configuration as structured data.
-
-
- - -Notes ------ - -.. note:: - - Requires ``ansible_connection=httpapi`` with the VyOS httpapi plugin. - - ``ansible_network_os`` must be set to ``vyos.rest.vyos``. - - - -Examples --------- - -.. code-block:: yaml - - - name: Merge prefix list configuration - vyos.rest.vyos_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: AnsibleIPv4PrefixList - description: PL configured by ansible - entries: - - sequence: 2 - action: permit - prefix: 92.168.10.0/26 - le: 32 - - sequence: 3 - action: deny - prefix: 72.168.2.0/24 - ge: 26 - - afi: ipv6 - prefix_lists: - - name: AllowIPv6Prefix - entries: - - sequence: 5 - action: permit - prefix: 2001:db8:8000::/35 - le: 37 - state: merged - - - name: Delete all prefix lists - vyos.rest.vyos_prefix_lists: - state: deleted - - - name: Gather current prefix list configuration - vyos.rest.vyos_prefix_lists: - state: gathered - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
Prefix list configuration after this module ran.
-
-
-
- before - -
- list -
-
always -
Prefix list configuration before this module ran.
-
-
-
- commands - -
- list -
-
always -
List of API command tuples sent to the device.
-
-
-
- gathered - -
- list -
-
when state is gathered -
Current prefix list configuration as structured data.
-
-
-
- response - -
- dictionary -
-
when changes are applied -
Raw API response.
-
-
-
- saved - -
- boolean -
-
when changes are applied -
Whether the config was saved after changes.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_reset_module.rst b/docs/vyos.rest.vyos_reset_module.rst deleted file mode 100644 index 46d4dee..0000000 --- a/docs/vyos.rest.vyos_reset_module.rst +++ /dev/null @@ -1,191 +0,0 @@ -.. _vyos.rest.vyos_reset_module: - - -******************** -vyos.rest.vyos_reset -******************** - -**Execute reset commands on a VyOS device via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Sends a ``reset`` operational command to a VyOS device via the HTTPS REST API (``/reset`` endpoint). -- Useful for resetting BGP sessions, VPN tunnels, ARP caches, etc. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- path - -
- list - / elements=string - / required -
-
- -
Reset command path tokens.
-
E.g. ["ip", "bgp", "192.0.2.1"] to reset a BGP peer.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- output - -
- string -
-
success -
Text output from the reset command (usually empty on success).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_show_module.rst b/docs/vyos.rest.vyos_show_module.rst deleted file mode 100644 index 29d7ee1..0000000 --- a/docs/vyos.rest.vyos_show_module.rst +++ /dev/null @@ -1,210 +0,0 @@ -.. _vyos.rest.vyos_show_module: - - -******************* -vyos.rest.vyos_show -******************* - -**Execute op-mode show commands on a VyOS device via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Sends a ``show`` operational-mode command to a VyOS device via the HTTPS REST API (``/show`` endpoint) and returns the text output. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- path - -
- list - / elements=string - / required -
-
- -
Operational-mode command tokens following show.
-
E.g. ["interfaces"] maps to show interfaces.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - -Notes ------ - -.. note:: - - This module never modifies device state. - - -See Also --------- - -.. seealso:: - - :ref:`vyos.rest.vyos_configure_module` - The official documentation on the **vyos.rest.vyos_configure** module. - :ref:`vyos.rest.vyos_retrieve_module` - The official documentation on the **vyos.rest.vyos_retrieve** module. - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- output - -
- string -
-
success -
Raw text output from the show command.
-
-
Sample:
-
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down - Interface IP Address S/L Description - eth0 10.0.0.1/24 u/u WAN
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_static_routes_module.rst b/docs/vyos.rest.vyos_static_routes_module.rst deleted file mode 100644 index f5cf5ee..0000000 --- a/docs/vyos.rest.vyos_static_routes_module.rst +++ /dev/null @@ -1,505 +0,0 @@ -.. _vyos.rest.vyos_static_routes_module: - - -**************************** -vyos.rest.vyos_static_routes -**************************** - -**Manage static routes on VyOS via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages IPv4 and IPv6 static routes on VyOS devices using the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_static_routes`` but uses the HTTP API. - - - -Requirements ------------- -The below requirements are needed on the host that executes this module. - -- VyOS 1.3+ - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
API key configured on the device.
-
-
- config - -
- list - / elements=dictionary -
-
- -
List of static route address-family configurations.
-
-
- address_families - -
- list - / elements=dictionary -
-
- -
List of address family route groups.
-
-
- afi - -
- string - / required -
-
-
    Choices: -
  • ipv4
  • -
  • ipv6
  • -
-
-
Address family indicator.
-
-
- routes - -
- list - / elements=dictionary -
-
- -
List of static route entries.
-
-
- blackhole_config - -
- dictionary -
-
- -
Blackhole route configuration.
-
-
- distance - -
- integer -
-
- -
Administrative distance (1-255).
-
-
- type - -
- string -
-
- -
Blackhole type.
-
-
- dest - -
- string - / required -
-
- -
Destination prefix in CIDR notation.
-
-
- next_hops - -
- list - / elements=dictionary -
-
- -
List of next-hop addresses.
-
-
- admin_distance - -
- integer -
-
- -
Administrative distance for this next-hop.
-
-
- enabled - -
- boolean -
-
-
    Choices: -
  • no
  • -
  • yes ←
  • -
-
-
Whether this next-hop is enabled.
-
-
- forward_router_address - -
- string - / required -
-
- -
Next-hop IP address.
-
-
- interface - -
- string -
-
- -
Outgoing interface name.
-
-
- hostname - -
- string - / required -
-
- -
IP address or FQDN of the VyOS device.
-
-
- port - -
- integer -
-
- Default:
443
-
-
HTTPS port for the REST API.
-
-
- state - -
- string -
-
-
    Choices: -
  • merged ←
  • -
  • replaced
  • -
  • overridden
  • -
  • deleted
  • -
  • gathered
  • -
-
-
{'merged': 'Add routes (preserve existing).'}
-
{'replaced': 'Replace routes for listed destinations.'}
-
{'overridden': 'Replace the entire static route table.'}
-
{'deleted': 'Remove listed (or all) static routes.'}
-
{'gathered': 'Read static routes from device.'}
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
Request timeout in seconds.
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Validate the device's TLS certificate.
-
-
- - - -See Also --------- - -.. seealso:: - - :ref:`vyos.vyos.vyos_static_routes_module` - The official documentation on the **vyos.vyos.vyos_static_routes** module. - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyReturnedDescription
-
- after - -
- list -
-
when changed -
Static route config after the module ran.
-
-
-
- before - -
- list -
-
always -
Static route config before the module ran.
-
-
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-
- gathered - -
- list -
-
when state is gathered -
Static routes read from device (state=gathered).
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_system_module.rst b/docs/vyos.rest.vyos_system_module.rst deleted file mode 100644 index 7b70e41..0000000 --- a/docs/vyos.rest.vyos_system_module.rst +++ /dev/null @@ -1,244 +0,0 @@ -.. _vyos.rest.vyos_system_module: - - -********************* -vyos.rest.vyos_system -********************* - -**Manage system settings on VyOS via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages system-level settings — hostname, domain name, name servers, domain search list — using the VyOS HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_system`` but uses the HTTP API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- api_key - -
- string - / required -
-
- -
-
- domain_name - -
- string -
-
- -
System domain name.
-
-
- domain_search - -
- list - / elements=string -
-
- -
List of domain search suffixes. Mutually exclusive with name_server.
-
-
- host_name - -
- string -
-
- -
System hostname.
-
-
- hostname - -
- string - / required -
-
- -
-
- name_server - -
- list - / elements=string -
-
- -
List of DNS name servers. Mutually exclusive with domain_search.
-

aliases: name_servers
-
-
- port - -
- integer -
-
- Default:
443
-
-
-
- state - -
- string -
-
-
    Choices: -
  • present ←
  • -
  • absent
  • -
-
-
present to apply, absent to remove.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_user_module.rst b/docs/vyos.rest.vyos_user_module.rst deleted file mode 100644 index 119edf0..0000000 --- a/docs/vyos.rest.vyos_user_module.rst +++ /dev/null @@ -1,564 +0,0 @@ -.. _vyos.rest.vyos_user_module: - - -******************* -vyos.rest.vyos_user -******************* - -**Manage local users on VyOS via the REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages local user accounts on VyOS devices using the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_user`` but uses the HTTP API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- aggregate - -
- list - / elements=dictionary -
-
- -
List of user definitions. Mutually exclusive with name.
-

aliases: users, collection
-
-
- configured_password - -
- string -
-
- -
Plaintext password (will be hashed on device).
-
-
- encrypted_password - -
- string -
-
- -
Pre-hashed password string.
-
-
- full_name - -
- string -
-
- -
Full name.
-
-
- level - -
- string -
-
-
    Choices: -
  • admin
  • -
  • operator
  • -
-
-
User privilege level.
-
-
- name - -
- string - / required -
-
- -
Username.
-
-
- public_keys - -
- list - / elements=dictionary -
-
- -
SSH public keys for authentication.
-
-
- key - -
- string - / required -
-
- -
Base64-encoded public key.
-
-
- name - -
- string - / required -
-
- -
Key identifier (e.g. user@host).
-
-
- type - -
- string - / required -
-
-
    Choices: -
  • ssh-dss
  • -
  • ssh-rsa
  • -
  • ecdsa-sha2-nistp256
  • -
  • ecdsa-sha2-nistp384
  • -
  • ssh-ed25519
  • -
  • ecdsa-sha2-nistp521
  • -
-
-
Key type.
-
-
- state - -
- string -
-
-
    Choices: -
  • present
  • -
  • absent
  • -
-
-
Present or absent.
-
-
- update_password - -
- string -
-
-
    Choices: -
  • always
  • -
  • on_create
  • -
-
-
When to update the password.
-
-
- api_key - -
- string - / required -
-
- -
-
- configured_password - -
- string -
-
- -
Plaintext password.
-
-
- encrypted_password - -
- string -
-
- -
Pre-hashed password.
-
-
- full_name - -
- string -
-
- -
Full name for the single user.
-
-
- hostname - -
- string - / required -
-
- -
-
- level - -
- string -
-
-
    Choices: -
  • admin
  • -
  • operator
  • -
-
-
-
- name - -
- string -
-
- -
Single username. Mutually exclusive with aggregate.
-
-
- port - -
- integer -
-
- Default:
443
-
-
-
- public_keys - -
- list - / elements=dictionary -
-
- -
-
- key - -
- string - / required -
-
- -
-
- name - -
- string - / required -
-
- -
-
- type - -
- string - / required -
-
- -
-
- state - -
- string -
-
-
    Choices: -
  • present ←
  • -
  • absent
  • -
-
-
Whether to create (present) or remove (absent) the user.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- update_password - -
- string -
-
-
    Choices: -
  • always
  • -
  • on_create
  • -
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/docs/vyos.rest.vyos_vlan_module.rst b/docs/vyos.rest.vyos_vlan_module.rst deleted file mode 100644 index db45fd8..0000000 --- a/docs/vyos.rest.vyos_vlan_module.rst +++ /dev/null @@ -1,360 +0,0 @@ -.. _vyos.rest.vyos_vlan_module: - - -******************* -vyos.rest.vyos_vlan -******************* - -**Manage VLANs on VyOS network devices via REST API.** - - -Version added: 1.0.0 - -.. contents:: - :local: - :depth: 1 - - -Synopsis --------- -- Manages 802.1Q VLAN sub-interfaces on VyOS Ethernet interfaces using the HTTPS REST API. -- Mirrors ``vyos.vyos.vyos_vlan`` but uses the HTTP API. - - - - -Parameters ----------- - -.. raw:: html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterChoices/DefaultsComments
-
- address - -
- string -
-
- -
IP address for the VLAN interface.
-
-
- aggregate - -
- list - / elements=dictionary -
-
- -
List of VLAN definitions.
-
-
- address - -
- string -
-
- -
-
- interfaces - -
- list - / elements=string - / required -
-
- -
-
- name - -
- string -
-
- -
-
- state - -
- string -
-
-
    Choices: -
  • present
  • -
  • absent
  • -
-
-
-
- vlan_id - -
- integer - / required -
-
- -
-
- api_key - -
- string - / required -
-
- -
-
- hostname - -
- string - / required -
-
- -
-
- interfaces - -
- list - / elements=string -
-
- -
List of physical interfaces to configure the VLAN on.
-
-
- name - -
- string -
-
- -
VLAN name (used as description on the VIF).
-
-
- port - -
- integer -
-
- Default:
443
-
-
-
- purge - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
Remove VLANs not defined in aggregate.
-
-
- state - -
- string -
-
-
    Choices: -
  • present ←
  • -
  • absent
  • -
-
-
present to configure, absent to remove.
-
-
- timeout - -
- integer -
-
- Default:
30
-
-
-
- verify_ssl - -
- boolean -
-
-
    Choices: -
  • no ←
  • -
  • yes
  • -
-
-
-
- vlan_id - -
- integer -
-
- -
VLAN ID (0-4094).
-
-
- - - - - - - -Return Values -------------- -Common return values are documented `here `_, the following are the fields unique to this module: - -.. raw:: html - - - - - - - - - - - - -
KeyReturnedDescription
-
- commands - -
- list -
-
always -
set/delete commands issued.
-
-
-

- - -Status ------- - - -Authors -~~~~~~~ - -- VyOS Community (@vyos) diff --git a/plugins/httpapi/vyos.py b/plugins/httpapi/vyos.py index 1719254..6dd6042 100644 --- a/plugins/httpapi/vyos.py +++ b/plugins/httpapi/vyos.py @@ -105,11 +105,15 @@ class HttpApi(HttpApiBase): Raises: ConnectionError: on HTTP error or VyOS success=false response. """ + try: api_key = self._get_api_key() - body = json.dumps(payload) - form_data = urlencode({"data": body, "key": api_key}) + if "_raw_list" in payload: + body = json.dumps(payload["_raw_list"]) + else: + body = json.dumps(payload) + form_data = urlencode({"data": body, "key": api_key}) response, response_data = self.connection.send( endpoint, data=form_data, diff --git a/plugins/module_utils/vyos.py b/plugins/module_utils/vyos.py index 87fc37b..82670e7 100644 --- a/plugins/module_utils/vyos.py +++ b/plugins/module_utils/vyos.py @@ -62,58 +62,75 @@ class VyOSModule: # Write # ------------------------------------------------------------------ - def apply_commands(self, commands): - """Execute a list of ``(op, path)`` command tuples against the device. - - Args: - commands (list): Each item is a 2-tuple ``(op, path)`` where: - - *op* is ``"set"`` or ``"delete"`` - - *path* is a list of config path tokens - - Optionally a 3-tuple ``(op, path, value)`` for leaf nodes - that carry a value. - - Returns: - list: Results from each command (dicts with ``op`` and ``path``). - - Raises: - VyOSRestError: If a command fails and cannot be recovered. - - Notes: - **Version-adaptive set:** if a ``set`` is rejected by the device, - the method retries once with the last path segment removed. - This handles schema simplifications between VyOS releases - (e.g. ``allow-client address `` -> ``allow-client `` - in VyOS 1.5+). - - **Idempotent delete:** ``delete`` failures are silently ignored - (the path is already absent). - """ - results = [] + # def apply_commands(self, commands): + # """Execute a list of ``(op, path)`` command tuples against the device. + + # Args: + # commands (list): Each item is a 2-tuple ``(op, path)`` where: + # - *op* is ``"set"`` or ``"delete"`` + # - *path* is a list of config path tokens + + # Optionally a 3-tuple ``(op, path, value)`` for leaf nodes + # that carry a value. + + # Returns: + # list: Results from each command (dicts with ``op`` and ``path``). + + # Raises: + # VyOSRestError: If a command fails and cannot be recovered. + + # Notes: + # **Version-adaptive set:** if a ``set`` is rejected by the device, + # the method retries once with the last path segment removed. + # This handles schema simplifications between VyOS releases + # (e.g. ``allow-client address `` -> ``allow-client `` + # in VyOS 1.5+). + + # **Idempotent delete:** ``delete`` failures are silently ignored + # (the path is already absent). + # """ + # results = [] + + # for cmd in commands: + # # Support two command formats: + # # Tuple: ("set", ["path", "tokens"]) or ("set", ["path"], "value") + # # Dict: {"op": "set", "path": ["path", "tokens"]} + # if isinstance(cmd, dict): + # op = cmd["op"] + # path = list(cmd["path"]) + # value = cmd.get("value") + # else: + # op = cmd[0] + # path = list(cmd[1]) + # value = cmd[2] if len(cmd) > 2 else None + + # if op == "set": + # results.append(self._apply_set(path, value)) + # elif op == "delete": + # results.append(self._apply_delete(path)) + # else: + # self._module.fail_json( + # msg="Unknown command op '{op}' in apply_commands".format(op=op), + # ) + + # return results + def apply_commands(self, commands): + if not commands: + return [] + payload = [] for cmd in commands: - # Support two command formats: - # Tuple: ("set", ["path", "tokens"]) or ("set", ["path"], "value") - # Dict: {"op": "set", "path": ["path", "tokens"]} if isinstance(cmd, dict): - op = cmd["op"] - path = list(cmd["path"]) - value = cmd.get("value") - else: - op = cmd[0] - path = list(cmd[1]) - value = cmd[2] if len(cmd) > 2 else None - - if op == "set": - results.append(self._apply_set(path, value)) - elif op == "delete": - results.append(self._apply_delete(path)) + op, path = cmd["op"], list(cmd["path"]) else: - self._module.fail_json( - msg="Unknown command op '{op}' in apply_commands".format(op=op), - ) - - return results + op, path = cmd[0], list(cmd[1]) + payload.append({"op": op, "path": path}) + try: + return self._client.configure_batch(payload) + except VyOSRestError as exc: + self._module.fail_json( + msg="apply_commands failed: {e}".format(e=str(exc)), + ) def _apply_set(self, path, value=None): """Set a config path, retrying with a shortened path on failure.""" diff --git a/plugins/module_utils/vyos_rest.py b/plugins/module_utils/vyos_rest.py index 95b3aac..aaf2b23 100644 --- a/plugins/module_utils/vyos_rest.py +++ b/plugins/module_utils/vyos_rest.py @@ -1,36 +1,5 @@ """ VyOS REST API client utility — supports both connection modes. - -**httpapi mode (recommended)**:: - - # inventory - vyos15x ansible_host=192.168.122.194 - ansible_network_os=vyos.rest.vyos - ansible_connection=ansible.netcommon.httpapi - ansible_httpapi_use_ssl=true - ansible_httpapi_port=443 - ansible_httpapi_validate_certs=false - ansible_httpapi_api_key=vyos123 - - # playbook — no connection params needed on any task - - vyos.rest.vyos_banner: - banner: pre-login - text: "Authorised use only." - state: present - -**local mode (alternative, no inventory network_os required)**:: - - - vyos.rest.vyos_banner: - hostname: 192.168.122.194 - api_key: vyos123 - verify_ssl: false - banner: pre-login - text: "Authorised use only." - state: present - -Both modes call the same VyOS endpoints. The httpapi mode routes calls -through the persistent connection daemon (better for large inventories); -the local mode opens a new HTTPS connection per task. """ from __future__ import absolute_import, division, print_function @@ -45,7 +14,7 @@ import os try: from urllib.parse import urlencode except ImportError: - from urllib import urlencode # Python 2 + from urllib import urlencode try: import urllib3 @@ -218,6 +187,21 @@ class VyOSRestClient: def image_delete(self, name): return self._post("/image", {"op": "delete", "name": name}) + def configure_batch(self, commands): + """Send all commands as a single atomic commit.""" + if self._mode == "httpapi": + try: + return self._conn.send_request( + endpoint="/configure", + _raw_list=commands, + ) + except ConnectionError as exc: + raise VyOSRestError(str(exc)) + except Exception as exc: + raise VyOSRestError( + "configure_batch failed: {e}".format(e=str(exc)), + ) + def config_file_save(self, path=None): payload = {"op": "save"} if path: diff --git a/plugins/modules/vyos_ntp_global.py b/plugins/modules/vyos_ntp_global.py index 185dc02..88073e1 100644 --- a/plugins/modules/vyos_ntp_global.py +++ b/plugins/modules/vyos_ntp_global.py @@ -218,13 +218,12 @@ def build_commands(desired, existing, state): cmds = [] if state == "overridden": - if existing["allow_clients"]: - cmds.append(("delete", ["service", "ntp", "allow-client"])) - if existing["listen_addresses"]: - cmds.append(("delete", ["service", "ntp", "listen-address"])) - if existing["servers"]: - cmds.append(("delete", ["service", "ntp", "server"])) - state = "merged" + state = "replaced" + + if state == "deleted": + if existing["servers"] or existing["allow_clients"] or existing["listen_addresses"]: + cmds.append(("delete", ["service", "ntp"])) + return cmds cmds += diff_list( "allow-client", diff --git a/tests/integration/targets/vyos_banner/defaults/main.yaml b/tests/integration/targets/vyos_banner/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_banner/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_banner/tasks/httpapi.yaml b/tests/integration/targets/vyos_banner/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_banner/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_banner/tasks/main.yaml b/tests/integration/targets/vyos_banner/tasks/main.yaml new file mode 100644 index 0000000..b1f6193 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tasks/main.yaml @@ -0,0 +1,5 @@ +--- +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..2557b70 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/_populate_config.yaml @@ -0,0 +1,11 @@ +--- +- name: Populate banner config for testing + vyos.rest.vyos_banner: + config: + banners: + - banner: pre-login + text: "Ansible test pre-login banner" + - banner: post-login + text: "Ansible test post-login banner" + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..cc56d27 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/_remove_config.yaml @@ -0,0 +1,5 @@ +--- +- name: Remove pre-existing banner config + vyos.rest.vyos_banner: + state: deleted + ignore_errors: true diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..5d0db34 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/deleted.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_banner deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all banner configuration + register: result + vyos.rest.vyos_banner: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Delete banner configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_banner: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..a51ff48 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/gathered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START vyos_banner gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Gather banner configuration + register: result + vyos.rest.vyos_banner: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered is defined + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml new file mode 100644 index 0000000..027702a --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/merged.yaml @@ -0,0 +1,32 @@ +--- +- debug: + msg: START vyos_banner merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge banner configuration + register: result + vyos.rest.vyos_banner: &id001 + config: + banners: + - banner: pre-login + text: "Ansible test pre-login banner" + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge banner configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_banner: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_banner/vars/main.yaml b/tests/integration/targets/vyos_banner/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_banner/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here diff --git a/tests/integration/targets/vyos_hostname/defaults/main.yaml b/tests/integration/targets/vyos_hostname/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_hostname/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_hostname/tasks/httpapi.yaml b/tests/integration/targets/vyos_hostname/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_hostname/tasks/main.yaml b/tests/integration/targets/vyos_hostname/tasks/main.yaml new file mode 100644 index 0000000..b1f6193 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tasks/main.yaml @@ -0,0 +1,5 @@ +--- +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..c6d2583 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/_populate_config.yaml @@ -0,0 +1,6 @@ +--- +- name: Populate hostname for testing + vyos.rest.vyos_hostname: + config: + hostname: ansible-test-host + state: merged diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..a6f7aeb --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/_remove_config.yaml @@ -0,0 +1,7 @@ +--- +- name: Reset hostname to default + vyos.rest.vyos_hostname: + config: + hostname: vyos + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..dfc8896 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/gathered.yaml @@ -0,0 +1,19 @@ +--- +- debug: + msg: START vyos_hostname gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _populate_config.yaml + +- block: + - name: Gather hostname configuration + register: result + vyos.rest.vyos_hostname: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered.hostname == "ansible-test-host" + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/merged.yaml new file mode 100644 index 0000000..d815d53 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/merged.yaml @@ -0,0 +1,30 @@ +--- +- debug: + msg: START vyos_hostname merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge hostname configuration + register: result + vyos.rest.vyos_hostname: &id001 + config: + hostname: ansible-test-host + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge hostname configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_hostname: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..b4e318d --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/replaced.yaml @@ -0,0 +1,30 @@ +--- +- debug: + msg: START vyos_hostname replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _populate_config.yaml + +- block: + - name: Replace hostname configuration + register: result + vyos.rest.vyos_hostname: &id001 + config: + hostname: ansible-replaced-host + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace hostname configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_hostname: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/vars/main.yaml b/tests/integration/targets/vyos_hostname/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here diff --git a/tests/integration/targets/vyos_lldp_global/defaults/main.yaml b/tests/integration/targets/vyos_lldp_global/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_lldp_global/tasks/httpapi.yaml b/tests/integration/targets/vyos_lldp_global/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_lldp_global/tasks/main.yaml b/tests/integration/targets/vyos_lldp_global/tasks/main.yaml new file mode 100644 index 0000000..b1f6193 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tasks/main.yaml @@ -0,0 +1,5 @@ +--- +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..3bf4fb0 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/_populate_config.yaml @@ -0,0 +1,13 @@ +--- +- name: Populate lldp_global config for testing + vyos.rest.vyos_lldp_global: + config: + enable: true + addresses: + - 192.0.2.17 + snmp: enable + legacy_protocols: + - cdp + - sonmp + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..9e3b01d --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/_remove_config.yaml @@ -0,0 +1,5 @@ +--- +- name: Remove pre-existing lldp_global config + vyos.rest.vyos_lldp_global: + state: deleted + ignore_errors: true diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..d084d4a --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/deleted.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_lldp_global deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all lldp_global configuration + register: result + vyos.rest.vyos_lldp_global: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Delete lldp_global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_lldp_global: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..20ac2b2 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/gathered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START vyos_lldp_global gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Gather lldp_global configuration + register: result + vyos.rest.vyos_lldp_global: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered is defined + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/merged.yaml new file mode 100644 index 0000000..a4c9bec --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/merged.yaml @@ -0,0 +1,36 @@ +--- +- debug: + msg: START vyos_lldp_global merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge lldp_global configuration + register: result + vyos.rest.vyos_lldp_global: &id001 + config: + enable: true + addresses: + - 192.0.2.17 + snmp: enable + legacy_protocols: + - cdp + - sonmp + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge lldp_global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_lldp_global: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..d5523eb --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/replaced.yaml @@ -0,0 +1,35 @@ +--- +- debug: + msg: START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Replace lldp_global configuration + register: result + vyos.rest.vyos_lldp_global: &id001 + config: + enable: true + addresses: + - 192.0.2.99 + legacy_protocols: + - cdp + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace lldp_global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_lldp_global: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/vars/main.yaml b/tests/integration/targets/vyos_lldp_global/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here diff --git a/tests/integration/targets/vyos_logging_global/defaults/main.yaml b/tests/integration/targets/vyos_logging_global/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_logging_global/tasks/httpapi.yaml b/tests/integration/targets/vyos_logging_global/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_logging_global/tasks/main.yaml b/tests/integration/targets/vyos_logging_global/tasks/main.yaml index f5a1f31..b1f6193 100644 --- a/tests/integration/targets/vyos_logging_global/tasks/main.yaml +++ b/tests/integration/targets/vyos_logging_global/tasks/main.yaml @@ -1,133 +1,5 @@ --- -# tests/integration/targets/vyos_logging_global/tasks/main.yaml - -- name: TEARDOWN — delete all syslog config before tests - vyos.rest.vyos_logging_global: - state: deleted - -# ------------------------------------------------------------------ -# MERGED -# ------------------------------------------------------------------ - -- name: MERGED — set initial logging config - register: result - vyos.rest.vyos_logging_global: - config: - console: - facilities: - - facility: local7 - severity: err - hosts: - - hostname: 172.16.0.1 - port: 514 - facilities: - - facility: local7 - severity: all - global_params: - facilities: - - facility: cron - severity: debug - preserve_fqdn: true - state: merged - -- name: ASSERT — merged changed - assert: - that: - - result.changed == true - -- name: MERGED — idempotency check - register: result - vyos.rest.vyos_logging_global: - config: - console: - facilities: - - facility: local7 - severity: err - hosts: - - hostname: 172.16.0.1 - port: 514 - facilities: - - facility: local7 - severity: all - global_params: - facilities: - - facility: cron - severity: debug - preserve_fqdn: true - state: merged - -- name: ASSERT — merged idempotent - assert: - that: - - result.changed == false - - result.commands | length == 0 - -# ------------------------------------------------------------------ -# GATHERED -# ------------------------------------------------------------------ - -- name: GATHERED — read current config - register: result - vyos.rest.vyos_logging_global: - state: gathered - -- name: ASSERT — gathered returns expected data - assert: - that: - - result.gathered is defined - -# ------------------------------------------------------------------ -# REPLACED -# ------------------------------------------------------------------ - -- name: REPLACED — replace with minimal config - register: result - vyos.rest.vyos_logging_global: - config: - console: - facilities: - - facility: local6 - state: replaced - -- name: ASSERT — replaced changed - assert: - that: - - result.changed == true - -- name: REPLACED — idempotency check - register: result - vyos.rest.vyos_logging_global: - config: - console: - facilities: - - facility: local6 - state: replaced - -- name: ASSERT — replaced idempotent - assert: - that: - - result.changed == false - -# ------------------------------------------------------------------ -# DELETED -# ------------------------------------------------------------------ - -- name: DELETED — remove all syslog config - register: result - vyos.rest.vyos_logging_global: - state: deleted - -- name: ASSERT — deleted changed - assert: - that: - - result.changed == true - -- name: DELETED — idempotency check - register: result - vyos.rest.vyos_logging_global: - state: deleted - -- name: ASSERT — deleted idempotent - assert: - that: - - result.changed == false +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..c081853 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/_populate_config.yaml @@ -0,0 +1,21 @@ +--- +- name: Populate logging_global config for testing + vyos.rest.vyos_logging_global: + config: + console: + facilities: + - facility: local7 + severity: err + hosts: + - hostname: 172.16.0.1 + port: 514 + facilities: + - facility: local7 + severity: all + global_params: + facilities: + - facility: cron + severity: debug + preserve_fqdn: true + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..14975a5 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/_remove_config.yaml @@ -0,0 +1,5 @@ +--- +- name: Remove pre-existing logging_global config + vyos.rest.vyos_logging_global: + state: deleted + ignore_errors: true diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..8c62627 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/deleted.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_logging_global deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all logging_global configuration + register: result + vyos.rest.vyos_logging_global: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Delete logging_global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_logging_global: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..667c088 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/gathered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START vyos_logging_global gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Gather logging_global configuration + register: result + vyos.rest.vyos_logging_global: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered is defined + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/merged.yaml new file mode 100644 index 0000000..daa1c2a --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/merged.yaml @@ -0,0 +1,44 @@ +--- +- debug: + msg: START vyos_logging_global merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge logging_global configuration + register: result + vyos.rest.vyos_logging_global: &id001 + config: + console: + facilities: + - facility: local7 + severity: err + hosts: + - hostname: 172.16.0.1 + port: 514 + facilities: + - facility: local7 + severity: all + global_params: + facilities: + - facility: cron + severity: debug + preserve_fqdn: true + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge logging_global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_logging_global: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..a1c24c0 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/replaced.yaml @@ -0,0 +1,33 @@ +--- +- debug: + msg: START vyos_logging_global replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Replace logging_global configuration + register: result + vyos.rest.vyos_logging_global: &id001 + config: + console: + facilities: + - facility: local6 + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace logging_global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_logging_global: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/vars/main.yaml b/tests/integration/targets/vyos_logging_global/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here diff --git a/tests/integration/targets/vyos_prefix_lists.old/aliases b/tests/integration/targets/vyos_prefix_lists.old/aliases new file mode 100644 index 0000000..cc0afef --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists.old/aliases @@ -0,0 +1 @@ +network/vyos diff --git a/tests/integration/targets/vyos_prefix_lists.old/tasks/main.yaml b/tests/integration/targets/vyos_prefix_lists.old/tasks/main.yaml new file mode 100644 index 0000000..e5c62cd --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists.old/tasks/main.yaml @@ -0,0 +1,144 @@ +--- +# tests/integration/targets/vyos_prefix_lists/tasks/main.yaml + +- name: TEARDOWN — delete all prefix lists before tests + vyos.rest.vyos_prefix_lists: + state: deleted + +# ------------------------------------------------------------------ +# MERGED +# ------------------------------------------------------------------ + +- name: MERGED — create prefix lists + register: result + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: PL configured by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + - sequence: 3 + action: deny + prefix: 72.168.2.0/24 + ge: 26 + - afi: ipv6 + prefix_lists: + - name: AllowIPv6Prefix + description: Configured by ansible for allowing IPv6 networks + entries: + - sequence: 5 + action: permit + prefix: 2001:db8:8000::/35 + le: 37 + state: merged + +- name: ASSERT — merged changed + assert: + that: + - result.changed == true + +- name: MERGED — idempotency check + register: result + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: PL configured by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + - sequence: 3 + action: deny + prefix: 72.168.2.0/24 + ge: 26 + state: merged + +- name: ASSERT — merged idempotent + assert: + that: + - result.changed == false + - result.commands | length == 0 + +# ------------------------------------------------------------------ +# GATHERED +# ------------------------------------------------------------------ + +- name: GATHERED — read current prefix lists + register: result + vyos.rest.vyos_prefix_lists: + state: gathered + +- name: ASSERT — gathered has ipv4 entry + assert: + that: + - result.gathered | selectattr('afi','eq','ipv4') | list | length > 0 + +# ------------------------------------------------------------------ +# REPLACED +# ------------------------------------------------------------------ + +- name: REPLACED — replace AnsibleIPv4PrefixList + register: result + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + entries: + - sequence: 10 + action: permit + prefix: 10.0.0.0/8 + state: replaced + +- name: ASSERT — replaced changed + assert: + that: + - result.changed == true + +- name: REPLACED — idempotency check + register: result + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + entries: + - sequence: 10 + action: permit + prefix: 10.0.0.0/8 + state: replaced + +- name: ASSERT — replaced idempotent + assert: + that: + - result.changed == false + +# ------------------------------------------------------------------ +# DELETED +# ------------------------------------------------------------------ + +- name: DELETED — remove specific prefix list + register: result + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + state: deleted + +- name: ASSERT — deleted changed + assert: + that: + - result.changed == true + +- name: DELETED — remove all remaining + vyos.rest.vyos_prefix_lists: + state: deleted diff --git a/tests/integration/targets/vyos_prefix_lists/defaults/main.yaml b/tests/integration/targets/vyos_prefix_lists/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_prefix_lists/tasks/httpapi.yaml b/tests/integration/targets/vyos_prefix_lists/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_prefix_lists/tasks/main.yaml b/tests/integration/targets/vyos_prefix_lists/tasks/main.yaml index e5c62cd..b1f6193 100644 --- a/tests/integration/targets/vyos_prefix_lists/tasks/main.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tasks/main.yaml @@ -1,144 +1,5 @@ --- -# tests/integration/targets/vyos_prefix_lists/tasks/main.yaml - -- name: TEARDOWN — delete all prefix lists before tests - vyos.rest.vyos_prefix_lists: - state: deleted - -# ------------------------------------------------------------------ -# MERGED -# ------------------------------------------------------------------ - -- name: MERGED — create prefix lists - register: result - vyos.rest.vyos_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: AnsibleIPv4PrefixList - description: PL configured by ansible - entries: - - sequence: 2 - action: permit - prefix: 92.168.10.0/26 - le: 32 - - sequence: 3 - action: deny - prefix: 72.168.2.0/24 - ge: 26 - - afi: ipv6 - prefix_lists: - - name: AllowIPv6Prefix - description: Configured by ansible for allowing IPv6 networks - entries: - - sequence: 5 - action: permit - prefix: 2001:db8:8000::/35 - le: 37 - state: merged - -- name: ASSERT — merged changed - assert: - that: - - result.changed == true - -- name: MERGED — idempotency check - register: result - vyos.rest.vyos_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: AnsibleIPv4PrefixList - description: PL configured by ansible - entries: - - sequence: 2 - action: permit - prefix: 92.168.10.0/26 - le: 32 - - sequence: 3 - action: deny - prefix: 72.168.2.0/24 - ge: 26 - state: merged - -- name: ASSERT — merged idempotent - assert: - that: - - result.changed == false - - result.commands | length == 0 - -# ------------------------------------------------------------------ -# GATHERED -# ------------------------------------------------------------------ - -- name: GATHERED — read current prefix lists - register: result - vyos.rest.vyos_prefix_lists: - state: gathered - -- name: ASSERT — gathered has ipv4 entry - assert: - that: - - result.gathered | selectattr('afi','eq','ipv4') | list | length > 0 - -# ------------------------------------------------------------------ -# REPLACED -# ------------------------------------------------------------------ - -- name: REPLACED — replace AnsibleIPv4PrefixList - register: result - vyos.rest.vyos_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: AnsibleIPv4PrefixList - entries: - - sequence: 10 - action: permit - prefix: 10.0.0.0/8 - state: replaced - -- name: ASSERT — replaced changed - assert: - that: - - result.changed == true - -- name: REPLACED — idempotency check - register: result - vyos.rest.vyos_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: AnsibleIPv4PrefixList - entries: - - sequence: 10 - action: permit - prefix: 10.0.0.0/8 - state: replaced - -- name: ASSERT — replaced idempotent - assert: - that: - - result.changed == false - -# ------------------------------------------------------------------ -# DELETED -# ------------------------------------------------------------------ - -- name: DELETED — remove specific prefix list - register: result - vyos.rest.vyos_prefix_lists: - config: - - afi: ipv4 - prefix_lists: - - name: AnsibleIPv4PrefixList - state: deleted - -- name: ASSERT — deleted changed - assert: - that: - - result.changed == true - -- name: DELETED — remove all remaining - vyos.rest.vyos_prefix_lists: - state: deleted +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..9d73f0b --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_populate_config.yaml @@ -0,0 +1,28 @@ +--- +- name: Populate prefix_lists config for testing + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: PL configured by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + - sequence: 3 + action: deny + prefix: 72.168.2.0/24 + ge: 26 + - afi: ipv6 + prefix_lists: + - name: AllowIPv6Prefix + description: Configured by ansible for allowing IPv6 networks + entries: + - sequence: 5 + action: permit + prefix: 2001:db8:8000::/35 + le: 37 + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..043fb3e --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_remove_config.yaml @@ -0,0 +1,5 @@ +--- +- name: Remove pre-existing prefix_lists config + vyos.rest.vyos_prefix_lists: + state: deleted + ignore_errors: true diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..6cfb063 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_prefix_lists deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all prefix_lists configuration + register: result + vyos.rest.vyos_prefix_lists: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Delete prefix_lists configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_prefix_lists: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..083cb48 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START vyos_prefix_lists gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Gather prefix_lists configuration + register: result + vyos.rest.vyos_prefix_lists: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered | selectattr('afi','eq','ipv4') | list | length > 0 + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.yaml new file mode 100644 index 0000000..a70f826 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.yaml @@ -0,0 +1,42 @@ +--- +- debug: + msg: START vyos_prefix_lists merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge prefix_lists configuration + register: result + vyos.rest.vyos_prefix_lists: &id001 + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: PL configured by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + - sequence: 3 + action: deny + prefix: 72.168.2.0/24 + ge: 26 + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge prefix_lists configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_prefix_lists: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..bd8c5c1 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: START vyos_prefix_lists replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Replace prefix_lists configuration + register: result + vyos.rest.vyos_prefix_lists: &id001 + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + entries: + - sequence: 10 + action: permit + prefix: 10.0.0.0/8 + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace prefix_lists configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_prefix_lists: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_prefix_lists/vars/main.yaml b/tests/integration/targets/vyos_prefix_lists/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here diff --git a/tests/integration/targets/vyos_route_maps/defaults/main.yaml b/tests/integration/targets/vyos_route_maps/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_route_maps/tasks/httpapi.yaml b/tests/integration/targets/vyos_route_maps/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_route_maps/tasks/main.yaml b/tests/integration/targets/vyos_route_maps/tasks/main.yaml index e8171dd..b1f6193 100644 --- a/tests/integration/targets/vyos_route_maps/tasks/main.yaml +++ b/tests/integration/targets/vyos_route_maps/tasks/main.yaml @@ -1,133 +1,5 @@ --- -# tests/integration/targets/vyos_route_maps/tasks/main.yaml - -- name: TEARDOWN — delete all route maps before tests - vyos.rest.vyos_route_maps: - state: deleted - -# ------------------------------------------------------------------ -# MERGED -# ------------------------------------------------------------------ - -- name: MERGED — create route map - register: result - vyos.rest.vyos_route_maps: - config: - - route_map: RM-TEST-EXPORT-POLICY - entries: - - sequence: 10 - action: permit - match: - peer: 192.0.2.32 - set: - metric: "5" - as_path_exclude: "111" - aggregator: - as: 100 - state: merged - -- name: ASSERT — merged changed - assert: - that: - - result.changed == true - -- name: MERGED — idempotency check - register: result - vyos.rest.vyos_route_maps: - config: - - route_map: RM-TEST-EXPORT-POLICY - entries: - - sequence: 10 - action: permit - match: - peer: 192.0.2.32 - set: - metric: "5" - as_path_exclude: "111" - aggregator: - as: 100 - state: merged - -- name: ASSERT — merged idempotent - assert: - that: - - result.changed == false - - result.commands | length == 0 - -# ------------------------------------------------------------------ -# GATHERED -# ------------------------------------------------------------------ - -- name: GATHERED — read current route maps - register: result - vyos.rest.vyos_route_maps: - state: gathered - -- name: ASSERT — gathered has expected route map - assert: - that: - - result.gathered | selectattr('route_map','eq','RM-TEST-EXPORT-POLICY') | list | length == 1 - -# ------------------------------------------------------------------ -# REPLACED -# ------------------------------------------------------------------ - -- name: REPLACED — replace route map with updated set - register: result - vyos.rest.vyos_route_maps: - config: - - route_map: RM-TEST-EXPORT-POLICY - entries: - - sequence: 10 - action: permit - set: - metric: "10" - state: replaced - -- name: ASSERT — replaced changed - assert: - that: - - result.changed == true - -- name: REPLACED — idempotency check - register: result - vyos.rest.vyos_route_maps: - config: - - route_map: RM-TEST-EXPORT-POLICY - entries: - - sequence: 10 - action: permit - set: - metric: "10" - state: replaced - -- name: ASSERT — replaced idempotent - assert: - that: - - result.changed == false - -# ------------------------------------------------------------------ -# DELETED -# ------------------------------------------------------------------ - -- name: DELETED — remove specific route map - register: result - vyos.rest.vyos_route_maps: - config: - - route_map: RM-TEST-EXPORT-POLICY - state: deleted - -- name: ASSERT — deleted changed - assert: - that: - - result.changed == true - -- name: DELETED — idempotency check - register: result - vyos.rest.vyos_route_maps: - state: deleted - -- name: ASSERT — deleted idempotent - assert: - that: - - result.changed == false +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..adcaf55 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/_populate_config.yaml @@ -0,0 +1,17 @@ +--- +- name: Populate route_maps config for testing + vyos.rest.vyos_route_maps: + config: + - route_map: RM-TEST-EXPORT-POLICY + entries: + - sequence: 10 + action: permit + match: + peer: 192.0.2.32 + set: + metric: "5" + as_path_exclude: "111" + aggregator: + as: 100 + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..de02f54 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/_remove_config.yaml @@ -0,0 +1,5 @@ +--- +- name: Remove pre-existing route_maps config + vyos.rest.vyos_route_maps: + state: deleted + ignore_errors: true diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..ec80b23 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/deleted.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_route_maps deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all route_maps configuration + register: result + vyos.rest.vyos_route_maps: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Delete route_maps configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_route_maps: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..494a23e --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/gathered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START vyos_route_maps gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Gather route_maps configuration + register: result + vyos.rest.vyos_route_maps: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered | selectattr('route_map','eq','RM-TEST-EXPORT-POLICY') | list | length == 1 + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/merged.yaml new file mode 100644 index 0000000..c8c9474 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/merged.yaml @@ -0,0 +1,40 @@ +--- +- debug: + msg: START vyos_route_maps merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge route_maps configuration + register: result + vyos.rest.vyos_route_maps: &id001 + config: + - route_map: RM-TEST-EXPORT-POLICY + entries: + - sequence: 10 + action: permit + match: + peer: 192.0.2.32 + set: + metric: "5" + as_path_exclude: "111" + aggregator: + as: 100 + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge route_maps configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_route_maps: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..dece9a8 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/replaced.yaml @@ -0,0 +1,36 @@ +--- +- debug: + msg: START vyos_route_maps replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Replace route_maps configuration + register: result + vyos.rest.vyos_route_maps: &id001 + config: + - route_map: RM-TEST-EXPORT-POLICY + entries: + - sequence: 10 + action: permit + set: + metric: "10" + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace route_maps configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_route_maps: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/vars/main.yaml b/tests/integration/targets/vyos_route_maps/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here diff --git a/tests/integration/targets/vyos_snmp_server/defaults/main.yaml b/tests/integration/targets/vyos_snmp_server/defaults/main.yaml new file mode 100644 index 0000000..164afea --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml b/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml new file mode 100644 index 0000000..4147e6d --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all httpapi test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/httpapi" + patterns: "{{ testcase }}.yaml" + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" + vars: + ansible_connection: ansible.netcommon.httpapi + ansible_network_os: vyos.rest.vyos + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_snmp_server/tasks/main.yaml b/tests/integration/targets/vyos_snmp_server/tasks/main.yaml new file mode 100644 index 0000000..b1f6193 --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tasks/main.yaml @@ -0,0 +1,5 @@ +--- +- name: Run httpapi tests + ansible.builtin.include_tasks: httpapi.yaml + tags: + - httpapi diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/_populate_config.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/_populate_config.yaml new file mode 100644 index 0000000..c847765 --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/_populate_config.yaml @@ -0,0 +1,15 @@ +--- +- name: Populate snmp_server config for testing + vyos.rest.vyos_snmp_server: + config: + communities: + - name: switches + authorization_type: rw + - name: bridges + clients: + - 1.1.1.1 + contact: admin@example.com + listen_addresses: + - address: 20.1.1.1 + state: merged + ignore_errors: true diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/_remove_config.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/_remove_config.yaml new file mode 100644 index 0000000..c77493a --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/_remove_config.yaml @@ -0,0 +1,5 @@ +--- +- name: Remove pre-existing snmp_server config + vyos.rest.vyos_snmp_server: + state: deleted + ignore_errors: true diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml new file mode 100644 index 0000000..90ee0ae --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START vyos_snmp_server deleted integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Delete all snmp_server configuration + register: result + vyos.rest.vyos_snmp_server: &id001 + state: deleted + + - assert: + that: + - result.changed == true + + - name: Delete snmp_server configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_snmp_server: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml new file mode 100644 index 0000000..740446f --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: START vyos_snmp_server gathered integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Gather snmp_server configuration + register: result + vyos.rest.vyos_snmp_server: + state: gathered + + - assert: + that: + - result.changed == false + - result.gathered is defined + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/merged.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/merged.yaml new file mode 100644 index 0000000..475b5fe --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/merged.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START vyos_snmp_server merged integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: Merge snmp_server configuration + register: result + vyos.rest.vyos_snmp_server: &id001 + config: + communities: + - name: switches + authorization_type: rw + - name: bridges + clients: + - 1.1.1.1 + contact: admin@example.com + listen_addresses: + - address: 20.1.1.1 + state: merged + + - assert: + that: + - result.changed == true + + - name: Merge snmp_server configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_snmp_server: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..cd9bef2 --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START vyos_snmp_server replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Replace snmp_server configuration + register: result + vyos.rest.vyos_snmp_server: &id001 + config: + communities: + - name: routers + authorization_type: ro + location: "RDU, NC" + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace snmp_server configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_snmp_server: *id001 + + - name: Assert idempotent + assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/vars/main.yaml b/tests/integration/targets/vyos_snmp_server/vars/main.yaml new file mode 100644 index 0000000..4303881 --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/vars/main.yaml @@ -0,0 +1,2 @@ +--- +# only common vars here -- cgit v1.2.3