Skip to content

Commit 3dcd5e9

Browse files
RaviPatrarwcrowe
andauthored
Implemented iosxr_snmp_server_views feature (#17)
* Updated with banner feature. * updated the variable file to empty list * implemented iosxr_cdp feature. * Removed unused files. Updated files with default data. * Delete examples/system/system.nac.yaml * Updated pre-commit file. * Updated Readme file using pre-commit command * Address Git test failed issues by adding system.nac.yaml file. * Replaced system.nac.yaml with master copy. * implemented iosxr_snmp_server_view feature. * implemented iosxr_snmp_server_view feature. * Handled with try and default value. * Addressed code review comments * Updated readme file --------- Co-authored-by: rpatraga <> Co-authored-by: Robert Crowe <rwcrowe@users.noreply.github.com>
1 parent 8f0cd2a commit 3dcd5e9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ module "iosxr" {
7171
| [iosxr_ntp.ntp](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/ntp) | resource |
7272
| [iosxr_service_timestamps.service_timestamps](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/service_timestamps) | resource |
7373
| [iosxr_snmp_server_mib.snmp_server_mib](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/snmp_server_mib) | resource |
74+
| [iosxr_snmp_server_view.snmp_server_view](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/snmp_server_view) | resource |
7475
| [local_sensitive_file.defaults](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource |
7576
| [terraform_data.validation](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
7677
## Modules

iosxr_snmp_server_view.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
locals {
2+
device_snmp_server_view_configs = flatten([
3+
for device in local.devices : [
4+
for view in try(local.device_config[device.name].snmp_server_views, local.defaults.iosxr.configuration.snmp_server_views, []) : {
5+
device_name = device.name
6+
key = try("${device.name}-snmp-server-view-${view.view_name}", null)
7+
view_name = try(view.view_name, local.defaults.iosxr.configuration.snmp_server_view_name, null)
8+
mib_view_families = [
9+
for family in try(view.mib_view_families, local.defaults.iosxr.configuration.snmp_server_view_mib_view_families, []) : {
10+
name = try(family.name, local.defaults.iosxr.configuration.snmp_server_view_mib_view_family_name, null)
11+
excluded = try(family.excluded, local.defaults.iosxr.configuration.snmp_server_view_mib_view_family_excluded, null)
12+
included = try(family.included, local.defaults.iosxr.configuration.snmp_server_view_mib_view_family_included, null)
13+
}
14+
]
15+
}
16+
] if try(local.device_config[device.name].snmp_server_views, local.defaults.iosxr.configuration.snmp_server_views, null) != null
17+
])
18+
}
19+
20+
resource "iosxr_snmp_server_view" "snmp_server_view" {
21+
for_each = { for view_config in local.device_snmp_server_view_configs : view_config.key => view_config }
22+
device = each.value.device_name
23+
24+
view_name = each.value.view_name
25+
mib_view_families = each.value.mib_view_families
26+
}

0 commit comments

Comments
 (0)