Skip to content

Commit 89f8990

Browse files
committed
allow to specify different loopback ip address in topology for multi-duts
Signed-off-by: Guohan Lu <[email protected]>
1 parent 1fbb9ed commit 89f8990

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

ansible/templates/minigraph_cpg.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
{% if 'tor' in vm_topo_config['dut_type'] | lower %}
4545
<BGPPeer i:type="a:BGPPeerPassive">
4646
<ElementType>BGPPeer</ElementType>
47-
<Address>10.1.0.32</Address>
47+
<Address>{{ lp_ipv4_addr }}</Address>
4848
<RouteMapIn i:nil="true"/>
4949
<RouteMapOut i:nil="true"/>
5050
<Vrf i:nil="true"/>
@@ -53,7 +53,7 @@
5353
</BGPPeer>
5454
<BGPPeer i:type="a:BGPPeerPassive">
5555
<ElementType>BGPPeer</ElementType>
56-
<Address>10.1.0.32</Address>
56+
<Address>{{ lp_ipv4_addr }}</Address>
5757
<RouteMapIn i:nil="true"/>
5858
<RouteMapOut i:nil="true"/>
5959
<Vrf i:nil="true"/>

ansible/templates/minigraph_dpg.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
<Name>HostIP</Name>
77
<AttachTo>Loopback0</AttachTo>
88
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
9-
<b:IPPrefix>10.1.0.32/32</b:IPPrefix>
9+
<b:IPPrefix>{{ lp_ipv4 }}</b:IPPrefix>
1010
</a:Prefix>
11-
<a:PrefixStr>10.1.0.32/32</a:PrefixStr>
11+
<a:PrefixStr>{{ lp_ipv4 }}</a:PrefixStr>
1212
</a:LoopbackIPInterface>
1313
<a:LoopbackIPInterface>
1414
<Name>HostIP1</Name>
1515
<AttachTo>Loopback0</AttachTo>
1616
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
17-
<b:IPPrefix>FC00:1::32/128</b:IPPrefix>
17+
<b:IPPrefix>{{ lp_ipv6 }}</b:IPPrefix>
1818
</a:Prefix>
19-
<a:PrefixStr>FC00:1::32/128</a:PrefixStr>
19+
<a:PrefixStr>{{ lp_ipv6 }}</a:PrefixStr>
2020
</a:LoopbackIPInterface>
2121
</LoopbackIPInterfaces>
2222
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">

ansible/templates/minigraph_template.j2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
<DeviceMiniGraph xmlns="Microsoft.Search.Autopilot.Evolution" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
22
{% set vms=vm_topo_config['vm'].keys() | sort %}
33
{% set vms_number = vms | length %}
4+
{% if 'loopback' in vm_topo_config['DUT'] %}
5+
{% set lp_ipv4 = vm_topo_config['DUT']['loopback']['ipv4'][dut_index|int] %}
6+
{% set lp_ipv4_addr = lp_ipv4.split('/')[0] %}
7+
{% set lp_ipv6 = vm_topo_config['DUT']['loopback']['ipv6'][dut_index|int] %}
8+
{% set lp_ipv6_addr = lp_ipv6.split('/')[0] %}
9+
{% else %}
10+
{% set lp_ipv4 = '10.1.0.32/32' %}
11+
{% set lp_ipv4_addr = '10.1.0.32' %}
12+
{% set lp_ipv6 = 'FC00:1::32/128' %}
13+
{% set lp_ipv6_addr = 'FC00:1::32' %}
14+
{% endif %}
415
{% include 'minigraph_cpg.j2' %}
516
{% include 'minigraph_dpg.j2' %}
617
{% include 'minigraph_png.j2' %}

ansible/vars/topo_dualtor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ topology:
5656
- "1.31@35"
5757
vm_offset: 3
5858
DUT:
59+
loopback:
60+
ipv4:
61+
- 10.1.0.32/32
62+
- 10.1.0.33/32
63+
ipv6:
64+
- FC00:1::32/128
65+
- FC00:1::33/128
5966
vlan_configs:
6067
default_vlan_config: one_vlan_a
6168
one_vlan_a:

0 commit comments

Comments
 (0)