'Test HA in the standby router
The intent is to test the PD code with HA. To avoid unnecessary
complexities, use the regular router.'

@mock.patch.object(l3router.RouterInfo, 'enable_radvd')
@mock.patch.object(pd.PrefixDelegation, '_add_lla')
@mock.patch.object(pd.PrefixDelegation, 'update_subnet')
@mock.patch.object(dibbler.PDDibbler, 'get_prefix', autospec=True)
@mock.patch.object(dibbler.os, 'getpid', return_value=1234)
@mock.patch.object(pd.PrefixDelegation, '_is_lla_active', return_value=True)
@mock.patch.object(dibbler.os, 'chmod')
@mock.patch.object(dibbler.shutil, 'rmtree')
@mock.patch.object(pd.PrefixDelegation, '_get_sync_data')
def test_pd_ha_standby(self, mock1, mock2, mock3, mock4, mock_getpid, mock_get_prefix, mock_pd_update_subnet, mock_add_lla, mock_enable_radvd):

    (agent, router, ri) = self._pd_setup_agent_router(enable_ha=True)
    l3_test_common.router_append_pd_enabled_subnet(router)
    self._pd_add_gw_interface(agent, ri)
    ri.process()
    self.assertFalse(mock_add_lla.called)
    agent.pd.process_prefix_update()
    self.assertFalse(self.external_process.called)
    self.assertFalse(mock_get_prefix.called)
    update_router = copy.deepcopy(router)
    pd_intfs = l3_test_common.assign_prefix_for_pd_interfaces(update_router)
    ri.router = update_router
    ri.process()
    self._pd_assert_update_subnet_calls(router['id'], pd_intfs, mock_pd_update_subnet)
    agent.pd.process_prefix_update()
    self.assertFalse(self.external_process.called)
    self.assertFalse(mock_get_prefix.called)
