def acl_ut_entry_modify1(table_id, entry_id): global total, passed total.append(sys._getframe().f_code.co_name) e = nas_acl.EntryCPSObj(table_id=table_id, entry_id=entry_id) filters = { 'DST_IP': '56.0.0.1', 'IPV6_FLOW_LABEL': {'data': '34456', 'mask': '0xff'}, 'TCP_FLAGS': {'data': '0x17', 'mask': '0x3f'}, 'ECN': {'data': '0x2', 'mask': '0x2'}, 'IP_TYPE': 'IP', 'IN_PORTS': [a_utl.get_if_name(3)], } actions = { 'SET_DST_MAC': '01:00:79:08:78:BC', 'MIRROR_INGRESS': {'index': mirror_id_1, 'data': mir_opq_1}, } try: nas_acl.replace_entry_filter_list( table_id=table_id, entry_id=entry_id, filter_map=filters) nas_acl.replace_entry_action_list( table_id=table_id, entry_id=entry_id, action_map=actions) except RuntimeError: print (sys._getframe().f_code.co_name + " - Error Modifying Entry") return None print (sys._getframe().f_code.co_name + " - Modified Entry " + str(entry_id)) raw_input( "Check entry is modified (Del SRCIP,SRCMAC,Redirect port. Changed IPv6Flowlabel mask,IN PORTS,Packet Action. Add DSTIP, DST-MAC action. Press Enter to continue...") passed.append(sys._getframe().f_code.co_name) return entry_id
action_type='MIRROR_INGRESS') print "Removed Mirror Ingress action" nas_acl.print_entry(tid, eid) # Completely overwrite the filter list with another set of filters filters = { 'DST_MAC': '00:70:a2:00:00:01', # Auto apply default mask 'IP_TYPE': 'IP', # Filters where Mask is N/A 'IN_PORT': a_utl.get_if_name(6), # Takes name or ifindex } print "Replaced filter list - new filters - Dst MAC, IP Type and In port" nas_acl.replace_entry_filter_list( table_id=tid, entry_id=eid, filter_map=filters) nas_acl.print_entry(tid, eid) # Completely overwrite the action list with another set of actions print "Replaced action list - new action - Mirror egress" actions = { 'MIRROR_EGRESS': {'index': mirr_id_2, 'data': mirr_opq_2} # Attaching external obj # to ACL # action } nas_acl.replace_entry_action_list( table_id=tid, entry_id=eid, action_map=actions)
entry_id=eid, action_type='MIRROR_INGRESS') print "Removed Mirror Ingress action" nas_acl.print_entry(tid, eid) # Completely overwrite the filter list with another set of filters filters = { 'DST_MAC': '00:70:a2:00:00:01', # Auto apply default mask 'IP_TYPE': 'IP', # Filters where Mask is N/A 'IN_PORT': a_utl.get_if_name(6), # Takes name or ifindex } print "Replaced filter list - new filters - Dst MAC, IP Type and In port" nas_acl.replace_entry_filter_list(table_id=tid, entry_id=eid, filter_map=filters) nas_acl.print_entry(tid, eid) # Completely overwrite the action list with another set of actions print "Replaced action list - new action - Mirror egress" actions = { 'MIRROR_EGRESS': { 'index': mirr_id_2, 'data': mirr_opq_2 } # Attaching external obj # to ACL # action } nas_acl.replace_entry_action_list(table_id=tid, entry_id=eid,