[baseimage]: Management vrf ntp support (#3204)
This commit adds NTP support for management VRF using L3mdev. Config vrf add mgmt will enable management VRF, enslave the eth0 device to the master device mgmt, stop ntp service in default, restart interfaces-configs and restart ntp service in mgmt-vrf context. Requirement and design are covered in mgmt vrf design document. Signed-off-by: Harish Venkatraman <harish_venkatraman@dell.com>
This commit is contained in:
parent
75104bb35d
commit
31d1a76197
@ -426,6 +426,9 @@ sudo cp files/dhcp/graphserviceurl $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks
|
||||
sudo cp files/dhcp/snmpcommunity $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/
|
||||
sudo cp files/dhcp/vrf $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d/
|
||||
sudo cp files/dhcp/dhclient.conf $FILESYSTEM_ROOT/etc/dhcp/
|
||||
if [ -f files/image_config/ntp/ntp ]; then
|
||||
sudo cp ./files/image_config/ntp/ntp $FILESYSTEM_ROOT/etc/init.d/
|
||||
fi
|
||||
|
||||
## Version file
|
||||
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic
|
||||
|
@ -21,6 +21,14 @@ iface lo {{ 'inet' if prefix | ipv4 else 'inet6' }} static
|
||||
netmask {{ prefix | netmask if prefix | ipv4 else prefix | prefixlen }}
|
||||
#
|
||||
{% endfor %}
|
||||
{% if (MGMT_VRF_CONFIG) and (MGMT_VRF_CONFIG['vrf_global']['mgmtVrfEnabled'] == "true") %}
|
||||
# The loopback network interface for mgmt VRF that is required for applications like NTP
|
||||
up ip link add lo-m type dummy
|
||||
up ip addr add 127.0.0.1/8 dev lo-m
|
||||
up ip link set lo-m up
|
||||
up ip link set dev lo-m master mgmt
|
||||
down ip link delete dev lo-m
|
||||
{% endif %}
|
||||
{% endblock loopback %}
|
||||
{% block mgmt_interface %}
|
||||
|
||||
|
91
files/image_config/ntp/ntp
Executable file
91
files/image_config/ntp/ntp
Executable file
@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This file was originally created automatically as part of default NTP application installation from debian package.
|
||||
# This is now manually modified for supporting NTP in management VRF.
|
||||
# When management VRF is enabled, the NTP application should be started using "cgexec -g l3mdev:mgmt".
|
||||
# Check has been added to verify the management VRF enabled status and use cgexec when it is enabled.
|
||||
# This file will be copied on top of the etc/init.d/ntp file that gets created during build process.
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ntp
|
||||
# Required-Start: $network $remote_fs $syslog
|
||||
# Required-Stop: $network $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Start NTP daemon
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
DAEMON=/usr/sbin/ntpd
|
||||
PIDFILE=/var/run/ntpd.pid
|
||||
|
||||
test -x $DAEMON || exit 5
|
||||
|
||||
if [ -r /etc/default/ntp ]; then
|
||||
. /etc/default/ntp
|
||||
fi
|
||||
|
||||
if [ -e /run/ntp.conf.dhcp ]; then
|
||||
NTPD_OPTS="$NTPD_OPTS -c /run/ntp.conf.dhcp"
|
||||
fi
|
||||
|
||||
|
||||
LOCKFILE=/run/lock/ntpdate
|
||||
|
||||
RUNASUSER=ntp
|
||||
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
|
||||
if test "$(uname -s)" = "Linux"; then
|
||||
NTPD_OPTS="$NTPD_OPTS -u $UGID"
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
log_daemon_msg "Starting NTP server" "ntpd"
|
||||
if [ -z "$UGID" ]; then
|
||||
log_failure_msg "user \"$RUNASUSER\" does not exist"
|
||||
exit 1
|
||||
fi
|
||||
(
|
||||
flock -w 180 9
|
||||
vrfEnabled=$(/usr/local/bin/sonic-cfggen -d -v 'MGMT_VRF_CONFIG["vrf_global"]["mgmtVrfEnabled"]')
|
||||
if [ "$vrfEnabled" = "true" ]
|
||||
then
|
||||
log_daemon_msg "Starting NTP server in mgmt-vrf" "ntpd"
|
||||
cgexec -g l3mdev:mgmt start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $NTPD_OPTS
|
||||
else
|
||||
log_daemon_msg "Starting NTP server in default-vrf" "ntpd"
|
||||
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $NTPD_OPTS
|
||||
fi
|
||||
) 9>$LOCKFILE
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping NTP server" "ntpd"
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --retry=TERM/30/KILL/5 --exec $DAEMON
|
||||
log_end_msg $?
|
||||
rm -f $PIDFILE
|
||||
;;
|
||||
restart|force-reload)
|
||||
$0 stop && sleep 2 && $0 start
|
||||
;;
|
||||
try-restart)
|
||||
if $0 status >/dev/null; then
|
||||
$0 restart
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
exit 3
|
||||
;;
|
||||
status)
|
||||
status_of_proc $DAEMON "NTP server"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
@ -179,6 +179,14 @@ def parse_dpg(dpg, hname):
|
||||
ipprefix = lointf.find(str(QName(ns1, "PrefixStr"))).text
|
||||
lo_intfs[(intfname, ipprefix)] = {}
|
||||
|
||||
mvrfConfigs = child.find(str(QName(ns, "MgmtVrfConfigs")))
|
||||
mvrf = {}
|
||||
if mvrfConfigs != None:
|
||||
mv = mvrfConfigs.find(str(QName(ns1, "MgmtVrfGlobal")))
|
||||
if mv != None:
|
||||
mvrf_en_flag = mv.find(str(QName(ns, "mgmtVrfEnabled"))).text
|
||||
mvrf["vrf_global"] = {"mgmtVrfEnabled": mvrf_en_flag}
|
||||
|
||||
mgmtintfs = child.find(str(QName(ns, "ManagementIPInterfaces")))
|
||||
mgmt_intf = {}
|
||||
for mgmtintf in mgmtintfs.findall(str(QName(ns1, "ManagementIPInterface"))):
|
||||
@ -305,8 +313,8 @@ def parse_dpg(dpg, hname):
|
||||
except:
|
||||
print >> sys.stderr, "Warning: Ignoring Control Plane ACL %s without type" % aclname
|
||||
|
||||
return intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, pc_members, acls, vni
|
||||
return None, None, None, None, None, None, None, None, None
|
||||
return intfs, lo_intfs, mvrf, mgmt_intf, vlans, vlan_members, pcs, pc_members, acls, vni
|
||||
return None, None, None, None, None, None, None, None, None, None
|
||||
|
||||
|
||||
def parse_cpg(cpg, hname):
|
||||
@ -549,7 +557,7 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
port_alias_map.update(alias_map)
|
||||
for child in root:
|
||||
if child.tag == str(QName(ns, "DpgDec")):
|
||||
(intfs, lo_intfs, mgmt_intf, vlans, vlan_members, pcs, pc_members, acls, vni) = parse_dpg(child, hostname)
|
||||
(intfs, lo_intfs, mvrf, mgmt_intf, vlans, vlan_members, pcs, pc_members, acls, vni) = parse_dpg(child, hostname)
|
||||
elif child.tag == str(QName(ns, "CpgDec")):
|
||||
(bgp_sessions, bgp_asn, bgp_peers_with_range) = parse_cpg(child, hostname)
|
||||
elif child.tag == str(QName(ns, "PngDec")):
|
||||
@ -593,6 +601,7 @@ def parse_xml(filename, platform=None, port_config_file=None):
|
||||
results['MGMT_PORT'][name]['speed'] = port_speeds_default[alias]
|
||||
results['MGMT_INTERFACE'][(name, key[1])] = mgmt_intf[key]
|
||||
results['LOOPBACK_INTERFACE'] = lo_intfs
|
||||
results['MGMT_VRF_CONFIG'] = mvrf
|
||||
|
||||
phyport_intfs = {}
|
||||
vlan_intfs = {}
|
||||
|
69
src/sonic-config-engine/tests/sample_output/mvrf_interfaces
Normal file
69
src/sonic-config-engine/tests/sample_output/mvrf_interfaces
Normal file
@ -0,0 +1,69 @@
|
||||
#
|
||||
# =============== Managed by SONiC Config Engine DO NOT EDIT! ===============
|
||||
# generated from /usr/share/sonic/templates/interfaces.j2 using sonic-cfggen
|
||||
# file: /etc/network/interfaces
|
||||
#
|
||||
auto mgmt
|
||||
iface mgmt
|
||||
vrf-table 5000
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
# Use command 'ip addr list dev lo' to check all addresses
|
||||
iface lo inet static
|
||||
address 10.1.0.32
|
||||
netmask 255.255.255.255
|
||||
#
|
||||
iface lo inet6 static
|
||||
address fc00:1::32
|
||||
netmask 128
|
||||
#
|
||||
iface lo inet static
|
||||
address 10.10.0.99
|
||||
netmask 255.255.255.255
|
||||
#
|
||||
# The loopback network interface for mgmt VRF that is required for applications like NTP
|
||||
up ip link add lo-m type dummy
|
||||
up ip addr add 127.0.0.1/8 dev lo-m
|
||||
up ip link set lo-m up
|
||||
up ip link set dev lo-m master mgmt
|
||||
down ip link delete dev lo-m
|
||||
|
||||
# The management network interface
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 10.0.0.100
|
||||
netmask 255.255.255.0
|
||||
vrf mgmt
|
||||
########## management network policy routing rules
|
||||
# management port up rules
|
||||
up ip -4 route add default via 10.0.0.1 dev eth0 table 5000 metric 201
|
||||
up ip -4 route add 10.0.0.0/24 dev eth0 table 5000
|
||||
up ip -4 rule add from 10.0.0.100/32 table 5000
|
||||
up cgcreate -g l3mdev:mgmt
|
||||
up cgset -r l3mdev.master-device=mgmt mgmt
|
||||
# management port down rules
|
||||
down ip -4 route delete default via 10.0.0.1 dev eth0 table 5000
|
||||
down ip -4 route delete 10.0.0.0/24 dev eth0 table 5000
|
||||
down ip -4 rule delete from 10.0.0.100/32 table 5000
|
||||
down cgdelete -g l3mdev:mgmt
|
||||
iface eth0 inet6 static
|
||||
address 2603:10e2:0:2902::8
|
||||
netmask 64
|
||||
vrf mgmt
|
||||
########## management network policy routing rules
|
||||
# management port up rules
|
||||
up ip -6 route add default via 2603:10e2:0:2902::1 dev eth0 table 5000 metric 201
|
||||
up ip -6 route add 2603:10e2:0:2902::/64 dev eth0 table 5000
|
||||
up ip -6 rule add from 2603:10e2:0:2902::8/128 table 5000
|
||||
up cgcreate -g l3mdev:mgmt
|
||||
up cgset -r l3mdev.master-device=mgmt mgmt
|
||||
# management port down rules
|
||||
down ip -6 route delete default via 2603:10e2:0:2902::1 dev eth0 table 5000
|
||||
down ip -6 route delete 2603:10e2:0:2902::/64 dev eth0 table 5000
|
||||
down ip -6 rule delete from 2603:10e2:0:2902::8/128 table 5000
|
||||
down cgdelete -g l3mdev:mgmt
|
||||
#
|
||||
source /etc/network/interfaces.d/*
|
||||
#
|
||||
|
408
src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml
Normal file
408
src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml
Normal file
@ -0,0 +1,408 @@
|
||||
<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>
|
||||
</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>
|
||||
<a:LoopbackIPInterface>
|
||||
<Name>LoopbackIP1</Name>
|
||||
<AttachTo>Loopback1</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>10.10.0.99/32</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>10.10.0.99/32</a:PrefixStr>
|
||||
</a:LoopbackIPInterface>
|
||||
</LoopbackIPInterfaces>
|
||||
<MgmtVrfConfigs xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
|
||||
<a:MgmtVrfGlobal>
|
||||
<mgmtVrfEnabled>true</mgmtVrfEnabled>
|
||||
</a:MgmtVrfGlobal>
|
||||
</MgmtVrfConfigs>
|
||||
<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>
|
||||
<a:ManagementIPInterface>
|
||||
<Name>HostIP</Name>
|
||||
<AttachTo>eth0</AttachTo>
|
||||
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
|
||||
<b:IPPrefix>2603:10e2:0:2902::8/64</b:IPPrefix>
|
||||
</a:Prefix>
|
||||
<a:PrefixStr>2603:10e2:0:2902::8/64</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"/>
|
||||
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
|
||||
<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>ERSPAN</AttachTo>
|
||||
<InAcl>everflow</InAcl>
|
||||
<Type>Everflow</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>ERSPANv6</AttachTo>
|
||||
<InAcl>everflowV6</InAcl>
|
||||
<Type>Everflow</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>PortChannel01;PortChannel02;PortChannel03;PortChannel04</AttachTo>
|
||||
<InAcl>DataAcl</InAcl>
|
||||
<Type>DataPlane</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>SNMP</AttachTo>
|
||||
<InAcl>SNMP_ACL</InAcl>
|
||||
<Type>SNMP</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>NTP</AttachTo>
|
||||
<InAcl>NTP_ACL</InAcl>
|
||||
<Type>NTP</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>SSH</AttachTo>
|
||||
<InAcl>SSH_ACL</InAcl>
|
||||
<Type>SSH</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>SSH</AttachTo>
|
||||
<InAcl>ROUTER-PROTECT</InAcl>
|
||||
<Type>SSH</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>SNMP</AttachTo>
|
||||
<InAcl>ROUTER-PROTECT</InAcl>
|
||||
<Type>SNMP</Type>
|
||||
</AclInterface>
|
||||
<AclInterface>
|
||||
<AttachTo>NTP</AttachTo>
|
||||
<InAcl>NTP_ACL</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>
|
||||
<DeviceLinkBase>
|
||||
<ElementType>DeviceInterfaceLink</ElementType>
|
||||
<AutoNegotiation>true</AutoNegotiation>
|
||||
<Bandwidth>10000</Bandwidth>
|
||||
<EndDevice>switch-t0</EndDevice>
|
||||
<EndPort>fortyGigE0/2</EndPort>
|
||||
<FlowControl>true</FlowControl>
|
||||
<StartDevice>ARISTA05T1</StartDevice>
|
||||
<StartPort>Ethernet1/33</StartPort>
|
||||
<Validate>true</Validate>
|
||||
</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: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>
|
@ -12,6 +12,7 @@ class TestJ2Files(TestCase):
|
||||
self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen')
|
||||
self.simple_minigraph = os.path.join(self.test_dir, 'simple-sample-graph.xml')
|
||||
self.t0_minigraph = os.path.join(self.test_dir, 't0-sample-graph.xml')
|
||||
self.t0_mvrf_minigraph = os.path.join(self.test_dir, 't0-sample-graph-mvrf.xml')
|
||||
self.pc_minigraph = os.path.join(self.test_dir, 'pc-test-graph.xml')
|
||||
self.t0_port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini')
|
||||
self.t1_mlnx_minigraph = os.path.join(self.test_dir, 't1-sample-graph-mlnx.xml')
|
||||
@ -32,6 +33,10 @@ class TestJ2Files(TestCase):
|
||||
self.run_script(argument)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'interfaces'), self.output_file))
|
||||
|
||||
argument = '-m ' + self.t0_mvrf_minigraph + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file
|
||||
self.run_script(argument)
|
||||
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 'mvrf_interfaces'), self.output_file))
|
||||
|
||||
def test_ports_json(self):
|
||||
ports_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ports.json.j2')
|
||||
argument = '-m ' + self.simple_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ports_template + ' > ' + self.output_file
|
||||
|
Loading…
Reference in New Issue
Block a user