summaryrefslogtreecommitdiff
path: root/plugins/modules/vyos_bgp_address_family.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/modules/vyos_bgp_address_family.py')
-rw-r--r--plugins/modules/vyos_bgp_address_family.py279
1 files changed, 139 insertions, 140 deletions
diff --git a/plugins/modules/vyos_bgp_address_family.py b/plugins/modules/vyos_bgp_address_family.py
index ba56309c..d6f89259 100644
--- a/plugins/modules/vyos_bgp_address_family.py
+++ b/plugins/modules/vyos_bgp_address_family.py
@@ -28,6 +28,7 @@ The module file for vyos_bgp_address_family
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
DOCUMENTATION = """
@@ -264,39 +265,39 @@ EXAMPLES = """
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# vyos@vyos:~$
- - name: Merge provided configuration with device configuration
- vyos.vyos.vyos_bgp_address_family:
- config:
- as_number: "100"
- address_family:
- - afi: "ipv4"
- redistribute:
- - protocol: "static"
- metric: 50
- neighbors:
- - neighbor_address: "20.33.1.1/24"
- address_family:
- - afi: "ipv4"
- allowas_in: 4
- as_override: True
- attribute_unchanged:
- med: True
- - afi: "ipv6"
- default_originate: "map01"
- distribute_list:
- - action: "export"
- acl: 10
- - neighbor_address: "100.11.34.12"
- address_family:
- - afi: "ipv4"
- maximum_prefix: 45
- nexthop_self: True
- route_map:
- - action: "export"
- route_map: "map01"
- - action: "import"
- route_map: "map01"
- weight: 50
+- name: Merge provided configuration with device configuration
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "100"
+ address_family:
+ - afi: "ipv4"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "20.33.1.1/24"
+ address_family:
+ - afi: "ipv4"
+ allowas_in: 4
+ as_override: true
+ attribute_unchanged:
+ med: true
+ - afi: "ipv6"
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ - neighbor_address: "100.11.34.12"
+ address_family:
+ - afi: "ipv4"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ - action: "import"
+ route_map: "map01"
+ weight: 50
# After State:
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
@@ -410,33 +411,32 @@ EXAMPLES = """
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight '50'
# vyos@vyos:~$
- - name: Replace provided configuration with device configuration
- vyos.vyos.vyos_bgp_address_family:
- config:
- as_number: "100"
- neighbors:
- - neighbor_address: "100.11.34.12"
- address_family:
- - afi: "ipv4"
- allowas_in: 4
- as_override: True
- attribute_unchanged:
- med: True
- - afi: "ipv6"
- default_originate: "map01"
- distribute_list:
- - action: "export"
- acl: 10
- - neighbor_address: "20.33.1.1/24"
- address_family:
- - afi: "ipv6"
- maximum_prefix: 45
- nexthop_self: True
-
- state: replaced
+- name: Replace provided configuration with device configuration
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "100"
+ neighbors:
+ - neighbor_address: "100.11.34.12"
+ address_family:
+ - afi: "ipv4"
+ allowas_in: 4
+ as_override: true
+ attribute_unchanged:
+ med: true
+ - afi: "ipv6"
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ - neighbor_address: "20.33.1.1/24"
+ address_family:
+ - afi: "ipv6"
+ maximum_prefix: 45
+ nexthop_self: true
+ state: replaced
# After State:
-
+#
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast redistribute static metric '50'
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast
@@ -600,31 +600,31 @@ EXAMPLES = """
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast distribute-list export '10'
# vyos@vyos:~$
- - name: Override
- vyos.vyos.vyos_bgp_address_family:
- config:
- as_number: "100"
- neighbors:
- - neighbor_address: "100.11.34.12"
- address_family:
- - afi: "ipv6"
- maximum_prefix: 45
- nexthop_self: True
- route_map:
- - action: "import"
- route_map: "map01"
- address_family:
- - afi: "ipv4"
- aggregate_address:
- - prefix: "60.9.2.0/24"
- summary_only: True
- - afi: "ipv6"
- redistribute:
- - protocol: "static"
- metric: 50
- state: overridden
+- name: Override
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "100"
+ neighbors:
+ - neighbor_address: "100.11.34.12"
+ address_family:
+ - afi: "ipv6"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "import"
+ route_map: "map01"
+ address_family:
+ - afi: "ipv4"
+ aggregate_address:
+ - prefix: "60.9.2.0/24"
+ summary_only: true
+ - afi: "ipv6"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ state: overridden
-# Aft=validate-moduleser State
+# After State
# vyos@vyos:~$ show configuration commands | match "set protocols bgp"
# set protocols bgp 100 address-family ipv4-unicast aggregate-address 60.9.2.0/24 summary-only
@@ -799,18 +799,18 @@ EXAMPLES = """
# set protocols bgp 100 neighbor 100.11.34.12 address-family ipv6-unicast route-map import 'map01'
# vyos@vyos:~$
- - name: Delete
- vyos.vyos.vyos_bgp_address_family:
- config:
- as_number: "100"
- neighbors:
- - neighbor_address: "20.33.1.1/24"
- address_family:
- - afi: "ipv6"
- - neighbor_address: "100.11.34.12"
- address_family:
- - afi: "ipv4"
- state: deleted
+- name: Delete
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "100"
+ neighbors:
+ - neighbor_address: "20.33.1.1/24"
+ address_family:
+ - afi: "ipv6"
+ - neighbor_address: "100.11.34.12"
+ address_family:
+ - afi: "ipv4"
+ state: deleted
# After State:
@@ -961,12 +961,13 @@ EXAMPLES = """
# set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged next-hop
- - name: parse configs
- vyos.vyos.vyos_bgp_address_family:
- running_config: "{{ lookup('file', './parsed.cfg') }}"
- state: parsed
+- name: parse configs
+ vyos.vyos.vyos_bgp_address_family:
+ running_config: "{{ lookup('file', './parsed.cfg') }}"
+ state: parsed
-# Module Execution:
+# Module execution result:
+#
# "parsed": {
# "address_family": [
# {
@@ -1044,12 +1045,12 @@ EXAMPLES = """
# set protocols bgp 100 neighbor 20.33.1.1/24 address-family ipv4-unicast attribute-unchanged med
# set protocols bgp 100 neighbor 100.11.34.12
- - name: gather configs
- vyos.vyos.vyos_bgp_address_family:
- state: gathered
-
-# Module Execution:
+- name: gather configs
+ vyos.vyos.vyos_bgp_address_family:
+ state: gathered
+# Module execution result:
+#
# "gathered": {
# "address_family": [
# {
@@ -1108,40 +1109,40 @@ EXAMPLES = """
# Using rendered:
- - name: Render
- vyos.vyos.vyos_bgp_address_family:
- config:
- as_number: "100"
- address_family:
- - afi: "ipv4"
- redistribute:
- - protocol: "static"
- metric: 50
- neighbors:
- - neighbor_address: "20.33.1.1/24"
- address_family:
- - afi: "ipv4"
- allowas_in: 4
- as_override: True
- attribute_unchanged:
- med: True
- - afi: "ipv6"
- default_originate: "map01"
- distribute_list:
- - action: "export"
- acl: 10
- - neighbor_address: "100.11.34.12"
- address_family:
- - afi: "ipv4"
- maximum_prefix: 45
- nexthop_self: True
- route_map:
- - action: "export"
- route_map: "map01"
- - action: "import"
- route_map: "map01"
- weight: 50
- state: rendered
+- name: Render
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "100"
+ address_family:
+ - afi: "ipv4"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "20.33.1.1/24"
+ address_family:
+ - afi: "ipv4"
+ allowas_in: 4
+ as_override: true
+ attribute_unchanged:
+ med: true
+ - afi: "ipv6"
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ - neighbor_address: "100.11.34.12"
+ address_family:
+ - afi: "ipv4"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ - action: "import"
+ route_map: "map01"
+ weight: 50
+ state: rendered
# Module Execution:
@@ -1158,8 +1159,6 @@ EXAMPLES = """
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast route-map import map01",
# "set protocols bgp 100 neighbor 100.11.34.12 address-family ipv4-unicast weight 50"
# ]
-
-
"""
from ansible.module_utils.basic import AnsibleModule