def _ensure_create_ha_compliant(self, router, router_type):
details = router.pop(ha.DETAILS, {})<EOL>if details == ATTR_NOT_SPECIFIED:<EOL><INDENT>details = {}<EOL><DEDENT>res = {ha.ENABLED: router.pop(ha.ENABLED, ATTR_NOT_SPECIFIED),<EOL>ha.DETAILS: details}<EOL>if not is_attr_set(res[ha.ENABLED]):<EOL><INDENT>res[ha.ENABLED] = router_type['<STR_LIT>']<EOL><DEDENT>if res[ha.ENABLED] and not cfg.CONF.ha.ha_support_enabled:<EOL><INDENT>raise ha.HADisabled()<EOL><DEDENT>if not res[ha.ENABLED]:<EOL><INDENT>return res<EOL><DEDENT>if not is_attr_set(details.get(ha.TYPE, ATTR_NOT_SPECIFIED)):<EOL><INDENT>details[ha.TYPE] = cfg.CONF.ha.default_ha_mechanism<EOL><DEDENT>if details[ha.TYPE] in cfg.CONF.ha.disabled_ha_mechanisms:<EOL><INDENT>raise ha.HADisabledHAType(ha_type=details[ha.TYPE])<EOL><DEDENT>if not is_attr_set(details.get(ha.REDUNDANCY_LEVEL,<EOL>ATTR_NOT_SPECIFIED)):<EOL><INDENT>details[ha.REDUNDANCY_LEVEL] = (<EOL>cfg.CONF.ha.default_ha_redundancy_level)<EOL><DEDENT>if not is_attr_set(details.get(ha.PROBE_CONNECTIVITY,<EOL>ATTR_NOT_SPECIFIED)):<EOL><INDENT>details[ha.PROBE_CONNECTIVITY] = (<EOL>cfg.CONF.ha.connectivity_probing_enabled_by_default)<EOL><DEDENT>if not is_attr_set(details.get(ha.PROBE_TARGET, ATTR_NOT_SPECIFIED)):<EOL><INDENT>details[ha.PROBE_TARGET] = cfg.CONF.ha.default_probe_target<EOL><DEDENT>if not is_attr_set(details.get(ha.PROBE_INTERVAL, ATTR_NOT_SPECIFIED)):<EOL><INDENT>details[ha.PROBE_INTERVAL] = cfg.CONF.ha.default_ping_interval<EOL><DEDENT>return res<EOL>
To be called in create_router() BEFORE router is created in DB.