| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 |
# not use this file except in compliance with the License. You may obtain |
| 3 |
# a copy of the License at |
| 4 |
# |
| 5 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 |
# |
| 7 |
# Unless required by applicable law or agreed to in writing, software |
| 8 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 |
# License for the specific language governing permissions and limitations |
| 11 |
# under the License. |
| 12 |
|
| 13 |
import abc |
| 14 |
|
| 15 |
from neutron_lib.api.definitions import tap_mirror as tap_mirror_api_def |
| 16 |
from neutron_lib.api import extensions as api_extensions |
| 17 |
from neutron_lib.services import base as service_base |
| 18 |
|
| 19 |
from neutron.api.v2 import resource_helper |
| 20 |
|
| 21 |
|
| 22 |
class Tap_mirror(api_extensions.APIExtensionDescriptor): |
| 23 |
|
| 24 |
api_definition = tap_mirror_api_def |
| 25 |
|
| 26 |
@classmethod |
| 27 |
def get_resources(cls): |
| 28 |
plural_mappings = resource_helper.build_plural_mappings( |
| 29 |
{}, tap_mirror_api_def.RESOURCE_ATTRIBUTE_MAP) |
| 30 |
resources = resource_helper.build_resource_info( |
| 31 |
plural_mappings, |
| 32 |
tap_mirror_api_def.RESOURCE_ATTRIBUTE_MAP, |
| 33 |
tap_mirror_api_def.ALIAS, |
| 34 |
translate_name=False, |
| 35 |
allow_bulk=False) |
| 36 |
|
| 37 |
return resources |
| 38 |
|
| 39 |
@classmethod |
| 40 |
def get_plugin_interface(cls): |
| 41 |
return TapMirrorBase |
| 42 |
|
| 43 |
|
| 44 |
class TapMirrorBase(service_base.ServicePluginBase, metaclass=abc.ABCMeta): |
| 45 |
|
| 46 |
def get_plugin_description(self): |
| 47 |
return tap_mirror_api_def.DESCRIPTION |
| 48 |
|
| 49 |
@classmethod |
| 50 |
def get_plugin_type(cls): |
| 51 |
return tap_mirror_api_def.ALIAS |
| 52 |
|
| 53 |
@abc.abstractmethod |
| 54 |
def create_tap_mirror(self, context, tap_mirror): |
| 55 |
"""Create a Tap Mirror.""" |
| 56 |
pass |
| 57 |
|
| 58 |
@abc.abstractmethod |
| 59 |
def get_tap_mirror(self, context, id, fields=None): |
| 60 |
"""Get a Tap Mirror.""" |
| 61 |
pass |
| 62 |
|
| 63 |
@abc.abstractmethod |
| 64 |
def get_tap_mirrors(self, context, filters=None, fields=None, |
| 65 |
sorts=None, limit=None, marker=None, |
| 66 |
page_reverse=False): |
| 67 |
"""List all Tap Mirrors.""" |
| 68 |
pass |
| 69 |
|
| 70 |
@abc.abstractmethod |
| 71 |
def delete_tap_mirror(self, context, id): |
| 72 |
"""Delete a Tap Mirror.""" |
| 73 |
pass |
| 74 |
|
| 75 |
@abc.abstractmethod |
| 76 |
def update_tap_mirror(self, context, id, tap_mirror): |
| 77 |
"""Update a Tap Mirror.""" |
| 78 |
pass |