Compare commits

...

12 Commits

Author SHA1 Message Date
12d927d460 fix: add human_friendly_id to 4 schemas for idempotent Repository sync (#29)
## Summary

- Add `local_identifier` attribute + `uniqueness_constraints` + `human_friendly_id` to **InfraVlanVniMapping**, **InfraEVPNInstance**, **InfraMlagInterface**, and **InfraUnderlayLink**, following the same pattern already used for `InfraBGPPeerGroup` and `InfraBGPSession`
- Populate `local_identifier` in all corresponding object YAML files with deterministic composite keys so Infrahub can upsert objects during Repository backend sync instead of creating duplicates

## Schema changes

| Schema file | Model | human_friendly_id |
|---|---|---|
| `infrahub/schemas/vlan_vxlan.yml` | `InfraVlanVniMapping` | `local_identifier__value` |
| `infrahub/schemas/vlan_vxlan.yml` | `InfraEVPNInstance` | `local_identifier__value` |
| `infrahub/schemas/mlag.yml` | `InfraMlagInterface` | `local_identifier__value` |
| `infrahub/schemas/extensions.yml` | `InfraUnderlayLink` | `local_identifier__value` |

## Object file changes

| Object file | Kind | Key format | Example |
|---|---|---|---|
| `infrahub/objects/06-vlans-vxlan.yml` | `InfraVlanVniMapping` | `{device}__vlan{vlan_id}__vni{vni_id}` | `leaf1__vlan40__vni110040` |
| `infrahub/objects/06-vlans-vxlan.yml` | `InfraEVPNInstance` | `{device}__vlan{vlan_id}` | `leaf1__vlan40` |
| `infrahub/objects/12-mlag.yml` | `InfraMlagInterface` | `mlag{id}__{device1}-{device2}` | `mlag1__leaf1-leaf2` |
| `infrahub/objects/14-fabric-links.yml` | `InfraUnderlayLink` | `{local_dev}-{local_intf}__{remote_dev}-{remote_intf}` | `spine1-eth1__leaf1-eth11` |

Note: `InfraMlagInterface` objects (4 entries, one per MLAG pair) and `InfraUnderlayLink` objects (16 entries, all spine↔leaf P2P links) are new additions to their respective files.

## Test plan

- [x] `infrahubctl schema load infrahub/schemas/*.yml` succeeds without errors
- [x] `infrahubctl object load infrahub/objects/06-vlans-vxlan.yml` succeeds
- [x] `infrahubctl object load infrahub/objects/12-mlag.yml` succeeds
- [x] `infrahubctl object load infrahub/objects/14-fabric-links.yml` succeeds
- [x] Re-running the same load is idempotent (no duplicate objects created)
- [x] Gitea Repository backend sync completes without import errors
2026-03-03 16:26:46 +00:00
Damien
370782da62 feat: Update objects list in .infrahub.yml to match infrahub/objects folder
- Swap order of vrfs (10) and bgp-sessions (11) to reflect renumbering
- Add new object files: 13-ipam-links.yml and 14-fabric-links.yml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 20:40:03 +01:00
1dfec839c7 Actualiser .infrahub.yml 2026-03-01 19:38:46 +00:00
833a460ddf Actualiser .infrahub.yml 2026-03-01 18:27:07 +00:00
68b9e88483 docs: Add README for Infrahub transforms (#28)
Adds a concise README in `infrahub/transforms/` documenting the 6 available Jinja2 transforms, usage commands, directory structure, and how to add new transforms.

Reviewed-on: #28
2026-03-01 16:29:40 +00:00
1b918a4cbc feat: Add Infrahub Jinja2 transform for BGP configuration (#23) (#27)
## Summary

Closes #23. Implements a single unified `bgp_yang_transform` covering the complete BGP router stanza for all 10 fabric devices.

**Design decision:** One transform (one query + one template) rather than 4 separate transforms, because all BGP components (process config, peer groups, neighbors, AFs) live under a single `router bgp <ASN>` stanza and must be consistent. This avoids multiple API calls per device and keeps the data model coherent.

| File | Description |
|------|-------------|
| `infrahub/transforms/queries/bgp_intent.gql` | Unified GraphQL query — `InfraBGPRouterConfig` (with peer_groups, sessions) + `InfraBGPAddressFamily` (with active_peer_groups, active_sessions, networks, optional vrf) |
| `infrahub/transforms/templates/bgp_yang.j2` | Jinja2 template — renders `bgp.global`, `bgp.peer_groups`, `bgp.neighbors`, `bgp.address_families`, `bgp.vrf_neighbors`, `bgp.vrf_address_families`; returns `[]` for devices with no BGP config |
| `infrahub/transforms/tests/bgp_yang/test.yml` | Smoke check + unit render tests for leaf1, spine1, leaf7 |
| `infrahub/transforms/tests/bgp_yang/leaf1/` | 3 peer-groups, 5 global neighbors, 2 global AFs |
| `infrahub/transforms/tests/bgp_yang/spine1/` | 1 peer-group (evpn/next-hop-unchanged), 16 neighbors (8 direct underlay + 8 EVPN), IPv4 AF activates individual sessions |
| `infrahub/transforms/tests/bgp_yang/leaf7/` | leaf1 pattern + VRF gold border session (AS 64999) + VRF-scoped IPv4 unicast AF |
| `.infrahub.yml` | Registers `bgp_intent` query and `bgp_yang_transform` |

## Validation

| Device | Expected output |
|--------|----------------|
| `leaf1` | 3 peer-groups, 5 global neighbors (underlay×2, iBGP×1, EVPN×2), 2 AFs, empty VRF sections |
| `spine1` | 1 peer-group (evpn, next-hop-unchanged), 16 neighbors (8 direct with `remote_asn`, 8 EVPN via peer-group), IPv4 AF activates individual sessions |
| `leaf7` | Same as leaf1 (AS 65004) + `vrf_neighbors: [{10.90.90.1, AS 64999, VRF gold}]` + `vrf_address_families: [{ipv4, VRF gold, active_sessions: [10.90.90.1]}]` |

```bash
infrahubctl render bgp_yang_transform device_name=leaf1
infrahubctl render bgp_yang_transform device_name=spine1
infrahubctl render bgp_yang_transform device_name=leaf7
```

## Design notes

- Follows identical conventions to existing transforms (#20–#22)
- All optional relationships (`remote_asn`, `peer_group`, `vrf`, `peer_device`, `update_source`, etc.) wrapped in `is defined and is not none` guards
- `send_community` value `"none"` (schema default) is normalised to `null` in the output — keeps the rendered JSON clean for downstream consumers
- VRF-scoped sessions and AFs are separated into `vrf_neighbors` / `vrf_address_families` arrays, each entry carrying a `"vrf"` key, so the template consumer can trivially iterate per-VRF without filtering
2026-03-01 13:22:51 +00:00
cf7da535ed feat: Add Infrahub Jinja2 transforms for MLAG configuration (#22) (#26)
## Summary

Closes #22. Implements Infrahub Jinja2 transforms for MLAG configuration, generating Arista-native YANG-compatible JSON payloads from Infrahub intent data.

| File | Description |
|------|-------------|
| `infrahub/transforms/queries/mlag_intent.gql` | GraphQL query — fetches `InfraMlagPeerConfig` by `$device_name`, including MLAG domain attributes, peer/iBGP VLANs, local interface SVI, and peer-link LAG |
| `infrahub/transforms/templates/mlag_yang.j2` | Jinja2 template — renders a JSON object targeting `/arista-mlag-augments:mlag/config`; returns `[]` for devices with no MLAG (spines) |
| `infrahub/transforms/tests/mlag_yang/test.yml` | Test spec: smoke check + unit render tests for `leaf1` and `spine1` |
| `infrahub/transforms/tests/mlag_yang/leaf1/` | Mock input + expected output for leaf1 (full MLAG config, domain `leafs-1-2`) |
| `infrahub/transforms/tests/mlag_yang/spine1/` | Mock input (empty edges) + expected output `[]` for spine1 |
| `.infrahub.yml` | Registers `mlag_intent` query and `mlag_yang_transform` jinja2 transform |

## Output shape (leaf1)

```json
{
  "mlag": {
    "config": {
      "domain-id": "leafs-1-2",
      "peer-link": "Port-Channel999",
      "local-interface": "Vlan4090",
      "peer-address": "10.0.199.255",
      "shutdown": false
    },
    "dual_primary_detection": {
      "enabled": true,
      "delay": 10,
      "action": "errdisable",
      "heartbeat_peer_ip": "172.16.0.50",
      "heartbeat_vrf": "mgmt"
    },
    "virtual_mac": "c001.cafe.babe",
    "peer_vlan_id": 4090,
    "ibgp_vlan_id": 4091,
    "local_interface_ip": "10.0.199.254/31"
  }
}
```

## Validation

```bash
infrahubctl render mlag_yang_transform device_name=leaf1   # → MLAG config JSON
infrahubctl render mlag_yang_transform device_name=spine1  # → []
```

## Design notes

- Follows identical conventions to existing transforms (#20 VLAN/interface/VXLAN, #21 VRF/L3VNI)
- All optional relationship accesses wrapped in `is defined and is not none` guards
- Spine/non-MLAG devices return `[]` (empty array) — consistent with the "no data → empty collection" pattern used in vxlan_yang for devices without VTEP
2026-03-01 11:06:55 +00:00
a105e44bbd feat: Add Infrahub Jinja2 transform for VRF/L3VNI configuration (#21) (#25)
## Summary

Implements Infrahub Jinja2 Transform for VRF/L3VNI configuration, generating structured JSON payloads from Infrahub intent data. Closes #21.

## What's included

- **GraphQL query** (`transforms/queries/vrf_intent.gql`): Queries `InfraVRFDeviceAssignment` by device name, fetching VRF details, L3VNI, route targets, and device-specific route distinguisher
- **Jinja2 transform** (`transforms/templates/vrf_yang.j2`): Renders VRF config payloads with defensive null handling (lessons learned from #20)
- **`.infrahub.yml`** updated with the new query and transform definitions
- **Tests** (`transforms/tests/vrf_yang/`) using correct Infrahub pytest format (`jinja2-transform-smoke` + `jinja2-transform-unit-render`)

## Validation

All transforms render correctly:

| Device | Expected | Result |
|--------|----------|--------|
| `leaf3` | VRF gold, RD `10.0.250.13:1`, L3VNI 100001 |  |
| `leaf7` | VRF gold, RD `10.0.250.17:1`, L3VNI 100001 |  |
| `leaf1` | Empty array (no VRF assignment) |  |
| `spine1` | Empty array (no VRF assignment) |  |

## Usage

```bash
# Local debugging
infrahubctl render vrf_yang_transform device_name=leaf3

# API endpoint
GET /api/transform/jinja2/vrf_yang_transform?device_name=leaf3
```

## Related

- Depends on: #20 (base transforms infrastructure, already merged)
- Reference: Arista EVPN Type-5 / L3VXLAN configuration from lab topology
2026-03-01 10:45:01 +00:00
668e9cbada feat: Add Infrahub Jinja2 transforms for VLANs, interfaces, and VXLAN (#20) (#24)
## Summary

Closes #20

Adds Infrahub Jinja2 transforms that query device intent from Infrahub via GraphQL and produce structured JSON payloads (YANG-style) suitable for gNMI Set operations on Arista EOS devices.

- **3 GraphQL queries** — `vlan_intent`, `interface_intent`, `vxlan_intent` — each parameterized by `$device_name`
- **3 Jinja2 templates** — `vlan_yang.j2`, `interface_yang.j2`, `vxlan_yang.j2` — producing JSON arrays/objects from the GraphQL response
- **Integration test fixtures** — one directory per transform with `input.json`, `output.json`, and `test.yml`, using leaf1 from the lab topology as sample device
- **`.infrahub.yml` updated** with `queries` and `jinja2_transforms` sections

## Files added

```
transforms/
├── queries/
│   ├── vlan_intent.gql       # VLANs via VTEP mappings + SVI interfaces
│   ├── interface_intent.gql  # All interface types with IPs
│   └── vxlan_intent.gql      # VTEP config + VLAN/VNI/VRF mappings
├── templates/
│   ├── vlan_yang.j2          # JSON array of VLANs (merged, deduplicated, sorted)
│   ├── interface_yang.j2     # JSON array of interfaces with type discriminator
│   └── vxlan_yang.j2         # JSON object: vtep + vlan_vni + vrf_vni mappings
└── tests/
    ├── vlan_yang/{input,output,test}.{json,yml}
    ├── interface_yang/{input,output,test}.{json,yml}
    └── vxlan_yang/{input,output,test}.{json,yml}
```

## Transform usage

```bash
# Render locally
infrahubctl render vlan_yang_transform device_name=leaf1
infrahubctl render interface_yang_transform device_name=leaf1
infrahubctl render vxlan_yang_transform device_name=leaf1

# Via API
GET /api/transform/jinja2/vlan_yang_transform?device_name=leaf1
GET /api/transform/jinja2/interface_yang_transform?device_name=leaf1
GET /api/transform/jinja2/vxlan_yang_transform?device_name=leaf1
```

## Test plan

- [x] Load branch into Infrahub (`infrahubctl schema load` + `infrahubctl object load`)
- [x] Run `infrahubctl render vlan_yang_transform device_name=leaf1` and verify JSON output matches expected VLANs (40, 4090, 4091)
- [x] Run `infrahubctl render interface_yang_transform device_name=leaf1` and verify all interface types are present with correct attributes
- [x] Run `infrahubctl render vxlan_yang_transform device_name=leaf1` and verify VTEP source address, UDP port, and VLAN-VNI mapping for VLAN 40 / VNI 110040
- [x] Run `infrahubctl render vxlan_yang_transform device_name=leaf3` and verify VRF gold / L3VNI 100001 appears in `vrf_vni_mappings`
- ~~[ ] Verify `infrahubctl test` passes for all three test fixtures~~

Reviewed-on: #24
2026-02-28 17:42:08 +00:00
e00cf517e3 Merge pull request 'Add bidirectional navigation relationships' (#18) from feat/update-identifiers into main
Reviewed-on: #18
2026-02-22 09:27:20 +00:00
Damien
ac1634b561 Add device roles to fabric links 2026-02-22 10:07:27 +01:00
Damien
9a0b6dd1e6 feat(schema): add bidirectional relationship identifiers and fabric-device links
- LocationSite: add devices (device__site) and fabrics (fabric__sites) reverse relationships
- InfraDevice.site: add identifier device__site
- InfraDevice: add fabric relationship (fabric__devices)
- InfraFabric.sites: add identifier fabric__sites; add devices reverse relationship (fabric__devices)
- InfraInterfaceVlan.vlan: add identifier vlan__svi
- InfraVLAN: add svi_interfaces reverse relationship (vlan__svi)
- Add 14-fabric-links.yml to assign all 10 devices to the evpn-lab fabric

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 20:59:10 +01:00
47 changed files with 3631 additions and 10 deletions

View File

@@ -13,6 +13,48 @@ objects:
- infrahub/objects/07-interface-vlans.yml
- infrahub/objects/08-ipam-vlans.yml
- infrahub/objects/09-bgp.yml
- infrahub/objects/10-bgp-sessions.yml
- infrahub/objects/11-vrfs.yml
- infrahub/objects/10-vrfs.yml
- infrahub/objects/11-bgp-sessions.yml
- infrahub/objects/12-mlag.yml
- infrahub/objects/13-ipam-links.yml
- infrahub/objects/14-fabric-links.yml
queries:
- name: vlan_intent
file_path: infrahub/transforms/queries/vlan_intent.gql
- name: interface_intent
file_path: infrahub/transforms/queries/interface_intent.gql
- name: vxlan_intent
file_path: infrahub/transforms/queries/vxlan_intent.gql
- name: vrf_intent
file_path: infrahub/transforms/queries/vrf_intent.gql
- name: mlag_intent
file_path: infrahub/transforms/queries/mlag_intent.gql
- name: bgp_intent
file_path: infrahub/transforms/queries/bgp_intent.gql
jinja2_transforms:
- name: vlan_yang_transform
description: "Generate VLAN configuration payload from Infrahub intent"
query: vlan_intent
template_path: infrahub/transforms/templates/vlan_yang.j2
- name: interface_yang_transform
description: "Generate interface configuration payload from Infrahub intent"
query: interface_intent
template_path: infrahub/transforms/templates/interface_yang.j2
- name: vxlan_yang_transform
description: "Generate VXLAN/VTEP configuration payload from Infrahub intent"
query: vxlan_intent
template_path: infrahub/transforms/templates/vxlan_yang.j2
- name: vrf_yang_transform
description: "Generate VRF/L3VNI configuration payload from Infrahub intent"
query: vrf_intent
template_path: infrahub/transforms/templates/vrf_yang.j2
- name: mlag_yang_transform
description: "Generate MLAG configuration payload from Infrahub intent"
query: mlag_intent
template_path: infrahub/transforms/templates/mlag_yang.j2
- name: bgp_yang_transform
description: "Generate BGP configuration payload from Infrahub intent"
query: bgp_intent
template_path: infrahub/transforms/templates/bgp_yang.j2

View File

@@ -116,19 +116,23 @@ spec:
kind: InfraVlanVniMapping
data:
# VLAN 40 <-> VNI 110040 on leaf1/2/5/6 (L2 VXLAN leafs)
- vtep: ["leaf1"]
- local_identifier: leaf1__vlan40__vni110040
vtep: ["leaf1"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
- vtep: ["leaf2"]
- local_identifier: leaf2__vlan40__vni110040
vtep: ["leaf2"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
- vtep: ["leaf5"]
- local_identifier: leaf5__vlan40__vni110040
vtep: ["leaf5"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
- vtep: ["leaf6"]
- local_identifier: leaf6__vlan40__vni110040
vtep: ["leaf6"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
@@ -140,26 +144,30 @@ spec:
data:
# EVPN instance for VLAN 40 on L2 VXLAN leafs
# leaf1: rd 65001:110040, rt both 40:110040
- device: ["leaf1"]
- local_identifier: leaf1__vlan40
device: ["leaf1"]
vlan: ["40"]
route_distinguisher: "65001:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true
- device: ["leaf2"]
- local_identifier: leaf2__vlan40
device: ["leaf2"]
vlan: ["40"]
route_distinguisher: "65001:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true
# leaf5/6: rd 65003:110040, rt both 40:110040
- device: ["leaf5"]
- local_identifier: leaf5__vlan40
device: ["leaf5"]
vlan: ["40"]
route_distinguisher: "65003:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true
- device: ["leaf6"]
- local_identifier: leaf6__vlan40
device: ["leaf6"]
vlan: ["40"]
route_distinguisher: "65003:110040"
route_target_import: "40:110040"

View File

@@ -512,6 +512,7 @@ spec:
# Spine1 address families
# ============================================================
- bgp_config: ["spine1"]
device: ["spine1"]
local_identifier: "spine1__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -527,6 +528,7 @@ spec:
networks:
- ["10.0.250.1/32"]
- bgp_config: ["spine1"]
device: ["spine1"]
local_identifier: "spine1__evpn_unicast"
afi: evpn
safi: unicast
@@ -536,6 +538,7 @@ spec:
# Spine2 address families
# ============================================================
- bgp_config: ["spine2"]
device: ["spine2"]
local_identifier: "spine2__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -551,6 +554,7 @@ spec:
networks:
- ["10.0.250.2/32"]
- bgp_config: ["spine2"]
device: ["spine2"]
local_identifier: "spine2__evpn_unicast"
afi: evpn
safi: unicast
@@ -560,6 +564,7 @@ spec:
# Leaf1 address families
# ============================================================
- bgp_config: ["leaf1"]
device: ["leaf1"]
local_identifier: "leaf1__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -570,6 +575,7 @@ spec:
- ["10.0.250.11/32"]
- ["10.0.255.11/32"]
- bgp_config: ["leaf1"]
device: ["leaf1"]
local_identifier: "leaf1__evpn_unicast"
afi: evpn
safi: unicast
@@ -579,6 +585,7 @@ spec:
# Leaf2 address families
# ============================================================
- bgp_config: ["leaf2"]
device: ["leaf2"]
local_identifier: "leaf2__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -589,6 +596,7 @@ spec:
- ["10.0.250.12/32"]
- ["10.0.255.11/32"]
- bgp_config: ["leaf2"]
device: ["leaf2"]
local_identifier: "leaf2__evpn_unicast"
afi: evpn
safi: unicast
@@ -598,6 +606,7 @@ spec:
# Leaf3 address families
# ============================================================
- bgp_config: ["leaf3"]
device: ["leaf3"]
local_identifier: "leaf3__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -608,6 +617,7 @@ spec:
- ["10.0.250.13/32"]
- ["10.0.255.12/32"]
- bgp_config: ["leaf3"]
device: ["leaf3"]
local_identifier: "leaf3__evpn_unicast"
afi: evpn
safi: unicast
@@ -617,6 +627,7 @@ spec:
# Leaf4 address families
# ============================================================
- bgp_config: ["leaf4"]
device: ["leaf4"]
local_identifier: "leaf4__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -627,6 +638,7 @@ spec:
- ["10.0.250.14/32"]
- ["10.0.255.12/32"]
- bgp_config: ["leaf4"]
device: ["leaf4"]
local_identifier: "leaf4__evpn_unicast"
afi: evpn
safi: unicast
@@ -636,6 +648,7 @@ spec:
# Leaf5 address families
# ============================================================
- bgp_config: ["leaf5"]
device: ["leaf5"]
local_identifier: "leaf5__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -646,6 +659,7 @@ spec:
- ["10.0.250.15/32"]
- ["10.0.255.13/32"]
- bgp_config: ["leaf5"]
device: ["leaf5"]
local_identifier: "leaf5__evpn_unicast"
afi: evpn
safi: unicast
@@ -655,6 +669,7 @@ spec:
# Leaf6 address families
# ============================================================
- bgp_config: ["leaf6"]
device: ["leaf6"]
local_identifier: "leaf6__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -665,6 +680,7 @@ spec:
- ["10.0.250.16/32"]
- ["10.0.255.13/32"]
- bgp_config: ["leaf6"]
device: ["leaf6"]
local_identifier: "leaf6__evpn_unicast"
afi: evpn
safi: unicast
@@ -674,6 +690,7 @@ spec:
# Leaf7 address families
# ============================================================
- bgp_config: ["leaf7"]
device: ["leaf7"]
local_identifier: "leaf7__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -684,6 +701,7 @@ spec:
- ["10.0.250.17/32"]
- ["10.0.255.14/32"]
- bgp_config: ["leaf7"]
device: ["leaf7"]
local_identifier: "leaf7__evpn_unicast"
afi: evpn
safi: unicast
@@ -691,6 +709,7 @@ spec:
- ["leaf7__evpn"]
# Leaf7 IPv4 unicast in VRF gold (border peering)
- bgp_config: ["leaf7"]
device: ["leaf7"]
local_identifier: "leaf7__vrf_gold__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -701,6 +720,7 @@ spec:
# Leaf8 address families
# ============================================================
- bgp_config: ["leaf8"]
device: ["leaf8"]
local_identifier: "leaf8__ipv4_unicast"
afi: ipv4
safi: unicast
@@ -711,6 +731,7 @@ spec:
- ["10.0.250.18/32"]
- ["10.0.255.14/32"]
- bgp_config: ["leaf8"]
device: ["leaf8"]
local_identifier: "leaf8__evpn_unicast"
afi: evpn
safi: unicast
@@ -718,6 +739,7 @@ spec:
- ["leaf8__evpn"]
# Leaf8 IPv4 unicast in VRF gold (border peering)
- bgp_config: ["leaf8"]
device: ["leaf8"]
local_identifier: "leaf8__vrf_gold__ipv4_unicast"
afi: ipv4
safi: unicast

View File

@@ -132,3 +132,49 @@ spec:
heartbeat_peer_ip: "172.16.0.31"
local_interface: ["leaf8", "Vlan4090"]
peer_link: ["leaf8", "Port-Channel999"]
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraMlagInterface
data:
# MLAG interface 1 on leaf1/leaf2 pair (Port-Channel1 → host1)
- local_identifier: mlag1__leaf1-leaf2
mlag_id: 1
description: "MLAG interface 1 for leaf1/leaf2 pair (host1)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-1-2"]
lag_interfaces:
- ["leaf1", "Port-Channel1"]
- ["leaf2", "Port-Channel1"]
# MLAG interface 1 on leaf3/leaf4 pair (Port-Channel1 → host2)
- local_identifier: mlag1__leaf3-leaf4
mlag_id: 1
description: "MLAG interface 1 for leaf3/leaf4 pair (host2)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-3-4"]
lag_interfaces:
- ["leaf3", "Port-Channel1"]
- ["leaf4", "Port-Channel1"]
# MLAG interface 1 on leaf5/leaf6 pair (Port-Channel1 → host3)
- local_identifier: mlag1__leaf5-leaf6
mlag_id: 1
description: "MLAG interface 1 for leaf5/leaf6 pair (host3)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-5-6"]
lag_interfaces:
- ["leaf5", "Port-Channel1"]
- ["leaf6", "Port-Channel1"]
# MLAG interface 1 on leaf7/leaf8 pair (Port-Channel1 → host4)
- local_identifier: mlag1__leaf7-leaf8
mlag_id: 1
description: "MLAG interface 1 for leaf7/leaf8 pair (host4)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-7-8"]
lag_interfaces:
- ["leaf7", "Port-Channel1"]
- ["leaf8", "Port-Channel1"]

View File

@@ -0,0 +1,210 @@
# Fabric-to-Device links
# Depends on: 02-devices, 03-fabric
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraDevice
data:
- name: spine1
role: spine
fabric: "evpn-lab"
- name: spine2
role: spine
fabric: "evpn-lab"
- name: leaf1
role: leaf
fabric: "evpn-lab"
- name: leaf2
role: leaf
fabric: "evpn-lab"
- name: leaf3
role: leaf
fabric: "evpn-lab"
- name: leaf4
role: leaf
fabric: "evpn-lab"
- name: leaf5
role: leaf
fabric: "evpn-lab"
- name: leaf6
role: leaf
fabric: "evpn-lab"
- name: leaf7
role: leaf
fabric: "evpn-lab"
- name: leaf8
role: leaf
fabric: "evpn-lab"
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraUnderlayLink
data:
# ============================================================
# Spine1 P2P underlay links (Ethernet1-8 → leaf1-8:Ethernet11)
# ============================================================
- local_identifier: spine1-eth1__leaf1-eth11
description: "spine1:Ethernet1 <-> leaf1:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet1"]
local_ip_address: ["10.0.1.0/31"]
remote_device: ["leaf1"]
remote_interface: ["leaf1", "Ethernet11"]
remote_ip_address: ["10.0.1.1/31"]
- local_identifier: spine1-eth2__leaf2-eth11
description: "spine1:Ethernet2 <-> leaf2:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet2"]
local_ip_address: ["10.0.1.2/31"]
remote_device: ["leaf2"]
remote_interface: ["leaf2", "Ethernet11"]
remote_ip_address: ["10.0.1.3/31"]
- local_identifier: spine1-eth3__leaf3-eth11
description: "spine1:Ethernet3 <-> leaf3:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet3"]
local_ip_address: ["10.0.1.4/31"]
remote_device: ["leaf3"]
remote_interface: ["leaf3", "Ethernet11"]
remote_ip_address: ["10.0.1.5/31"]
- local_identifier: spine1-eth4__leaf4-eth11
description: "spine1:Ethernet4 <-> leaf4:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet4"]
local_ip_address: ["10.0.1.6/31"]
remote_device: ["leaf4"]
remote_interface: ["leaf4", "Ethernet11"]
remote_ip_address: ["10.0.1.7/31"]
- local_identifier: spine1-eth5__leaf5-eth11
description: "spine1:Ethernet5 <-> leaf5:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet5"]
local_ip_address: ["10.0.1.8/31"]
remote_device: ["leaf5"]
remote_interface: ["leaf5", "Ethernet11"]
remote_ip_address: ["10.0.1.9/31"]
- local_identifier: spine1-eth6__leaf6-eth11
description: "spine1:Ethernet6 <-> leaf6:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet6"]
local_ip_address: ["10.0.1.10/31"]
remote_device: ["leaf6"]
remote_interface: ["leaf6", "Ethernet11"]
remote_ip_address: ["10.0.1.11/31"]
- local_identifier: spine1-eth7__leaf7-eth11
description: "spine1:Ethernet7 <-> leaf7:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet7"]
local_ip_address: ["10.0.1.12/31"]
remote_device: ["leaf7"]
remote_interface: ["leaf7", "Ethernet11"]
remote_ip_address: ["10.0.1.13/31"]
- local_identifier: spine1-eth8__leaf8-eth11
description: "spine1:Ethernet8 <-> leaf8:Ethernet11"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine1"]
local_interface: ["spine1", "Ethernet8"]
local_ip_address: ["10.0.1.14/31"]
remote_device: ["leaf8"]
remote_interface: ["leaf8", "Ethernet11"]
remote_ip_address: ["10.0.1.15/31"]
# ============================================================
# Spine2 P2P underlay links (Ethernet1-8 → leaf1-8:Ethernet12)
# ============================================================
- local_identifier: spine2-eth1__leaf1-eth12
description: "spine2:Ethernet1 <-> leaf1:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet1"]
local_ip_address: ["10.0.2.0/31"]
remote_device: ["leaf1"]
remote_interface: ["leaf1", "Ethernet12"]
remote_ip_address: ["10.0.2.1/31"]
- local_identifier: spine2-eth2__leaf2-eth12
description: "spine2:Ethernet2 <-> leaf2:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet2"]
local_ip_address: ["10.0.2.2/31"]
remote_device: ["leaf2"]
remote_interface: ["leaf2", "Ethernet12"]
remote_ip_address: ["10.0.2.3/31"]
- local_identifier: spine2-eth3__leaf3-eth12
description: "spine2:Ethernet3 <-> leaf3:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet3"]
local_ip_address: ["10.0.2.4/31"]
remote_device: ["leaf3"]
remote_interface: ["leaf3", "Ethernet12"]
remote_ip_address: ["10.0.2.5/31"]
- local_identifier: spine2-eth4__leaf4-eth12
description: "spine2:Ethernet4 <-> leaf4:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet4"]
local_ip_address: ["10.0.2.6/31"]
remote_device: ["leaf4"]
remote_interface: ["leaf4", "Ethernet12"]
remote_ip_address: ["10.0.2.7/31"]
- local_identifier: spine2-eth5__leaf5-eth12
description: "spine2:Ethernet5 <-> leaf5:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet5"]
local_ip_address: ["10.0.2.8/31"]
remote_device: ["leaf5"]
remote_interface: ["leaf5", "Ethernet12"]
remote_ip_address: ["10.0.2.9/31"]
- local_identifier: spine2-eth6__leaf6-eth12
description: "spine2:Ethernet6 <-> leaf6:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet6"]
local_ip_address: ["10.0.2.10/31"]
remote_device: ["leaf6"]
remote_interface: ["leaf6", "Ethernet12"]
remote_ip_address: ["10.0.2.11/31"]
- local_identifier: spine2-eth7__leaf7-eth12
description: "spine2:Ethernet7 <-> leaf7:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet7"]
local_ip_address: ["10.0.2.12/31"]
remote_device: ["leaf7"]
remote_interface: ["leaf7", "Ethernet12"]
remote_ip_address: ["10.0.2.13/31"]
- local_identifier: spine2-eth8__leaf8-eth12
description: "spine2:Ethernet8 <-> leaf8:Ethernet12"
mtu: 9214
fabric: ["evpn-lab"]
local_device: ["spine2"]
local_interface: ["spine2", "Ethernet8"]
local_ip_address: ["10.0.2.14/31"]
remote_device: ["leaf8"]
remote_interface: ["leaf8", "Ethernet12"]
remote_ip_address: ["10.0.2.15/31"]

View File

@@ -62,6 +62,19 @@ nodes:
kind: Text
optional: true
description: Facility identifier or code
relationships:
- name: devices
peer: InfraDevice
identifier: device__site
cardinality: many
kind: Generic
description: Devices at this site
- name: fabrics
peer: InfraFabric
identifier: fabric__sites
cardinality: many
kind: Generic
description: Fabrics deployed at this site
# ================================================================
# Platform
@@ -145,6 +158,7 @@ nodes:
relationships:
- name: site
peer: LocationSite
identifier: device__site
cardinality: one
optional: true
- name: platform
@@ -164,6 +178,12 @@ nodes:
peer: InfraMlagDomain
cardinality: one
optional: true
- name: fabric
peer: InfraFabric
identifier: fabric__devices
cardinality: one
optional: true
description: Fabric this device belongs to
# ================================================================
# Interface Types (inherit from InfraInterface generic)
@@ -263,6 +283,7 @@ nodes:
relationships:
- name: vlan
peer: InfraVLAN
identifier: vlan__svi
cardinality: one
optional: true

View File

@@ -264,6 +264,12 @@ nodes:
label: Multicast
description: Sub Address Family Identifier
relationships:
- name: device
peer: InfraDevice
cardinality: one
kind: Attribute
optional: false
description: Device this address family belongs to (denormalized for query filtering)
- name: bgp_config
peer: InfraBGPRouterConfig
cardinality: one

View File

@@ -55,8 +55,15 @@ nodes:
description: AS used by spine layer
- name: sites
peer: LocationSite
identifier: fabric__sites
cardinality: many
optional: true
- name: devices
peer: InfraDevice
identifier: fabric__devices
cardinality: many
kind: Generic
description: Devices in this fabric
# ================================================================
# Underlay P2P Link
@@ -67,8 +74,15 @@ nodes:
label: Underlay Link
icon: mdi--cable-data
include_in_menu: false
uniqueness_constraints:
- ["local_identifier__value"]
human_friendly_id:
- local_identifier__value
display_label: "{{ description__value }}"
attributes:
- name: local_identifier
kind: Text
description: "Unique identifier combining local and remote device/interface (e.g. spine1-eth1__leaf1-eth11)"
- name: description
kind: Text
description: Link description (e.g., spine1:eth1 <-> leaf1:eth11)

View File

@@ -114,8 +114,15 @@ nodes:
label: MLAG Interface
icon: mdi--ethernet-cable
include_in_menu: false
uniqueness_constraints:
- ["local_identifier__value"]
human_friendly_id:
- local_identifier__value
display_label: "{{ mlag_id__value }}"
attributes:
- name: local_identifier
kind: Text
description: "Unique identifier combining mlag_id and peer devices (e.g. mlag1__leaf1-leaf2)"
- name: mlag_id
kind: Number
description: MLAG interface ID

View File

@@ -70,6 +70,12 @@ nodes:
peer: LocationSite
cardinality: one
optional: true
- name: svi_interfaces
peer: InfraInterfaceVlan
identifier: vlan__svi
cardinality: many
kind: Generic
description: SVI interfaces for this VLAN
# ================================================================
# VNI (VXLAN Network Identifier)
@@ -168,8 +174,15 @@ nodes:
label: VLAN-VNI Mapping
icon: mdi--swap-horizontal
include_in_menu: false
uniqueness_constraints:
- ["local_identifier__value"]
human_friendly_id:
- local_identifier__value
display_label: "{{ description__value }}"
attributes:
- name: local_identifier
kind: Text
description: "Unique identifier combining device name, VLAN ID and VNI (e.g. leaf1__vlan40__vni110040)"
- name: description
kind: Text
optional: true
@@ -196,8 +209,15 @@ nodes:
label: EVPN Instance
icon: mdi--cloud-sync
include_in_menu: false
uniqueness_constraints:
- ["local_identifier__value"]
human_friendly_id:
- local_identifier__value
display_label: "{{ route_distinguisher__value }}"
attributes:
- name: local_identifier
kind: Text
description: "Unique identifier combining device name and VLAN ID (e.g. leaf1__vlan40)"
- name: route_distinguisher
kind: Text
description: "Route Distinguisher (format: ASN:VNI or IP:VNI)"

View File

@@ -0,0 +1,48 @@
# Infrahub Transforms
Jinja2 transforms that query InfraHub and produce JSON configuration payloads for the EVPN-VXLAN fabric devices.
Each transform follows the same pattern: a **GraphQL query** fetches intent data from InfraHub, and a **Jinja2 template** renders it into a structured JSON payload. Transforms are registered in `.infrahub.yml` at the repository root.
## Available Transforms
| Transform | Query | Scope |
|-----------|-------|-------|
| `vlan_yang_transform` | `vlan_intent` | VLAN definitions per device |
| `interface_yang_transform` | `interface_intent` | Physical/logical interfaces, switchport config |
| `vxlan_yang_transform` | `vxlan_intent` | VXLAN/VTEP tunnel config, VNI mappings |
| `vrf_yang_transform` | `vrf_intent` | VRF instances, L3VNI, route targets |
| `mlag_yang_transform` | `mlag_intent` | MLAG domain, peer-link, dual-primary detection |
| `bgp_yang_transform` | `bgp_intent` | BGP process, peer groups, neighbors, address families |
## Usage
All transforms take a `device_name` parameter:
```bash
# Render a single transform
infrahubctl render vlan_yang_transform device_name=leaf1
infrahubctl render interface_yang_transform device_name=leaf1
infrahubctl render vxlan_yang_transform device_name=leaf1
infrahubctl render vrf_yang_transform device_name=leaf7
infrahubctl render mlag_yang_transform device_name=leaf1
infrahubctl render bgp_yang_transform device_name=spine1
```
Devices without applicable config return `[]` (e.g. `mlag_yang_transform` on a spine, `vxlan_yang_transform` on a non-VTEP device).
## Directory Structure
```
infrahub/transforms/
├── queries/ # GraphQL .gql files
├── templates/ # Jinja2 .j2 files
└── tests/ # Unit test fixtures (mock input + expected output)
```
## Adding a New Transform
1. Create the GraphQL query in `queries/<name>_intent.gql`
2. Create the Jinja2 template in `templates/<name>_yang.j2`
3. Register both in `.infrahub.yml` (query + jinja2_transform)
4. Add test fixtures in `tests/<name>_yang/`

View File

@@ -0,0 +1,105 @@
query BgpIntent($device_name: String!) {
InfraBGPRouterConfig(device__name__value: $device_name) {
edges {
node {
router_id { value }
default_ipv4_unicast { value }
log_neighbor_changes { value }
ecmp_max_paths { value }
ecmp_max_ecmp { value }
ebgp_distance { value }
ibgp_distance { value }
local_distance { value }
local_asn {
node {
asn { value }
}
}
peer_groups {
edges {
node {
name { value }
peer_group_type { value }
update_source { value }
ebgp_multihop { value }
send_community { value }
next_hop_self { value }
next_hop_unchanged { value }
maximum_routes { value }
maximum_routes_warning_only { value }
remote_asn {
node {
asn { value }
}
}
}
}
}
sessions {
edges {
node {
peer_address { value }
description { value }
enabled { value }
peer_group {
node {
name { value }
local_identifier { value }
}
}
remote_asn {
node {
asn { value }
}
}
vrf {
node {
name { value }
}
}
peer_device {
node {
name { value }
}
}
}
}
}
}
}
}
InfraBGPAddressFamily(device__name__value: $device_name) {
edges {
node {
afi { value }
safi { value }
vrf {
node {
name { value }
}
}
active_peer_groups {
edges {
node {
name { value }
}
}
}
active_sessions {
edges {
node {
peer_address { value }
}
}
}
networks {
edges {
node {
address { value }
}
}
}
}
}
}
}

View File

@@ -0,0 +1,155 @@
query InterfaceIntent($device_name: String!) {
# Loopback interfaces
InfraInterfaceLoopback(device__name__value: $device_name) {
edges {
node {
name {
value
}
description {
value
}
enabled {
value
}
mtu {
value
}
ip_addresses {
edges {
node {
address {
value
}
}
}
}
}
}
}
# Ethernet interfaces
InfraInterfaceEthernet(device__name__value: $device_name) {
edges {
node {
name {
value
}
description {
value
}
enabled {
value
}
mtu {
value
}
speed {
value
}
mode {
value
}
lag {
node {
name {
value
}
}
}
ip_addresses {
edges {
node {
address {
value
}
}
}
}
}
}
}
# VLAN SVI interfaces
InfraInterfaceVlan(device__name__value: $device_name) {
edges {
node {
name {
value
}
description {
value
}
enabled {
value
}
mtu {
value
}
virtual_router_address {
value
}
autostate {
value
}
vlan {
node {
vlan_id {
value
}
}
}
ip_addresses {
edges {
node {
address {
value
}
}
}
}
}
}
}
# LAG / Port-Channel interfaces
InfraInterfaceLag(device__name__value: $device_name) {
edges {
node {
name {
value
}
description {
value
}
enabled {
value
}
mtu {
value
}
lacp_mode {
value
}
mlag_id {
value
}
members {
edges {
node {
name {
value
}
}
}
}
ip_addresses {
edges {
node {
address {
value
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,53 @@
query MlagIntent($device_name: String!) {
InfraMlagPeerConfig(device__name__value: $device_name) {
edges {
node {
local_interface_ip { value }
peer_address { value }
heartbeat_peer_ip { value }
device {
node {
name { value }
}
}
mlag_domain {
node {
domain_id { value }
virtual_mac { value }
heartbeat_vrf { value }
dual_primary_detection { value }
dual_primary_delay { value }
dual_primary_action { value }
devices {
edges {
node {
name { value }
}
}
}
peer_vlan {
node {
vlan_id { value }
}
}
ibgp_vlan {
node {
vlan_id { value }
}
}
}
}
local_interface {
node {
name { value }
}
}
peer_link {
node {
name { value }
}
}
}
}
}
}

View File

@@ -0,0 +1,92 @@
query VlanIntent($device_name: String!) {
# VLANs reachable via VTEP VLAN-VNI mappings (L2/VXLAN VLANs)
InfraVTEP(device__name__value: $device_name) {
edges {
node {
source_address {
value
}
udp_port {
value
}
vlan_vni_mappings {
edges {
node {
vlan {
node {
vlan_id {
value
}
name {
value
}
status {
value
}
vlan_type {
value
}
trunk_groups {
value
}
stp_enabled {
value
}
vni {
node {
vni {
value
}
vni_type {
value
}
}
}
}
}
}
}
}
}
}
}
# VLANs reachable via SVI interfaces (MLAG, routing, and other local VLANs)
InfraInterfaceVlan(device__name__value: $device_name) {
edges {
node {
vlan {
node {
vlan_id {
value
}
name {
value
}
status {
value
}
vlan_type {
value
}
trunk_groups {
value
}
stp_enabled {
value
}
vni {
node {
vni {
value
}
vni_type {
value
}
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,50 @@
query VrfIntent($device_name: String!) {
InfraVRFDeviceAssignment(device__name__value: $device_name) {
edges {
node {
route_distinguisher { value }
vrf {
node {
name { value }
description { value }
route_distinguisher { value }
l3vni {
node {
vni { value }
vni_type { value }
}
}
import_targets {
edges {
node {
target { value }
}
}
}
export_targets {
edges {
node {
target { value }
}
}
}
}
}
import_targets {
edges {
node {
target { value }
}
}
}
export_targets {
edges {
node {
target { value }
}
}
}
}
}
}
}

View File

@@ -0,0 +1,100 @@
query VxlanIntent($device_name: String!) {
# VTEP configuration for the device
InfraVTEP(device__name__value: $device_name) {
edges {
node {
source_address {
value
}
udp_port {
value
}
learn_restrict {
value
}
source_interface {
node {
name {
value
}
}
}
# VLAN-to-VNI mappings (L2 VXLAN)
vlan_vni_mappings {
edges {
node {
description {
value
}
vlan {
node {
vlan_id {
value
}
name {
value
}
}
}
vni {
node {
vni {
value
}
vni_type {
value
}
}
}
}
}
}
}
}
}
# VRF-to-VNI mappings (L3 VXLAN) via VRF device assignments
InfraVRFDeviceAssignment(device__name__value: $device_name) {
edges {
node {
route_distinguisher {
value
}
vrf {
node {
name {
value
}
l3vni {
node {
vni {
value
}
vni_type {
value
}
}
}
import_targets {
edges {
node {
target {
value
}
}
}
}
export_targets {
edges {
node {
target {
value
}
}
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,194 @@
{#
bgp_yang.j2 — Produce a JSON object with the complete BGP configuration
for a single device.
Input: GraphQL response from bgp_intent query.
Returns [] if the device has no BGP router config.
Output structure:
{
"bgp": {
"global": { asn, router_id, flags, distance, ecmp },
"peer_groups": [ ... ],
"neighbors": [ ... global-VRF sessions ... ],
"address_families": [ ... global-VRF AFs ... ],
"vrf_neighbors": [ ... VRF-scoped sessions ... ],
"vrf_address_families": [ ... VRF-scoped AFs ... ]
}
}
#}
{%- set router_configs = data.InfraBGPRouterConfig.edges -%}
{%- set af_edges = data.InfraBGPAddressFamily.edges -%}
{%- if router_configs | length == 0 -%}
[]
{%- else -%}
{%- set rc = router_configs[0].node -%}
{#— Global section —#}
{%- set asn = none -%}
{%- if rc.local_asn is defined and rc.local_asn is not none and rc.local_asn.node is not none -%}
{%- set asn = rc.local_asn.node.asn.value -%}
{%- endif -%}
{#— Build peer_groups list —#}
{%- set peer_groups = [] -%}
{%- for pg_edge in rc.peer_groups.edges -%}
{%- set pg = pg_edge.node -%}
{%- set pg_remote_asn = none -%}
{%- if pg.remote_asn is defined and pg.remote_asn is not none and pg.remote_asn.node is not none -%}
{%- set pg_remote_asn = pg.remote_asn.node.asn.value -%}
{%- endif -%}
{%- set pg_send_community = none -%}
{%- if pg.send_community is defined and pg.send_community is not none and pg.send_community.value is not none and pg.send_community.value != "none" -%}
{%- set pg_send_community = pg.send_community.value -%}
{%- endif -%}
{%- set pg_update_source = none -%}
{%- if pg.update_source is defined and pg.update_source is not none and pg.update_source.value is not none -%}
{%- set pg_update_source = pg.update_source.value -%}
{%- endif -%}
{%- set pg_ebgp_multihop = none -%}
{%- if pg.ebgp_multihop is defined and pg.ebgp_multihop is not none and pg.ebgp_multihop.value is not none -%}
{%- set pg_ebgp_multihop = pg.ebgp_multihop.value -%}
{%- endif -%}
{%- set pg_max_routes = none -%}
{%- if pg.maximum_routes is defined and pg.maximum_routes is not none and pg.maximum_routes.value is not none -%}
{%- set pg_max_routes = pg.maximum_routes.value -%}
{%- endif -%}
{%- set _ = peer_groups.append({
"name": pg.name.value,
"type": pg.peer_group_type.value,
"remote_asn": pg_remote_asn,
"update_source": pg_update_source,
"ebgp_multihop": pg_ebgp_multihop,
"send_community": pg_send_community,
"next_hop_self": pg.next_hop_self.value,
"next_hop_unchanged": pg.next_hop_unchanged.value,
"maximum_routes": pg_max_routes,
"maximum_routes_warning_only": pg.maximum_routes_warning_only.value
}) -%}
{%- endfor -%}
{#— Split sessions into global and VRF-scoped —#}
{%- set neighbors = [] -%}
{%- set vrf_neighbors = [] -%}
{%- for sess_edge in rc.sessions.edges -%}
{%- set sess = sess_edge.node -%}
{%- set sess_peer_group = none -%}
{%- if sess.peer_group is defined and sess.peer_group is not none and sess.peer_group.node is not none -%}
{%- set sess_peer_group = sess.peer_group.node.name.value -%}
{%- endif -%}
{%- set sess_remote_asn = none -%}
{%- if sess.remote_asn is defined and sess.remote_asn is not none and sess.remote_asn.node is not none -%}
{%- set sess_remote_asn = sess.remote_asn.node.asn.value -%}
{%- endif -%}
{%- set sess_vrf = none -%}
{%- if sess.vrf is defined and sess.vrf is not none and sess.vrf.node is not none -%}
{%- set sess_vrf = sess.vrf.node.name.value -%}
{%- endif -%}
{%- set sess_obj = {
"peer_address": sess.peer_address.value,
"description": sess.description.value | default(none),
"enabled": sess.enabled.value,
"peer_group": sess_peer_group,
"remote_asn": sess_remote_asn
} -%}
{%- if sess_vrf is not none -%}
{%- set vrf_sess_obj = {
"peer_address": sess.peer_address.value,
"description": sess.description.value | default(none),
"enabled": sess.enabled.value,
"peer_group": sess_peer_group,
"remote_asn": sess_remote_asn,
"vrf": sess_vrf
} -%}
{%- set _ = vrf_neighbors.append(vrf_sess_obj) -%}
{%- else -%}
{%- set _ = neighbors.append(sess_obj) -%}
{%- endif -%}
{%- endfor -%}
{#— Split address families into global and VRF-scoped —#}
{%- set address_families = [] -%}
{%- set vrf_address_families = [] -%}
{%- for af_edge in af_edges -%}
{%- set af = af_edge.node -%}
{%- set af_vrf = none -%}
{%- if af.vrf is defined and af.vrf is not none and af.vrf.node is not none -%}
{%- set af_vrf = af.vrf.node.name.value -%}
{%- endif -%}
{%- set af_active_pgs = [] -%}
{%- for pg_edge in af.active_peer_groups.edges -%}
{%- set _ = af_active_pgs.append(pg_edge.node.name.value) -%}
{%- endfor -%}
{%- set af_active_sess = [] -%}
{%- if af.active_sessions is defined and af.active_sessions is not none -%}
{%- for s_edge in af.active_sessions.edges -%}
{%- set _ = af_active_sess.append(s_edge.node.peer_address.value) -%}
{%- endfor -%}
{%- endif -%}
{%- set af_networks = [] -%}
{%- if af.networks is defined and af.networks is not none -%}
{%- for net_edge in af.networks.edges -%}
{%- set _ = af_networks.append(net_edge.node.address.value) -%}
{%- endfor -%}
{%- endif -%}
{%- set af_obj = {
"afi": af.afi.value,
"safi": af.safi.value,
"active_peer_groups": af_active_pgs,
"active_sessions": af_active_sess,
"networks": af_networks
} -%}
{%- if af_vrf is not none -%}
{%- set vrf_af_obj = {
"afi": af.afi.value,
"safi": af.safi.value,
"vrf": af_vrf,
"active_peer_groups": af_active_pgs,
"active_sessions": af_active_sess,
"networks": af_networks
} -%}
{%- set _ = vrf_address_families.append(vrf_af_obj) -%}
{%- else -%}
{%- set _ = address_families.append(af_obj) -%}
{%- endif -%}
{%- endfor -%}
{%- set result = {
"bgp": {
"global": {
"asn": asn,
"router_id": rc.router_id.value,
"default_ipv4_unicast": rc.default_ipv4_unicast.value,
"log_neighbor_changes": rc.log_neighbor_changes.value,
"distance": {
"ebgp": rc.ebgp_distance.value,
"ibgp": rc.ibgp_distance.value,
"local": rc.local_distance.value
},
"ecmp": {
"max_paths": rc.ecmp_max_paths.value,
"max_ecmp": rc.ecmp_max_ecmp.value
}
},
"peer_groups": peer_groups,
"neighbors": neighbors,
"address_families": address_families,
"vrf_neighbors": vrf_neighbors,
"vrf_address_families": vrf_address_families
}
} -%}
{{ result | tojson(indent=2) }}
{%- endif -%}

View File

@@ -0,0 +1,101 @@
{#
interface_yang.j2 — Produce a JSON array of interface configuration objects.
Input: GraphQL response from interface_intent query.
Returns all interface types (loopback, ethernet, vlan, lag) for the device,
each with a "type" discriminator and type-specific attributes.
#}
{%- set interfaces = [] -%}
{#— Loopback interfaces —#}
{%- for edge in data.InfraInterfaceLoopback.edges -%}
{%- set iface = edge.node -%}
{%- set ip_list = [] -%}
{%- for ip_edge in iface.ip_addresses.edges -%}
{%- set _ = ip_list.append(ip_edge.node.address.value) -%}
{%- endfor -%}
{%- set _ = interfaces.append({
"type": "loopback",
"name": iface.name.value,
"description": iface.description.value | default(none),
"enabled": iface.enabled.value,
"mtu": iface.mtu.value | default(none),
"ip_addresses": ip_list
}) -%}
{%- endfor -%}
{#— Ethernet interfaces —#}
{%- for edge in data.InfraInterfaceEthernet.edges -%}
{%- set iface = edge.node -%}
{%- set ip_list = [] -%}
{%- for ip_edge in iface.ip_addresses.edges -%}
{%- set _ = ip_list.append(ip_edge.node.address.value) -%}
{%- endfor -%}
{%- set lag_name = none -%}
{%- if iface.lag is defined and iface.lag is not none and iface.lag.node is not none -%}
{%- set lag_name = iface.lag.node.name.value -%}
{%- endif -%}
{%- set _ = interfaces.append({
"type": "ethernet",
"name": iface.name.value,
"description": iface.description.value | default(none),
"enabled": iface.enabled.value,
"mtu": iface.mtu.value | default(none),
"speed": iface.speed.value | default(none),
"mode": iface.mode.value | default(none),
"lag": lag_name,
"ip_addresses": ip_list
}) -%}
{%- endfor -%}
{#— VLAN SVI interfaces —#}
{%- for edge in data.InfraInterfaceVlan.edges -%}
{%- set iface = edge.node -%}
{%- set ip_list = [] -%}
{%- for ip_edge in iface.ip_addresses.edges -%}
{%- set _ = ip_list.append(ip_edge.node.address.value) -%}
{%- endfor -%}
{%- set vlan_id = none -%}
{%- if iface.vlan is defined and iface.vlan is not none and iface.vlan.node is not none -%}
{%- set vlan_id = iface.vlan.node.vlan_id.value -%}
{%- endif -%}
{%- set _ = interfaces.append({
"type": "vlan",
"name": iface.name.value,
"description": iface.description.value | default(none),
"enabled": iface.enabled.value,
"mtu": iface.mtu.value | default(none),
"vlan_id": vlan_id,
"virtual_router_address": iface.virtual_router_address.value | default(none),
"autostate": iface.autostate.value,
"ip_addresses": ip_list
}) -%}
{%- endfor -%}
{#— LAG / Port-Channel interfaces —#}
{%- for edge in data.InfraInterfaceLag.edges -%}
{%- set iface = edge.node -%}
{%- set ip_list = [] -%}
{%- for ip_edge in iface.ip_addresses.edges -%}
{%- set _ = ip_list.append(ip_edge.node.address.value) -%}
{%- endfor -%}
{%- set member_list = [] -%}
{%- for member_edge in iface.members.edges -%}
{%- set _ = member_list.append(member_edge.node.name.value) -%}
{%- endfor -%}
{%- set _ = interfaces.append({
"type": "lag",
"name": iface.name.value,
"description": iface.description.value | default(none),
"enabled": iface.enabled.value,
"mtu": iface.mtu.value | default(none),
"lacp_mode": iface.lacp_mode.value | default(none),
"mlag_id": iface.mlag_id.value | default(none),
"members": member_list,
"ip_addresses": ip_list
}) -%}
{%- endfor -%}
{#— Sort by name and emit JSON array —#}
{%- set sorted_ifaces = interfaces | sort(attribute='name') -%}
{{ sorted_ifaces | tojson(indent=2) }}

View File

@@ -0,0 +1,90 @@
{#
mlag_yang.j2 — Produce a JSON object with the MLAG configuration payload
for a single device, targeting Arista-native YANG paths.
Input: GraphQL response from mlag_intent query.
Returns an empty array [] if the device has no MLAG peer config (e.g. spines).
Output structure:
{
"mlag": {
"config": { ... }, # /arista-mlag-augments:mlag/config
"dual_primary_detection": { ... },
"virtual_mac": "...",
"peer_vlan_id": ...,
"ibgp_vlan_id": ...,
"local_interface_ip": "..."
}
}
#}
{%- set peer_configs = data.InfraMlagPeerConfig.edges -%}
{%- if peer_configs | length == 0 -%}
[]
{%- else -%}
{%- set cfg = peer_configs[0].node -%}
{#— Resolve local interface name —#}
{%- set local_iface_name = none -%}
{%- if cfg.local_interface is defined and cfg.local_interface is not none and cfg.local_interface.node is not none -%}
{%- set local_iface_name = cfg.local_interface.node.name.value -%}
{%- endif -%}
{#— Resolve peer-link name —#}
{%- set peer_link_name = none -%}
{%- if cfg.peer_link is defined and cfg.peer_link is not none and cfg.peer_link.node is not none -%}
{%- set peer_link_name = cfg.peer_link.node.name.value -%}
{%- endif -%}
{#— Resolve MLAG domain attributes —#}
{%- set domain_id = none -%}
{%- set virtual_mac = none -%}
{%- set heartbeat_vrf = none -%}
{%- set dual_primary_detection = false -%}
{%- set dual_primary_delay = none -%}
{%- set dual_primary_action = none -%}
{%- set peer_vlan_id = none -%}
{%- set ibgp_vlan_id = none -%}
{%- if cfg.mlag_domain is defined and cfg.mlag_domain is not none and cfg.mlag_domain.node is not none -%}
{%- set domain = cfg.mlag_domain.node -%}
{%- set domain_id = domain.domain_id.value -%}
{%- set virtual_mac = domain.virtual_mac.value | default(none) -%}
{%- set heartbeat_vrf = domain.heartbeat_vrf.value | default("mgmt") -%}
{%- set dual_primary_detection = domain.dual_primary_detection.value | default(false) -%}
{%- set dual_primary_delay = domain.dual_primary_delay.value | default(none) -%}
{%- set dual_primary_action = domain.dual_primary_action.value | default(none) -%}
{%- if domain.peer_vlan is defined and domain.peer_vlan is not none and domain.peer_vlan.node is not none -%}
{%- set peer_vlan_id = domain.peer_vlan.node.vlan_id.value -%}
{%- endif -%}
{%- if domain.ibgp_vlan is defined and domain.ibgp_vlan is not none and domain.ibgp_vlan.node is not none -%}
{%- set ibgp_vlan_id = domain.ibgp_vlan.node.vlan_id.value -%}
{%- endif -%}
{%- endif -%}
{%- set result = {
"mlag": {
"config": {
"domain-id": domain_id,
"peer-link": peer_link_name,
"local-interface": local_iface_name,
"peer-address": cfg.peer_address.value,
"shutdown": false
},
"dual_primary_detection": {
"enabled": dual_primary_detection,
"delay": dual_primary_delay,
"action": dual_primary_action,
"heartbeat_peer_ip": cfg.heartbeat_peer_ip.value,
"heartbeat_vrf": heartbeat_vrf
},
"virtual_mac": virtual_mac,
"peer_vlan_id": peer_vlan_id,
"ibgp_vlan_id": ibgp_vlan_id,
"local_interface_ip": cfg.local_interface_ip.value
}
} -%}
{{ result | tojson(indent=2) }}
{%- endif -%}

View File

@@ -0,0 +1,67 @@
{#
vlan_yang.j2 — Produce a JSON array of VLAN configuration objects.
Input: GraphQL response from vlan_intent query.
The query returns VLANs from two sources:
1. data.InfraVTEP[].vlan_vni_mappings[].vlan (L2/VXLAN VLANs)
2. data.InfraInterfaceVlan[].vlan (SVI/routing/MLAG VLANs)
We merge both sources, deduplicate by vlan_id, and emit one object per VLAN.
#}
{%- set vlans = {} -%}
{#— Collect VLANs from VTEP VLAN-VNI mappings —#}
{%- for vtep_edge in data.InfraVTEP.edges -%}
{%- for mapping_edge in vtep_edge.node.vlan_vni_mappings.edges -%}
{%- set vlan_node = mapping_edge.node.vlan.node -%}
{%- set vid = vlan_node.vlan_id.value | string -%}
{%- if vid not in vlans -%}
{%- set vni_val = none -%}
{%- set vni_type_val = none -%}
{%- if vlan_node.vni is defined and vlan_node.vni is not none and vlan_node.vni.node is not none -%}
{%- set vni_val = vlan_node.vni.node.vni.value -%}
{%- set vni_type_val = vlan_node.vni.node.vni_type.value -%}
{%- endif -%}
{%- set _ = vlans.update({vid: {
"vlan_id": vlan_node.vlan_id.value,
"name": vlan_node.name.value,
"status": vlan_node.status.value | default('') | upper,
"vlan_type": vlan_node.vlan_type.value | default(none),
"trunk_groups": vlan_node.trunk_groups.value | default([]),
"stp_enabled": vlan_node.stp_enabled.value,
"vni": vni_val,
"vni_type": vni_type_val
}}) -%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{#— Collect VLANs from SVI interfaces —#}
{%- for svi_edge in data.InfraInterfaceVlan.edges -%}
{%- if svi_edge.node.vlan is defined and svi_edge.node.vlan is not none and svi_edge.node.vlan.node is not none -%}
{%- set vlan_node = svi_edge.node.vlan.node -%}
{%- set vid = vlan_node.vlan_id.value | string -%}
{%- if vid not in vlans -%}
{%- set vni_val = none -%}
{%- set vni_type_val = none -%}
{%- if vlan_node.vni is defined and vlan_node.vni is not none and vlan_node.vni.node is not none -%}
{%- set vni_val = vlan_node.vni.node.vni.value -%}
{%- set vni_type_val = vlan_node.vni.node.vni_type.value -%}
{%- endif -%}
{%- set _ = vlans.update({vid: {
"vlan_id": vlan_node.vlan_id.value,
"name": vlan_node.name.value,
"status": vlan_node.status.value | default('') | upper,
"vlan_type": vlan_node.vlan_type.value | default(none),
"trunk_groups": vlan_node.trunk_groups.value | default([]),
"stp_enabled": vlan_node.stp_enabled.value,
"vni": vni_val,
"vni_type": vni_type_val
}}) -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{#— Sort by vlan_id and emit JSON array —#}
{%- set sorted_vlans = vlans.values() | sort(attribute='vlan_id') -%}
{{ sorted_vlans | tojson(indent=2) }}

View File

@@ -0,0 +1,78 @@
{#
vrf_yang.j2 — Produce a JSON array of VRF configuration objects.
Input: GraphQL response from vrf_intent query.
For each VRFDeviceAssignment, produce one VRF config entry with:
- device-specific RD (falls back to VRF-level RD if not set on assignment)
- L3VNI from the VRF's l3vni relationship
- import/export targets: device-level if present, otherwise VRF-level
#}
{%- set vrf_list = [] -%}
{%- for assignment_edge in data.InfraVRFDeviceAssignment.edges -%}
{%- set assignment = assignment_edge.node -%}
{#— Resolve VRF node —#}
{%- set vrf_name = none -%}
{%- set vrf_description = none -%}
{%- set l3vni = none -%}
{%- set vrf_level_import_rts = [] -%}
{%- set vrf_level_export_rts = [] -%}
{%- if assignment.vrf is defined and assignment.vrf is not none and assignment.vrf.node is not none -%}
{%- set vrf_node = assignment.vrf.node -%}
{%- set vrf_name = vrf_node.name.value -%}
{%- set vrf_description = vrf_node.description.value | default(none) -%}
{%- if vrf_node.l3vni is defined and vrf_node.l3vni is not none and vrf_node.l3vni.node is not none -%}
{%- set l3vni = vrf_node.l3vni.node.vni.value -%}
{%- endif -%}
{%- for rt_edge in vrf_node.import_targets.edges -%}
{%- set _ = vrf_level_import_rts.append(rt_edge.node.target.value) -%}
{%- endfor -%}
{%- for rt_edge in vrf_node.export_targets.edges -%}
{%- set _ = vrf_level_export_rts.append(rt_edge.node.target.value) -%}
{%- endfor -%}
{%- endif -%}
{#— Resolve route_distinguisher: device-specific first, fall back to VRF-level —#}
{%- set rd = none -%}
{%- if assignment.route_distinguisher is defined and assignment.route_distinguisher is not none and assignment.route_distinguisher.value is not none and assignment.route_distinguisher.value != "" -%}
{%- set rd = assignment.route_distinguisher.value -%}
{%- elif assignment.vrf is defined and assignment.vrf is not none and assignment.vrf.node is not none and assignment.vrf.node.route_distinguisher is defined and assignment.vrf.node.route_distinguisher is not none -%}
{%- set rd = assignment.vrf.node.route_distinguisher.value | default(none) -%}
{%- endif -%}
{#— Resolve import targets: device-level if present, otherwise VRF-level —#}
{%- set import_rts = [] -%}
{%- if assignment.import_targets is defined and assignment.import_targets is not none and assignment.import_targets.edges | length > 0 -%}
{%- for rt_edge in assignment.import_targets.edges -%}
{%- set _ = import_rts.append(rt_edge.node.target.value) -%}
{%- endfor -%}
{%- else -%}
{%- set import_rts = vrf_level_import_rts -%}
{%- endif -%}
{#— Resolve export targets: device-level if present, otherwise VRF-level —#}
{%- set export_rts = [] -%}
{%- if assignment.export_targets is defined and assignment.export_targets is not none and assignment.export_targets.edges | length > 0 -%}
{%- for rt_edge in assignment.export_targets.edges -%}
{%- set _ = export_rts.append(rt_edge.node.target.value) -%}
{%- endfor -%}
{%- else -%}
{%- set export_rts = vrf_level_export_rts -%}
{%- endif -%}
{%- set _ = vrf_list.append({
"vrf_name": vrf_name,
"description": vrf_description,
"route_distinguisher": rd,
"l3vni": l3vni,
"import_targets": import_rts,
"export_targets": export_rts,
"redistribute_connected": true
}) -%}
{%- endfor -%}
{{ vrf_list | tojson(indent=2) }}

View File

@@ -0,0 +1,88 @@
{#
vxlan_yang.j2 — Produce a JSON object representing the VXLAN/VTEP configuration
for the device, including VLAN-to-VNI mappings and VRF-to-VNI mappings.
Input: GraphQL response from vxlan_intent query.
#}
{%- set vtep_edges = data.InfraVTEP.edges -%}
{%- set vrf_edges = data.InfraVRFDeviceAssignment.edges -%}
{#— Build VTEP section (there is one VTEP per device) —#}
{%- if vtep_edges | length > 0 -%}
{%- set vtep = vtep_edges[0].node -%}
{%- set source_iface = none -%}
{%- if vtep.source_interface is defined and vtep.source_interface is not none and vtep.source_interface.node is not none -%}
{%- set source_iface = vtep.source_interface.node.name.value -%}
{%- endif -%}
{#— Build VLAN-to-VNI mapping list —#}
{%- set vlan_vni_list = [] -%}
{%- for mapping_edge in vtep.vlan_vni_mappings.edges -%}
{%- set m = mapping_edge.node -%}
{%- set vlan_id = none -%}
{%- set vlan_name = none -%}
{%- if m.vlan is defined and m.vlan is not none and m.vlan.node is not none -%}
{%- set vlan_id = m.vlan.node.vlan_id.value -%}
{%- set vlan_name = m.vlan.node.name.value -%}
{%- endif -%}
{%- set vni_val = none -%}
{%- set vni_type_val = none -%}
{%- if m.vni is defined and m.vni is not none and m.vni.node is not none -%}
{%- set vni_val = m.vni.node.vni.value -%}
{%- set vni_type_val = m.vni.node.vni_type.value -%}
{%- endif -%}
{%- set _ = vlan_vni_list.append({
"vlan_id": vlan_id,
"vlan_name": vlan_name,
"vni": vni_val,
"vni_type": vni_type_val
}) -%}
{%- endfor -%}
{#— Build VRF-to-VNI mapping list —#}
{%- set vrf_vni_list = [] -%}
{%- for vrf_edge in vrf_edges -%}
{%- set assignment = vrf_edge.node -%}
{%- set vrf_name = none -%}
{%- set l3vni = none -%}
{%- set import_rts = [] -%}
{%- set export_rts = [] -%}
{%- if assignment.vrf is defined and assignment.vrf is not none and assignment.vrf.node is not none -%}
{%- set vrf_node = assignment.vrf.node -%}
{%- set vrf_name = vrf_node.name.value -%}
{%- if vrf_node.l3vni is defined and vrf_node.l3vni is not none and vrf_node.l3vni.node is not none -%}
{%- set l3vni = vrf_node.l3vni.node.vni.value -%}
{%- endif -%}
{%- for rt_edge in vrf_node.import_targets.edges -%}
{%- set _ = import_rts.append(rt_edge.node.target.value) -%}
{%- endfor -%}
{%- for rt_edge in vrf_node.export_targets.edges -%}
{%- set _ = export_rts.append(rt_edge.node.target.value) -%}
{%- endfor -%}
{%- endif -%}
{%- set _ = vrf_vni_list.append({
"vrf": vrf_name,
"l3vni": l3vni,
"route_distinguisher": assignment.route_distinguisher.value | default(none),
"import_targets": import_rts,
"export_targets": export_rts
}) -%}
{%- endfor -%}
{%- set result = {
"vtep": {
"source_address": vtep.source_address.value,
"source_interface": source_iface,
"udp_port": vtep.udp_port.value,
"learn_restrict": vtep.learn_restrict.value | default(none),
"vlan_vni_mappings": vlan_vni_list | sort(attribute='vlan_id'),
"vrf_vni_mappings": vrf_vni_list
}
} -%}
{%- else -%}
{%- set result = {
"vtep": none,
"vrf_vni_mappings": []
} -%}
{%- endif -%}
{{ result | tojson(indent=2) }}

View File

@@ -0,0 +1,180 @@
{
"data": {
"InfraBGPRouterConfig": {
"edges": [
{
"node": {
"router_id": { "value": "10.0.250.11" },
"default_ipv4_unicast": { "value": false },
"log_neighbor_changes": { "value": true },
"ecmp_max_paths": { "value": 4 },
"ecmp_max_ecmp": { "value": 64 },
"ebgp_distance": { "value": 20 },
"ibgp_distance": { "value": 200 },
"local_distance": { "value": 200 },
"local_asn": {
"node": {
"asn": { "value": 65001 }
}
},
"peer_groups": {
"edges": [
{
"node": {
"name": { "value": "underlay" },
"peer_group_type": { "value": "underlay" },
"update_source": { "value": null },
"ebgp_multihop": { "value": null },
"send_community": { "value": "none" },
"next_hop_self": { "value": false },
"next_hop_unchanged": { "value": false },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": {
"node": {
"asn": { "value": 65000 }
}
}
}
},
{
"node": {
"name": { "value": "underlay_ibgp" },
"peer_group_type": { "value": "underlay_ibgp" },
"update_source": { "value": null },
"ebgp_multihop": { "value": null },
"send_community": { "value": "none" },
"next_hop_self": { "value": true },
"next_hop_unchanged": { "value": false },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": {
"node": {
"asn": { "value": 65001 }
}
}
}
},
{
"node": {
"name": { "value": "evpn" },
"peer_group_type": { "value": "evpn" },
"update_source": { "value": "Loopback0" },
"ebgp_multihop": { "value": 3 },
"send_community": { "value": "extended" },
"next_hop_self": { "value": false },
"next_hop_unchanged": { "value": false },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": {
"node": {
"asn": { "value": 65000 }
}
}
}
}
]
},
"sessions": {
"edges": [
{
"node": {
"peer_address": { "value": "10.0.1.0" },
"description": { "value": "underlay to spine1" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "underlay" }, "local_identifier": { "value": "leaf1__underlay" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine1" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.2.0" },
"description": { "value": "underlay to spine2" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "underlay" }, "local_identifier": { "value": "leaf1__underlay" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine2" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.3.1" },
"description": { "value": "iBGP to leaf2" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "underlay_ibgp" }, "local_identifier": { "value": "leaf1__underlay_ibgp" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf2" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.1" },
"description": { "value": "EVPN to spine1" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "leaf1__evpn" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine1" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.2" },
"description": { "value": "EVPN to spine2" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "leaf1__evpn" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine2" } } }
}
}
]
}
}
}
]
},
"InfraBGPAddressFamily": {
"edges": [
{
"node": {
"afi": { "value": "ipv4" },
"safi": { "value": "unicast" },
"vrf": { "node": null },
"active_peer_groups": {
"edges": [
{ "node": { "name": { "value": "underlay" } } },
{ "node": { "name": { "value": "underlay_ibgp" } } }
]
},
"active_sessions": { "edges": [] },
"networks": {
"edges": [
{ "node": { "address": { "value": "10.0.250.11/32" } } },
{ "node": { "address": { "value": "10.0.255.11/32" } } }
]
}
}
},
{
"node": {
"afi": { "value": "evpn" },
"safi": { "value": "unicast" },
"vrf": { "node": null },
"active_peer_groups": {
"edges": [
{ "node": { "name": { "value": "evpn" } } }
]
},
"active_sessions": { "edges": [] },
"networks": { "edges": [] }
}
}
]
}
}
}

View File

@@ -0,0 +1,120 @@
{
"bgp": {
"global": {
"asn": 65001,
"router_id": "10.0.250.11",
"default_ipv4_unicast": false,
"log_neighbor_changes": true,
"distance": {
"ebgp": 20,
"ibgp": 200,
"local": 200
},
"ecmp": {
"max_paths": 4,
"max_ecmp": 64
}
},
"peer_groups": [
{
"name": "underlay",
"type": "underlay",
"remote_asn": 65000,
"update_source": null,
"ebgp_multihop": null,
"send_community": null,
"next_hop_self": false,
"next_hop_unchanged": false,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
},
{
"name": "underlay_ibgp",
"type": "underlay_ibgp",
"remote_asn": 65001,
"update_source": null,
"ebgp_multihop": null,
"send_community": null,
"next_hop_self": true,
"next_hop_unchanged": false,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
},
{
"name": "evpn",
"type": "evpn",
"remote_asn": 65000,
"update_source": "Loopback0",
"ebgp_multihop": 3,
"send_community": "extended",
"next_hop_self": false,
"next_hop_unchanged": false,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
}
],
"neighbors": [
{
"peer_address": "10.0.1.0",
"description": "underlay to spine1",
"enabled": true,
"peer_group": "underlay",
"remote_asn": null
},
{
"peer_address": "10.0.2.0",
"description": "underlay to spine2",
"enabled": true,
"peer_group": "underlay",
"remote_asn": null
},
{
"peer_address": "10.0.3.1",
"description": "iBGP to leaf2",
"enabled": true,
"peer_group": "underlay_ibgp",
"remote_asn": null
},
{
"peer_address": "10.0.250.1",
"description": "EVPN to spine1",
"enabled": true,
"peer_group": "evpn",
"remote_asn": null
},
{
"peer_address": "10.0.250.2",
"description": "EVPN to spine2",
"enabled": true,
"peer_group": "evpn",
"remote_asn": null
}
],
"address_families": [
{
"afi": "ipv4",
"safi": "unicast",
"active_peer_groups": [
"underlay",
"underlay_ibgp"
],
"active_sessions": [],
"networks": [
"10.0.250.11/32",
"10.0.255.11/32"
]
},
{
"afi": "evpn",
"safi": "unicast",
"active_peer_groups": [
"evpn"
],
"active_sessions": [],
"networks": []
}
],
"vrf_neighbors": [],
"vrf_address_families": []
}
}

View File

@@ -0,0 +1,205 @@
{
"data": {
"InfraBGPRouterConfig": {
"edges": [
{
"node": {
"router_id": { "value": "10.0.250.17" },
"default_ipv4_unicast": { "value": false },
"log_neighbor_changes": { "value": true },
"ecmp_max_paths": { "value": 4 },
"ecmp_max_ecmp": { "value": 64 },
"ebgp_distance": { "value": 20 },
"ibgp_distance": { "value": 200 },
"local_distance": { "value": 200 },
"local_asn": {
"node": {
"asn": { "value": 65004 }
}
},
"peer_groups": {
"edges": [
{
"node": {
"name": { "value": "underlay" },
"peer_group_type": { "value": "underlay" },
"update_source": { "value": null },
"ebgp_multihop": { "value": null },
"send_community": { "value": "none" },
"next_hop_self": { "value": false },
"next_hop_unchanged": { "value": false },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": {
"node": {
"asn": { "value": 65000 }
}
}
}
},
{
"node": {
"name": { "value": "underlay_ibgp" },
"peer_group_type": { "value": "underlay_ibgp" },
"update_source": { "value": null },
"ebgp_multihop": { "value": null },
"send_community": { "value": "none" },
"next_hop_self": { "value": true },
"next_hop_unchanged": { "value": false },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": {
"node": {
"asn": { "value": 65004 }
}
}
}
},
{
"node": {
"name": { "value": "evpn" },
"peer_group_type": { "value": "evpn" },
"update_source": { "value": "Loopback0" },
"ebgp_multihop": { "value": 3 },
"send_community": { "value": "extended" },
"next_hop_self": { "value": false },
"next_hop_unchanged": { "value": false },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": {
"node": {
"asn": { "value": 65000 }
}
}
}
}
]
},
"sessions": {
"edges": [
{
"node": {
"peer_address": { "value": "10.0.1.12" },
"description": { "value": "underlay to spine1" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "underlay" }, "local_identifier": { "value": "leaf7__underlay" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine1" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.2.12" },
"description": { "value": "underlay to spine2" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "underlay" }, "local_identifier": { "value": "leaf7__underlay" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine2" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.3.7" },
"description": { "value": "iBGP to leaf8" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "underlay_ibgp" }, "local_identifier": { "value": "leaf7__underlay_ibgp" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf8" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.1" },
"description": { "value": "EVPN to spine1" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "leaf7__evpn" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine1" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.2" },
"description": { "value": "EVPN to spine2" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "leaf7__evpn" } } },
"remote_asn": { "node": null },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "spine2" } } }
}
},
{
"node": {
"peer_address": { "value": "10.90.90.1" },
"description": { "value": "border peering to AS 64999 in VRF gold" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 64999 } } },
"vrf": { "node": { "name": { "value": "gold" } } },
"peer_device": { "node": null }
}
}
]
}
}
}
]
},
"InfraBGPAddressFamily": {
"edges": [
{
"node": {
"afi": { "value": "ipv4" },
"safi": { "value": "unicast" },
"vrf": { "node": null },
"active_peer_groups": {
"edges": [
{ "node": { "name": { "value": "underlay" } } },
{ "node": { "name": { "value": "underlay_ibgp" } } }
]
},
"active_sessions": { "edges": [] },
"networks": {
"edges": [
{ "node": { "address": { "value": "10.0.250.17/32" } } },
{ "node": { "address": { "value": "10.0.255.14/32" } } }
]
}
}
},
{
"node": {
"afi": { "value": "evpn" },
"safi": { "value": "unicast" },
"vrf": { "node": null },
"active_peer_groups": {
"edges": [
{ "node": { "name": { "value": "evpn" } } }
]
},
"active_sessions": { "edges": [] },
"networks": { "edges": [] }
}
},
{
"node": {
"afi": { "value": "ipv4" },
"safi": { "value": "unicast" },
"vrf": { "node": { "name": { "value": "gold" } } },
"active_peer_groups": { "edges": [] },
"active_sessions": {
"edges": [
{ "node": { "peer_address": { "value": "10.90.90.1" } } }
]
},
"networks": { "edges": [] }
}
}
]
}
}
}

View File

@@ -0,0 +1,140 @@
{
"bgp": {
"global": {
"asn": 65004,
"router_id": "10.0.250.17",
"default_ipv4_unicast": false,
"log_neighbor_changes": true,
"distance": {
"ebgp": 20,
"ibgp": 200,
"local": 200
},
"ecmp": {
"max_paths": 4,
"max_ecmp": 64
}
},
"peer_groups": [
{
"name": "underlay",
"type": "underlay",
"remote_asn": 65000,
"update_source": null,
"ebgp_multihop": null,
"send_community": null,
"next_hop_self": false,
"next_hop_unchanged": false,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
},
{
"name": "underlay_ibgp",
"type": "underlay_ibgp",
"remote_asn": 65004,
"update_source": null,
"ebgp_multihop": null,
"send_community": null,
"next_hop_self": true,
"next_hop_unchanged": false,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
},
{
"name": "evpn",
"type": "evpn",
"remote_asn": 65000,
"update_source": "Loopback0",
"ebgp_multihop": 3,
"send_community": "extended",
"next_hop_self": false,
"next_hop_unchanged": false,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
}
],
"neighbors": [
{
"peer_address": "10.0.1.12",
"description": "underlay to spine1",
"enabled": true,
"peer_group": "underlay",
"remote_asn": null
},
{
"peer_address": "10.0.2.12",
"description": "underlay to spine2",
"enabled": true,
"peer_group": "underlay",
"remote_asn": null
},
{
"peer_address": "10.0.3.7",
"description": "iBGP to leaf8",
"enabled": true,
"peer_group": "underlay_ibgp",
"remote_asn": null
},
{
"peer_address": "10.0.250.1",
"description": "EVPN to spine1",
"enabled": true,
"peer_group": "evpn",
"remote_asn": null
},
{
"peer_address": "10.0.250.2",
"description": "EVPN to spine2",
"enabled": true,
"peer_group": "evpn",
"remote_asn": null
}
],
"address_families": [
{
"afi": "ipv4",
"safi": "unicast",
"active_peer_groups": [
"underlay",
"underlay_ibgp"
],
"active_sessions": [],
"networks": [
"10.0.250.17/32",
"10.0.255.14/32"
]
},
{
"afi": "evpn",
"safi": "unicast",
"active_peer_groups": [
"evpn"
],
"active_sessions": [],
"networks": []
}
],
"vrf_neighbors": [
{
"peer_address": "10.90.90.1",
"description": "border peering to AS 64999 in VRF gold",
"enabled": true,
"peer_group": null,
"remote_asn": 64999,
"vrf": "gold"
}
],
"vrf_address_families": [
{
"afi": "ipv4",
"safi": "unicast",
"vrf": "gold",
"active_peer_groups": [],
"active_sessions": [
"10.90.90.1"
],
"networks": []
}
]
}
}

View File

@@ -0,0 +1,266 @@
{
"data": {
"InfraBGPRouterConfig": {
"edges": [
{
"node": {
"router_id": { "value": "10.0.250.1" },
"default_ipv4_unicast": { "value": false },
"log_neighbor_changes": { "value": true },
"ecmp_max_paths": { "value": 4 },
"ecmp_max_ecmp": { "value": 64 },
"ebgp_distance": { "value": 20 },
"ibgp_distance": { "value": 200 },
"local_distance": { "value": 200 },
"local_asn": {
"node": {
"asn": { "value": 65000 }
}
},
"peer_groups": {
"edges": [
{
"node": {
"name": { "value": "evpn" },
"peer_group_type": { "value": "evpn" },
"update_source": { "value": "Loopback0" },
"ebgp_multihop": { "value": 3 },
"send_community": { "value": "extended" },
"next_hop_self": { "value": false },
"next_hop_unchanged": { "value": true },
"maximum_routes": { "value": 12000 },
"maximum_routes_warning_only": { "value": true },
"remote_asn": { "node": null }
}
}
]
},
"sessions": {
"edges": [
{
"node": {
"peer_address": { "value": "10.0.1.1" },
"description": { "value": "underlay to leaf1" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65001 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf1" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.3" },
"description": { "value": "underlay to leaf2" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65001 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf2" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.5" },
"description": { "value": "underlay to leaf3" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65002 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf3" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.7" },
"description": { "value": "underlay to leaf4" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65002 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf4" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.9" },
"description": { "value": "underlay to leaf5" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65003 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf5" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.11" },
"description": { "value": "underlay to leaf6" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65003 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf6" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.13" },
"description": { "value": "underlay to leaf7" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65004 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf7" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.1.15" },
"description": { "value": "underlay to leaf8" },
"enabled": { "value": true },
"peer_group": { "node": null },
"remote_asn": { "node": { "asn": { "value": 65004 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf8" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.11" },
"description": { "value": "EVPN to leaf1" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65001 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf1" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.12" },
"description": { "value": "EVPN to leaf2" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65001 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf2" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.13" },
"description": { "value": "EVPN to leaf3" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65002 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf3" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.14" },
"description": { "value": "EVPN to leaf4" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65002 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf4" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.15" },
"description": { "value": "EVPN to leaf5" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65003 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf5" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.16" },
"description": { "value": "EVPN to leaf6" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65003 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf6" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.17" },
"description": { "value": "EVPN to leaf7" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65004 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf7" } } }
}
},
{
"node": {
"peer_address": { "value": "10.0.250.18" },
"description": { "value": "EVPN to leaf8" },
"enabled": { "value": true },
"peer_group": { "node": { "name": { "value": "evpn" }, "local_identifier": { "value": "spine1__evpn" } } },
"remote_asn": { "node": { "asn": { "value": 65004 } } },
"vrf": { "node": null },
"peer_device": { "node": { "name": { "value": "leaf8" } } }
}
}
]
}
}
}
]
},
"InfraBGPAddressFamily": {
"edges": [
{
"node": {
"afi": { "value": "ipv4" },
"safi": { "value": "unicast" },
"vrf": { "node": null },
"active_peer_groups": { "edges": [] },
"active_sessions": {
"edges": [
{ "node": { "peer_address": { "value": "10.0.1.1" } } },
{ "node": { "peer_address": { "value": "10.0.1.3" } } },
{ "node": { "peer_address": { "value": "10.0.1.5" } } },
{ "node": { "peer_address": { "value": "10.0.1.7" } } },
{ "node": { "peer_address": { "value": "10.0.1.9" } } },
{ "node": { "peer_address": { "value": "10.0.1.11" } } },
{ "node": { "peer_address": { "value": "10.0.1.13" } } },
{ "node": { "peer_address": { "value": "10.0.1.15" } } }
]
},
"networks": {
"edges": [
{ "node": { "address": { "value": "10.0.250.1/32" } } }
]
}
}
},
{
"node": {
"afi": { "value": "evpn" },
"safi": { "value": "unicast" },
"vrf": { "node": null },
"active_peer_groups": {
"edges": [
{ "node": { "name": { "value": "evpn" } } }
]
},
"active_sessions": { "edges": [] },
"networks": { "edges": [] }
}
}
]
}
}
}

View File

@@ -0,0 +1,178 @@
{
"bgp": {
"global": {
"asn": 65000,
"router_id": "10.0.250.1",
"default_ipv4_unicast": false,
"log_neighbor_changes": true,
"distance": {
"ebgp": 20,
"ibgp": 200,
"local": 200
},
"ecmp": {
"max_paths": 4,
"max_ecmp": 64
}
},
"peer_groups": [
{
"name": "evpn",
"type": "evpn",
"remote_asn": null,
"update_source": "Loopback0",
"ebgp_multihop": 3,
"send_community": "extended",
"next_hop_self": false,
"next_hop_unchanged": true,
"maximum_routes": 12000,
"maximum_routes_warning_only": true
}
],
"neighbors": [
{
"peer_address": "10.0.1.1",
"description": "underlay to leaf1",
"enabled": true,
"peer_group": null,
"remote_asn": 65001
},
{
"peer_address": "10.0.1.3",
"description": "underlay to leaf2",
"enabled": true,
"peer_group": null,
"remote_asn": 65001
},
{
"peer_address": "10.0.1.5",
"description": "underlay to leaf3",
"enabled": true,
"peer_group": null,
"remote_asn": 65002
},
{
"peer_address": "10.0.1.7",
"description": "underlay to leaf4",
"enabled": true,
"peer_group": null,
"remote_asn": 65002
},
{
"peer_address": "10.0.1.9",
"description": "underlay to leaf5",
"enabled": true,
"peer_group": null,
"remote_asn": 65003
},
{
"peer_address": "10.0.1.11",
"description": "underlay to leaf6",
"enabled": true,
"peer_group": null,
"remote_asn": 65003
},
{
"peer_address": "10.0.1.13",
"description": "underlay to leaf7",
"enabled": true,
"peer_group": null,
"remote_asn": 65004
},
{
"peer_address": "10.0.1.15",
"description": "underlay to leaf8",
"enabled": true,
"peer_group": null,
"remote_asn": 65004
},
{
"peer_address": "10.0.250.11",
"description": "EVPN to leaf1",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65001
},
{
"peer_address": "10.0.250.12",
"description": "EVPN to leaf2",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65001
},
{
"peer_address": "10.0.250.13",
"description": "EVPN to leaf3",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65002
},
{
"peer_address": "10.0.250.14",
"description": "EVPN to leaf4",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65002
},
{
"peer_address": "10.0.250.15",
"description": "EVPN to leaf5",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65003
},
{
"peer_address": "10.0.250.16",
"description": "EVPN to leaf6",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65003
},
{
"peer_address": "10.0.250.17",
"description": "EVPN to leaf7",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65004
},
{
"peer_address": "10.0.250.18",
"description": "EVPN to leaf8",
"enabled": true,
"peer_group": "evpn",
"remote_asn": 65004
}
],
"address_families": [
{
"afi": "ipv4",
"safi": "unicast",
"active_peer_groups": [],
"active_sessions": [
"10.0.1.1",
"10.0.1.3",
"10.0.1.5",
"10.0.1.7",
"10.0.1.9",
"10.0.1.11",
"10.0.1.13",
"10.0.1.15"
],
"networks": [
"10.0.250.1/32"
]
},
{
"afi": "evpn",
"safi": "unicast",
"active_peer_groups": [
"evpn"
],
"active_sessions": [],
"networks": []
}
],
"vrf_neighbors": [],
"vrf_address_families": []
}
}

View File

@@ -0,0 +1,27 @@
---
version: "1.0"
infrahub_tests:
- resource: Jinja2Transform
resource_name: bgp_yang_transform
tests:
- name: smoke_check
spec:
kind: jinja2-transform-smoke
- name: render_leaf1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/bgp_yang/leaf1
input: input.json
output: output.json
- name: render_spine1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/bgp_yang/spine1
input: input.json
output: output.json
- name: render_leaf7
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/bgp_yang/leaf7
input: input.json
output: output.json

View File

@@ -0,0 +1,350 @@
{
"data": {
"InfraInterfaceLoopback": {
"edges": [
{
"node": {
"name": {
"value": "Loopback0"
},
"description": {
"value": "Router-ID"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"ip_addresses": {
"edges": [
{
"node": {
"address": {
"value": "10.0.250.11/32"
}
}
}
]
}
}
},
{
"node": {
"name": {
"value": "Loopback1"
},
"description": {
"value": "VTEP"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"ip_addresses": {
"edges": []
}
}
}
]
},
"InfraInterfaceEthernet": {
"edges": [
{
"node": {
"name": {
"value": "Ethernet1"
},
"description": {
"value": "host1"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"speed": {
"value": null
},
"mode": {
"value": "trunk"
},
"lag": {
"node": {
"name": {
"value": "Port-Channel1"
}
}
},
"ip_addresses": {
"edges": []
}
}
},
{
"node": {
"name": {
"value": "Ethernet10"
},
"description": {
"value": "mlag peer link"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"speed": {
"value": null
},
"mode": {
"value": "trunk"
},
"lag": {
"node": {
"name": {
"value": "Port-Channel999"
}
}
},
"ip_addresses": {
"edges": []
}
}
},
{
"node": {
"name": {
"value": "Ethernet11"
},
"description": {
"value": "spine1"
},
"enabled": {
"value": true
},
"mtu": {
"value": 9214
},
"speed": {
"value": null
},
"mode": {
"value": "routed"
},
"lag": null,
"ip_addresses": {
"edges": [
{
"node": {
"address": {
"value": "10.0.1.1/31"
}
}
}
]
}
}
},
{
"node": {
"name": {
"value": "Ethernet12"
},
"description": {
"value": "spine2"
},
"enabled": {
"value": true
},
"mtu": {
"value": 9214
},
"speed": {
"value": null
},
"mode": {
"value": "routed"
},
"lag": null,
"ip_addresses": {
"edges": [
{
"node": {
"address": {
"value": "10.0.2.1/31"
}
}
}
]
}
}
}
]
},
"InfraInterfaceVlan": {
"edges": [
{
"node": {
"name": {
"value": "Vlan4090"
},
"description": {
"value": "MLAG Peer-Link"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"virtual_router_address": {
"value": null
},
"autostate": {
"value": false
},
"vlan": {
"node": {
"vlan_id": {
"value": 4090
}
}
},
"ip_addresses": {
"edges": [
{
"node": {
"address": {
"value": "10.0.199.254/31"
}
}
}
]
}
}
},
{
"node": {
"name": {
"value": "Vlan4091"
},
"description": {
"value": "MLAG iBGP Peering"
},
"enabled": {
"value": true
},
"mtu": {
"value": 9214
},
"virtual_router_address": {
"value": null
},
"autostate": {
"value": true
},
"vlan": {
"node": {
"vlan_id": {
"value": 4091
}
}
},
"ip_addresses": {
"edges": [
{
"node": {
"address": {
"value": "10.0.3.0/31"
}
}
}
]
}
}
}
]
},
"InfraInterfaceLag": {
"edges": [
{
"node": {
"name": {
"value": "Port-Channel1"
},
"description": {
"value": "host1"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"lacp_mode": {
"value": "active"
},
"mlag_id": {
"value": 1
},
"members": {
"edges": [
{
"node": {
"name": {
"value": "Ethernet1"
}
}
}
]
},
"ip_addresses": {
"edges": []
}
}
},
{
"node": {
"name": {
"value": "Port-Channel999"
},
"description": {
"value": "MLAG Peer"
},
"enabled": {
"value": true
},
"mtu": {
"value": null
},
"lacp_mode": {
"value": "active"
},
"mlag_id": {
"value": null
},
"members": {
"edges": [
{
"node": {
"name": {
"value": "Ethernet10"
}
}
}
]
},
"ip_addresses": {
"edges": []
}
}
}
]
}
}
}

View File

@@ -0,0 +1,12 @@
[
{"description":"host1","enabled":true,"ip_addresses":[],"lag":"Port-Channel1","mode":"trunk","mtu":null,"name":"Ethernet1","speed":null,"type":"ethernet"},
{"description":"mlag peer link","enabled":true,"ip_addresses":[],"lag":"Port-Channel999","mode":"trunk","mtu":null,"name":"Ethernet10","speed":null,"type":"ethernet"},
{"description":"spine1","enabled":true,"ip_addresses":["10.0.1.1/31"],"lag":null,"mode":"routed","mtu":9214,"name":"Ethernet11","speed":null,"type":"ethernet"},
{"description":"spine2","enabled":true,"ip_addresses":["10.0.2.1/31"],"lag":null,"mode":"routed","mtu":9214,"name":"Ethernet12","speed":null,"type":"ethernet"},
{"description":"Router-ID","enabled":true,"ip_addresses":["10.0.250.11/32"],"mtu":null,"name":"Loopback0","type":"loopback"},
{"description":"VTEP","enabled":true,"ip_addresses":[],"mtu":null,"name":"Loopback1","type":"loopback"},
{"description":"host1","enabled":true,"ip_addresses":[],"lacp_mode":"active","members":["Ethernet1"],"mlag_id":1,"mtu":null,"name":"Port-Channel1","type":"lag"},
{"description":"MLAG Peer","enabled":true,"ip_addresses":[],"lacp_mode":"active","members":["Ethernet10"],"mlag_id":null,"mtu":null,"name":"Port-Channel999","type":"lag"},
{"autostate":false,"description":"MLAG Peer-Link","enabled":true,"ip_addresses":["10.0.199.254/31"],"mtu":null,"name":"Vlan4090","type":"vlan","virtual_router_address":null,"vlan_id":4090},
{"autostate":true,"description":"MLAG iBGP Peering","enabled":true,"ip_addresses":["10.0.3.0/31"],"mtu":9214,"name":"Vlan4091","type":"vlan","virtual_router_address":null,"vlan_id":4091}
]

View File

@@ -0,0 +1,15 @@
---
version: "1.0"
infrahub_tests:
- resource: Jinja2Transform
resource_name: interface_yang_transform
tests:
- name: smoke_check
spec:
kind: jinja2-transform-smoke
- name: render_leaf1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/interface_yang
input: input.json
output: output.json

View File

@@ -0,0 +1,96 @@
{
"data": {
"InfraMlagPeerConfig": {
"edges": [
{
"node": {
"local_interface_ip": {
"value": "10.0.199.254/31"
},
"peer_address": {
"value": "10.0.199.255"
},
"heartbeat_peer_ip": {
"value": "172.16.0.50"
},
"device": {
"node": {
"name": {
"value": "leaf1"
}
}
},
"mlag_domain": {
"node": {
"domain_id": {
"value": "leafs-1-2"
},
"virtual_mac": {
"value": "c001.cafe.babe"
},
"heartbeat_vrf": {
"value": "mgmt"
},
"dual_primary_detection": {
"value": true
},
"dual_primary_delay": {
"value": 10
},
"dual_primary_action": {
"value": "errdisable"
},
"devices": {
"edges": [
{
"node": {
"name": {
"value": "leaf1"
}
}
},
{
"node": {
"name": {
"value": "leaf2"
}
}
}
]
},
"peer_vlan": {
"node": {
"vlan_id": {
"value": 4090
}
}
},
"ibgp_vlan": {
"node": {
"vlan_id": {
"value": 4091
}
}
}
}
},
"local_interface": {
"node": {
"name": {
"value": "Vlan4090"
}
}
},
"peer_link": {
"node": {
"name": {
"value": "Port-Channel999"
}
}
}
}
}
]
}
}
}

View File

@@ -0,0 +1,22 @@
{
"mlag": {
"config": {
"domain-id": "leafs-1-2",
"peer-link": "Port-Channel999",
"local-interface": "Vlan4090",
"peer-address": "10.0.199.255",
"shutdown": false
},
"dual_primary_detection": {
"enabled": true,
"delay": 10,
"action": "errdisable",
"heartbeat_peer_ip": "172.16.0.50",
"heartbeat_vrf": "mgmt"
},
"virtual_mac": "c001.cafe.babe",
"peer_vlan_id": 4090,
"ibgp_vlan_id": 4091,
"local_interface_ip": "10.0.199.254/31"
}
}

View File

@@ -0,0 +1,7 @@
{
"data": {
"InfraMlagPeerConfig": {
"edges": []
}
}
}

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,21 @@
---
version: "1.0"
infrahub_tests:
- resource: Jinja2Transform
resource_name: mlag_yang_transform
tests:
- name: smoke_check
spec:
kind: jinja2-transform-smoke
- name: render_leaf1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/mlag_yang/leaf1
input: input.json
output: output.json
- name: render_spine1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/mlag_yang/spine1
input: input.json
output: output.json

View File

@@ -0,0 +1,116 @@
{
"data": {
"InfraVTEP": {
"edges": [
{
"node": {
"source_address": {
"value": "10.0.255.11"
},
"udp_port": {
"value": 4789
},
"vlan_vni_mappings": {
"edges": [
{
"node": {
"vlan": {
"node": {
"vlan_id": {
"value": 40
},
"name": {
"value": "test-l2-vxlan"
},
"status": {
"value": "active"
},
"vlan_type": {
"value": "standard"
},
"trunk_groups": {
"value": null
},
"stp_enabled": {
"value": true
},
"vni": {
"node": {
"vni": {
"value": 110040
},
"vni_type": {
"value": "l2vni"
}
}
}
}
}
}
}
]
}
}
}
]
},
"InfraInterfaceVlan": {
"edges": [
{
"node": {
"vlan": {
"node": {
"vlan_id": {
"value": 4090
},
"name": {
"value": "mlag-peer"
},
"status": {
"value": "active"
},
"vlan_type": {
"value": "mlag_peer"
},
"trunk_groups": {
"value": ["mlag-peer"]
},
"stp_enabled": {
"value": false
},
"vni": null
}
}
}
},
{
"node": {
"vlan": {
"node": {
"vlan_id": {
"value": 4091
},
"name": {
"value": "mlag-ibgp"
},
"status": {
"value": "active"
},
"vlan_type": {
"value": "mlag_ibgp"
},
"trunk_groups": {
"value": ["mlag-peer"]
},
"stp_enabled": {
"value": false
},
"vni": null
}
}
}
}
]
}
}
}

View File

@@ -0,0 +1,32 @@
[
{
"name": "test-l2-vxlan",
"status": "ACTIVE",
"stp_enabled": true,
"trunk_groups": null,
"vlan_id": 40,
"vlan_type": "standard",
"vni": 110040,
"vni_type": "l2vni"
},
{
"name": "mlag-peer",
"status": "ACTIVE",
"stp_enabled": false,
"trunk_groups": ["mlag-peer"],
"vlan_id": 4090,
"vlan_type": "mlag_peer",
"vni": null,
"vni_type": null
},
{
"name": "mlag-ibgp",
"status": "ACTIVE",
"stp_enabled": false,
"trunk_groups": ["mlag-peer"],
"vlan_id": 4091,
"vlan_type": "mlag_ibgp",
"vni": null,
"vni_type": null
}
]

View File

@@ -0,0 +1,15 @@
---
version: "1.0"
infrahub_tests:
- resource: Jinja2Transform
resource_name: vlan_yang_transform
tests:
- name: smoke_check
spec:
kind: jinja2-transform-smoke
- name: render_leaf1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/vlan_yang
input: input.json
output: output.json

View File

@@ -0,0 +1,82 @@
{
"data": {
"InfraVRFDeviceAssignment": {
"edges": [
{
"node": {
"route_distinguisher": {
"value": "10.0.250.13:1"
},
"vrf": {
"node": {
"name": {
"value": "gold"
},
"description": {
"value": "VRF gold - L3 VXLAN with symmetric IRB"
},
"route_distinguisher": {
"value": null
},
"l3vni": {
"node": {
"vni": {
"value": 100001
},
"vni_type": {
"value": "l3vni"
}
}
},
"import_targets": {
"edges": [
{
"node": {
"target": {
"value": "1:100001"
}
}
}
]
},
"export_targets": {
"edges": [
{
"node": {
"target": {
"value": "1:100001"
}
}
}
]
}
}
},
"import_targets": {
"edges": [
{
"node": {
"target": {
"value": "1:100001"
}
}
}
]
},
"export_targets": {
"edges": [
{
"node": {
"target": {
"value": "1:100001"
}
}
}
]
}
}
}
]
}
}
}

View File

@@ -0,0 +1,15 @@
[
{
"description": "VRF gold - L3 VXLAN with symmetric IRB",
"export_targets": [
"1:100001"
],
"import_targets": [
"1:100001"
],
"l3vni": 100001,
"redistribute_connected": true,
"route_distinguisher": "10.0.250.13:1",
"vrf_name": "gold"
}
]

View File

@@ -0,0 +1,15 @@
---
version: "1.0"
infrahub_tests:
- resource: Jinja2Transform
resource_name: vrf_yang_transform
tests:
- name: smoke_check
spec:
kind: jinja2-transform-smoke
- name: render_leaf3
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/vrf_yang
input: input.json
output: output.json

View File

@@ -0,0 +1,62 @@
{
"data": {
"InfraVTEP": {
"edges": [
{
"node": {
"source_address": {
"value": "10.0.255.11/32"
},
"udp_port": {
"value": 4789
},
"learn_restrict": {
"value": "any"
},
"source_interface": {
"node": {
"name": {
"value": "Loopback1"
}
}
},
"vlan_vni_mappings": {
"edges": [
{
"node": {
"description": {
"value": "VLAN 40 <-> VNI 110040"
},
"vlan": {
"node": {
"vlan_id": {
"value": 40
},
"name": {
"value": "test-l2-vxlan"
}
}
},
"vni": {
"node": {
"vni": {
"value": 110040
},
"vni_type": {
"value": "l2vni"
}
}
}
}
}
]
}
}
}
]
},
"InfraVRFDeviceAssignment": {
"edges": []
}
}
}

View File

@@ -0,0 +1,12 @@
{
"vtep": {
"learn_restrict": "any",
"source_address": "10.0.255.11/32",
"source_interface": "Loopback1",
"udp_port": 4789,
"vlan_vni_mappings": [
{"vlan_id": 40, "vlan_name": "test-l2-vxlan", "vni": 110040, "vni_type": "l2vni"}
],
"vrf_vni_mappings": []
}
}

View File

@@ -0,0 +1,15 @@
---
version: "1.0"
infrahub_tests:
- resource: Jinja2Transform
resource_name: vxlan_yang_transform
tests:
- name: smoke_check
spec:
kind: jinja2-transform-smoke
- name: render_leaf1
spec:
kind: jinja2-transform-unit-render
directory: infrahub/transforms/tests/vxlan_yang
input: input.json
output: output.json