Minigraph parser changes for storage backend acl (#11221)

Signed-off-by: Neetha John nejo@microsoft.com

Why I did it
For storage backend, certain rules will be applied to the DATAACL table to allow only vlan tagged packets and drop untagged packets.

How I did it
Create DATAACL table if the device is a storage backend device
To avoid ACL resource issues, remove EVERFLOW related tables if the device is a storage backend device

How to verify it
Added the following unit tests
- verify that EVERFLOW acl tables is removed and DATAACL table is added for storage backend tor
- verify that no DATAACL tables are created and EVERFLOW tables exist for storage backend leaf
This commit is contained in:
Neetha John 2022-07-06 10:27:05 -07:00 committed by Ying Xie
parent 73abb5c58a
commit 37c2370165
4 changed files with 838 additions and 51 deletions

View File

@ -1172,7 +1172,26 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m
#
###############################################################################
def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role):
def filter_acl_table_for_backend(acls, vlan_members):
filter_acls = {}
for acl_name, value in acls.items():
if 'everflow' not in acl_name.lower():
filter_acls[acl_name] = value
ports = set()
for vlan, member in vlan_members:
ports.add(member)
filter_acls['DATAACL'] = { 'policy_desc': 'DATAACL',
'stage': 'ingress',
'type': 'L3',
'ports': list(ports)
}
return filter_acls
def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role, device_type, is_storage_device, vlan_members):
if device_type == 'BackEndToRRouter' and is_storage_device:
return filter_acl_table_for_backend(acls, vlan_members)
filter_acls = {}
# If the asic role is BackEnd no ACL Table (Ctrl/Data/Everflow) is binded.
@ -1741,7 +1760,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
results['DHCP_RELAY'] = dhcp_relay_table
results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers)
results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers)
results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role)
results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role, current_device['type'], is_storage_device, vlan_members)
results['FEATURE'] = {
'telemetry': {
'state': 'enabled'

View File

@ -0,0 +1,781 @@
<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>
<StartRouter>switch-t0</StartRouter>
<StartPeer>10.1.0.32</StartPeer>
<EndRouter>BGPMonitor</EndRouter>
<EndPeer>10.20.30.40</EndPeer>
<Multihop>30</Multihop>
<HoldTime>10</HoldTime>
<KeepAliveTime>3</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>
<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.2.0.20</StartPeer>
<EndRouter>CHASSIS_PEER</EndRouter>
<EndPeer>10.2.0.21</EndPeer>
<Multihop>1</Multihop>
<HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime>
<ChassisInternal>voq</ChassisInternal>
</BGPSession>
</PeeringSessions>
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:BGPRouterDeclaration>
<a:ASN>1</a:ASN>
<a:BgpGroups/>
<a:Hostname>BGPMonitor</a:Hostname>
<a:Peers>
<BGPPeer>
<ElementType>BGPPeer</ElementType>
<Address>10.1.0.32</Address>
<RouteMapIn i:nil="true"/>
<RouteMapOut i:nil="true"/>
<Vrf i:nil="true"/>
</BGPPeer>
</a:Peers>
<a:RouteMaps/>
</a:BGPRouterDeclaration>
<a:BGPRouterDeclaration>
<a:ASN>65100</a:ASN>
<a:Hostname>switch-t0</a:Hostname>
<a:Peers>
<BGPPeer>
<Address>10.0.0.59</Address>
<RouteMapIn i:nil="true"/>
<RouteMapOut i:nil="true"/>
<Vrf i:nil="true"/>
</BGPPeer>
<BGPPeer>
<Address>10.2.0.21</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>
<a:BGPRouterDeclaration>
<a:ASN>65100</a:ASN>
<a:Hostname>CHASSIS_PEER</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>PortChannel1</Name>
<AttachTo>fortyGigE0/4</AttachTo>
<SubInterface/>
</PortChannel>
</PortChannelInterfaces>
<VlanInterfaces>
<VlanInterface>
<Name>ab1</Name>
<AttachTo>fortyGigE0/8</AttachTo>
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
<VlanID>1000</VlanID>
<Tag>1000</Tag>
<Subnets>192.168.0.0/27</Subnets>
</VlanInterface>
<VlanInterface>
<Name>ab4</Name>
<AttachTo>fortyGigE0/8</AttachTo>
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
<VlanID>1001</VlanID>
<Tag>1001</Tag>
<Subnets>192.168.0.32/27</Subnets>
</VlanInterface>
<VlanInterface>
<Name>kk1</Name>
<AttachTo>fortyGigE0/12</AttachTo>
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
<VlanID>2020</VlanID>
<Tag>2020</Tag>
<Type>Tagged</Type>
<Subnets>192.168.0.0/28</Subnets>
</VlanInterface>
<VlanInterface>
<Name>ab2</Name>
<AttachTo>fortyGigE0/12</AttachTo>
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
<VlanID>2000</VlanID>
<Tag>2000</Tag>
<Type>Tagged</Type>
<Subnets>192.168.0.240/27</Subnets>
</VlanInterface>
<VlanInterface>
<Name>ab3</Name>
<AttachTo>fortyGigE0/12</AttachTo>
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
<VlanID>2001</VlanID>
<Tag>2001</Tag>
<Subnets>192.168.0.240/27</Subnets>
</VlanInterface>
</VlanInterfaces>
<IPInterfaces>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel1</AttachTo>
<Prefix>10.0.0.56/31</Prefix>
</IPInterface>
<IPInterface>
<Name i:Name="true"/>
<AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix>
</IPInterface>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>fortyGigE0/0</AttachTo>
<Prefix>10.0.0.58/31</Prefix>
</IPInterface>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>fortyGigE0/0</AttachTo>
<Prefix>FC00::75/126</Prefix>
</IPInterface>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>ab1</AttachTo>
<Prefix>192.168.0.1/27</Prefix>
</IPInterface>
</IPInterfaces>
<DataAcls/>
<AclInterfaces>
<AclInterface>
<ElementType>DataAcl</ElementType>
<Name i:nil="true"/>
<AttachTo>ERSPAN</AttachTo>
<InAcl>everflow</InAcl>
<Type>Everflow</Type>
<Vlan>0</Vlan>
<File>everflow.xml</File>
</AclInterface>
<AclInterface>
<ElementType>DataAcl</ElementType>
<Name i:nil="true"/>
<AttachTo>ERSPANv6</AttachTo>
<InAcl>everflowV6</InAcl>
<Type>Everflow</Type>
<Vlan>0</Vlan>
<File>everflow.xml</File>
</AclInterface>
<AclInterface>
<ElementType>DataAcl</ElementType>
<Name i:nil="true"/>
<AttachTo>Loopback0</AttachTo>
<InAcl>ipv6-mgmt-only</InAcl>
<Type>Management</Type>
<Vlan>0</Vlan>
<File i:nil="true"/>
</AclInterface>
<AclInterface>
<ElementType>DataAcl</ElementType>
<Name i:nil="true"/>
<AttachTo>Loopback0</AttachTo>
<InAcl>mgmt-only</InAcl>
<Type>Management</Type>
<Vlan>0</Vlan>
<File i:nil="true"/>
</AclInterface>
<AclInterface>
<ElementType>DataAcl</ElementType>
<Name i:nil="true"/>
<AttachTo>StaticERSPAN</AttachTo>
<InAcl>everflowStatic</InAcl>
<Type>Everflow</Type>
<Vlan>0</Vlan>
<File>everflow.xml</File>
</AclInterface>
</AclInterfaces>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>1000</Bandwidth>
<EndDevice>ARISTA01T1</EndDevice>
<EndPort>et1</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>switch-t0</StartDevice>
<StartPort>fortyGigE0/8</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceMgmtLink">
<ElementType>DeviceMgmtLink</ElementType>
<Bandwidth>1000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/16</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ChassisMTS1</StartDevice>
<StartPort>mgmt0</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="ToRRouter">
<Hostname>switch-t0</Hostname>
<HwSku>Arista-7050-QX-32S</HwSku>
<ClusterName>AAA00PrdStr00</ClusterName>
</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>
<DeviceInfos>
<DeviceInfo>
<EthernetInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/0</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>10000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet1</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>10000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet2</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>10000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/4</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>25000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/8</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>40000</Speed>
<Description>Interface description</Description>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/12</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
<Description>Interface description</Description>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/16</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/20</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/24</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/28</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/32</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/36</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/40</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/44</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/48</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/52</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/56</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/60</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/64</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/68</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/72</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/76</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/80</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/84</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/88</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/92</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/96</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/100</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/104</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/108</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/112</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/116</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/120</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>fortyGigE0/124</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>0</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
</a:EthernetInterface>
</EthernetInterfaces>
<FlowControl>true</FlowControl>
<Height>0</Height>
<HwSku>Arista-7050-QX-32S</HwSku>
<ManagementInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:ManagementInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<Index>1</Index>
<InterfaceName>Management1</InterfaceName>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>mgmt1</PortName>
<Speed>1000</Speed>
</a:ManagementInterface>
</ManagementInterfaces>
</DeviceInfo>
</DeviceInfos>
<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>DeploymentId</a:Name>
<a:Reference i:nil="true"/>
<a:Value>1</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ResourceType</a:Name>
<a:Reference i:nil="true"/>
<a:Value>Storage</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>Arista-7050-QX-32S</HwSku>
</DeviceMiniGraph>

View File

@ -11,25 +11,6 @@
<HoldTime>10</HoldTime>
<KeepAliveTime>3</KeepAliveTime>
</BGPSession>
<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>
@ -90,12 +71,6 @@
<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"/>
@ -253,16 +228,6 @@
<AttachTo>PortChannel1</AttachTo>
<Prefix>FC00::71/126</Prefix>
</IPInterface>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel1001</AttachTo>
<Prefix>10.0.0.57/31</Prefix>
</IPInterface>
<IPInterface>
<Name i:Name="true"/>
<AttachTo>PortChannel1001</AttachTo>
<Prefix>FC00::72/126</Prefix>
</IPInterface>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>ab1</AttachTo>
@ -308,15 +273,6 @@
<StartPort>mgmt0</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceMgmtLink">
<ElementType>DeviceMgmtLink</ElementType>
<Bandwidth>1000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>Management1</EndPort>
<StartDevice>switch-m0</StartDevice>
<StartPort>Management1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="ToRRouter">

View File

@ -39,6 +39,7 @@ class TestCfgGen(TestCase):
self.packet_chassis_graph = os.path.join(self.test_dir, 'sample-chassis-packet-lc-graph.xml')
self.packet_chassis_port_ini = os.path.join(self.test_dir, 'sample-chassis-packet-lc-port-config.ini')
self.macsec_profile = os.path.join(self.test_dir, 'macsec_profile.json')
self.sample_backend_graph = os.path.join(self.test_dir, 'sample-graph-storage-backend.xml')
# To ensure that mock config_db data is used for unit-test cases
os.environ["CFGGEN_UNIT_TESTING"] = "2"
@ -710,14 +711,11 @@ class TestCfgGen(TestCase):
output = self.run_script(argument)
self.assertEqual(output.strip(), "")
def test_minigraph_sub_port_interfaces(self, check_stderr=True):
self.verify_sub_intf(check_stderr=check_stderr)
def test_minigraph_sub_port_intf_resource_type_non_backend_tor(self, check_stderr=True):
self.verify_sub_intf_non_backend_tor(graph_file=self.sample_resource_graph, check_stderr=check_stderr)
def test_minigraph_sub_port_intf_resource_type(self, check_stderr=True):
self.verify_sub_intf(graph_file=self.sample_resource_graph, check_stderr=check_stderr)
def test_minigraph_sub_port_intf_hwsku(self, check_stderr=True):
self.verify_sub_intf(graph_file=self.sample_backend_graph, check_stderr=check_stderr)
def test_minigraph_sub_port_intf_sub(self, check_stderr=True):
self.verify_sub_intf(graph_file=self.sample_subintf_graph, check_stderr=check_stderr)
@ -725,6 +723,32 @@ class TestCfgGen(TestCase):
def test_minigraph_no_vlan_member(self, check_stderr=True):
self.verify_no_vlan_member()
def test_minigraph_backend_acl_leaf(self, check_stderr=True):
try:
print('\n Change device type to %s' % (BACKEND_LEAF_ROUTER))
if check_stderr:
output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BACKEND_LEAF_ROUTER, self.sample_backend_graph), stderr=subprocess.STDOUT, shell=True)
else:
output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BACKEND_LEAF_ROUTER, self.sample_backend_graph), shell=True)
self.test_jinja_expression(self.sample_backend_graph, self.port_config, BACKEND_LEAF_ROUTER)
# ACL_TABLE should contain EVERFLOW related entries
argument = '-m "' + self.sample_backend_graph + '" -p "' + self.port_config + '" -v "ACL_TABLE"'
output = self.run_script(argument)
sample_output = utils.to_dict(output.strip()).keys()
assert 'DATAACL' not in sample_output, sample_output
assert 'EVERFLOW' in sample_output, sample_output
finally:
print('\n Change device type back to %s' % (TOR_ROUTER))
if check_stderr:
output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_LEAF_ROUTER, TOR_ROUTER, self.sample_backend_graph), stderr=subprocess.STDOUT, shell=True)
else:
output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_LEAF_ROUTER, TOR_ROUTER, self.sample_backend_graph), shell=True)
self.test_jinja_expression(self.sample_backend_graph, self.port_config, TOR_ROUTER)
def test_minigraph_sub_port_no_vlan_member(self, check_stderr=True):
try:
print('\n Change device type to %s' % (BACKEND_LEAF_ROUTER))
@ -780,6 +804,13 @@ class TestCfgGen(TestCase):
output = self.run_script(argument)
self.assertEqual(output.strip(), "")
# ACL_TABLE should not contain EVERFLOW related entries
argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "ACL_TABLE"'
output = self.run_script(argument)
sample_output = utils.to_dict(output.strip()).keys()
assert 'DATAACL' in sample_output, sample_output
assert 'EVERFLOW' not in sample_output, sample_output
# All the other tables stay unchanged
self.test_minigraph_vlans(graph_file=graph_file)
self.test_minigraph_vlan_interfaces(graph_file=graph_file)