'Add one pd-enabled subnet, followed by adding another one
Remove the gateway port and check the prefix is removed'

@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_remove_gateway_2_subnets(self, mock1, mock2, mock3, mock4, mock_getpid, mock_get_prefix, mock_pd_update_subnet):

    (agent, router, ri) = self._pd_setup_agent_router()
    self._pd_add_gw_interface(agent, ri)
    l3_test_common.router_append_pd_enabled_subnet(router, count=1)
    ri.process()
    update_router = copy.deepcopy(router)
    pd_intfs = l3_test_common.get_unassigned_pd_interfaces(update_router)
    self._pd_get_prefixes(agent, ri, [], pd_intfs, mock_get_prefix)
    ri.router = update_router
    ri.process()
    self._pd_verify_update_results(ri, pd_intfs, mock_pd_update_subnet)
    l3_test_common.router_append_pd_enabled_subnet(update_router, count=1)
    ri.process()
    update_router_2 = copy.deepcopy(update_router)
    pd_intfs1 = l3_test_common.get_unassigned_pd_interfaces(update_router_2)
    self._pd_get_prefixes(agent, ri, pd_intfs, pd_intfs1, mock_get_prefix)
    ri.router = update_router_2
    ri.process()
    self._pd_verify_update_results(ri, pd_intfs1, mock_pd_update_subnet)
    self._pd_remove_gw_interface((pd_intfs + pd_intfs1), agent, ri)
