Python neutron_lib.exceptions.NotFound() Examples

The following are 7 code examples of neutron_lib.exceptions.NotFound(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module neutron_lib.exceptions , or try the search function .
Example #1
Source File: test_recovery.py    From networking-odl with Apache License 2.0 6 votes vote down vote up
def _test_recovery_creates_operation(
            self, operation, resource, odl_resource, expected_operation,
            recovery_mock):
        if resource is not None:
            recovery_mock.return_value = resource
        else:
            recovery_mock.side_effect = nexc.NotFound
        original_row = self._test_recovery(
            operation, odl_resource, odl_const.COMPLETED)

        pending_row = db.get_all_db_rows_by_state(
            self.db_context, odl_const.PENDING)[0]
        self.assertEqual(expected_operation, pending_row['operation'])
        self.assertEqual(original_row['object_type'],
                         pending_row['object_type'])
        self.assertEqual(original_row['object_uuid'],
                         pending_row['object_uuid']) 
Example #2
Source File: recovery.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
def _sync_resource_to_odl(context, row, operation_type, exists_on_odl):
    resource = None
    try:
        resource = _get_latest_resource(context, row)
    except nexc.NotFound:
        if exists_on_odl:
            journal.record(context, row.object_type,
                           row.object_uuid, odl_const.ODL_DELETE, [])
    else:
        journal.record(context, row.object_type, row.object_uuid,
                       operation_type, resource)

    journal.entry_complete(context, row) 
Example #3
Source File: test_recovery.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
def test__get_latest_resource_none(self, plugin_mock):
        plugin_mock.return_value.get_network.side_effect = nexc.NotFound()
        l2 = mech_driver_v2.OpenDaylightMechanismDriver.RESOURCES
        full_sync.ALL_RESOURCES[plugin_constants.CORE] = l2

        mock_row = self._mock_row(odl_const.ODL_NETWORK)
        self.assertRaises(
            nexc.NotFound, recovery._get_latest_resource,
            self.db_context.session, mock_row) 
Example #4
Source File: test_recovery.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
def test_recovery_created_resource_missing_and_not_in_odl(self, rmock):
        rmock.side_effect = nexc.NotFound
        self._test_recovery(odl_const.ODL_CREATE, None, odl_const.COMPLETED) 
Example #5
Source File: test_recovery.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
def test_recovery_created_resource_missing_and_not_in_odl_purged(
            self, rmock):
        rmock.side_effect = nexc.NotFound
        self._disable_retention()
        self._test_recovery(odl_const.ODL_CREATE, None, None) 
Example #6
Source File: test_recovery.py    From networking-odl with Apache License 2.0 5 votes vote down vote up
def test_recovery_updated_resource_missing_and_not_in_odl_purged(
            self, rmock):
        rmock.side_effect = nexc.NotFound
        self._disable_retention()
        self._test_recovery(odl_const.ODL_UPDATE, None, None) 
Example #7
Source File: test_exceptions.py    From neutron-lib with Apache License 2.0 5 votes vote down vote up
def test_not_found(self):
        self._check_nexc(
            ne.NotFound,
            _('An unknown exception occurred.'))