'Set HA network port to DOWN for HA routers hosted on <host>
This will update HA network port status to down for all HA routers
hosted on <host>. This is needed to avoid l3 agent spawning keepalived
when l2 agent not yet wired the port. This can happen after a system
reboot that has wiped out flows, etc and the L2 agent hasn\'t started up
yet. The port will still be ACTIVE in the data model and the L3 agent
will use that info to mistakenly think that L2 network is ready.
By forcing into DOWN, we will require the L2 agent to essentially ack
that the port is indeed ACTIVE by reacting to the port update and
calling update_device_up.'

def update_all_ha_network_port_statuses(self, context, host):

    if (not utils.is_extension_supported(self.plugin, constants.PORT_BINDING_EXT_ALIAS)):
        return
    device_filter = {'device_owner': [constants.DEVICE_OWNER_ROUTER_HA_INTF], 'status': [constants.PORT_STATUS_ACTIVE]}
    ports = self.plugin.get_ports(context, filters=device_filter)
    ha_ports = [p['id'] for p in ports if (p.get(portbindings.HOST_ID) == host)]
    if (not ha_ports):
        return
    LOG.debug('L3    agent    on    host    %(host)s    requested    for    fullsync,    so    setting    HA    network    ports    %(ha_ports)s    status    to    DOWN.', {'host': host, 'ha_ports': ha_ports})
    for p in ha_ports:
        self.plugin.update_port(context, p, {'port': {'status': constants.PORT_STATUS_DOWN}})
