mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
MSO: Clean up internal references (#53242)
During the development of the new site modules the use of references is more common and this urged making the mechanism more simple overall.
This commit is contained in:
parent
e4093fbad4
commit
85eb8c30a6
3 changed files with 34 additions and 19 deletions
|
@ -97,7 +97,7 @@ def mso_reference_spec():
|
|||
|
||||
def mso_subnet_spec():
|
||||
return dict(
|
||||
ip=dict(type='str', required=True),
|
||||
subnet=dict(type='str', required=True, aliases=['ip']),
|
||||
description=dict(type='str'),
|
||||
scope=dict(type='str', choices=['private', 'public']),
|
||||
shared=dict(type='bool'),
|
||||
|
@ -393,19 +393,33 @@ class MSOModule(object):
|
|||
ids.append(l['id'])
|
||||
return ids
|
||||
|
||||
def contract_ref(self, contract):
|
||||
''' Create contractRef string '''
|
||||
return '/schemas/{schema_id}/templates/{template}/contracts/{name}'.format(**contract)
|
||||
def anp_ref(self, **data):
|
||||
''' Create anpRef string '''
|
||||
return '/schemas/{schema_id}/templates/{template}/anps/{anp}'.format(**data)
|
||||
|
||||
def filter_ref(self, schema_id, template, filter_name):
|
||||
def epg_ref(self, **data):
|
||||
''' Create epgRef string '''
|
||||
return '/schemas/{schema_id}/templates/{template}/anps/{anp}/epgs/{epg}'.format(**data)
|
||||
|
||||
def bd_ref(self, **data):
|
||||
''' Create bdRef string '''
|
||||
return '/schemas/{schema_id}/templates/{template}/bds/{bd}'.format(**data)
|
||||
|
||||
def contract_ref(self, **data):
|
||||
''' Create contractRef string '''
|
||||
# Support the contract argspec
|
||||
if 'name' in data:
|
||||
data['contract'] = data['name']
|
||||
return '/schemas/{schema_id}/templates/{template}/contracts/{contract}'.format(**data)
|
||||
|
||||
def filter_ref(self, **data):
|
||||
''' Create a filterRef string '''
|
||||
data = dict(
|
||||
schema_id=schema_id,
|
||||
template=template,
|
||||
filter=filter_name,
|
||||
)
|
||||
return '/schemas/{schema_id}/templates/{template}/filters/{filter}'.format(**data)
|
||||
|
||||
def vrf_ref(self, **data):
|
||||
''' Create vrfRef string '''
|
||||
return '/schemas/{schema_id}/templates/{template}/vrfs/{vrf}'.format(**data)
|
||||
|
||||
def make_reference(self, data, reftype, schema_id, template):
|
||||
''' Create a reference from a dictionary '''
|
||||
# Removes entry from payload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue