|
35 | 35 | VLAN_SUB_INTERFACE_SEPARATOR = '.'
|
36 | 36 | VLAN_SUB_INTERFACE_VLAN_ID = '10'
|
37 | 37 |
|
38 |
| -# Default Virtual Network Index (VNI) |
| 38 | +FRONTEND_ASIC_SUB_ROLE = 'FrontEnd' |
| 39 | +BACKEND_ASIC_SUB_ROLE = 'BackEnd' |
| 40 | +BACKEND_ASIC_INTERFACE_NAME_PREFIX = 'Ethernet-BP' |
| 41 | + |
| 42 | +# Default Virtual Network Index (VNI) |
39 | 43 | vni_default = 8000
|
40 | 44 |
|
41 | 45 | ###############################################################################
|
@@ -401,7 +405,9 @@ def parse_dpg(dpg, hname):
|
401 | 405 | # later after the rest of the minigraph has been parsed.
|
402 | 406 | acl_intfs = pc_intfs[:]
|
403 | 407 | for panel_port in port_alias_map.values():
|
404 |
| - if panel_port not in intfs_inpc: |
| 408 | + # because of port_alias_asic_map we can have duplicate in port_alias_map |
| 409 | + # so check if already present do not add |
| 410 | + if panel_port not in intfs_inpc and panel_port not in acl_intfs: |
405 | 411 | acl_intfs.append(panel_port)
|
406 | 412 | break
|
407 | 413 | if acl_intfs:
|
@@ -687,27 +693,61 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m
|
687 | 693 | #
|
688 | 694 | ###############################################################################
|
689 | 695 |
|
690 |
| -def filter_acl_mirror_table_bindings(acls, neighbors, port_channels): |
691 |
| - """ |
692 |
| - Filters out inactive front-panel ports from the binding list for mirror |
693 |
| - ACL tables. We define an "active" port as one that is a member of a |
694 |
| - port channel or one that is connected to a neighboring device. |
695 |
| - """ |
| 696 | +def filter_acl_table_bindings(acls, neighbors, port_channels, sub_role): |
| 697 | + filter_acls = {} |
| 698 | + |
| 699 | + # If the asic role is BackEnd no ACL Table (Ctrl/Data/Everflow) is binded. |
| 700 | + # This will be applicable in Multi-NPU Platforms. |
| 701 | + |
| 702 | + if sub_role == BACKEND_ASIC_SUB_ROLE: |
| 703 | + return filter_acls |
| 704 | + |
| 705 | + front_port_channel_intf = [] |
| 706 | + |
| 707 | + # Get the front panel port channel. It will use port_alias_asic_map |
| 708 | + # which will get populated from port_config.ini for Multi-NPU |
| 709 | + # architecture |
| 710 | + for port_channel_intf in port_channels: |
| 711 | + backend_port_channel = any(lag_member in port_alias_asic_map \ |
| 712 | + and lag_member.startswith(BACKEND_ASIC_INTERFACE_NAME_PREFIX) \ |
| 713 | + for lag_member in port_channels[port_channel_intf]['members']) |
| 714 | + if not backend_port_channel: |
| 715 | + front_port_channel_intf.append(port_channel_intf) |
696 | 716 |
|
697 | 717 | for acl_table, group_params in acls.iteritems():
|
698 | 718 | group_type = group_params.get('type', None)
|
| 719 | + filter_acls[acl_table] = acls[acl_table] |
699 | 720 |
|
| 721 | + # For Control Plane and Data ACL no filtering is needed |
| 722 | + # Control Plane ACL has no Interface associated and |
| 723 | + # Data Plane ACL Interface are attached via minigraph |
| 724 | + # AclInterface. |
700 | 725 | if group_type != 'MIRROR' and group_type != 'MIRRORV6':
|
701 | 726 | continue
|
702 | 727 |
|
703 |
| - active_ports = [ port for port in group_params.get('ports', []) if port in neighbors.keys() or port in port_channels ] |
704 |
| - |
| 728 | + # Filters out back-panel ports from the binding list for Everflow (Mirror) |
| 729 | + # ACL tables. We define an "back-panel" port as one that is a member of a |
| 730 | + # port channel connected to back asic or directly connected to back asic. |
| 731 | + # This will be applicable in Multi-NPU Platforms. |
| 732 | + front_panel_ports = [] |
| 733 | + for port in group_params.get('ports', []): |
| 734 | + if port in port_alias_asic_map and port.startswith(BACKEND_ASIC_INTERFACE_NAME_PREFIX): |
| 735 | + continue |
| 736 | + if port in port_channels and port not in front_port_channel_intf: |
| 737 | + continue |
| 738 | + front_panel_ports.append(port) |
| 739 | + |
| 740 | + # Filters out inactive front-panel ports from the binding list for mirror |
| 741 | + # ACL tables. We define an "active" port as one that is a member of a |
| 742 | + # front pannel port channel or one that is connected to a neighboring device via front panel port. |
| 743 | + active_ports = [port for port in front_panel_ports if port in neighbors.keys() or port in front_port_channel_intf] |
| 744 | + |
705 | 745 | if not active_ports:
|
706 | 746 | print >> sys.stderr, 'Warning: mirror table {} in ACL_TABLE does not have any ports bound to it'.format(acl_table)
|
707 | 747 |
|
708 |
| - acls[acl_table]['ports'] = active_ports |
| 748 | + filter_acls[acl_table]['ports'] = active_ports |
709 | 749 |
|
710 |
| - return acls |
| 750 | + return filter_acls |
711 | 751 |
|
712 | 752 | ###############################################################################
|
713 | 753 | #
|
@@ -1020,7 +1060,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None):
|
1020 | 1060 | results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers)
|
1021 | 1061 | results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers)
|
1022 | 1062 | results['TACPLUS_SERVER'] = dict((item, {'priority': '1', 'tcp_port': '49'}) for item in tacacs_servers)
|
1023 |
| - results['ACL_TABLE'] = filter_acl_mirror_table_bindings(acls, neighbors, pcs) |
| 1063 | + results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role) |
1024 | 1064 | results['FEATURE'] = {
|
1025 | 1065 | 'telemetry': {
|
1026 | 1066 | 'status': 'enabled'
|
|
0 commit comments