Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix import for anp_epg_static_leaf to include template (DCNE-214) #306

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions mso/resource_mso_schema_site_anp_epg_static_leaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ func resourceMSOSchemaSiteAnpEpgStaticleafImport(d *schema.ResourceData, m inter
}

stateSite := get_attribute[2]
stateTemplate := get_attribute[4]
found := false
stateAnp := get_attribute[4]
stateEpg := get_attribute[6]
stateAnp := get_attribute[6]
stateEpg := get_attribute[8]
statePath := import_split[2]

for i := 0; i < count; i++ {
Expand All @@ -99,8 +100,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafImport(d *schema.ResourceData, m inter
return nil, err
}
apiSite := models.StripQuotes(tempCont.S("siteId").String())
apiTemplate := models.StripQuotes(tempCont.S("templateName").String())

if apiSite == stateSite {
if apiSite == stateSite && apiTemplate == stateTemplate {
anpCount, err := tempCont.ArrayCount("anps")
if err != nil {
return nil, fmt.Errorf("Unable to get Anp list")
Expand Down Expand Up @@ -329,6 +331,7 @@ func resourceMSOSchemaSiteAnpEpgStaticleafRead(d *schema.ResourceData, m interfa

stateSite := d.Get("site_id").(string)
found := false
stateTemplate := d.Get("template_name").(string)
stateAnp := d.Get("anp_name").(string)
stateEpg := d.Get("epg_name").(string)
statePath := d.Get("path").(string)
Expand All @@ -339,8 +342,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafRead(d *schema.ResourceData, m interfa
return err
}
apiSite := models.StripQuotes(tempCont.S("siteId").String())
apiTemplate := models.StripQuotes(tempCont.S("templateName").String())

if apiSite == stateSite {
if apiSite == stateSite && apiTemplate == stateTemplate {
anpCount, err := tempCont.ArrayCount("anps")
if err != nil {
return fmt.Errorf("Unable to get Anp list")
Expand Down Expand Up @@ -435,6 +439,7 @@ func resourceMSOSchemaSiteAnpEpgStaticleafDelete(d *schema.ResourceData, m inter

index := -1
stateSite := d.Get("site_id").(string)
stateTemplate := d.Get("template_name").(string)
stateAnp := d.Get("anp_name").(string)
stateEpg := d.Get("epg_name").(string)
statePath := d.Get("path").(string)
Expand All @@ -445,8 +450,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafDelete(d *schema.ResourceData, m inter
return err
}
apiSite := models.StripQuotes(tempCont.S("siteId").String())
apiTemplate := models.StripQuotes(tempCont.S("templateName").String())

if apiSite == stateSite {
if apiSite == stateSite && apiTemplate == stateTemplate {
anpCount, err := tempCont.ArrayCount("anps")
if err != nil {
return fmt.Errorf("Unable to get Anp list")
Expand Down
Loading