Skip to content

Commit

Permalink
Add bgp advertised prefix resource and data source (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgomezve authored Aug 11, 2023
1 parent a5f9bc7 commit e972c80
Show file tree
Hide file tree
Showing 20 changed files with 893 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.1 (unreleased)

- Add `nxos_bgp_advertised_prefix` resource and data source

## 0.5.0

- Migrate to `CiscoDevNet` registry namespace
Expand Down
44 changes: 44 additions & 0 deletions docs/data-sources/bgp_advertised_prefix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nxos_bgp_advertised_prefix Data Source - terraform-provider-nxos"
subcategory: "BGP"
description: |-
This data source can read the BGP (VRF) advertised prefix configuration.
API Documentation: bgpAdvPrefix https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:AdvPrefix/
---

# nxos_bgp_advertised_prefix (Data Source)

This data source can read the BGP (VRF) advertised prefix configuration.

- API Documentation: [bgpAdvPrefix](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:AdvPrefix/)

## Example Usage

```terraform
data "nxos_bgp_advertised_prefix" "example" {
asn = "65001"
vrf = "default"
address_family = "ipv4-ucast"
prefix = "192.168.1.0/24"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `address_family` (String) Address Family.
- `asn` (String) Autonomous system number.
- `prefix` (String) IP address of the network or prefix to advertise.
- `vrf` (String) VRF name.

### Optional

- `device` (String) A device name from the provider configuration.

### Read-Only

- `id` (String) The distinguished name of the object.
- `route_map` (String) Route map to modify attributes.
4 changes: 4 additions & 0 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ description: |-

# Changelog

## 0.5.1 (unreleased)

- Add `nxos_bgp_advertised_prefix` resource and data source

## 0.5.0

- Migrate to `CiscoDevNet` registry namespace
Expand Down
1 change: 1 addition & 0 deletions docs/guides/supported_objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For the following DME objects a corresponding Terraform resource and data source
|------------|--------------------|-----------------------|
| [bgpEntity](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Entity/) | [nxos_bgp](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp) | [nxos_bgp](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp) |
| [bgpDomAf](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:DomAf/) | [nxos_bgp_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_address_family) | [nxos_bgp_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_address_family) |
| [bgpAdvPrefix](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:AdvPrefix/) | [nxos_bgp_advertised_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_advertised_prefix) | [nxos_bgp_advertised_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_advertised_prefix) |
| [bgpGr](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Gr/) | [nxos_bgp_graceful_restart](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_graceful_restart) | [nxos_bgp_graceful_restart](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_graceful_restart) |
| [bgpInst](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Inst/) | [nxos_bgp_instance](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_instance) | [nxos_bgp_instance](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_instance) |
| [bgpPeer](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Peer/) | [nxos_bgp_peer](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_peer) | [nxos_bgp_peer](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_peer) |
Expand Down
6 changes: 6 additions & 0 deletions docs/resources/bgp_address_family.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: |-
API Documentation: bgpDomAf https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:DomAf/
Parent resources
nxosbgpvrf https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_vrf
Child resources
nxosbgpadvertised_prefix https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_advertised_prefix
---

# nxos_bgp_address_family (Resource)
Expand All @@ -19,6 +21,10 @@ This resource can manage the BGP (VRF) address family configuration.

- [nxos_bgp_vrf](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_vrf)

### Child resources

- [nxos_bgp_advertised_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_advertised_prefix)

## Example Usage

```terraform
Expand Down
61 changes: 61 additions & 0 deletions docs/resources/bgp_advertised_prefix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "nxos_bgp_advertised_prefix Resource - terraform-provider-nxos"
subcategory: "BGP"
description: |-
This resource can manage the BGP (VRF) advertised prefix configuration.
API Documentation: bgpAdvPrefix https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:AdvPrefix/
Parent resources
nxosbgpaddress_family https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_address_family
---

# nxos_bgp_advertised_prefix (Resource)

This resource can manage the BGP (VRF) advertised prefix configuration.

- API Documentation: [bgpAdvPrefix](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:AdvPrefix/)

### Parent resources

- [nxos_bgp_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_address_family)

## Example Usage

```terraform
resource "nxos_bgp_advertised_prefix" "example" {
asn = "65001"
vrf = "default"
address_family = "ipv4-ucast"
prefix = "192.168.1.0/24"
route_map = "rt-map"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `address_family` (String) Address Family.
- Choices: `ipv4-ucast`, `ipv4-mcast`, `vpnv4-ucast`, `ipv6-ucast`, `ipv6-mcast`, `vpnv6-ucast`, `vpnv6-mcast`, `l2vpn-evpn`, `ipv4-lucast`, `ipv6-lucast`, `lnkstate`, `ipv4-mvpn`, `ipv6-mvpn`, `l2vpn-vpls`, `ipv4-mdt`
- Default value: `ipv4-ucast`
- `asn` (String) Autonomous system number.
- `prefix` (String) IP address of the network or prefix to advertise.
- `vrf` (String) VRF name.

### Optional

- `device` (String) A device name from the provider configuration.
- `route_map` (String) Route map to modify attributes.

### Read-Only

- `id` (String) The distinguished name of the object.

## Import

Import is supported using the following syntax:

```shell
terraform import nxos_bgp_advertised_prefix.example "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]/prefix-[192.168.1.0/24]"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "nxos_bgp_advertised_prefix" "example" {
asn = "65001"
vrf = "default"
address_family = "ipv4-ucast"
prefix = "192.168.1.0/24"
}
1 change: 1 addition & 0 deletions examples/resources/nxos_bgp_advertised_prefix/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import nxos_bgp_advertised_prefix.example "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]/prefix-[192.168.1.0/24]"
7 changes: 7 additions & 0 deletions examples/resources/nxos_bgp_advertised_prefix/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "nxos_bgp_advertised_prefix" "example" {
asn = "65001"
vrf = "default"
address_family = "ipv4-ucast"
prefix = "192.168.1.0/24"
route_map = "rt-map"
}
2 changes: 2 additions & 0 deletions gen/definitions/bgp_address_family.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ doc_path: Routing%20and%20Forwarding/bgp:DomAf/
doc_category: BGP
parents:
- BGP VRF
children:
- BGP Advertised Prefix
attributes:
- nxos_name: asn
tf_name: asn
Expand Down
92 changes: 92 additions & 0 deletions gen/definitions/bgp_advertised_address.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
name: BGP Advertised Prefix
class_name: bgpAdvPrefix
dn: sys/bgp/inst/dom-[%s]/af-[%s]/prefix-[%s]
ds_description: This data source can read the BGP (VRF) advertised prefix configuration.
res_description: This resource can manage the BGP (VRF) advertised prefix configuration.
doc_path: Routing%20and%20Forwarding/bgp:AdvPrefix/
doc_category: BGP
parents:
- BGP Address Family
attributes:
- nxos_name: asn
tf_name: asn
type: String
reference_only: true
description: 'Autonomous system number.'
example: '65001'
- nxos_name: name
tf_name: vrf
type: String
id: true
reference_only: true
description: 'VRF name.'
example: default
- nxos_name: type
tf_name: address_family
type: String
id: true
reference_only: true
description: 'Address Family.'
enum_values:
- ipv4-ucast
- ipv4-mcast
- vpnv4-ucast
- ipv6-ucast
- ipv6-mcast
- vpnv6-ucast
- vpnv6-mcast
- l2vpn-evpn
- ipv4-lucast
- ipv6-lucast
- lnkstate
- ipv4-mvpn
- ipv6-mvpn
- l2vpn-vpls
- ipv4-mdt
default_value: 'ipv4-ucast'
example: 'ipv4-ucast'
- nxos_name: addr
tf_name: prefix
type: String
id: true
description: 'IP address of the network or prefix to advertise.'
example: '192.168.1.0/24'
- nxos_name: rtMap
tf_name: route_map
type: String
description: 'Route map to modify attributes.'
default_value: ''
example: rt-map
test_prerequisites:
- dn: sys/fm/bgp
class_name: fmBgp
no_delete: true
attributes:
- name: adminSt
value: enabled
- dn: sys/bgp
class_name: bgpEntity
dependencies: [0]
- dn: sys/bgp/inst
class_name: bgpInst
attributes:
- name: adminSt
value: enabled
- name: asn
value: '65001'
dependencies: [1]
- dn: sys/bgp/inst/dom-[default]
class_name: bgpDom
attributes:
- name: name
value: default
dependencies: [2]
- dn: sys/bgp/inst/dom-[default]/af-[ipv4-ucast]
class_name: bgpDomAf
attributes:
- name: name
value: default
- name: type
value: ipv4cast
dependencies: [2]
124 changes: 124 additions & 0 deletions internal/provider/data_source_nxos_bgp_advertised_prefix.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e972c80

Please sign in to comment.