'Test to validate the extra routes on dvr routers.'

def _setup_dvr_router_static_routes(self, router_namespace=True, check_fpr_int_rule_delete=False):

    self.agent.conf.agent_mode = 'dvr_snat'
    router_info = self.generate_dvr_router_info(enable_snat=True)
    router1 = self.manage_router(self.agent, router_info)
    self.assertTrue(self._namespace_exists(router1.ns_name))
    self._assert_snat_namespace_exists(router1)
    fip_ns_name = router1.fip_ns.get_name()
    self.assertTrue(self._namespace_exists(fip_ns_name))
    snat_ns_name = dvr_snat_ns.SnatNamespace.get_snat_ns_name(router1.router_id)
    if router_namespace:
        router1.router['routes'] = [{'destination': '8.8.4.0/24', 'nexthop': '35.4.0.20'}]
    else:
        router1.router['routes'] = [{'destination': '8.8.4.0/24', 'nexthop': '19.4.4.10'}]
    self.agent._process_updated_router(router1.router)
    router_updated = self.agent.router_info[router_info['id']]
    if router_namespace:
        self._assert_extra_routes(router_updated)
        self._assert_extra_routes(router_updated, namespace=snat_ns_name)
    else:
        (rtr_2_fip, fip_2_rtr) = router_updated.rtr_fip_subnet.get_pair()
        router_fip_table_idx = router_updated._get_snat_idx(fip_2_rtr)
        self._assert_extra_routes_for_fipns(router_updated, router_fip_table_idx)
        self._assert_extra_routes(router_updated, namespace=snat_ns_name)
    if check_fpr_int_rule_delete:
        router_updated.router[lib_constants.FLOATINGIP_KEY] = []
        router_updated.router['gw_port'] = ''
        router_updated.router['gw_port_host'] = ''
        router_updated.router['external_gateway_info'] = ''
        self.agent._process_updated_router(router_updated.router)
        new_router_info = self.agent.router_info[router_updated.router_id]
        self.assertTrue(self._namespace_exists(fip_ns_name))
        self._assert_extra_routes_for_fipns(new_router_info, router_fip_table_idx, check_fpr_int_rule_delete=check_fpr_int_rule_delete)
