Skip to content
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
218 changes: 201 additions & 17 deletions ansible/generate_topo.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions ansible/module_utils/port_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ def get_port_alias_to_name_map(hwsku, asic_name=None):
port_alias_to_name_map["etp%d%s" % (i, j)] = "Ethernet%d" % ((i - 1) * 8 + x - 1)
port_alias_to_name_map["etp65"] = "Ethernet512"
port_alias_to_name_map["etp66"] = "Ethernet513"
elif hwsku in ["Arista-7060X6-64PE-B-P32V128", "Arista-7060X6-64PE-P32V128"]:
for i in range(1, 33):
port_alias_to_name_map["etp%d" % (i)] = "Ethernet%d" % ((i - 1) * 8)
for i in range(33, 65):
for x, j in zip([1, 3, 5, 7], ["a", "b", "c", "d"]):
port_alias_to_name_map["etp%d%s" % (i, j)] = "Ethernet%d" % ((i - 1) * 8 + x - 1)
elif hwsku == "Arista-7060X6-64PE-256x200G":
for i in range(1, 65):
for j in [1, 3, 5, 7]:
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/eos/templates/t0-f2-d40u8-leaf.j2
144 changes: 144 additions & 0 deletions ansible/roles/eos/templates/t1-f2-d10u8-spine.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{% 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 disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%}
{% elif 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 name.startswith('Port-Channel') %}
port-channel min-links 1
{% endif %}
{% if iface['lacp'] is defined %}
channel-group {{ iface['lacp'] }} mode active
lacp rate normal
{% 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['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }}
!
{% 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 }}
neighbor {{ remote_ip }} next-hop-self
{% if remote_ip | ansible.utils.ipv6 %}
address-family ipv6
neighbor {{ remote_ip }} activate
exit
{% endif %}
{% endfor %}
{% endfor %}
{% if props.enable_ipv4_routes_generation is not defined or props.enable_ipv4_routes_generation %}
neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }}
neighbor {{ props.nhipv4 }} description exabgp_v4
{% endif %}
{% if props.enable_ipv6_routes_generation is not defined or props.enable_ipv6_routes_generation %}
neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }}
neighbor {{ props.nhipv6 }} description exabgp_v6
address-family ipv6
neighbor {{ props.nhipv6 }} activate
exit
{% endif %}
!
{% 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
144 changes: 144 additions & 0 deletions ansible/roles/eos/templates/t1-f2-d10u8-tor.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{% set host = configuration[hostname] %}
{% set mgmt_ip = ansible_host %}
{% set tornum = host['tornum'] %}
{% 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 disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%}
{% elif 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 name.startswith('Port-Channel') %}
port-channel min-links 1
{% 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 %}
{% if iface['lacp'] is defined %}
channel-group {{ iface['lacp'] }} mode active
lacp rate normal
{% 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'] | ansible.utils.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 }}
neighbor {{ remote_ip }} next-hop-self
{% if remote_ip | ansible.utils.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
86 changes: 86 additions & 0 deletions ansible/templates/topo_t0.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
topology:
host_interfaces:
{%- for hostif in hostif_list %}
- {{ hostif.port_id }}
{%- endfor %}
disabled_host_interfaces:
{%- for hostif in disabled_hostif_list %}
- {{ hostif.port_id }}
{%- endfor %}
{%- if vm_list | length == 0 %}
VMs: {}
{%- else %}
VMs:
{%- for vm in vm_list %}
{{ vm.name }}:
vlans:
{%- for vlan in vm.vlans %}
- {{ vlan }}
{%- endfor %}
vm_offset: {{ vm.vm_offset }}
{%- endfor %}
{%- endif %}
DUT:
vlan_configs:
default_vlan_config: {{ vlan_group_list[0].name }}
{%- for vlan_group in vlan_group_list %}
{{ vlan_group.name }}:
{%- for vlan in vlan_group.vlans %}
Vlan{{ vlan.id }}:
id: {{ vlan.id }}
intfs: {{ vlan.port_ids }}
prefix: {{ vlan.v4_prefix }}
prefix_v6: {{ vlan.v6_prefix }}
tag: {{ vlan.id }}
{%- endfor %}
{%- endfor %}

configuration_properties:
common:
dut_asn: {{ dut.asn }}
dut_type: ToRRouter
swrole: leaf
nhipv4: 10.10.246.254
nhipv6: FC0A::FF
podset_number: 200
tor_number: 16
tor_subnet_number: 2
max_tor_subnet_number: 16
tor_subnet_size: 128
spine_asn: 65534
leaf_asn_start: 64600
tor_asn_start: 65500
failure_rate: 0

configuration:
{%- for vm in vm_list %}
{{vm.name}}:
properties:
- common
bgp:
asn: {{vm.asn}}
peers:
{{vm.peer_asn}}:
- {{vm.dut_intf_ipv4}}
- {{vm.dut_intf_ipv6}}
interfaces:
Loopback0:
ipv4: {{vm.loopback_ipv4}}/32
ipv6: {{vm.loopback_ipv6}}/128
{%- if vm.num_lags > 0 %}
{%- for i in range(1, vm.num_lags + 1) %}
Ethernet{{i}}:
lacp: 1
{%- endfor %}
Port-Channel1:
ipv4: {{vm.pc_intf_ipv4}}/31
ipv6: {{vm.pc_intf_ipv6}}/126
{%- else %}
Ethernet1:
ipv4: {{vm.pc_intf_ipv4}}/31
ipv6: {{vm.pc_intf_ipv6}}/126
{%- endif %}
bp_interface:
ipv4: {{vm.bp_ipv4}}/24
ipv6: {{vm.bp_ipv6}}/64
{%- endfor %}
Loading
Loading