def _setup_create_dvr_fip_interfaces_for_setting_routing_rules(self, address_scopes_match=False):
    ri = self._create_router()
    ri.get_floating_agent_gw_interface = mock.Mock()
    ri.fip_ns = mock.Mock()
    ri._add_interface_routing_rule_to_router_ns = mock.Mock()
    ri._add_interface_route_to_fip_ns = mock.Mock()
    ri.fip_ns._create_rtr_2_fip_link = mock.Mock()
    ri.internal_ports = ['moke_port_1', 'moke_port_2']
    if address_scopes_match:
        ri._check_if_address_scopes_match = mock.Mock(return_value=True)
    else:
        ri._check_if_address_scopes_match = mock.Mock(return_value=False)
    ri.rtr_fip_connect = False
    ex_gw_port = {'network_id': 'fake_net_id'}
    ri.create_dvr_external_gateway_on_agent(ex_gw_port)
    ri._check_rtr_2_fip_connect = mock.Mock()
    ri.connect_rtr_2_fip()
    self.assertTrue(ri._check_if_address_scopes_match.called)
    if address_scopes_match:
        self.assertTrue(ri.fip_ns.create_rtr_2_fip_link.called)
        self.assertTrue(ri._add_interface_routing_rule_to_router_ns.called)
        self.assertTrue(ri._add_interface_route_to_fip_ns.called)
    else:
        self.assertFalse(ri._add_interface_routing_rule_to_router_ns.called)
        self.assertFalse(ri._add_interface_route_to_fip_ns.called)
        self.assertTrue(ri.fip_ns.create_rtr_2_fip_link.called)
def _setup_create_dvr_fip_interfaces_for_setting_routing_rules(self, address_scopes_match=False):
    ri = self._create_router()
    ri.get_floating_agent_gw_interface = mock.Mock()
    ri.fip_ns = mock.Mock()
    ri._add_interface_routing_rule_to_router_ns = mock.Mock()
    ri._add_interface_route_to_fip_ns = mock.Mock()
    ri.fip_ns._create_rtr_2_fip_link = mock.Mock()
    ri.internal_ports = ['moke_port_1', 'moke_port_2']
    if address_scopes_match:
        ri._check_if_address_scopes_match = mock.Mock(return_value=True)
    else:
        ri._check_if_address_scopes_match = mock.Mock(return_value=False)
    ri.rtr_fip_connect = False
    ex_gw_port = {'network_id': 'fake_net_id'}
    ri.create_dvr_external_gateway_on_agent(ex_gw_port)
    ri._check_rtr_2_fip_connect = mock.Mock()
    ri.connect_rtr_2_fip()
    self.assertTrue(ri._check_if_address_scopes_match.called)
    if address_scopes_match:
        self.assertTrue(ri.fip_ns.create_rtr_2_fip_link.called)
        self.assertTrue(ri._add_interface_routing_rule_to_router_ns.called)
        self.assertTrue(ri._add_interface_route_to_fip_ns.called)
    else:
        self.assertFalse(ri._add_interface_routing_rule_to_router_ns.called)
        self.assertFalse(ri._add_interface_route_to_fip_ns.called)
        self.assertTrue(ri.fip_ns.create_rtr_2_fip_link.called)