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