Skip to content

Commit

Permalink
Merge pull request #218 from HewlettPackard/I162
Browse files Browse the repository at this point in the history
Issue162
  • Loading branch information
AsisBagga authored Sep 18, 2020
2 parents 33815f7 + da70b85 commit 667ba07
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 82 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
### Bug fixes & Enhancements:
- [#29] (https://github.com/HewlettPackard/terraform-provider-oneview/issues/29) Add Description and Bios settings to server template
- [#63] (https://github.com/HewlettPackard/terraform-provider-oneview/issues/63) Create util function to get scope by name while creating a resource instead of hardcoding it
- [#162] (https://github.com/HewlettPackard/terraform-provider-oneview/issues/162) Logical Interconnect Group dependentResourceUri error.

# [v1.4.0]
### Notes
Expand Down
1 change: 0 additions & 1 deletion examples/logical_interconnect_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ provider "oneview" {
ov_ifmatch = "*"
}


/*
# Creates a logical interconnect group or updates if already existing
resource "oneview_logical_interconnect_group" "LIG" {
Expand Down
118 changes: 37 additions & 81 deletions oneview/resource_logical_interconnect_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ func resourceLogicalInterconnectGroup() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"dependent_resource_uri": {
Type: schema.TypeString,
Computed: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -2119,6 +2123,8 @@ func resourceLogicalInterconnectGroupUpdate(d *schema.ResourceData, meta interfa
lig.SnmpConfiguration = &snmpConfiguration
}

ligCall, _ := config.ovClient.GetLogicalInterconnectGroupByName(d.Get("name").(string))

interconnectSettingsPrefix := fmt.Sprintf("interconnect_settings.0")
if val, ok := d.GetOk(interconnectSettingsPrefix + ".type"); ok {
interconnectSettings := ov.EthernetSettings{}
Expand All @@ -2145,91 +2151,41 @@ func resourceLogicalInterconnectGroupUpdate(d *schema.ResourceData, meta interfa
if val1, ok := d.GetOk(interconnectSettingsPrefix + ".mac_refresh_interval"); ok {
interconnectSettings.MacRefreshInterval = val1.(int)
}

interconnectSettings.DependentResourceUri = ligCall.EthernetSettings.DependentResourceUri
interconnectSettings.Type = val.(string)
lig.EthernetSettings = &interconnectSettings
}

igmpSettingsPrefix := fmt.Sprintf("igmp_settings.0")

if val, ok := d.GetOk(igmpSettingsPrefix + ".type"); ok {
igmpSettings := ov.IgmpSettings{}

consistencyChecking := d.Get(igmpSettingsPrefix + ".consistency_checking").(string)
igmpSettings.ConsistencyChecking = consistencyChecking

igmpSnooping := d.Get(igmpSettingsPrefix + ".igmp_snooping").(bool)
igmpSettings.EnableIgmpSnooping = &igmpSnooping

preventFlooding := d.Get(igmpSettingsPrefix + ".prevent_flooding").(bool)
igmpSettings.EnablePreventFlooding = &preventFlooding

proxyReporting := d.Get(igmpSettingsPrefix + ".proxy_reporting").(bool)
igmpSettings.EnableProxyReporting = &proxyReporting

if val1, ok := d.GetOk(igmpSettingsPrefix + ".created"); ok {
enabled := val1.(string)
igmpSettings.Created = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".description"); ok {
enabled := val1.(string)
igmpSettings.Description = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".id"); ok {
enabled := val1.(string)
igmpSettings.ID = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".etag"); ok {
enabled := utils.NewNstring(val1.(string))
igmpSettings.ETAG = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".igmp_idle_timeout_interval"); ok {
enabled := val1.(int)
igmpSettings.IgmpIdleTimeoutInterval = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".igmp_snooping_vlan_ids"); ok {
enabled := val1.(string)
igmpSettings.IgmpSnoopingVlanIds = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".modified"); ok {
enabled := val1.(string)
igmpSettings.Modified = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".name"); ok {
enabled := val1.(string)
igmpSettings.Name = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".state"); ok {
enabled := val1.(string)
igmpSettings.State = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".status"); ok {
enabled := val1.(string)
igmpSettings.Status = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".category"); ok {
enabled := utils.NewNstring(val1.(string))
igmpSettings.Category = enabled
}

if val1, ok := d.GetOk(igmpSettingsPrefix + ".uri"); ok {
enabled := utils.NewNstring(val1.(string))
igmpSettings.URI = enabled
}

igmpSettings.Type = val.(string)
lig.IgmpSettings = &igmpSettings
}
rawigmpsetting := d.Get("igmp_settings").(*schema.Set).List()
igmpSetting := ov.IgmpSettings{}
for _, val := range rawigmpsetting {

rawlval := val.(map[string]interface{})

enableigmpsnooping := rawlval["igmp_snooping"].(bool)
enablepreventflooding := rawlval["prevent_flooding"].(bool)
enableproxyreporting := rawlval["proxy_reporting"].(bool)

igmpSetting.Created = rawlval["created"].(string)
igmpSetting.Category = utils.Nstring(rawlval["category"].(string))
igmpSetting.Type = rawlval["type"].(string)
igmpSetting.ConsistencyChecking = rawlval["consistency_checking"].(string)
igmpSetting.DependentResourceUri = ligCall.IgmpSettings.DependentResourceUri
igmpSetting.Description = rawlval["description"].(string)
igmpSetting.ETAG = utils.Nstring(rawlval["etag"].(string))
igmpSetting.EnableIgmpSnooping = &enableigmpsnooping
igmpSetting.EnablePreventFlooding = &enablepreventflooding
igmpSetting.EnableProxyReporting = &enableproxyreporting
igmpSetting.ID = rawlval["id"].(string)
igmpSetting.IgmpIdleTimeoutInterval = rawlval["igmp_idle_timeout_interval"].(int)
igmpSetting.IgmpSnoopingVlanIds = rawlval["igmp_snooping_vlan_ids"].(string)
igmpSetting.Modified = rawlval["modified"].(string)
igmpSetting.Name = rawlval["name"].(string)
igmpSetting.State = rawlval["state"].(string)
igmpSetting.Status = rawlval["status"].(string)
igmpSetting.URI = utils.Nstring(rawlval["uri"].(string))
}
lig.IgmpSettings = &igmpSetting

qualityOfServicePrefix := fmt.Sprintf("quality_of_service.0")
activeQosConfig := ov.ActiveQosConfig{}
Expand Down

0 comments on commit 667ba07

Please sign in to comment.