Module ImportFrom alias Import alias ImportFrom alias alias ImportFrom alias identifier ImportFrom alias identifier ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BinOpAdd Str SubscriptLoad NameLoad Slice Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareEq Call AttributeLoad NameLoad attr Str Str body Expr Call AttributeLoad NameLoad attr NameLoad If CompareEq Call AttributeLoad NameLoad attr Str Str body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr For NameStore NameLoad body If BoolOpAnd CompareEq AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str CompareEq AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str CompareEq AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad For NameStore Call AttributeLoad NameLoad attr Str body If CompareIn NameLoad Call AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Call NameLoad Str Dict Str Str NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Str Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad For NameStore Call AttributeLoad NameLoad attr Str body If CompareIn NameLoad Call AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Call NameLoad Str Dict Str Str NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If BoolOpOr UnaryOpNot NameLoad UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad Str Dict Str Str NameLoad NameLoad Return Assign NameStore ListLoad Str Str BinOpMod Str NameLoad BinOpMod Str NameLoad Str BinOpMod Str NameLoad Str Str Str BinOpMod Str NameLoad Str Str Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Str NameLoad If CompareEq Call AttributeLoad NameLoad attr Str Str body For NameStore AttributeLoad NameLoad attr body If BoolOpAnd CompareEq AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr Str attr CompareEq AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str body If CompareNotEq AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Return Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body TryExcept body Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr Str Num Assign NameStore SubscriptLoad Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr Str Index Num Return CompareEq NameLoad NameLoad handlers ExceptHandler type NameLoad body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad Assign NameStore ListLoad Assign NameStore NameLoad For NameStore Call AttributeLoad NameLoad attr Str body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr If CompareIn Str NameLoad body Assign NameStore Call NameLoad AttributeLoad NameLoad attr For NameStore NameLoad body If BoolOpAnd CompareIn AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr CompareIn Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr Str Num Assign SubscriptStore NameLoad Index NameLoad BinOpAdd AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str Dict Str Str NameLoad NameLoad Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If BoolOpAnd NameLoad NameLoad body Assign NameStore ListLoad Str Str Expr Call AttributeLoad NameLoad attr NameLoad keyword Call AttributeLoad Str attr NameLoad keyword AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str While NameLoad body TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad Str decorator_list decorator_list
N/A six.moves queue N/A time networking_cisco._i18n _LE _LI networking_cisco.apps.saf.common dfa_logger logging networking_cisco.apps.saf.common dfa_sys_lib dsl networking_cisco.apps.saf.common utils N/A LOG N/A N/A logging getLogger __name__ IpMacPort N/A object N/A N/A This class keeps host rule information. __init__ N/A N/A self ip mac port N/A N/A N/A N/A self ip ip N/A N/A self mac N/A mac N/A N/A mac lower N/A N/A self port port N/A N/A self chain N/A neutron-openvswi-s N/A port N/A 10 N/A N/A IptablesDriver N/A object N/A N/A This class provides API to update iptables rule. __init__ N/A N/A self cfg N/A N/A N/A N/A self _root_helper N/A N/A cfg sys root_helper N/A N/A self rule_info N/A N/A N/A self _iptq N/A N/A queue Queue N/A update_rule_entry N/A N/A self rule_info N/A N/A N/A Update the rule_info list. N/A N/A N/A N/A rule_info get status up N/A N/A N/A N/A self add_rule_entry rule_info N/A N/A N/A N/A rule_info get status down N/A N/A N/A N/A self remove_rule_entry rule_info N/A add_rule_entry N/A N/A self rule_info N/A N/A N/A Add host data object to the rule_info list. N/A new_rule N/A IpMacPort N/A N/A rule_info get ip N/A N/A rule_info get mac N/A N/A rule_info get port N/A N/A N/A LOG debug Added rule info %s to the list rule_info N/A N/A N/A N/A self rule_info append new_rule N/A remove_rule_entry N/A N/A self rule_info N/A N/A N/A Remove host data object from rule_info list. N/A temp_list N/A list N/A self rule_info N/A rule temp_list N/A N/A N/A N/A N/A rule ip N/A N/A rule_info get ip N/A N/A rule mac N/A N/A rule_info get mac N/A N/A rule port N/A N/A rule_info get port N/A N/A N/A N/A LOG debug Removed rule info %s from the list rule_info N/A N/A N/A N/A self rule_info remove rule N/A _find_chain_name N/A N/A self mac N/A N/A N/A Find a rule associated with a given mac. N/A ipt_cmd N/A iptables -t filter -S N/A cmdo N/A N/A dsl execute ipt_cmd root_helper N/A self _root_helper log_output False N/A o N/A N/A cmdo split N/A N/A N/A mac N/A N/A o lower N/A N/A chain N/A N/A N/A o split N/A 1 N/A N/A N/A LOG info N/A _LI Find %(chain)s for %(mac)s. N/A chain mac chain mac N/A chain N/A _find_rule_no N/A N/A self mac N/A N/A N/A Find rule number associated with a given mac. N/A ipt_cmd N/A iptables -L --line-numbers N/A cmdo N/A N/A dsl execute ipt_cmd N/A self _root_helper log_output False N/A o N/A N/A cmdo split N/A N/A N/A mac N/A N/A o lower N/A N/A rule_no N/A N/A N/A o split N/A 0 N/A N/A N/A LOG info N/A _LI Found rule %(rule)s for %(mac)s. N/A rule mac rule_no mac N/A rule_no N/A update_ip_rule N/A N/A self ip mac N/A N/A N/A Update a rule associated with given ip and mac. N/A rule_no N/A N/A self _find_rule_no mac N/A chain N/A N/A self _find_chain_name mac N/A N/A N/A rule_no N/A chain N/A N/A N/A N/A LOG error N/A _LE Failed to update ip rule for %(ip)s %(mac)s N/A ip mac ip mac N/A N/A update_cmd N/A iptables -R N/A %s chain N/A %s rule_no -s N/A %s/32 ip -m mac --mac-source N/A %s mac -j RETURN N/A N/A N/A LOG debug Execute command: %s update_cmd N/A N/A N/A dsl execute update_cmd N/A self _root_helper log_output False N/A enqueue_event N/A N/A self event N/A N/A N/A Enqueue the given event.

        The event contains host data (ip, mac, port) which will be used to
        update the spoofing rule for the host in the iptables.
         N/A N/A N/A LOG debug Enqueue iptable event %s. event N/A N/A N/A N/A event get status up N/A N/A rule N/A self rule_info N/A N/A N/A N/A N/A rule mac N/A N/A N/A N/A event get mac lower N/A N/A rule port N/A N/A event get port N/A N/A N/A N/A rule ip N/A N/A event get ip N/A N/A N/A N/A LOG debug N/A enqueue_event: Only updating IP from %s to %s. N/A N/A rule ip N/A N/A event get ip N/A N/A rule ip N/A N/A event get ip N/A N/A N/A N/A N/A self _iptq put event N/A create_thread N/A N/A self N/A N/A N/A Create a task to process event for updating iptables. N/A ipt_thrd N/A N/A utils EventProcessingThread iptables self process_rule_info N/A ipt_thrd N/A _is_ip_in_rule N/A N/A self ip rule N/A N/A N/A N/A N/A ip_loc N/A N/A N/A rule index -s 1 N/A rule_ip N/A N/A N/A N/A rule N/A ip_loc split / N/A 0 N/A N/A ip rule_ip N/A N/A N/A Exception N/A N/A False N/A update_iptables N/A N/A self N/A N/A N/A Update iptables based on information in the rule_info. N/A iptables_cmds N/A iptables-save -c N/A all_rules N/A N/A dsl execute iptables_cmds root_helper N/A self _root_helper log_output False N/A new_rules N/A N/A is_modified False N/A line N/A N/A all_rules split N/A N/A new_line line N/A line_content N/A N/A line split N/A N/A -s line_content N/A N/A tmp_rule_info N/A list N/A self rule_info N/A rule tmp_rule_info N/A N/A N/A N/A N/A rule mac N/A N/A line lower N/A N/A N/A N/A rule chain lower N/A N/A line lower N/A N/A N/A self _is_ip_in_rule N/A rule ip line_content N/A N/A ip_loc N/A N/A N/A line_content index -s 1 N/A N/A line_content N/A ip_loc N/A N/A rule ip /32 N/A new_line N/A N/A join line_content N/A N/A N/A LOG debug N/A Modified %(old_rule)s. New rule is %(new_rule)s. N/A old_rule new_rule line new_line N/A is_modified True N/A N/A N/A new_rules append new_line N/A N/A is_modified new_rules N/A N/A iptables_cmds N/A iptables-restore -c N/A N/A N/A dsl execute iptables_cmds process_input N/A N/A join new_rules root_helper N/A self _root_helper log_output False N/A process_rule_info N/A N/A self N/A N/A N/A Task responsible for processing event queue. N/A True N/A N/A N/A N/A event N/A N/A N/A self _iptq get block False N/A N/A N/A LOG debug Dequeue event: %s. event N/A N/A N/A self update_rule_entry event N/A N/A N/A N/A queue Empty N/A N/A N/A N/A self update_iptables N/A N/A N/A time sleep 1 N/A N/A Exception N/A N/A N/A N/A LOG exception N/A _LE ERROR: failed to process queue N/A N/A