Skip to content

Instantly share code, notes, and snippets.

@adarobin
Created February 13, 2020 21:19
Show Gist options
  • Save adarobin/2bac79949c89312a3218b03b4ce96715 to your computer and use it in GitHub Desktop.
Save adarobin/2bac79949c89312a3218b03b4ce96715 to your computer and use it in GitHub Desktop.
variable "native_network_uri" {
type = "string"
description = "The native network of the uplink ports"
default = ""
}
variable "network_uris" {
description = "The networks trunked to the uplink ports"
type = "list"
default = []
}
variable "uplink_port_nums" {
type = "list"
description = "The port numbers of the uplinks on the Logical Interconnect"
}
variable "lig_name_prefix" {
type = "string"
description = "A prefix to the name of the Logical Interconnect Group"
}
variable "logical_interconnect_type" {
type = "string"
description = "The model of Interconnect to be configured"
}
variable "logical_interconnect_link_type" {
type = "string"
description = "The model of the link interconnect to be configured"
}
variable "fabric_side_map" {
type = "map"
description = "The A and B side of the LIG pair mapped to interconnect bays on the chassis"
default = {
A = 3
B = 6
}
}
variable "a_side_primary_enclosure" {
type = "string"
description = "The enclosure number of the enclosure that contains the primary interconnect for the A side"
}
variable "b_side_primary_enclosure" {
type = "string"
description = "The enclosure number of the enclosure that contains the primary interconnect for the B side"
}
variable "snmp_community_string" {
type = "string"
description = "The SNMP Community string the Logical Interconnect should use"
default = "public"
}
resource "oneview_logical_interconnect_group" "ligA" {
name = "${var.lig_name_prefix}_Eth_LIG_A"
type = "logical-interconnect-groupV7"
redundancy_type = "NonRedundantASide"
interconnect_bay_set = 3
enclosure_indexes = [1,2]
interconnect_map_entry_template {
interconnect_type_name = "${var.logical_interconnect_type}"
bay_number = "${var.fabric_side_map["A"]}"
enclosure_index = "${var.a_side_primary_enclosure}"
}
interconnect_map_entry_template {
interconnect_type_name = "${var.logical_interconnect_link_type}"
bay_number = "${var.fabric_side_map["A"]}"
enclosure_index = 2
}
interconnect_settings {
type = "EthernetInterconnectSettingsV6"
fast_mac_cache_failover = true
igmp_snooping = false
network_loop_protection = true
pause_flood_protection = true
igmp_timeout_interval = 260
mac_refresh_interval = 5
}
telemetry_configuration {
type = "CanonicalTelemetryConfiguration"
enabled = true
sample_count = 12
sample_interval = 300
}
uplink_set {
name = "UplinkSet_A"
network_uris = ["${var.network_uris}"]
native_network_uri = "${var.native_network_uri}"
network_type = "Ethernet"
mode = "Auto"
lacp_timer = "Short"
logical_port_config {
desired_speed = "Auto"
bay_num = "${var.fabric_side_map["A"]}"
port_num = "${var.uplink_port_nums}"
enclosure_num = "${var.a_side_primary_enclosure}"
}
}
snmp_configuration {
enabled = true
v3_enabled = true
read_community = "${var.snmp_community_string}"
}
}
resource "oneview_logical_interconnect_group" "ligB" {
name = "${var.lig_name_prefix}_Eth_LIG_B"
type = "logical-interconnect-groupV7"
redundancy_type = "NonRedundantBSide"
interconnect_bay_set = 3
enclosure_indexes = [1,2]
interconnect_map_entry_template {
interconnect_type_name = "${var.logical_interconnect_type}"
bay_number = "${var.fabric_side_map["B"]}"
enclosure_index = "${var.b_side_primary_enclosure}"
}
interconnect_map_entry_template {
interconnect_type_name = "${var.logical_interconnect_link_type}"
bay_number = "${var.fabric_side_map["B"]}"
enclosure_index = 1
}
interconnect_settings {
type = "EthernetInterconnectSettingsV6"
fast_mac_cache_failover = true
igmp_snooping = false
network_loop_protection = true
pause_flood_protection = true
igmp_timeout_interval = 260
mac_refresh_interval = 5
}
telemetry_configuration {
type = "CanonicalTelemetryConfiguration"
enabled = true
sample_count = 12
sample_interval = 300
}
uplink_set {
name = "UplinkSet_B"
network_uris = ["${var.network_uris}"]
native_network_uri = "${var.native_network_uri}"
network_type = "Ethernet"
mode = "Auto"
lacp_timer = "Short"
logical_port_config {
desired_speed = "Auto"
bay_num = "${var.fabric_side_map["B"]}"
port_num = "${var.uplink_port_nums}"
enclosure_num = "${var.b_side_primary_enclosure}"
}
}
snmp_configuration {
enabled = true
v3_enabled = true
read_community = "${var.snmp_community_string}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment