summaryrefslogtreecommitdiff
path: root/PR408_README.md
blob: 0423b56fb347035409edeb61f5ae26e30b4260c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# ๐Ÿ“ฆ Pull Request Documentation

## ๐Ÿงพ Summary

<!-- Brief explanation of what this PR does and why. -->

This is a new Ansible module to manage VyOS VRF configuration as requested by https://vyos.dev/T6836

---

## ๐Ÿ” Implementation

<!-- Link to related issues or tasks -->

The module implements a set of VyOS 1.4.2 and 1.5.x commands related to VRF configuration, described in https://docs.vyos.io/en/1.4/configuration/vrf/index.html
The module allows to configure a global attribute (bind-all), as well as, VRF instance configuration.

The structure of the parameters is depicted below
![Diagram](pr408-diagram.png)

The module supports the following states:

- "deleted"
- "merged"
- "replaced"
- "overridden"
- "gathered"
- "rendered"
- "parsed"

---

## ๐Ÿ“ Examples

### Replaced (to demo individual attribute processing)

Initial coonfiguration

```
 - set vrf bind-to-all
  - set vrf name vrf-blue description 'blue-vrf'
  - set vrf name vrf-blue table '100'
  - set vrf name vrf-blue vni '1000'
  - set vrf name vrf-red description 'red-vrf'
  - set vrf name vrf-red disable
  - set vrf name vrf-red ip disable-forwarding
  - set vrf name vrf-red ip protocol kernel route-map 'rm1'
  - set vrf name vrf-red ip protocol rip route-map 'rm1'
  - set vrf name vrf-red ipv6 nht no-resolve-via-default
  - set vrf name vrf-red table '101'
  - set vrf name vrf-red vni '1001'
  - set vrf name vrf-pink table 111
  - set vrf name vrf-pink vni 1111
  - set vrf name vrf-pink description pink-vrf
  - set vrf name vrf-pink protocols bgp system-as 65000
  - set vrf name vrf-pink protocols bgp neighbor 192.0.2.1 remote-as 65002
  - set vrf name vrf-pink protocols bgp neighbor 1.1.1.3 passive
  - set vrf name vrf-pink protocols bgp neighbor 1.1.1.3 remote-as 400
  - set vrf name vrf-pink protocols ospf log-adjacency-changes 'detail'
  - set vrf name vrf-pink protocols ospf max-metric router-lsa administrative
  - set vrf name vrf-pink protocols ospf max-metric router-lsa on-shutdown 10
  - set vrf name vrf-pink protocols ospf max-metric router-lsa on-startup 10
  - set vrf name vrf-pink protocols ospf default-information originate always
  - set vrf name vrf-pink protocols ospf default-information originate metric 10
  - set vrf name vrf-pink protocols ospf default-information originate metric-type 2
  - set vrf name vrf-pink protocols ospf mpls-te router-address '192.0.11.12'
  - set vrf name vrf-pink protocols ospf auto-cost reference-bandwidth '2'
  - set vrf name vrf-pink protocols ospf neighbor 192.0.11.12
  - set vrf name vrf-pink protocols ospf neighbor 192.0.11.12 poll-interval 10
  - set vrf name vrf-pink protocols ospf neighbor 192.0.11.12 priority 2
  - set vrf name vrf-pink protocols ospf redistribute bgp
  - set vrf name vrf-pink protocols ospf redistribute bgp metric 10
  - set vrf name vrf-pink protocols ospf redistribute bgp metric-type 2
  - set vrf name vrf-pink protocols ospf parameters router-id '192.0.1.1'
  - set vrf name vrf-pink protocols ospf parameters rfc1583-compatibility
  - set vrf name vrf-pink protocols ospf parameters abr-type 'cisco'
  - set vrf name vrf-pink protocols ospf area '2'
  - set vrf name vrf-pink protocols ospf area 2 area-type normal
  - set vrf name vrf-pink protocols ospf area 2 authentication plaintext-password
  - set vrf name vrf-pink protocols ospf area 2 shortcut enable
  - set vrf name vrf-pink protocols ospf area '3'
  - set vrf name vrf-pink protocols ospf area 3 area-type nssa
  - set vrf name vrf-pink protocols ospf area '4'
  - set vrf name vrf-pink protocols ospf area 4 area-type stub default-cost 20
  - set vrf name vrf-pink protocols ospf area 4 network 192.0.2.0/24
  - set vrf name vrf-pink protocols ospf area 4 range 192.0.3.0/24
  - set vrf name vrf-pink protocols ospf area 4 range 192.0.3.0/24 cost 10
  - set vrf name vrf-pink protocols ospf area 4 range 192.0.4.0/24
  - set vrf name vrf-pink protocols ospf area 4 range 192.0.4.0/24 cost 12
  - set vrf name vrf-pink protocols ospfv3 area '2'
  - set vrf name vrf-pink protocols ospfv3 area 2 export-list export1
  - set vrf name vrf-pink protocols ospfv3 area 2 import-list import1
  - set vrf name vrf-pink protocols ospfv3 area 2 range 2001:db10::/32
  - set vrf name vrf-pink protocols ospfv3 area 2 range 2001:db20::/32
  - set vrf name vrf-pink protocols ospfv3 area 2 range 2001:db30::/32
  - set vrf name vrf-pink protocols ospfv3 area '3'
  - set vrf name vrf-pink protocols ospfv3 area 3 range 2001:db40::/32
  - set vrf name vrf-pink protocols ospfv3 parameters router-id '192.0.2.10'
  - set vrf name vrf-pink protocols ospfv3 redistribute bgp
  - set vrf name vrf-pink protocols static route 192.0.2.0/24
  - set vrf name vrf-pink protocols static route 192.0.2.0/24 blackhole distance '10'
  - set vrf name vrf-pink protocols static route 192.0.2.0/24 next-hop '203.0.113.1'
  - set vrf name vrf-pink protocols static route 192.0.2.0/24 next-hop '203.0.113.2'
  - set vrf name vrf-pink protocols static route6 2001:db8::/32
  - set vrf name vrf-pink protocols static route6 2001:db8::/32 blackhole distance '20'
  - set vrf name vrf-pink protocols static route6 2001:db8::/32 next-hop '2001:db8::1'
```

Module configuration

```yaml
vyos.vyos.vyos_vrf:
  config:
    instances:
      - name: "vrf-blue"
        description: "blue-vrf"
        disable: true
        table_id: 100
        vni: 1000
      - name: "vrf-red"
        description: "Vermillion_VRF"
        disable: false
        table_id: 101
        vni: 1011
        address_family:
          - afi: "ipv6"
            nht_no_resolve_via_default: false
      - name: "vrf-pink"
        table_id: 111
        protocols:
          ospf:
            default_information:
              originate:
                always: true
                metric: 20
                metric_type: 1
  state: replaced
```

Will result in

````
- delete vrf bind-to-all
- set vrf name vrf-blue disable
- set vrf name vrf-red vni 1011
- set vrf name vrf-red description Vermillion_VRF
- delete vrf name vrf-red disable
- delete vrf name vrf-red ipv6 nht no-resolve-via-default
- delete vrf name vrf-pink vni 1111
- delete vrf name vrf-pink description pink-vrf
- delete vrf name vrf-pink protocols ospf log-adjacency-changes 'detail'
- delete vrf name vrf-pink protocols ospf auto-cost
- delete vrf name vrf-pink protocols ospf max-metric
- delete vrf name vrf-pink protocols ospf mpls-te
- delete vrf name vrf-pink protocols ospf area
- delete vrf name vrf-pink protocols ospf parameters
- delete vrf name vrf-pink protocols ospf neighbor
- delete vrf name vrf-pink protocols ospf redistribute
- set vrf name vrf-pink protocols ospf default-information originate metric 20
- set vrf name vrf-pink protocols ospf default-information originate metric-type 1
```
---
````