Skip to content

Commit 245efb9

Browse files
anvitha-jainlhercot
authored andcommitted
Added classes to configure VMM domain childern
1 parent 1cc6778 commit 245efb9

20 files changed

+2188
-28
lines changed

aci/data_source_aci_vmmctrlrp.go

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
package aci
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/ciscoecosystem/aci-go-client/client"
7+
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
8+
)
9+
10+
func dataSourceAciVMMController() *schema.Resource {
11+
return &schema.Resource{
12+
13+
Read: dataSourceAciVMMControllerRead,
14+
15+
SchemaVersion: 1,
16+
17+
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{
18+
"vmm_domain_dn": &schema.Schema{
19+
Type: schema.TypeString,
20+
Required: true,
21+
},
22+
23+
"name": &schema.Schema{
24+
Type: schema.TypeString,
25+
Required: true,
26+
},
27+
28+
"annotation": &schema.Schema{
29+
Type: schema.TypeString,
30+
Optional: true,
31+
Computed: true,
32+
},
33+
34+
"dvs_version": &schema.Schema{
35+
Type: schema.TypeString,
36+
Optional: true,
37+
Computed: true,
38+
},
39+
40+
"host_or_ip": &schema.Schema{
41+
Type: schema.TypeString,
42+
Optional: true,
43+
Computed: true,
44+
},
45+
46+
"inventory_trig_st": &schema.Schema{
47+
Type: schema.TypeString,
48+
Optional: true,
49+
Computed: true,
50+
},
51+
52+
"mode": &schema.Schema{
53+
Type: schema.TypeString,
54+
Optional: true,
55+
Computed: true,
56+
},
57+
58+
"msft_config_err_msg": &schema.Schema{
59+
Type: schema.TypeString,
60+
Optional: true,
61+
Computed: true,
62+
},
63+
64+
"msft_config_issues": &schema.Schema{
65+
Type: schema.TypeString,
66+
Optional: true,
67+
Computed: true,
68+
},
69+
70+
"n1kv_stats_mode": &schema.Schema{
71+
Type: schema.TypeString,
72+
Optional: true,
73+
Computed: true,
74+
},
75+
76+
"name_alias": &schema.Schema{
77+
Type: schema.TypeString,
78+
Optional: true,
79+
Computed: true,
80+
},
81+
82+
"port": &schema.Schema{
83+
Type: schema.TypeString,
84+
Optional: true,
85+
Computed: true,
86+
},
87+
88+
"root_cont_name": &schema.Schema{
89+
Type: schema.TypeString,
90+
Optional: true,
91+
Computed: true,
92+
},
93+
94+
"scope": &schema.Schema{
95+
Type: schema.TypeString,
96+
Optional: true,
97+
Computed: true,
98+
},
99+
100+
"seq_num": &schema.Schema{
101+
Type: schema.TypeString,
102+
Optional: true,
103+
Computed: true,
104+
},
105+
106+
"stats_mode": &schema.Schema{
107+
Type: schema.TypeString,
108+
Optional: true,
109+
Computed: true,
110+
},
111+
112+
"vxlan_depl_pref": &schema.Schema{
113+
Type: schema.TypeString,
114+
Optional: true,
115+
Computed: true,
116+
},
117+
}),
118+
}
119+
}
120+
121+
func dataSourceAciVMMControllerRead(d *schema.ResourceData, m interface{}) error {
122+
aciClient := m.(*client.Client)
123+
124+
name := d.Get("name").(string)
125+
126+
rn := fmt.Sprintf("ctrlr-%s", name)
127+
VMMDomainDn := d.Get("vmm_domain_dn").(string)
128+
129+
dn := fmt.Sprintf("%s/%s", VMMDomainDn, rn)
130+
131+
vmmCtrlrP, err := getRemoteVMMController(aciClient, dn)
132+
133+
if err != nil {
134+
return err
135+
}
136+
setVMMControllerAttributes(vmmCtrlrP, d)
137+
return nil
138+
}

aci/data_source_aci_vmmusraccp.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package aci
2+
3+
4+
import (
5+
"fmt"
6+
"github.com/ciscoecosystem/aci-go-client/client"
7+
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
8+
)
9+
10+
func dataSourceAciVMMCredential() *schema.Resource {
11+
return &schema.Resource{
12+
13+
Read: dataSourceAciVMMCredentialRead,
14+
15+
SchemaVersion: 1,
16+
17+
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{
18+
"vmm_domain_dn": &schema.Schema{
19+
Type: schema.TypeString,
20+
Required: true,
21+
},
22+
23+
24+
"name": &schema.Schema{
25+
Type: schema.TypeString,
26+
Required: true,
27+
},
28+
29+
30+
31+
32+
"annotation": &schema.Schema{
33+
Type: schema.TypeString,
34+
Optional: true,
35+
Computed: true,
36+
},
37+
38+
39+
40+
"name_alias": &schema.Schema{
41+
Type: schema.TypeString,
42+
Optional: true,
43+
Computed: true,
44+
},
45+
46+
47+
48+
"pwd": &schema.Schema{
49+
Type: schema.TypeString,
50+
Optional: true,
51+
Computed: true,
52+
},
53+
54+
55+
56+
"usr": &schema.Schema{
57+
Type: schema.TypeString,
58+
Optional: true,
59+
Computed: true,
60+
},
61+
62+
63+
}),
64+
}
65+
}
66+
67+
68+
69+
func dataSourceAciVMMCredentialRead(d *schema.ResourceData, m interface{}) error {
70+
aciClient := m.(*client.Client)
71+
72+
name := d.Get("name").(string)
73+
74+
75+
rn := fmt.Sprintf("usracc-%s",name)
76+
VMMDomainDn := d.Get("vmm_domain_dn").(string)
77+
78+
dn := fmt.Sprintf("%s/%s",VMMDomainDn,rn)
79+
80+
81+
82+
vmmUsrAccP, err := getRemoteVMMCredential(aciClient, dn)
83+
84+
if err != nil {
85+
return err
86+
}
87+
setVMMCredentialAttributes(vmmUsrAccP, d)
88+
return nil
89+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package aci
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/ciscoecosystem/aci-go-client/client"
7+
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
8+
)
9+
10+
func dataSourceAciVSwitchPolicyGroup() *schema.Resource {
11+
return &schema.Resource{
12+
13+
Read: dataSourceAciVSwitchPolicyGroupRead,
14+
15+
SchemaVersion: 1,
16+
17+
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{
18+
"vmm_domain_dn": &schema.Schema{
19+
Type: schema.TypeString,
20+
Required: true,
21+
},
22+
23+
"annotation": &schema.Schema{
24+
Type: schema.TypeString,
25+
Optional: true,
26+
Computed: true,
27+
},
28+
29+
"name_alias": &schema.Schema{
30+
Type: schema.TypeString,
31+
Optional: true,
32+
Computed: true,
33+
},
34+
}),
35+
}
36+
}
37+
38+
func dataSourceAciVSwitchPolicyGroupRead(d *schema.ResourceData, m interface{}) error {
39+
aciClient := m.(*client.Client)
40+
41+
rn := fmt.Sprintf("vswitchpolcont")
42+
VMMDomainDn := d.Get("vmm_domain_dn").(string)
43+
44+
dn := fmt.Sprintf("%s/%s", VMMDomainDn, rn)
45+
46+
vmmVSwitchPolicyCont, err := getRemoteVSwitchPolicyGroup(aciClient, dn)
47+
48+
if err != nil {
49+
return err
50+
}
51+
setVSwitchPolicyGroupAttributes(vmmVSwitchPolicyCont, d)
52+
return nil
53+
}

aci/provider.go

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,19 @@ func Provider() terraform.ResourceProvider {
5656
},
5757

5858
ResourcesMap: map[string]*schema.Resource{
59-
"aci_tenant": resourceAciTenant(),
60-
"aci_application_profile": resourceAciApplicationProfile(),
61-
"aci_bridge_domain": resourceAciBridgeDomain(),
62-
"aci_contract": resourceAciContract(),
63-
"aci_application_epg": resourceAciApplicationEPG(),
64-
"aci_contract_subject": resourceAciContractSubject(),
65-
"aci_subnet": resourceAciSubnet(),
66-
"aci_filter": resourceAciFilter(),
67-
"aci_filter_entry": resourceAciFilterEntry(),
68-
"aci_vmm_domain": resourceAciVMMDomain(),
59+
"aci_tenant": resourceAciTenant(),
60+
"aci_application_profile": resourceAciApplicationProfile(),
61+
"aci_bridge_domain": resourceAciBridgeDomain(),
62+
"aci_contract": resourceAciContract(),
63+
"aci_application_epg": resourceAciApplicationEPG(),
64+
"aci_contract_subject": resourceAciContractSubject(),
65+
"aci_subnet": resourceAciSubnet(),
66+
"aci_filter": resourceAciFilter(),
67+
"aci_filter_entry": resourceAciFilterEntry(),
68+
"aci_vmm_domain": resourceAciVMMDomain(),
69+
"aci_vmm_controller": resourceAciVMMController(),
70+
"aci_vmm_credential": resourceAciVMMCredential(),
71+
"aci_vswitch_policy": resourceAciVSwitchPolicyGroup(),
6972
"aci_vrf": resourceAciVRF(),
7073
"aci_rest": resourceAciRest(),
7174
"aci_external_network_instance_profile": resourceAciExternalNetworkInstanceProfile(),
@@ -200,16 +203,19 @@ func Provider() terraform.ResourceProvider {
200203
},
201204

202205
DataSourcesMap: map[string]*schema.Resource{
203-
"aci_tenant": dataSourceAciTenant(),
204-
"aci_application_profile": dataSourceAciApplicationProfile(),
205-
"aci_bridge_domain": dataSourceAciBridgeDomain(),
206-
"aci_contract": dataSourceAciContract(),
207-
"aci_application_epg": dataSourceAciApplicationEPG(),
208-
"aci_contract_subject": dataSourceAciContractSubject(),
209-
"aci_subnet": dataSourceAciSubnet(),
210-
"aci_filter": dataSourceAciFilter(),
211-
"aci_filter_entry": dataSourceAciFilterEntry(),
212-
"aci_vmm_domain": dataSourceAciVMMDomain(),
206+
"aci_tenant": dataSourceAciTenant(),
207+
"aci_application_profile": dataSourceAciApplicationProfile(),
208+
"aci_bridge_domain": dataSourceAciBridgeDomain(),
209+
"aci_contract": dataSourceAciContract(),
210+
"aci_application_epg": dataSourceAciApplicationEPG(),
211+
"aci_contract_subject": dataSourceAciContractSubject(),
212+
"aci_subnet": dataSourceAciSubnet(),
213+
"aci_filter": dataSourceAciFilter(),
214+
"aci_filter_entry": dataSourceAciFilterEntry(),
215+
"aci_vmm_domain": dataSourceAciVMMDomain(),
216+
"aci_vmm_controller": dataSourceAciVMMController(),
217+
"aci_vmm_credential": dataSourceAciVMMCredential(),
218+
"aci_vswitch_policy": dataSourceAciVSwitchPolicyGroup(),
213219
"aci_vrf": dataSourceAciVRF(),
214220
"aci_external_network_instance_profile": dataSourceAciExternalNetworkInstanceProfile(),
215221
"aci_l3_outside": dataSourceAciL3Outside(),

0 commit comments

Comments
 (0)