Skip to content

Commit

Permalink
[ignore] Resolved the merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
sajagana authored and lhercot committed Mar 4, 2024
1 parent e8b9d90 commit d72863c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 50 deletions.
1 change: 1 addition & 0 deletions plugins/module_utils/mso.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,7 @@ def service_node_ref_str_to_dict(serviceNodeRefStr):
templateName=serviceNodeRefTokens[4],
)


def mso_schema_site_contract_service_graph_spec():
return dict(
cluster_interface_device=dict(type="str", required=True, aliases=["cluster_device", "device", "device_name"]),
Expand Down
78 changes: 42 additions & 36 deletions plugins/modules/mso_schema_site_contract_service_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,42 +295,48 @@ def main():
elif state == "present":
service_graph_ref = dict(schemaId=service_graph_reference_schema_id, serviceGraphName=service_graph, templateName=service_graph_reference_template)
service_node_relationship = []

for node_index, node in enumerate(node_relationship, 1):
service_node_ref = dict(
schemaId=service_graph_reference_schema_id,
serviceGraphName=service_graph,
serviceNodeName="node{0}".format(node_index),
templateName=service_graph_reference_template,
)

consumer_subnet_ips_list = [dict(ip=subnet) for subnet in node.get("consumer_subnet_ips")] if node.get("consumer_subnet_ips") else []
consumer_connector = dict(
clusterInterface=dict(
dn="uni/tn-{0}/lDevVip-{1}/lIf-{2}".format(tenant, node.get("cluster_interface_device"), node.get("consumer_connector_cluster_interface"))
),
redirectPolicy=dict(
dn="uni/tn-{0}/svcCont/svcRedirectPol-{1}".format(
node.get("consumer_connector_redirect_policy_tenant") or tenant, node.get("consumer_connector_redirect_policy")
)
),
subnets=consumer_subnet_ips_list,
)
provider_connector = dict(
clusterInterface=dict(
dn="uni/tn-{0}/lDevVip-{1}/lIf-{2}".format(tenant, node.get("cluster_interface_device"), node.get("provider_connector_cluster_interface"))
),
redirectPolicy=dict(
dn="uni/tn-{0}/svcCont/svcRedirectPol-{1}".format(
node.get("provider_connector_redirect_policy_tenant") or tenant, node.get("provider_connector_redirect_policy")
)
),
)
service_node_relationship.append(dict(consumerConnector=consumer_connector, providerConnector=provider_connector, serviceNodeRef=service_node_ref))
if mso.site_type == "on-premise":
payload = dict(serviceGraphRef=service_graph_ref, serviceNodesRelationship=service_node_relationship)
else:
payload = dict(serviceGraphRef=service_graph_ref, serviceNodesRelationship=[])
if node_relationship:
for node_index, node in enumerate(node_relationship, 1):
service_node_ref = dict(
schemaId=service_graph_reference_schema_id,
serviceGraphName=service_graph,
serviceNodeName="node{0}".format(node_index),
templateName=service_graph_reference_template,
)

consumer_subnet_ips_list = [dict(ip=subnet) for subnet in node.get("consumer_subnet_ips")] if node.get("consumer_subnet_ips") else []
consumer_connector = dict(
clusterInterface=dict(
dn="uni/tn-{0}/lDevVip-{1}/lIf-{2}".format(
tenant, node.get("cluster_interface_device"), node.get("consumer_connector_cluster_interface")
)
),
redirectPolicy=dict(
dn="uni/tn-{0}/svcCont/svcRedirectPol-{1}".format(
node.get("consumer_connector_redirect_policy_tenant") or tenant, node.get("consumer_connector_redirect_policy")
)
),
subnets=consumer_subnet_ips_list,
)
provider_connector = dict(
clusterInterface=dict(
dn="uni/tn-{0}/lDevVip-{1}/lIf-{2}".format(
tenant, node.get("cluster_interface_device"), node.get("provider_connector_cluster_interface")
)
),
redirectPolicy=dict(
dn="uni/tn-{0}/svcCont/svcRedirectPol-{1}".format(
node.get("provider_connector_redirect_policy_tenant") or tenant, node.get("provider_connector_redirect_policy")
)
),
)
service_node_relationship.append(
dict(consumerConnector=consumer_connector, providerConnector=provider_connector, serviceNodeRef=service_node_ref)
)
if mso.site_type == "on-premise":
payload = dict(serviceGraphRef=service_graph_ref, serviceNodesRelationship=service_node_relationship)
else:
payload = dict(serviceGraphRef=service_graph_ref, serviceNodesRelationship=[])

mso.sanitize(payload, collate=True)

Expand Down
4 changes: 1 addition & 3 deletions plugins/modules/mso_schema_site_service_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ def main():
device_payload["providerConnectorType"] = AZURE_L4L7_CONNECTOR_TYPE_MAP.get(provider_connector_type)
device_payload["consumerConnectorType"] = AZURE_L4L7_CONNECTOR_TYPE_MAP.get(consumer_connector_type)

devices_payload.append(device_payload)

devices_payload.append(device_payload)
devices_payload.append(device_payload)

payload = dict(
serviceGraphRef=dict(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,10 @@
state: absent
loop:
- '{{ mso_site | default("ansible_test") }}'

- name: Ensure Azure sites removed from tenant ansible_test # Azure Task
cisco.mso.mso_tenant_site:
<<: *mso_info
tenant: ansible_test
site: "{{ item }}"
state: absent
loop:
- 'aws_{{ mso_site | default("ansible_test") }}'
- 'azure_{{ mso_site | default("ansible_test") }}'
- '{{ mso_site | default("azure_ansible_test_2") }}'
ignore_errors: true

- name: Ensure tenant ansible_test exist
cisco.mso.mso_tenant:
Expand All @@ -83,16 +78,13 @@
- "{{ mso_username }}"
state: present

<<<<<<< HEAD
=======
- name: Associate site with ansible_test
cisco.mso.mso_tenant_site:
<<: *mso_info
tenant: ansible_test
site: '{{ mso_site | default("ansible_test") }}'
state: present

>>>>>>> 7992dcd ([minor_change] Added mso_schema_site_contract_service_graph module to manage site contract service graph)
- name: Set ansible_network_os to cisco.aci.aci and ansible_connection to local
ansible.builtin.set_fact:
ansible_connection: local
Expand Down

0 comments on commit d72863c

Please sign in to comment.