Skip to content

Commit

Permalink
[topo_m0] Add new topo for mgmt tor router (#6208)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
For mgmt tor router, both testing methodology and physical wiring pattern are quite different with existing T0/T1/ topo. Adding this topo can let us filter unrelated test cases from mgmt network.

How did you do it?
Add a new topo (inherit from t0-52)
Enhance topo config and topo_facts for including interfaces
Enhance minigraph templates to support generate minigraph for this new topo
How did you verify/test it?
Generate minigraph and deploy to DUT.
Use ./testbed-cli.sh deploy-mg to gen&deploy minigraph with new topo m0 successfully,
All the related configuration are correct pushed to DUT after deploy.
  • Loading branch information
yaqiangz authored Aug 31, 2022
1 parent 976bb15 commit 00b9f3e
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ansible/library/announce_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def wait_for_http(host_ip, http_port, timeout=10):


def get_topo_type(topo_name):
pattern = re.compile(r'^(t0-mclag|t0|t1|ptf|fullmesh|dualtor|t2|mgmttor)')
pattern = re.compile(r'^(t0-mclag|t0|t1|ptf|fullmesh|dualtor|t2|mgmttor|m0)')
match = pattern.match(topo_name)
if not match:
return "unsupported"
Expand Down Expand Up @@ -506,7 +506,7 @@ def main():
topo_type = get_topo_type(topo_name)

try:
if topo_type == "t0":
if topo_type == "t0" or topo_type == "m0":
fib_t0(topo, ptf_ip, no_default_route=is_storage_backend, action=action)
module.exit_json(changed=True)
elif topo_type == "t1":
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/eos/templates/m0-leaf.j2
134 changes: 134 additions & 0 deletions ansible/roles/eos/templates/m0-mx.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{% set host = configuration[hostname] %}
{% set mgmt_ip = ansible_host %}
{% if vm_type is defined and vm_type == "ceos" %}
{% set mgmt_if_index = 0 %}
{% else %}
{% set mgmt_if_index = 1 %}
{% endif %}
no schedule tech-support
!
{% if vm_type is defined and vm_type == "ceos" %}
agent LicenseManager shutdown
agent PowerFuse shutdown
agent PowerManager shutdown
agent Thermostat shutdown
agent LedPolicy shutdown
agent StandbyCpld shutdown
agent Bfd shutdown
{% endif %}
!
hostname {{ hostname }}
!
vrf definition MGMT
rd 1:1
!
spanning-tree mode mstp
!
aaa root secret 0 123456
!
username admin privilege 15 role network-admin secret 0 123456
!
clock timezone UTC
!
lldp run
lldp management-address Management{{ mgmt_if_index }}
lldp management-address vrf MGMT
!
snmp-server community {{ snmp_rocommunity }} ro
snmp-server vrf MGMT
!
ip routing
ip routing vrf MGMT
ipv6 unicast-routing
!
{% if vm_mgmt_gw is defined %}
ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }}
{% else %}
ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }}
{% endif %}
!
interface Management {{ mgmt_if_index }}
description TO LAB MGMT SWITCH
{% if vm_type is defined and vm_type == "ceos" %}
vrf MGMT
{% else %}
vrf forwarding MGMT
{% endif %}
ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }}
no shutdown
!
{% for name, iface in host['interfaces'].items() %}
interface {{ name }}
{% if name.startswith('Loopback') %}
description LOOPBACK
{% else %}
mtu 9214
no switchport
no shutdown
{% endif %}
{% if iface['ipv4'] is defined %}
ip address {{ iface['ipv4'] }}
{% endif %}
{% if iface['ipv6'] is defined %}
ipv6 enable
ipv6 address {{ iface['ipv6'] }}
ipv6 nd ra suppress
{% endif %}
no shutdown
!
{% endfor %}
!
interface {{ bp_ifname }}
description backplane
no switchport
no shutdown
{% if host['bp_interface']['ipv4'] is defined %}
ip address {{ host['bp_interface']['ipv4'] }}
{% endif %}
{% if host['bp_interface']['ipv6'] is defined %}
ipv6 enable
ipv6 address {{ host['bp_interface']['ipv6'] }}
ipv6 nd ra suppress
{% endif %}
no shutdown
!
router bgp {{ host['bgp']['asn'] }}
router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }}
!
graceful-restart restart-time {{ bgp_gr_timer }}
graceful-restart
!
{% for asn, remote_ips in host['bgp']['peers'].items() %}
{% for remote_ip in remote_ips %}
neighbor {{ remote_ip }} remote-as {{ asn }}
neighbor {{ remote_ip }} description {{ asn }}
{% if remote_ip | ipv6 %}
address-family ipv6
neighbor {{ remote_ip }} activate
exit
{% endif %}
{% endfor %}
{% endfor %}
neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }}
neighbor {{ props.nhipv4 }} description exabgp_v4
neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }}
neighbor {{ props.nhipv6 }} description exabgp_v6
address-family ipv6
neighbor {{ props.nhipv6 }} activate
exit
!
{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %}
{% if iface['ipv4'] is defined %}
network {{ iface['ipv4'] }}
{% endif %}
{% if iface['ipv6'] is defined %}
network {{ iface['ipv6'] }}
{% endif %}
{% endfor %}
!
management api http-commands
no protocol https
protocol http
no shutdown
!
end
4 changes: 4 additions & 0 deletions ansible/templates/minigraph_png.j2
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
{% set dev_type = 'CoreRouter' %}
{% elif 'T0' in dev %}
{% set dev_type = 'ToRRouter' %}
{% elif 'M1' in dev %}
{% set dev_type = 'MgmtLeafRouter' %}
{% elif 'MX' in dev %}
{% set dev_type = 'BmcMgmtToRRouter' %}
{% else %}
{% set dev_type = 'Unknown' %}
{% endif %}
Expand Down
Loading

0 comments on commit 00b9f3e

Please sign in to comment.