Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dualtor][minigraph] Support new minigraph schema for SoC IP #5863

Merged
merged 6 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions ansible/templates/minigraph_dpg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,73 @@
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
{% if mux_cable_facts is defined and mux_cable_facts %}
{% if dual_tor_facts is defined and 'cables' in dual_tor_facts %}
{% for cable in dual_tor_facts['cables'] %}
{% set intf_index = port_alias.index(cable['dut_intf'])|string %}
<DeviceDataPlaneInfo>
<IPSecTunnels />
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>HostIP</Name>
<AttachTo>Loopback0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>{{ mux_cable_facts[intf_index]['server_ipv4'] }}</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>{{ mux_cable_facts[intf_index]['server_ipv4'] }}</a:PrefixStr>
</a:LoopbackIPInterface>
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>HostIP1</Name>
<AttachTo>Loopback0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>{{ mux_cable_facts[intf_index]['server_ipv6'] }}</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>{{ mux_cable_facts[intf_index]['server_ipv6'] }}</a:PrefixStr>
</a:LoopbackIPInterface>
{% if 'soc_ipv4' in mux_cable_facts[intf_index] %}
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>SoCHostIP0</Name>
<AttachTo>Servers{{ loop.index - 1 }}SOC</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>{{ mux_cable_facts[intf_index]['soc_ipv4'] }}</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>{{ mux_cable_facts[intf_index]['soc_ipv4'] }}</a:PrefixStr>
</a:LoopbackIPInterface>
{% endif %}
{% if 'soc_ipv6' in mux_cable_facts[intf_index] %}
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>SoCHostIP1</Name>
<AttachTo>Servers{{ loop.index - 1 }}SOC</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>{{ mux_cable_facts[intf_index]['soc_ipv6'] }}</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>{{ mux_cable_facts[intf_index]['soc_ipv6'] }}</a:PrefixStr>
</a:LoopbackIPInterface>
{% endif %}
</LoopbackIPInterfaces>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
<ManagementVIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
<MplsInterfaces />
<MplsTeInterfaces />
<RsvpInterfaces />
<Hostname>Servers{{ loop.index - 1 }}</Hostname>
<PortChannelInterfaces />
<SubInterfaces />
<VlanInterfaces />
<IPInterfaces />
<DataAcls />
<AclInterfaces />
<NatInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
<DownstreamSummaries />
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
</DeviceDataPlaneInfo>
{% endfor %}
{% endif %}
{% endif %}
{% include 'minigraph_dpg_asic.j2' %}
</DpgDec>

13 changes: 13 additions & 0 deletions ansible/templates/minigraph_meta.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
<a:Value>True</a:Value>
</a:DeviceProperty>
{% endif %}
{% if 'dualtor-mixed' in topo %}
<a:DeviceProperty>
<a:Name>RedundancyType</a:Name>
<a:Reference i:nil="true" />
<a:Value>Mixed</a:Value>
</a:DeviceProperty>
{% elif 'dualtor' in topo %}
<a:DeviceProperty>
<a:Name>RedundancyType</a:Name>
<a:Reference i:nil="true" />
<a:Value>Gemini</a:Value>
</a:DeviceProperty>
{% endif %}
{% if dhcp_servers %}
<a:DeviceProperty>
<a:Name>DhcpResources</a:Name>
Expand Down
22 changes: 4 additions & 18 deletions ansible/templates/minigraph_png.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@
{% endfor %}
{% if 'dualtor' in topo %}
{% set cable_position = 'U' if inventory_hostname == dual_tor_facts['positions']['upper'] else 'L' %}
{% set mux_cable_facts = dual_tor_facts['mux_cable_facts'] if 'mux_cable_facts' in dual_tor_facts %}
{% for cable in dual_tor_facts['cables'] %}
{% set intf_index = port_alias.index(cable['dut_intf'])|string %}
{% if mux_cable_facts is not defined or mux_cable_facts[intf_index]['cable_type'] == 'active-standby' %}
<DeviceLinkBase>
<ElementType>LogicalLink</ElementType>
<EndDevice>{{ inventory_hostname }}</EndDevice>
<EndPort>{{ cable['dut_intf'] }}</EndPort>
<StartDevice>{{ cable['hostname'] }}</StartDevice>
<StartPort>{{ cable_position }}</StartPort>
</DeviceLinkBase>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
Expand Down Expand Up @@ -139,21 +143,12 @@
{% set server_base_address_v6 = (vlan_configs.values() | list)[0]['prefix_v6'] %}
{% set server_base_address_v6 = server_base_address_v6 | ipaddr('network') %}
{% set server_base_address_v6 = ':'.join(server_base_address_v6.split(':')[:-1]) + ':{:x}' %}
{% set mux_cable_facts = dual_tor_facts['mux_cable_facts'] if 'mux_cable_facts' in dual_tor_facts %}
{% for cable in dual_tor_facts['cables'] %}
{% set intf_index = port_alias.index(cable['dut_intf'])|string %}
<Device i:type="SmartCable">
<ElementType>SmartCable</ElementType>
{% if mux_cable_facts is defined %}
<SubType>{{ mux_cable_facts[intf_index]['cable_type'] }}</SubType>
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>{{ mux_cable_facts[intf_index]['soc_ipv4'] if 'soc_ipv4' in mux_cable_facts[intf_index] else '0.0.0.0/0' }}</d5p1:IPPrefix>
</Address>
{% else %}
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>0.0.0.0/0</d5p1:IPPrefix>
</Address>
{% endif %}
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>::/0</d5p1:IPPrefix>
</AddressV6>
Expand All @@ -168,21 +163,12 @@
</Device>
<Device i:type="Server">
<ElementType>Server</ElementType>
{% if mux_cable_facts is defined %}
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>{{ mux_cable_facts[intf_index]['server_ipv4'] }}</d5p1:IPPrefix>
</Address>
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>{{ mux_cable_facts[intf_index]['server_ipv6'] }}</d5p1:IPPrefix>
</AddressV6>
{% else %}
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>{{ server_base_address_v4.format(loop.index + 1) }}/26</d5p1:IPPrefix>
</Address>
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>{{ server_base_address_v6.format(loop.index + 1) }}/96</d5p1:IPPrefix>
</AddressV6>
{% endif %}
<ManagementAddress xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>0.0.0.0/0</d5p1:IPPrefix>
</ManagementAddress>
Expand Down