|
|
@ -73,6 +73,11 @@ options:
|
|
|
|
choices: [ both-way, consumer-to-provider, provider-to-consumer ]
|
|
|
|
choices: [ both-way, consumer-to-provider, provider-to-consumer ]
|
|
|
|
default: both-way
|
|
|
|
default: both-way
|
|
|
|
aliases: [ type ]
|
|
|
|
aliases: [ type ]
|
|
|
|
|
|
|
|
filter_directives:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- A list of filter directives.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
choices: [ log, none ]
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Use C(present) or C(absent) for adding or removing.
|
|
|
|
- Use C(present) or C(absent) for adding or removing.
|
|
|
@ -163,6 +168,7 @@ def main():
|
|
|
|
contract_scope=dict(type='str', choices=['application-profile', 'global', 'tenant', 'vrf']),
|
|
|
|
contract_scope=dict(type='str', choices=['application-profile', 'global', 'tenant', 'vrf']),
|
|
|
|
contract_filter_type=dict(type='str', choices=['both-way', 'one-way']),
|
|
|
|
contract_filter_type=dict(type='str', choices=['both-way', 'one-way']),
|
|
|
|
filter=dict(type='str', aliases=['name']), # This parameter is not required for querying all objects
|
|
|
|
filter=dict(type='str', aliases=['name']), # This parameter is not required for querying all objects
|
|
|
|
|
|
|
|
filter_directives=dict(type='list', choices=['log', 'none']),
|
|
|
|
filter_template=dict(type='str'),
|
|
|
|
filter_template=dict(type='str'),
|
|
|
|
filter_schema=dict(type='str'),
|
|
|
|
filter_schema=dict(type='str'),
|
|
|
|
filter_type=dict(type='str', default='both-way', choices=FILTER_KEYS.keys(), aliases=['type']),
|
|
|
|
filter_type=dict(type='str', default='both-way', choices=FILTER_KEYS.keys(), aliases=['type']),
|
|
|
@ -185,6 +191,7 @@ def main():
|
|
|
|
contract_filter_type = module.params['contract_filter_type']
|
|
|
|
contract_filter_type = module.params['contract_filter_type']
|
|
|
|
contract_scope = module.params['contract_scope']
|
|
|
|
contract_scope = module.params['contract_scope']
|
|
|
|
filter_name = module.params['filter']
|
|
|
|
filter_name = module.params['filter']
|
|
|
|
|
|
|
|
filter_directives = module.params['filter_directives']
|
|
|
|
filter_template = module.params['filter_template']
|
|
|
|
filter_template = module.params['filter_template']
|
|
|
|
filter_schema = module.params['filter_schema']
|
|
|
|
filter_schema = module.params['filter_schema']
|
|
|
|
filter_type = module.params['filter_type']
|
|
|
|
filter_type = module.params['filter_type']
|
|
|
@ -275,6 +282,8 @@ def main():
|
|
|
|
ops.append(dict(op='remove', path=filter_path))
|
|
|
|
ops.append(dict(op='remove', path=filter_path))
|
|
|
|
|
|
|
|
|
|
|
|
elif state == 'present':
|
|
|
|
elif state == 'present':
|
|
|
|
|
|
|
|
if filter_directives is None:
|
|
|
|
|
|
|
|
filter_directives = ['none']
|
|
|
|
|
|
|
|
|
|
|
|
payload = dict(
|
|
|
|
payload = dict(
|
|
|
|
filterRef=dict(
|
|
|
|
filterRef=dict(
|
|
|
@ -282,14 +291,13 @@ def main():
|
|
|
|
templateName=filter_template,
|
|
|
|
templateName=filter_template,
|
|
|
|
schemaId=filter_schema_id,
|
|
|
|
schemaId=filter_schema_id,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
directives=[],
|
|
|
|
directives=filter_directives,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
mso.sanitize(payload, collate=True)
|
|
|
|
mso.sanitize(payload, collate=True)
|
|
|
|
mso.existing = mso.sent
|
|
|
|
mso.existing = mso.sent
|
|
|
|
|
|
|
|
|
|
|
|
if contract_idx is None:
|
|
|
|
if contract_idx is None:
|
|
|
|
if not mso.existing:
|
|
|
|
|
|
|
|
# Contract does not exist, so we have to create it
|
|
|
|
# Contract does not exist, so we have to create it
|
|
|
|
if contract_display_name is None:
|
|
|
|
if contract_display_name is None:
|
|
|
|
contract_display_name = contract
|
|
|
|
contract_display_name = contract
|
|
|
|