Skip to content

Commit dcee5fc

Browse files
stchengyxieca
authored andcommitted
[neighbor_advertise]: Use the existing MIRROR ACL table (sonic-net#605)
Currently only one IPv4 mirror type ACL table is supported. Thus, in order to insert an ACL rule, we use the existing table in the configuration. Add the priority to the ACL rule as well. Signed-off-by: Shu0T1an ChenG <[email protected]>
1 parent 53281d0 commit dcee5fc

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

scripts/neighbor_advertiser

+4-22
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SYSLOG_IDENTIFIER = 'neighbor_advertiser'
3333
#
3434

3535
MIRROR_SESSION_NAME = 'neighbor_advertiser'
36-
MIRROR_ACL_NAME = 'neighbor_advertiser_acl'
36+
MIRROR_ACL_TABLE_NAME = 'EVERFLOW'
3737
MIRROR_ACL_RULE_NAME = 'rule_arp'
3838
VXLAN_TUNNEL_NAME = 'neighbor_advertiser'
3939
VXLAN_TUNNEL_MAP_PREFIX = 'map_'
@@ -306,32 +306,19 @@ def add_mirror_session(dst_ipv4_addr):
306306
config_db.set_entry('MIRROR_SESSION', MIRROR_SESSION_NAME, session_info)
307307

308308

309-
def add_mirror_acl():
310-
all_vlan_ports = []
311-
for vlan_intf in get_vlan_interfaces():
312-
all_vlan_ports.extend(get_vlan_interface_members(vlan_intf))
313-
314-
acl_info = {
315-
'policy_desc': 'neighbor advertiser',
316-
'type': 'mirror',
317-
'ports': all_vlan_ports
318-
}
319-
320-
config_db.set_entry('ACL_TABLE', MIRROR_ACL_NAME, acl_info)
321-
322309

323310
def add_mirror_acl_rule():
324311
acl_rule_info = {
312+
'PRIORITY': '8888',
325313
'ether_type': '2054',
326314
'mirror_action': MIRROR_SESSION_NAME
327315
}
328316

329-
config_db.set_entry('ACL_RULE', (MIRROR_ACL_NAME, MIRROR_ACL_RULE_NAME), acl_rule_info)
317+
config_db.set_entry('ACL_RULE', (MIRROR_ACL_TABLE_NAME, MIRROR_ACL_RULE_NAME), acl_rule_info)
330318

331319

332320
def set_mirror_tunnel(ferret_server_ip):
333321
add_mirror_session(ferret_server_ip)
334-
add_mirror_acl()
335322
add_mirror_acl_rule()
336323
log_info('Finish setting mirror tunnel; Ferret: {}'.format(ferret_server_ip))
337324

@@ -344,17 +331,12 @@ def remove_mirror_session():
344331
config_db.set_entry('MIRROR_SESSION', MIRROR_SESSION_NAME, None)
345332

346333

347-
def remove_mirror_acl():
348-
config_db.set_entry('ACL_TABLE', MIRROR_ACL_NAME, None)
349-
350-
351334
def remove_mirror_acl_rule():
352-
config_db.set_entry('ACL_RULE', (MIRROR_ACL_NAME, MIRROR_ACL_RULE_NAME), None)
335+
config_db.set_entry('ACL_RULE', (MIRROR_ACL_TABLE_NAME, MIRROR_ACL_RULE_NAME), None)
353336

354337

355338
def reset_mirror_tunnel():
356339
remove_mirror_acl_rule()
357-
remove_mirror_acl()
358340
remove_mirror_session()
359341
log_info('Finish resetting mirror tunnel')
360342

0 commit comments

Comments
 (0)