Skip to content

Commit

Permalink
S2 dev (#67)
Browse files Browse the repository at this point in the history
Added Test files for following resources along with minor fixes for following resource.

aci_vrf
aci_contract
aci_contract_subject
aci_filter
aci_epg_to_static_path
aci_any
aci_epg_to_contract
aci_epg_to_domain
aci_endpoint_security_group_selector
aci_endpoint_security_group
aci_imported_contract
aci_l3_outside
aci_external_network_instance_profile
aci_logical_node_profile
aci_logical_interface_profile
aci_l3_ext_subnet
aci_l3out_ospf_interface_profile
aci_hsrp_interface_policy
aci_bgp_route_control_profile
aci_l3out_hsrp_interface_group
aci_l3out_floating_svi
aci_l3out_hsrp_secondary_vip
aci_l3out_bfd_interface_profile
aci_l3out_hsrp_interface_profile
aci_l3out_route_tag_policy
aci_taboo_contract
aci_aaa_domain
  • Loading branch information
RutvikS-crest authored Dec 31, 2021
1 parent 49abd4a commit 373ba7d
Show file tree
Hide file tree
Showing 191 changed files with 22,836 additions and 5,322 deletions.
20 changes: 14 additions & 6 deletions aci/data_source_aci_fvrsprovcons.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ func dataSourceAciContractProvider() *schema.Resource {

SchemaVersion: 1,

Schema: AppendBaseAttrSchema(map[string]*schema.Schema{
Schema: map[string]*schema.Schema{
"application_epg_dn": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
},

"contract_name": &schema.Schema{
"contract_dn": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
Expand All @@ -47,14 +47,22 @@ func dataSourceAciContractProvider() *schema.Resource {
Optional: true,
Computed: true,
},
}),
"annotation": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
DefaultFunc: func() (interface{}, error) {
return "orchestrator:terraform", nil
},
},
},
}
}

func dataSourceAciContractProviderRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
aciClient := m.(*client.Client)
contractType := d.Get("contract_type").(string)
tnVzBrCPName := d.Get("contract_name").(string)
tnVzBrCPName := GetMOName(d.Get("contract_dn").(string))
ApplicationEPGDn := d.Get("application_epg_dn").(string)

if contractType == "provider" {
Expand Down Expand Up @@ -102,7 +110,7 @@ func setContractConsumerDataAttributes(fvRsCons *models.ContractConsumer, d *sch
return d, err
}

d.Set("contract_name", fvRsConsMap["tnVzBrCPName"])
// d.Set("contract_name", fvRsConsMap["tnVzBrCPName"])

d.Set("annotation", fvRsConsMap["annotation"])
d.Set("prio", fvRsConsMap["prio"])
Expand All @@ -117,7 +125,7 @@ func setContractProviderDataAttributes(fvRsProv *models.ContractProvider, d *sch
if err != nil {
return d, err
}
d.Set("contract_name", fvRsProvMap["tnVzBrCPName"])
// d.Set("contract_name", fvRsProvMap["tnVzBrCPName"])

d.Set("annotation", fvRsProvMap["annotation"])
d.Set("match_t", fvRsProvMap["matchT"])
Expand Down
6 changes: 3 additions & 3 deletions aci/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,10 @@ func configureClient(d *schema.ResourceData) (interface{}, error) {
return nil, err
}

return config.getClient(), nil
return config.GetClient(), nil
}

func (c Config) Valid() error {
func (c *Config) Valid() error {

if c.Username == "" {
return fmt.Errorf("Username must be provided for the ACI provider")
Expand All @@ -522,7 +522,7 @@ func (c Config) Valid() error {
return nil
}

func (c Config) getClient() interface{} {
func (c *Config) GetClient() interface{} {
if c.Password != "" {

return client.GetClient(c.URL, c.Username, client.Password(c.Password), client.Insecure(c.IsInsecure), client.ProxyUrl(c.ProxyUrl), client.ProxyCreds(c.ProxyCreds), client.ValidateRelationDn(c.ValidateRelationDn))
Expand Down
141 changes: 0 additions & 141 deletions aci/resource_aci_aaadomain_test.go

This file was deleted.

2 changes: 2 additions & 0 deletions aci/resource_aci_bfdifp.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func resourceAciBFDInterfaceProfile() *schema.Resource {

"relation_bfd_rs_if_pol": &schema.Schema{
Type: schema.TypeString,

Optional: true,
},
}),
Expand Down Expand Up @@ -120,6 +121,7 @@ func resourceAciBFDInterfaceProfileImport(d *schema.ResourceData, m interface{})
return nil, err
}

d.Set("logical_interface_profile_dn", GetParentDn(dn, "/bfdIfP"))
log.Printf("[DEBUG] %s: Import finished successfully", d.Id())

return []*schema.ResourceData{schemaFilled}, nil
Expand Down
143 changes: 0 additions & 143 deletions aci/resource_aci_bfdifp_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions aci/resource_aci_fvaepg.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ func resourceAciApplicationEPG() *schema.Resource {

"relation_fv_rs_bd": &schema.Schema{
Type: schema.TypeString,
Computed: true,

Optional: true,
},
"relation_fv_rs_cust_qos_pol": &schema.Schema{
Type: schema.TypeString,
Computed: true,

Optional: true,
},
"relation_fv_rs_fc_path_att": &schema.Schema{
Expand Down
Loading

0 comments on commit 373ba7d

Please sign in to comment.