#NEWLINE# def _add_rules_by_security_group( self , port , direction ) : #NEWLINE# #INDENT# security_group_rules = self . _select_sgr_by_direction ( port , direction ) #NEWLINE# security_group_rules += self . _select_sg_rules_for_port ( port , direction ) #NEWLINE# if self . enable_ipset : #NEWLINE# #INDENT# remote_sg_ids = self . _get_remote_sg_ids ( port , direction ) #NEWLINE# self . _update_ipset_members ( remote_sg_ids ) #NEWLINE# #UNINDENT# ( ipv4_sg_rules , ipv6_sg_rules ) = self . _split_sgr_by_ethertype ( security_group_rules ) #NEWLINE# ipv4_iptables_rules = [ ] #NEWLINE# ipv6_iptables_rules = [ ] #NEWLINE# if ( direction == firewall . EGRESS_DIRECTION ) : #NEWLINE# #INDENT# self . _add_fixed_egress_rules ( port , ipv4_iptables_rules , ipv6_iptables_rules ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( direction == firewall . INGRESS_DIRECTION ) : #NEWLINE# #INDENT# ipv6_iptables_rules += self . _accept_inbound_icmpv6 ( ) #NEWLINE# #UNINDENT# #UNINDENT# ipv4_iptables_rules += self . _convert_sgr_to_iptables_rules ( ipv4_sg_rules ) #NEWLINE# ipv6_iptables_rules += self . _convert_sgr_to_iptables_rules ( ipv6_sg_rules ) #NEWLINE# self . _add_rules_to_chain_v4v6 ( self . _port_chain_name ( port , direction ) , ipv4_iptables_rules , ipv6_iptables_rules )