Support both port name and alias in ACL table AttachTo attribute (#13444)

Why I did it
This PR is an enhancement of PR #13105
Because the input string of AttachTo for ACL table can appear in both port name group and port alias group, I added a logic to determine whether the string should be port name or port alias

If all the input strings belong to port name group, then we treat all of them as port name
If all the input strings belong to port alias, then we treat all of them as port alias
If all the input string belongs to both port alias group and port name group, we prefer port alias. The behavior is as before.
How I did it
Walk through all port names/alias in the input to make a decision.

How to verify it
Verified by adding UT.
This commit is contained in:
bingwang-ms 2023-01-20 10:11:39 -08:00 committed by GitHub
parent 568e966ff1
commit b03a65f331
No account linked to committer's email address
5 changed files with 1070 additions and 11 deletions

View File

@ -657,6 +657,40 @@ def parse_dpg(dpg, hname):
is_mirror = False
is_mirror_v6 = False
is_mirror_dscp = False
use_port_alias = True
# Walk through all interface names/alias to determine whether the input string is
# port name or alias.We need this logic because there can be duplicaitons in port alias
# and port names
# The input port name/alias can be either port_name or port_alias. A mix of name and alias is not accepted
port_name_count = 0
port_alias_count = 0
total_count = 0
for member in aclattach:
member = member.strip()
if member in pcs or \
member in vlans or \
member.lower().startswith('erspan') or \
member.lower().startswith('egress_erspan') or \
member.lower().startswith('erspan_dscp'):
continue
total_count += 1
if member in port_alias_map:
port_alias_count += 1
if member in port_names_map:
port_name_count += 1
# All inputs are port alias
if port_alias_count == total_count:
use_port_alias = True
# All inputs are port name
elif port_name_count == total_count:
use_port_alias = False
# There are both port alias and port name, then port alias is preferred to keep the behavior not changed
else:
use_port_alias = True
# For CTRLPLANE ACL, both counters are 0
if (port_alias_count != 0) and (port_name_count != 0):
print("Warning: The given port name for ACL " + aclname + " is inconsistent. It must be either port name or alias ", file=sys.stderr)
# TODO: Ensure that acl_intfs will only ever contain front-panel interfaces (e.g.,
# maybe we should explicity ignore management and loopback interfaces?) because we
@ -674,15 +708,15 @@ def parse_dpg(dpg, hname):
acl_intfs.extend(vlan_member_list[member])
else:
acl_intfs.append(member)
elif (member in port_alias_map) or (member in port_names_map):
if member in port_alias_map:
acl_intf = port_alias_map[member]
else:
acl_intf = member
acl_intfs.append(acl_intf)
elif use_port_alias and (member in port_alias_map):
acl_intfs.append(port_alias_map[member])
# Give a warning if trying to attach ACL to a LAG member interface, correct way is to attach ACL to the LAG interface
if acl_intf in intfs_inpc:
if port_alias_map[member] in intfs_inpc:
print("Warning: ACL " + aclname + " is attached to a LAG member interface " + port_alias_map[member] + ", instead of LAG interface", file=sys.stderr)
elif (not use_port_alias) and (member in port_names_map):
acl_intfs.append(member)
if member in intfs_inpc:
print("Warning: ACL " + aclname + " is attached to a LAG member interface " + member + ", instead of LAG interface", file=sys.stderr)
elif member.lower().startswith('erspan') or member.lower().startswith('egress_erspan') or member.lower().startswith('erspan_dscp'):
if 'dscp' in member.lower():
is_mirror_dscp = True

View File

@ -0,0 +1,974 @@
<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>
</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>
</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/4</AttachTo>
<SubInterface/>
</PortChannel>
</PortChannelInterfaces>
<TunnelInterfaces>
<TunnelInterface Name="MuxTunnel0" Type="IPInIP" AttachTo="Loopback0" DifferentiatedServicesCodePointMode="uniform" EcnEncapsulationMode="standard" EcnDecapsulationMode="copy_from_outer" TtlMode="pipe" />
</TunnelInterfaces>
<VlanInterfaces>
<VlanInterface>
<Name>ab1</Name>
<AttachTo>fortyGigE0/8</AttachTo>
<DhcpRelays>192.0.0.1;192.0.0.2</DhcpRelays>
<Dhcpv6Relays>fc02:2000::1;fc02:2000::2</Dhcpv6Relays>
<VlanID>1000</VlanID>
<Tag>1000</Tag>
<Subnets>192.168.0.0/27</Subnets>
<MacAddress>00:aa:bb:cc:dd:ee</MacAddress>
</VlanInterface>
<VlanInterface>
<Name>ab2</Name>
<AttachTo>fortyGigE0/4</AttachTo>
<DhcpRelays>192.0.0.1</DhcpRelays>
<Dhcpv6Relays>fc02:2000::3;fc02:2000::4</Dhcpv6Relays>
<VlanID>2000</VlanID>
<Tag>2000</Tag>
<MacAddress i:nil="true"/>
</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>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>
<AttachTo>PortChannel01;Ethernet20;Ethernet24</AttachTo>
<InAcl>DataAcl_port_name</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>PortChannel01;Ethernet6/1;Ethernet7/1</AttachTo>
<InAcl>DataAcl_port_alias</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>PortChannel01;Ethernet0;Ethernet1;Ethernet2;Ethernet3</AttachTo>
<InAcl>DataAcl_mixed_name_alias_1</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>PortChannel01;Ethernet1;Ethernet2;Ethernet6/1;Ethernet7/1</AttachTo>
<InAcl>DataAcl_mixed_name_alias_2</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>Ethernet1</AttachTo>
<InAcl>DataAcl_mixed_name_alias_3</InAcl>
<Type>DataPlane</Type>
</AclInterface>
<AclInterface>
<AttachTo>SNMP</AttachTo>
<InAcl>SNMP_ACL</InAcl>
<Type>SNMP</Type>
</AclInterface>
<AclInterface>
<AttachTo>ERSPAN_DSCP</AttachTo>
<InAcl>Everflow_dscp</InAcl>
<Type>Everflow_dscp</Type>
</AclInterface>
</AclInterfaces>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
<DeviceDataPlaneInfo>
<IPSecTunnels />
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>HostIP</Name>
<AttachTo>Loopback0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>10.10.10.2/32</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>10.10.10.2/32</a:PrefixStr>
</a:LoopbackIPInterface>
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>HostIP1</Name>
<AttachTo>Loopback0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>fe80::0002/128</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>fe80::0002/128</a:PrefixStr>
</a:LoopbackIPInterface>
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>SoCHostIP0</Name>
<AttachTo>server2SOC</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>10.10.10.3/32</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>10.10.10.3/32</a:PrefixStr>
</a:LoopbackIPInterface>
<a:LoopbackIPInterface>
<ElementType>LoopbackInterface</ElementType>
<Name>SoCHostIP1</Name>
<AttachTo>server2SOC</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.NetMux">
<b:IPPrefix>fe80::0003/128</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>fe80::0003/128</a:PrefixStr>
</a:LoopbackIPInterface>
</LoopbackIPInterfaces>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
<ManagementVIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
<MplsInterfaces />
<MplsTeInterfaces />
<RsvpInterfaces />
<Hostname>server2</Hostname>
<PortChannelInterfaces />
<SubInterfaces />
<VlanInterfaces />
<IPInterfaces />
<DataAcls />
<AclInterfaces />
<NatInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
<DownstreamSummaries />
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" />
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase i:type="DeviceSerialLink">
<ElementType>DeviceSerialLink</ElementType>
<Bandwidth>9600</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>console</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>switch-t1</StartDevice>
<StartPort>1</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceSerialLink">
<ElementType>DeviceSerialLink</ElementType>
<Bandwidth>9600</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>1</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>managed_device</StartDevice>
<StartPort>console</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>10000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/0</EndPort>
<StartDevice>switch-01t1</StartDevice>
<StartPort>port1</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>10000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/12</EndPort>
<StartDevice>switch-02t1</StartDevice>
<StartPort>port1</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>25000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/4</EndPort>
<StartDevice>server1</StartDevice>
<StartPort>port1</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>40000</Bandwidth>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/8</EndPort>
<StartDevice>server2</StartDevice>
<StartPort>port1</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="LogicalLink">
<ElementType>LogicalLink</ElementType>
<Bandwidth>10000</Bandwidth>
<ChassisInternal>false</ChassisInternal>
<EndDevice>switch-t0</EndDevice>
<EndPort>fortyGigE0/4</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>server1-SC</StartDevice>
<StartPort>L</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="LogicalLink">
<ElementType>LogicalLink</ElementType>
<Bandwidth>0</Bandwidth>
<ChassisInternal>false</ChassisInternal>
<EndDevice>switch-t0</EndDevice>
<EndPort>MuxTunnel0</EndPort>
<FlowControl>false</FlowControl>
<StartDevice>switch2-t0</StartDevice>
<StartPort>MuxTunnel0</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution" i:type="a:ToRRouter">
<ElementType>ToRRouter</ElementType>
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>26.1.1.10/32</d5p1:IPPrefix>
</Address>
<Hostname>switch-t0</Hostname>
<HwSku>Force10-S6000</HwSku>
<ClusterName>AAA00PrdStr00</ClusterName>
</Device>
<Device i:type="ToRRouter">
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>25.1.1.10/32</d5p1:IPPrefix>
</Address>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.7.0.196/26</a:IPPrefix>
</ManagementAddress>
<Hostname>switch2-t0</Hostname>
<HwSku>Force10-S6000</HwSku>
</Device>
<Device i:type="LeafRouter">
<Hostname>switch-01t1</Hostname>
<Address xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.1.0.186/32</a:IPPrefix>
</Address>
<DeploymentId>2</DeploymentId>
<DeviceLocation i:nil="true"/>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.7.0.196/26</a:IPPrefix>
</ManagementAddress>
<HwSku>Force10-S6000</HwSku>
</Device>
<Device i:type="SmartCable">
<ElementType>SmartCable</ElementType>
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>0.0.0.0/0</d5p1:IPPrefix>
</Address>
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>::/0</d5p1:IPPrefix>
</AddressV6>
<ManagementAddress xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>0.0.0.0/0</d5p1:IPPrefix>
</ManagementAddress>
<ManagementAddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>::/0</d5p1:IPPrefix>
</ManagementAddressV6>
<SerialNumber i:nil="true" />
<Hostname>server1-SC</Hostname>
<HwSku>smartcable-sku</HwSku>
</Device>
<Device i:type="Server">
<ElementType>Server</ElementType>
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>10.10.10.1/32</d5p1:IPPrefix>
</Address>
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>fe80::0001/80</d5p1:IPPrefix>
</AddressV6>
<ManagementAddress xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>10.0.0.1/32</d5p1:IPPrefix>
</ManagementAddress>
<Hostname>server1</Hostname>
<HwSku>server-sku</HwSku>
</Device>
<Device i:type="Server">
<ElementType>Server</ElementType>
<Address xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>10.10.10.2/32</d5p1:IPPrefix>
</Address>
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>fe80::0002/128</d5p1:IPPrefix>
</AddressV6>
<ManagementAddress xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>10.0.0.2/32</d5p1:IPPrefix>
</ManagementAddress>
<Hostname>server2</Hostname>
<HwSku>server-sku</HwSku>
</Device>
</Devices>
</PngDec>
<LinkMetadataDeclaration>
<Link xmlns:d3p1="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<d3p1:LinkMetadata>
<d3p1:Name i:nil="true" />
<d3p1:Properties>
<d3p1:DeviceProperty>
<d3p1:Name>GeminiPeeringLink</d3p1:Name>
<d3p1:Reference i:nil="true" />
<d3p1:Value>True</d3p1:Value>
</d3p1:DeviceProperty>
<d3p1:DeviceProperty>
<d3p1:Name>UpperTOR</d3p1:Name>
<d3p1:Reference i:nil="true" />
<d3p1:Value>switch-t0</d3p1:Value>
</d3p1:DeviceProperty>
<d3p1:DeviceProperty>
<d3p1:Name>LowerTOR</d3p1:Name>
<d3p1:Reference i:nil="true" />
<d3p1:Value>switch2-t0</d3p1:Value>
</d3p1:DeviceProperty>
</d3p1:Properties>
<d3p1:Key>switch2-t0:MuxTunnel0;switch-t0:MuxTunnel0</d3p1:Key>
</d3p1:LinkMetadata>
<d3p1:LinkMetadata>
<d3p1:Name i:nil="true"/>
<d3p1:Properties>
<d3p1:DeviceProperty>
<d3p1:Name>AutoNegotiation</d3p1:Name>
<d3p1:Reference i:nil="true"/>
<d3p1:Value>True</d3p1:Value>
</d3p1:DeviceProperty>
</d3p1:Properties>
<d3p1:Key>switch-01t1:port1;switch-t0:fortyGigE0/0</d3p1:Key>
</d3p1:LinkMetadata>
<d3p1:LinkMetadata>
<d3p1:Name i:nil="true"/>
<d3p1:Properties>
<d3p1:DeviceProperty>
<d3p1:Name>AutoNegotiation</d3p1:Name>
<d3p1:Reference i:nil="true"/>
<d3p1:Value>True</d3p1:Value>
</d3p1:DeviceProperty>
</d3p1:Properties>
<d3p1:Key>switch-02t1:port1;switch-t0:fortyGigE0/12</d3p1:Key>
</d3p1:LinkMetadata>
<d3p1:LinkMetadata>
<d3p1:Name i:nil="true"/>
<d3p1:Properties>
<d3p1:DeviceProperty>
<d3p1:Name>AutoNegotiation</d3p1:Name>
<d3p1:Reference i:nil="true"/>
<d3p1:Value>True</d3p1:Value>
</d3p1:DeviceProperty>
</d3p1:Properties>
<d3p1:Key>server1:port1;switch-t0:fortyGigE0/4</d3p1:Key>
</d3p1:LinkMetadata>
<d3p1:LinkMetadata>
<d3p1:Name i:nil="true"/>
<d3p1:Properties>
<d3p1:DeviceProperty>
<d3p1:Name>AutoNegotiation</d3p1:Name>
<d3p1:Reference i:nil="true"/>
<d3p1:Value>True</d3p1:Value>
</d3p1:DeviceProperty>
</d3p1:Properties>
<d3p1:Key>server2:port1;switch-t0:fortyGigE0/8</d3p1:Key>
</d3p1:LinkMetadata>
</Link>
</LinkMetadataDeclaration>
<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>ErspanDestinationIpv4</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.0.100.1</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>NtpResources</a:Name>
<a:Value>
10.0.10.1;10.0.10.2
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SnmpResources</a:Name>
<a:Value>
10.0.10.3;10.0.10.4
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SyslogResources</a:Name>
<a:Value>
10.0.10.5;10.0.10.6
</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>TacacsServer</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.0.10.7;10.0.10.8</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>KubernetesEnabled</a:Name>
<a:Reference i:nil="true"/>
<a:Value>0</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>KubernetesServerIp</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.10.10.10</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ResourceType</a:Name>
<a:Reference i:nil="true"/>
<a:Value>Storage</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>RedundancyType</a:Name>
<a:Reference i:nil="true"/>
<a:Value>Mixed</a:Value>
</a:DeviceProperty>
</a:Properties>
</a:DeviceMetadata>
</Devices>
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</MetadataDeclaration>
<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>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>Force10-S6000</HwSku>
<ManagementInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:ManagementInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>eth0</InterfaceName>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>eth0</PortName>
<Speed>1000</Speed>
</a:ManagementInterface>
</ManagementInterfaces>
</DeviceInfo>
</DeviceInfos>
<Hostname>switch-t0</Hostname>
<HwSku>Force10-S6000</HwSku>
</DeviceMiniGraph>

View File

@ -180,7 +180,7 @@
<DataAcls/>
<AclInterfaces>
<AclInterface>
<AttachTo>PortChannel01;fortyGigE0/8;Ethernet12</AttachTo>
<AttachTo>PortChannel01;Ethernet0;Ethernet12</AttachTo>
<InAcl>DataAcl</InAcl>
<Type>DataPlane</Type>
</AclInterface>

View File

@ -0,0 +1,36 @@
# name lanes alias index
Ethernet0 9 Ethernet1 1
Ethernet1 10 Ethernet2 2
Ethernet2 11 Ethernet3 3
Ethernet3 12 Ethernet4 4
Ethernet4 13,14,15,16 Ethernet6/1 6
Ethernet8 17,18,19,20 Ethernet7/1 7
Ethernet12 21,22,23,24 Ethernet8/1 8
Ethernet16 29,30,31,32 Ethernet9/1 9
Ethernet20 25,26,27,28 Ethernet10/1 10
Ethernet24 33,34,35,36 Ethernet11/1 11
Ethernet28 37,38,39,40 Ethernet12/1 12
Ethernet32 45,46,47,48 Ethernet13/1 13
Ethernet36 41,42,43,44 Ethernet14/1 14
Ethernet40 49,50,51,52 Ethernet15/1 15
Ethernet44 53,54,55,56 Ethernet16/1 16
Ethernet48 69,70,71,72 Ethernet17/1 17
Ethernet52 65,66,67,68 Ethernet18/1 18
Ethernet56 73,74,75,76 Ethernet19/1 19
Ethernet60 77,78,79,80 Ethernet20/1 20
Ethernet64 93,94,95,96 Ethernet21/1 21
Ethernet68 89,90,91,92 Ethernet22/1 22
Ethernet72 97,98,99,100 Ethernet23/1 23
Ethernet76 101,102,103,104 Ethernet24/1 24
Ethernet80 109,110,111,112 Ethernet25/1 25
Ethernet84 105,106,107,108 Ethernet26/1 26
Ethernet88 121,122,123,124 Ethernet27/1 27
Ethernet92 125,126,127,128 Ethernet28/1 28
Ethernet96 61,62,63,64 Ethernet29 29
Ethernet100 57,58,59,60 Ethernet30 30
Ethernet104 81,82,83,84 Ethernet31 31
Ethernet108 85,86,87,88 Ethernet32 32
Ethernet112 117,118,119,120 Ethernet33 33
Ethernet116 113,114,115,116 Ethernet34 34
Ethernet120 1,2,3,4 Ethernet35 35
Ethernet124 5,6,7,8 Ethernet36 36

View File

@ -471,9 +471,24 @@ class TestCfgGenCaseInsensitive(TestCase):
"""
The test case is to verify ACL table can be bound to both port names and alias
"""
result = minigraph.parse_xml(self.sample_graph, port_config_file=self.port_config)
expected_dataacl_ports = ['PortChannel01','fortyGigE0/8','Ethernet12']
self.assertEqual(result['ACL_TABLE']['DATAACL']['ports'].sort(), expected_dataacl_ports.sort())
sample_graph = os.path.join(self.test_dir,'simple-sample-graph-case-acl-test.xml')
port_config_duplicated_name_alias = os.path.join(self.test_dir, 't0-sample-port-config-duplicated-name-alias.ini')
result = minigraph.parse_xml(sample_graph, port_config_file=port_config_duplicated_name_alias)
# TC1: All ports are portchannels or port names
expected_dataacl_ports = ['PortChannel01','Ethernet20','Ethernet24']
self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_PORT_NAME']['ports']), sorted(expected_dataacl_ports))
# TC2: All ports are portchanels or port alias
expected_dataacl_ports = ['PortChannel01','Ethernet4','Ethernet8']
self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_PORT_ALIAS']['ports']), sorted(expected_dataacl_ports))
# TC3: Duplicated values in port names and alias, but all fall in port names
expected_dataacl_ports = ['PortChannel01','Ethernet0','Ethernet1','Ethernet2','Ethernet3']
self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_MIXED_NAME_ALIAS_1']['ports']), sorted(expected_dataacl_ports))
# TC4: Duplicated values in port names and alias, but all fall in port alias
expected_dataacl_ports = ['PortChannel01','Ethernet0','Ethernet1','Ethernet4','Ethernet8']
self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_MIXED_NAME_ALIAS_2']['ports']), sorted(expected_dataacl_ports))
# TC5: Same count in port names and alias, port alias is preferred
expected_dataacl_ports = ['Ethernet0']
self.assertEqual(sorted(result['ACL_TABLE']['DATAACL_MIXED_NAME_ALIAS_3']['ports']), sorted(expected_dataacl_ports))
def test_parse_device_desc_xml_mgmt_interface(self):
# Regular device_desc.xml with both IPv4 and IPv6 mgmt address