[BGPD]: add bgp dynamic neighbor configuration (#708)
* add bgp dynamic neighbor configuration * [bgpd]: update as comments * update as comment * update to deployment_id_asn_map * minor change
This commit is contained in:
parent
95906a6490
commit
3268946de5
@ -19,6 +19,10 @@ log facility local4
|
||||
!
|
||||
! bgp multiple-instance
|
||||
!
|
||||
route-map FROM_BGP_SPEAKER_V4 permit 10
|
||||
!
|
||||
route-map TO_BGP_SPEAKER_V4 deny 10
|
||||
!
|
||||
router bgp {{ minigraph_bgp_asn }}
|
||||
bgp log-neighbor-changes
|
||||
bgp bestpath as-path multipath-relax
|
||||
@ -65,6 +69,19 @@ router bgp {{ minigraph_bgp_asn }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock bgp_sessions %}
|
||||
{% block bgp_peers_with_range %}
|
||||
{% for bgp_peer in minigraph_bgp_peers_with_range %}
|
||||
neighbor {{ bgp_peer['name'] }} peer-group
|
||||
neighbor {{ bgp_peer['name'] }} passive
|
||||
neighbor {{ bgp_peer['name'] }} remote-as {{deployment_id_asn_map[deployment_id] }}
|
||||
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
|
||||
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
|
||||
neighbor {{ bgp_peer['name'] }} update-source Loopback0
|
||||
neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in
|
||||
neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out
|
||||
bgp listen range {{ bgp_peer['ip_range'] }} peer-group {{ bgp_peer['name'] }}
|
||||
{% endfor %}
|
||||
{% endblock bgp_peers_with_range %}
|
||||
!
|
||||
{% if minigraph_bgp_asn is not none %}
|
||||
maximum-paths 64
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
mkdir -p /etc/quagga
|
||||
if [ -f /etc/sonic/bgp_admin.yml ]; then
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/bgp_admin.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/bgp_admin.yml -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
|
||||
else
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
|
||||
fi
|
||||
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf
|
||||
|
||||
|
@ -138,6 +138,9 @@ sudo bash -c "echo ' all: off' >> $FILESYSTEM_ROOT/etc/sonic/bgp_admin.yml"
|
||||
# Copy SNMP configuration files
|
||||
sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/
|
||||
|
||||
# Copy ASN configuration files
|
||||
sudo cp $IMAGE_CONFIGS/asn/deployment_id_asn_map.yml $FILESYSTEM_ROOT/etc/sonic/
|
||||
|
||||
# Copy sudoers configuration file
|
||||
sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/
|
||||
|
||||
|
2
files/image_config/asn/deployment_id_asn_map.yml
Normal file
2
files/image_config/asn/deployment_id_asn_map.yml
Normal file
@ -0,0 +1,2 @@
|
||||
deployment_id_asn_map:
|
||||
"1" : 65432
|
@ -244,6 +244,7 @@ def parse_dpg(dpg, hname):
|
||||
def parse_cpg(cpg, hname):
|
||||
bgp_sessions = []
|
||||
myasn = None
|
||||
bgp_peers_with_range = []
|
||||
for child in cpg:
|
||||
tag = child.tag
|
||||
if tag == str(QName(ns, "PeeringSessions")):
|
||||
@ -270,12 +271,22 @@ def parse_cpg(cpg, hname):
|
||||
hostname = router.find(str(QName(ns1, "Hostname"))).text
|
||||
if hostname == hname:
|
||||
myasn = int(asn)
|
||||
peers = router.find(str(QName(ns1, "Peers")))
|
||||
for bgpPeer in peers.findall(str(QName(ns, "BGPPeer"))):
|
||||
addr = bgpPeer.find(str(QName(ns, "Address"))).text
|
||||
if bgpPeer.find(str(QName(ns1, "PeersRange"))) is not None:
|
||||
name = bgpPeer.find(str(QName(ns1, "Name"))).text
|
||||
ip_range = bgpPeer.find(str(QName(ns1, "PeersRange"))).text
|
||||
bgp_peers_with_range.append({
|
||||
'name': name,
|
||||
'ip_range': ip_range
|
||||
})
|
||||
else:
|
||||
for bgp_session in bgp_sessions:
|
||||
if hostname == bgp_session['name']:
|
||||
bgp_session['asn'] = int(asn)
|
||||
|
||||
return bgp_sessions, myasn
|
||||
return bgp_sessions, myasn, bgp_peers_with_range
|
||||
|
||||
|
||||
def parse_meta(meta, hname):
|
||||
@ -284,6 +295,7 @@ def parse_meta(meta, hname):
|
||||
ntp_servers = []
|
||||
mgmt_routes = []
|
||||
erspan_dst = []
|
||||
deployment_id = None
|
||||
device_metas = meta.find(str(QName(ns, "Devices")))
|
||||
for device in device_metas.findall(str(QName(ns1, "DeviceMetadata"))):
|
||||
if device.find(str(QName(ns1, "Name"))).text == hname:
|
||||
@ -302,7 +314,9 @@ def parse_meta(meta, hname):
|
||||
mgmt_routes = value_group
|
||||
elif name == "ErspanDestinationIpv4":
|
||||
erspan_dst = value_group
|
||||
return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst
|
||||
elif name == "DeploymentId":
|
||||
deployment_id = value
|
||||
return syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id
|
||||
|
||||
|
||||
def get_console_info(devices, dev, port):
|
||||
@ -396,6 +410,8 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
ntp_servers = []
|
||||
mgmt_routes = []
|
||||
erspan_dst = []
|
||||
bgp_peers_with_range = None
|
||||
deployment_id = None
|
||||
|
||||
hwsku_qn = QName(ns, "HwSku")
|
||||
hostname_qn = QName(ns, "Hostname")
|
||||
@ -411,13 +427,13 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
if child.tag == str(QName(ns, "DpgDec")):
|
||||
(intfs, lo_intfs, mgmt_intf, vlans, pcs, acls) = parse_dpg(child, hostname)
|
||||
elif child.tag == str(QName(ns, "CpgDec")):
|
||||
(bgp_sessions, bgp_asn) = parse_cpg(child, hostname)
|
||||
(bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname)
|
||||
elif child.tag == str(QName(ns, "PngDec")):
|
||||
(neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port) = parse_png(child, hostname)
|
||||
elif child.tag == str(QName(ns, "UngDec")):
|
||||
(u_neighbors, u_devices, _, _, _, _) = parse_png(child, hostname)
|
||||
elif child.tag == str(QName(ns, "MetadataDeclaration")):
|
||||
(syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst) = parse_meta(child, hostname)
|
||||
(syslog_servers, dhcp_servers, ntp_servers, mgmt_routes, erspan_dst, deployment_id) = parse_meta(child, hostname)
|
||||
|
||||
Tree = lambda: defaultdict(Tree)
|
||||
|
||||
@ -428,6 +444,7 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
# TODO: alternatively (preferred), implement class containers for multiple-attribute entries, enabling sort by attr
|
||||
results['minigraph_bgp'] = sorted(bgp_sessions, key=lambda x: x['addr'])
|
||||
results['minigraph_bgp_asn'] = bgp_asn
|
||||
results['minigraph_bgp_peers_with_range'] = bgp_peers_with_range
|
||||
# TODO: sort does not work properly on all interfaces of varying lengths. Need to sort by integer group(s).
|
||||
|
||||
phyport_intfs = []
|
||||
@ -466,6 +483,7 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
results['ntp_servers'] = ntp_servers
|
||||
results['forced_mgmt_routes'] = mgmt_routes
|
||||
results['erspan_dst'] = erspan_dst
|
||||
results['deployment_id'] = deployment_id
|
||||
|
||||
return results
|
||||
|
||||
|
346
src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml
Normal file
346
src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml
Normal file
@ -0,0 +1,346 @@
|
||||
<DeviceMiniGraph xmlns="Microsoft.Search.Autopilot.Evolution" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<CpgDec>
|
||||
<IsisRouters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
|
||||
<PeeringSessions>
|
||||
<BGPSession>
|
||||
<MacSec>false</MacSec>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>10.0.0.56</StartPeer>
|
||||
<EndRouter>ARISTA01T1</EndRouter>
|
||||
<EndPeer>10.0.0.57</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>FC00::71</StartPeer>
|
||||
<EndRouter>ARISTA01T1</EndRouter>
|
||||
<EndPeer>FC00::72</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<MacSec>false</MacSec>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>10.0.0.58</StartPeer>
|
||||
<EndRouter>ARISTA02T1</EndRouter>
|
||||
<EndPeer>10.0.0.59</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>FC00::75</StartPeer>
|
||||
<EndRouter>ARISTA02T1</EndRouter>
|
||||
<EndPeer>FC00::76</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<MacSec>false</MacSec>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>10.0.0.60</StartPeer>
|
||||
<EndRouter>ARISTA03T1</EndRouter>
|
||||
<EndPeer>10.0.0.61</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>FC00::79</StartPeer>
|
||||
<EndRouter>ARISTA03T1</EndRouter>
|
||||
<EndPeer>FC00::7A</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<MacSec>false</MacSec>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>10.0.0.62</StartPeer>
|
||||
<EndRouter>ARISTA04T1</EndRouter>
|
||||
<EndPeer>10.0.0.63</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
<BGPSession>
|
||||
<StartRouter>switch-t0</StartRouter>
|
||||
<StartPeer>FC00::7D</StartPeer>
|
||||
<EndRouter>ARISTA04T1</EndRouter>
|
||||
<EndPeer>FC00::7E</EndPeer>
|
||||
<Multihop>1</Multihop>
|
||||
<HoldTime>180</HoldTime>
|
||||
<KeepAliveTime>60</KeepAliveTime>
|
||||
</BGPSession>
|
||||
</PeeringSessions>
|
||||
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>65100</a:ASN>
|
||||
<a:Hostname>switch-t0</a:Hostname>
|
||||
<a:Peers>
|
||||
<BGPPeer>
|
||||
<Address>10.0.0.57</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<Address>10.0.0.59</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<Address>10.0.0.61</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<Address>10.0.0.63</Address>
|
||||
<RouteMapIn i:nil="true"/>
|
||||
<RouteMapOut i:nil="true"/>
|
||||
<Vrf i:nil="true"/>
|
||||
</BGPPeer>
|
||||
<BGPPeer>
|
||||
<Address>10.1.0.32</Address>
|
||||
<a:Name>BGPSLBPassive</a:Name>
|
||||
<a:PeersRange>10.10.10.10/26</a:PeersRange>
|
||||
</BGPPeer>
|
||||
</a:Peers>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64600</a:ASN>
|
||||
<a:Hostname>ARISTA01T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64600</a:ASN>
|
||||
<a:Hostname>ARISTA02T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64600</a:ASN>
|
||||
<a:Hostname>ARISTA03T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
<a:BGPRouterDeclaration>
|
||||
<a:ASN>64600</a:ASN>
|
||||
<a:Hostname>ARISTA04T1</a:Hostname>
|
||||
<a:RouteMaps/>
|
||||
</a:BGPRouterDeclaration>
|
||||
</Routers>
|
||||
</CpgDec>
|
||||
<DpgDec>
|
||||
<DeviceDataPlaneInfo>
|
||||
<IPSecTunnels/>
|
||||
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:LoopbackIPInterface>
|
||||
<Name>HostIP</Name>
|
||||
<AttachTo>Loopback0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>10.1.0.32/32</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>10.1.0.32/32</a:PrefixStr>
|
||||
</a:LoopbackIPInterface>
|
||||
<a:LoopbackIPInterface>
|
||||
<Name>HostIP1</Name>
|
||||
<AttachTo>Loopback0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>FC00:1::32/128</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>FC00:1::32/128</a:PrefixStr>
|
||||
</a:LoopbackIPInterface>
|
||||
</LoopbackIPInterfaces>
|
||||
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:ManagementIPInterface>
|
||||
<Name>HostIP</Name>
|
||||
<AttachTo>eth0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>10.0.0.100/24</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>10.0.0.100/24</a:PrefixStr>
|
||||
</a:ManagementIPInterface>
|
||||
</ManagementIPInterfaces>
|
||||
<ManagementVIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
|
||||
<MplsInterfaces/>
|
||||
<MplsTeInterfaces/>
|
||||
<RsvpInterfaces/>
|
||||
<Hostname>switch-t0</Hostname>
|
||||
<PortChannelInterfaces>
|
||||
<PortChannel>
|
||||
<Name>PortChannel01</Name>
|
||||
<AttachTo>fortyGigE0/112</AttachTo>
|
||||
<SubInterface/>
|
||||
</PortChannel>
|
||||
<PortChannel>
|
||||
<Name>PortChannel02</Name>
|
||||
<AttachTo>fortyGigE0/116</AttachTo>
|
||||
<SubInterface/>
|
||||
</PortChannel>
|
||||
<PortChannel>
|
||||
<Name>PortChannel03</Name>
|
||||
<AttachTo>fortyGigE0/120</AttachTo>
|
||||
<SubInterface/>
|
||||
</PortChannel>
|
||||
<PortChannel>
|
||||
<Name>PortChannel04</Name>
|
||||
<AttachTo>fortyGigE0/124</AttachTo>
|
||||
<SubInterface/>
|
||||
</PortChannel>
|
||||
</PortChannelInterfaces>
|
||||
<VlanInterfaces>
|
||||
<VlanInterface>
|
||||
<Name>Vlan1000</Name>
|
||||
<AttachTo>fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96</AttachTo>
|
||||
<NoDhcpRelay>False</NoDhcpRelay>
|
||||
<StaticDHCPRelay>0.0.0.0/0</StaticDHCPRelay>
|
||||
<Type i:nil="true"/>
|
||||
<VlanID>1000</VlanID>
|
||||
<Tag>1000</Tag>
|
||||
<Subnets>192.168.0.0/27</Subnets>
|
||||
</VlanInterface>
|
||||
</VlanInterfaces>
|
||||
<IPInterfaces>
|
||||
<IPInterface>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>PortChannel01</AttachTo>
|
||||
<Prefix>10.0.0.56/31</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>PortChannel01</AttachTo>
|
||||
<Prefix>FC00::71/126</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>PortChannel02</AttachTo>
|
||||
<Prefix>10.0.0.58/31</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>PortChannel02</AttachTo>
|
||||
<Prefix>FC00::75/126</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>PortChannel03</AttachTo>
|
||||
<Prefix>10.0.0.60/31</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>PortChannel03</AttachTo>
|
||||
<Prefix>FC00::79/126</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>PortChannel04</AttachTo>
|
||||
<Prefix>10.0.0.62/31</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:Name="true"/>
|
||||
<AttachTo>PortChannel04</AttachTo>
|
||||
<Prefix>FC00::7D/126</Prefix>
|
||||
</IPInterface>
|
||||
<IPInterface>
|
||||
<Name i:nil="true"/>
|
||||
<AttachTo>Vlan1000</AttachTo>
|
||||
<Prefix>192.168.0.1/27</Prefix>
|
||||
</IPInterface>
|
||||
</IPInterfaces>
|
||||
<DataAcls/>
|
||||
<AclInterfaces>
|
||||
<AclInterface>
|
||||
<AttachTo>
|
||||
PortChannel01;PortChannel02;PortChannel03;PortChannel04
|
||||
</AttachTo>
|
||||
<InAcl>DataAcl</InAcl>
|
||||
</AclInterface>
|
||||
</AclInterfaces>
|
||||
<DownstreamSummaries/>
|
||||
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
|
||||
</DeviceDataPlaneInfo>
|
||||
</DpgDec>
|
||||
<PngDec>
|
||||
<DeviceInterfaceLinks>
|
||||
<DeviceLinkBase>
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<EndDevice>ARISTA01T1</EndDevice>
|
||||
<EndPort>Ethernet1/1</EndPort>
|
||||
<StartDevice>switch-t0</StartDevice>
|
||||
<StartPort>fortyGigE0/112</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase>
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<EndDevice>ARISTA02T1</EndDevice>
|
||||
<EndPort>Ethernet1/1</EndPort>
|
||||
<StartDevice>switch-t0</StartDevice>
|
||||
<StartPort>fortyGigE0/116</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase>
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<EndDevice>ARISTA03T1</EndDevice>
|
||||
<EndPort>Ethernet1/1</EndPort>
|
||||
<StartDevice>switch-t0</StartDevice>
|
||||
<StartPort>fortyGigE0/120</StartPort>
|
||||
</DeviceLinkBase>
|
||||
<DeviceLinkBase>
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<EndDevice>ARISTA04T1</EndDevice>
|
||||
<EndPort>Ethernet1/1</EndPort>
|
||||
<StartDevice>switch-t0</StartDevice>
|
||||
<StartPort>fortyGigE0/124</StartPort>
|
||||
</DeviceLinkBase>
|
||||
</DeviceInterfaceLinks>
|
||||
<Devices>
|
||||
<Device i:type="ToRRouter">
|
||||
<Hostname>switch-t0</Hostname>
|
||||
<HwSku>Force10-S6000</HwSku>
|
||||
</Device>
|
||||
<Device i:type="LeafRouter">
|
||||
<Hostname>ARISTA01T1</Hostname>
|
||||
<HwSku>Arista</HwSku>
|
||||
</Device>
|
||||
<Device i:type="LeafRouter">
|
||||
<Hostname>ARISTA02T1</Hostname>
|
||||
<HwSku>Arista</HwSku>
|
||||
</Device>
|
||||
<Device i:type="LeafRouter">
|
||||
<Hostname>ARISTA03T1</Hostname>
|
||||
<HwSku>Arista</HwSku>
|
||||
</Device>
|
||||
<Device i:type="LeafRouter">
|
||||
<Hostname>ARISTA04T1</Hostname>
|
||||
<HwSku>Arista</HwSku>
|
||||
</Device>
|
||||
</Devices>
|
||||
</PngDec>
|
||||
<MetadataDeclaration>
|
||||
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:DeviceMetadata>
|
||||
<a:Name>switch-t0</a:Name>
|
||||
<a:Properties>
|
||||
<a:DeviceProperty>
|
||||
<a:Name>ErspanDestinationIpv4</a:Name>
|
||||
<a:Reference i:nil="true"/>
|
||||
<a:Value>2.2.2.2</a:Value>
|
||||
</a:DeviceProperty>
|
||||
<a:DeviceProperty>
|
||||
<a:Name>DeploymentId</a:Name>
|
||||
<a:Value>1</a:Value>
|
||||
</a:DeviceProperty>
|
||||
</a:Properties>
|
||||
</a:DeviceMetadata>
|
||||
</Devices>
|
||||
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
|
||||
</MetadataDeclaration>
|
||||
<Hostname>switch-t0</Hostname>
|
||||
<HwSku>Force10-S6000</HwSku>
|
||||
</DeviceMiniGraph>
|
@ -11,6 +11,7 @@ class TestCfgGen(TestCase):
|
||||
self.sample_graph_t0 = os.path.join(self.test_dir, 't0-sample-graph.xml')
|
||||
self.sample_graph_simple = os.path.join(self.test_dir, 'simple-sample-graph.xml')
|
||||
self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml')
|
||||
self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml')
|
||||
self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini')
|
||||
|
||||
def run_script(self, argument):
|
||||
@ -97,3 +98,13 @@ class TestCfgGen(TestCase):
|
||||
argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v minigraph_neighbors'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, 'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, 'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, 'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}")
|
||||
|
||||
def test_minigraph_peers_with_range(self):
|
||||
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v minigraph_bgp_peers_with_range'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': '10.10.10.10/26'}]")
|
||||
|
||||
def test_minigraph_deployment_id(self):
|
||||
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v deployment_id'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(output.strip(), "1")
|
||||
|
Loading…
Reference in New Issue
Block a user