@@ -258,29 +258,25 @@ def main():
258
258
argument_spec = aci_argument_spec ()
259
259
argument_spec .update (aci_annotation_spec ())
260
260
argument_spec .update (
261
- type = dict (type = "str" , choices = ["in_band" , "out_of_band" ], required = True ) #>>>> really required, both are under the same class
261
+ # type=dict(type="str", choices=["in_band", "out_of_band"], required=True) #>>>> really required? both are under the same class ----> yes, inb class and oob class difference in building URL
262
262
contract_type = dict (type = "str" , required = True , choices = ["consumer" , "provider" , "taboo" , "interface" ]),
263
- # ap=dict(type="str", aliases=["app_profile", "app_profile_name"]), # Not required for querying all objects
264
263
epg = dict (type = "str" , aliases = ["epg_name" ]), # Not required for querying all objects
265
264
contract = dict (type = "str" , aliases = ["contract_name" , "contract_interface" ]), # Not required for querying all objects
266
265
priority = dict (type = "str" , choices = ["level1" , "level2" , "level3" , "level4" , "level5" , "level6" , "unspecified" ]),
267
266
provider_match = dict (type = "str" , choices = ["all" , "at_least_one" , "at_most_one" , "none" ]),
268
267
state = dict (type = "str" , default = "present" , choices = ["absent" , "present" , "query" ]),
269
- # tenant=dict(type="str", aliases=["tenant_name"]), # Not required for querying all objects >>>>>> HARDCODE mgmt TENANT ???
270
- # contract_label=dict(type="str"),
271
- # subject_label=dict(type="str"),
272
268
)
273
269
274
270
module = AnsibleModule (
275
271
argument_spec = argument_spec ,
276
272
supports_check_mode = True ,
277
273
required_if = [
278
- ["state" , "absent" , ["contract " , "epg" ]],
279
- ["state" , "present" , ["contract " , "epg" ]],
274
+ ["state" , "absent" , ["contract_type " , "epg" , "contract " ]],
275
+ ["state" , "present" , ["contract_type " , "epg" , "contract " ]],
280
276
],
281
277
)
282
278
283
- # ap = module.params.get("ap ")
279
+ # epg_type = module.params.get("type ")
284
280
contract = module .params .get ("contract" )
285
281
contract_type = module .params .get ("contract_type" )
286
282
epg = module .params .get ("epg" )
@@ -289,10 +285,6 @@ def main():
289
285
if provider_match is not None :
290
286
provider_match = PROVIDER_MATCH_MAPPING [provider_match ]
291
287
state = module .params .get ("state" )
292
- # tenant = module.params.get("tenant")
293
- # contract_label = module.params.get("contract_label")
294
- # subject_label = module.params.get("subject_label")
295
-
296
288
aci_class = ACI_CLASS_MAPPING [contract_type ]["class" ]
297
289
aci_rn = ACI_CLASS_MAPPING [contract_type ]["rn" ]
298
290
aci_name = ACI_CLASS_MAPPING [contract_type ]["name" ]
@@ -301,14 +293,6 @@ def main():
301
293
if contract_type != "provider" and provider_match is not None :
302
294
module .fail_json (msg = "the 'provider_match' is only configurable for Provided Contracts" )
303
295
304
- # if contract_type in ["taboo", "interface"] and (contract_label is not None or subject_label is not None):
305
- # module.fail_json(msg="the 'contract_label' and 'subject_label' are not configurable for {0} contracts".format(contract_type))
306
-
307
- if contract_type not in ["taboo" , "interface" ]:
308
- contract_label_class = CONTRACT_LABEL_MAPPING .get (contract_type )
309
- subject_label_class = SUBJ_LABEL_MAPPING .get (contract_type )
310
- child_classes = [subject_label_class , contract_label_class ]
311
-
312
296
aci = ACIModule (module )
313
297
aci .construct_url (
314
298
root_class = dict (
@@ -324,8 +308,8 @@ def main():
324
308
target_filter = {"name" : "default" },
325
309
),
326
310
subclass_2 = dict (
327
- aci_class = "fvAEPg " ,
328
- aci_rn = "epg -{0}" .format (epg ),
311
+ aci_class = "mgmtInB " ,
312
+ aci_rn = "inb -{0}" .format (epg ),
329
313
module_object = epg ,
330
314
target_filter = {"name" : epg },
331
315
),
@@ -342,10 +326,6 @@ def main():
342
326
343
327
if state == "present" :
344
328
child_configs = []
345
- # if contract_label is not None:
346
- # child_configs.append({contract_label_class: {"attributes": {"name": contract_label}}})
347
- # if subject_label is not None:
348
- # child_configs.append({subject_label_class: {"attributes": {"name": subject_label}}})
349
329
aci .payload (
350
330
aci_class = aci_class ,
351
331
class_config = {"matchT" : provider_match , "prio" : priority , aci_name : contract },
0 commit comments