diff --git a/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go b/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go index 4aa07a6e..119666e7 100644 --- a/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go +++ b/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go @@ -182,6 +182,7 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortImport(d *schema.ResourceData, m i portPath := regexp.MustCompile(`(topology\/(?P.*)\/paths-(?P.*)\/extpaths-(?P.*)\/pathep-\[(?P.*)\])`) vpcPath := regexp.MustCompile(`(topology\/(?P.*)\/protpaths-(?P.*)\/pathep-\[(?P.*)\])`) + vpcWithFexPath := regexp.MustCompile(`(topology\/(?P.*)\/protpaths-(?P.*)\/extprotpaths-(?P.*)\/pathep-\[(?P.*)\])`) dpcPath := regexp.MustCompile(`(topology\/(?P.*)\/paths-(?P.*)\/pathep-\[(?P.*)\])`) staticPortsList := make([]interface{}, 0, 1) @@ -216,6 +217,9 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortImport(d *schema.ResourceData, m i if portPath.MatchString(pathValue) { matchedMap = getStaticPortPathValues(pathValue, portPath) staticPortMap["fex"] = matchedMap["fexValue"] + } else if vpcWithFexPath.MatchString(pathValue) { + matchedMap = getStaticPortPathValues(pathValue, vpcWithFexPath) + staticPortMap["fex"] = matchedMap["fexValue"] } else if vpcPath.MatchString(pathValue) { matchedMap = getStaticPortPathValues(pathValue, vpcPath) } else if dpcPath.MatchString(pathValue) { @@ -284,6 +288,8 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortCreate(d *schema.ResourceData, m i if staticPortMap["type"] == "port" && static_port_fex != "" { portpath = fmt.Sprintf("topology/%s/paths-%s/extpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_fex, static_port_path) + } else if staticPortMap["type"] == "vpc" && static_port_fex != "" { + portpath = fmt.Sprintf("topology/%s/protpaths-%s/extprotpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_fex, static_port_path) } else if staticPortMap["type"] == "vpc" { portpath = fmt.Sprintf("topology/%s/protpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_path) } else { @@ -412,6 +418,7 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortRead(d *schema.ResourceData, m int portPath := regexp.MustCompile(`(topology\/(?P.*)\/paths-(?P.*)\/extpaths-(?P.*)\/pathep-\[(?P.*)\])`) vpcPath := regexp.MustCompile(`(topology\/(?P.*)\/protpaths-(?P.*)\/pathep-\[(?P.*)\])`) + vpcWithFexPath := regexp.MustCompile(`(topology\/(?P.*)\/protpaths-(?P.*)\/extprotpaths-(?P.*)\/pathep-\[(?P.*)\])`) dpcPath := regexp.MustCompile(`(topology\/(?P.*)\/paths-(?P.*)\/pathep-\[(?P.*)\])`) staticPortsList := make([]interface{}, 0, 1) @@ -446,6 +453,9 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortRead(d *schema.ResourceData, m int if portPath.MatchString(pathValue) { matchedMap = getStaticPortPathValues(pathValue, portPath) staticPortMap["fex"] = matchedMap["fexValue"] + } else if vpcWithFexPath.MatchString(pathValue) { + matchedMap = getStaticPortPathValues(pathValue, vpcWithFexPath) + staticPortMap["fex"] = matchedMap["fexValue"] } else if vpcPath.MatchString(pathValue) { matchedMap = getStaticPortPathValues(pathValue, vpcPath) } else if dpcPath.MatchString(pathValue) { @@ -514,6 +524,8 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortUpdate(d *schema.ResourceData, m i if staticPortMap["type"] == "port" && static_port_fex != "" { portpath = fmt.Sprintf("topology/%s/paths-%s/extpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_fex, static_port_path) + } else if staticPortMap["type"] == "vpc" && static_port_fex != "" { + portpath = fmt.Sprintf("topology/%s/protpaths-%s/extprotpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_fex, static_port_path) } else if staticPortMap["type"] == "vpc" { portpath = fmt.Sprintf("topology/%s/protpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_path) } else { @@ -608,6 +620,8 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPortDelete(d *schema.ResourceData, m i if staticPortMap["path_type"] == "port" && staticPort["fex"] != "" { portpath = fmt.Sprintf("topology/%s/paths-%s/extpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_fex, static_port_path) + } else if staticPortMap["type"] == "vpc" && static_port_fex != "" { + portpath = fmt.Sprintf("topology/%s/protpaths-%s/extprotpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_fex, static_port_path) } else if staticPortMap["path_type"] == "vpc" { portpath = fmt.Sprintf("topology/%s/protpaths-%s/pathep-[%s]", static_port_pod, static_port_leaf, static_port_path) } else {