.. _vyos.rest.vyos_vrf_module: ****************** vyos.rest.vyos_vrf ****************** **Manage VRF configuration on VyOS devices using REST API** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Manages Virtual Routing and Forwarding (VRF) instances on VyOS devices via the REST API. - Supports merged, replaced, overridden, deleted, and gathered states. - Protocol configuration within VRFs (BGP, OSPFv2, static routes) is managed inline with focused scope (core fields only). Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
dictionary
VRF configuration.
bind_to_all
boolean
    Choices:
  • no
  • yes
Enable binding services to all VRFs.
Whether omitting this option preserves the current device setting depends on state. With merged, and with deleted when specific instances are named, omission leaves it untouched. With replaced or overridden, omission deletes an existing setting, since those states replace everything not explicitly present in config. With deleted and no instances given, the entire VRF configuration (including this setting) is removed.
Only set this explicitly (true or false) when you want this module to manage it under merged or deleted with named instances.
instances
list / elements=dictionary
List of VRF instances.
address_family
list / elements=dictionary
Address family configuration.
afi
string / required
    Choices:
  • ipv4
  • ipv6
Address family identifier.
disable_forwarding
boolean
    Choices:
  • no ←
  • yes
Disable IP forwarding for this address family.
nht_no_resolve_via_default
boolean
    Choices:
  • no ←
  • yes
Disable next-hop resolution via default route.
route_maps
list / elements=dictionary
Route maps applied per protocol.
protocol
string / required
    Choices:
  • any
  • babel
  • bgp
  • eigrp
  • isis
  • ospf
  • rip
  • static
Protocol to which the route map applies.
rm_name
string / required
Route map name.
description
string
VRF description.
disable
boolean
    Choices:
  • no ←
  • yes
Administratively disable this VRF.
name
string / required
VRF instance name.
protocols
dictionary
Protocol configuration within this VRF instance.
bgp
dictionary
BGP protocol configuration (core fields only).
neighbor
list / elements=dictionary
BGP neighbors.
address
string / required
Neighbor IP address.
description
string
Neighbor description.
remote_as
integer
Neighbor AS number.
system_as
integer
BGP autonomous system number.
ospf
dictionary
OSPFv2 protocol configuration (core fields only).
areas
list / elements=dictionary
OSPF areas.
area_id
string / required
OSPF area identifier.
networks
list / elements=string
Networks in this area.
parameters
dictionary
OSPF parameters.
router_id
string
OSPF router ID.
static
dictionary
Static routes configuration.
routes
list / elements=dictionary
Static routes.
dest
string / required
Destination prefix.
next_hops
list / elements=string
Next-hop IP addresses.
table_id
integer
Routing table ID associated with this VRF.
The device enforces the valid range and rejects an invalid value with its own error message.
VyOS does not support changing an existing VRF's table ID in place -- it must be deleted and recreated. state=merged and state=replaced fail with a clear error if this differs from the current device value, rather than silently deleting and recreating the VRF. Use state=overridden (which deletes and recreates the VRF, re-applying every other desired field, since it already replaces everything to match config), or explicitly run state=deleted followed by state=merged/replaced as separate tasks.
vni
integer
Virtual Network Identifier.
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
  • gathered
Desired state of the VRF configuration.

Examples -------- .. code-block:: yaml - name: Merge VRF instances vyos.rest.vyos_vrf: config: bind_to_all: true instances: - name: vrf1 description: Red VRF table_id: 101 vni: 501 protocols: bgp: system_as: 65001 neighbor: - address: 10.0.0.1 remote_as: 65002 ospf: areas: - area_id: "0" networks: - 10.0.0.0/24 parameters: router_id: 10.0.0.1 static: routes: - dest: 192.168.10.0/24 next_hops: - 10.0.0.254 state: merged - name: Delete specific VRF vyos.rest.vyos_vrf: config: instances: - name: vrf1 state: deleted - name: Delete all VRF configuration vyos.rest.vyos_vrf: state: deleted - name: Gather current VRF configuration vyos.rest.vyos_vrf: state: gathered Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
dictionary
when changed
VRF configuration after this module ran.

before
dictionary
state is not gathered
VRF configuration before this module ran.

commands
list
state is not gathered
List of API command tuples sent to the device, or that would be sent (in check mode).

gathered
dictionary
when state is gathered
Current VRF configuration as structured data.

saved
boolean
when changed
Whether the config was saved after changes.



Status ------ Authors ~~~~~~~ - VyOS Community (@vyos)