# Buggy code
def check_config(self):
    test_config_condition(not self.rules, "no rules found for ACL %s" % self._id)
    for match_fields in (MATCH_FIELDS, OLD_MATCH_FIELDS):
        for match in match_fields.keys():
            self.rule_types[match] = (str, int)
    for rule in self.rules:
        self._check_conf_types(rule, self.rule_types)
        for rule_field, rule_conf in rule.items():
            if rule_field == "cookie":
                test_config_condition(
                    rule_conf < 0 or rule_conf > 2**16,
                    ("rule cookie value must be 0-2**16"),
                )
            elif rule_field == "actions":
                test_config_condition(
                    not rule_conf, "Missing rule actions in ACL %s" % self._id
                )
                self._check_conf_types(rule_conf, self.actions_types)
                for action_name, action_conf in rule_conf.items():
                    if action_name == "output":
                        self._check_conf_types(action_conf, self.output_actions_types)


# Traceback (AttributeError)
Oct 25 16:13:59 faucet.exception ERROR    Unhandled exception, killing RYU
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/faucet/valve_util.py", line 34, in __koe
func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/faucet/faucet.py", line 156, in reload_config
time.time(), self.config_file, delete_dp=self._delete_deconfigured_dp)
File "/usr/lib/python3.6/site-packages/faucet/valves_manager.py", line 139, in request_reload_configs
self.load_configs(now, new_config_file, delete_dp=delete_dp)
File "/usr/lib/python3.6/site-packages/faucet/valves_manager.py", line 108, in load_configs
new_dps = self.parse_configs(new_config_file)
File "/usr/lib/python3.6/site-packages/faucet/valves_manager.py", line 88, in parse_configs
new_config_hashes, new_dps = dp_parser(new_config_file, self.logname)
File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 51, in dp_parser
config_hashes, dps = _config_parser_v2(config_file, logname)
File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 213, in _config_parser_v2
top_confs['vlans'])
File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 177, in _dp_parser_v2
for dp_key, dp_conf in dps_conf.items()]
File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 177, in <listcomp>
for dp_key, dp_conf in dps_conf.items()]
File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 161, in _parse_dp
acl = ACL(acl_key, dp_id, acl_conf)
File "/usr/lib/python3.6/site-packages/faucet/acl.py", line 118, in __init__
super(ACL, self).__init__(_id, dp_id, conf)
File "/usr/lib/python3.6/site-packages/faucet/conf.py", line 54, in __init__
self.check_config()
File "/usr/lib/python3.6/site-packages/faucet/acl.py", line 127, in check_config
self._check_conf_types(rule, self.rule_types)
File "/usr/lib/python3.6/site-packages/faucet/conf.py", line 76, in _check_conf_types
for conf_key, conf_value in conf.items():
AttributeError: 'NoneType' object has no attribute 'items'

# Fixed code
def check_config(self):
    test_config_condition(not self.rules, "no rules found for ACL %s" % self._id)
    for rule in self.rules:
        self._check_conf_types(rule, self.rule_types)
        for rule_field, rule_conf in rule.items():
            if rule_field == "cookie":
                test_config_condition(
                    rule_conf < 0 or rule_conf > 2**16,
                    "rule cookie value must be 0-2**16",
                )
            elif rule_field == "actions":
                test_config_condition(
                    not rule_conf, "Missing rule actions in ACL %s" % self._id
                )
                self._check_conf_types(rule_conf, self.actions_types)
                for action_name, action_conf in rule_conf.items():
                    if action_name == "output":
                        self._check_conf_types(action_conf, self.output_actions_types)