#NEWLINE# def _get_conntrack_cmds( self , device_info_list , rule , remote_ip = None ) : #NEWLINE# #INDENT# conntrack_cmds = set ( ) #NEWLINE# cmd = self . _generate_conntrack_cmd_by_rule ( rule , self . namespace ) #NEWLINE# ethertype = rule . get ( 'ethertype' ) #NEWLINE# for device_info in device_info_list : #NEWLINE# #INDENT# zone_id = self . get_device_zone ( device_info [ 'device' ] ) #NEWLINE# ips = device_info . get ( 'fixed_ips' , [ ] ) #NEWLINE# for ip in ips : #NEWLINE# #INDENT# net = netaddr . IPNetwork ( ip ) #NEWLINE# if ( str ( net . version ) not in ethertype ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ip_cmd = [ str ( net . ip ) , '-w' , zone_id ] #NEWLINE# if ( remote_ip and ( str ( netaddr . IPNetwork ( remote_ip ) . version ) in ethertype ) ) : #NEWLINE# #INDENT# ip_cmd . extend ( [ '-s' , str ( remote_ip ) ] ) #NEWLINE# #UNINDENT# conntrack_cmds . add ( tuple ( ( cmd + ip_cmd ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return conntrack_cmds