"Fossies" - the Fresh Open Source Software Archive

Member "tacker-2.0.0/tacker/tests/unit/extensions/extendedattribute.py" (16 Oct 2019, 1681 Bytes) of package /linux/misc/openstack/tacker-2.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright 2013 VMware, Inc.  All rights reserved.
    2 #
    3 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    4 #    not use this file except in compliance with the License. You may obtain
    5 #    a copy of the License at
    6 #
    7 #         http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 #    Unless required by applicable law or agreed to in writing, software
   10 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   11 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   12 #    License for the specific language governing permissions and limitations
   13 #    under the License.
   14 
   15 from tacker.api import extensions
   16 
   17 EXTENDED_ATTRIBUTE = 'extended_attribute'
   18 EXTENDED_ATTRIBUTES_2_0 = {
   19     'ext_test_resources': {
   20         EXTENDED_ATTRIBUTE: {'allow_post': True, 'allow_put': False,
   21                              'validate': {'type:uuid_or_none': None},
   22                              'default': None, 'is_visible': True},
   23     }
   24 }
   25 
   26 
   27 class Extendedattribute(extensions.ExtensionDescriptor):
   28     """Extension class supporting extended attribute for router."""
   29 
   30     @classmethod
   31     def get_name(cls):
   32         return "Extended Extension Attributes"
   33 
   34     @classmethod
   35     def get_alias(cls):
   36         return "extended-ext-attr"
   37 
   38     @classmethod
   39     def get_description(cls):
   40         return "Provides extended_attr attribute to router"
   41 
   42     @classmethod
   43     def get_namespace(cls):
   44         return ""
   45 
   46     @classmethod
   47     def get_updated(cls):
   48         return "2013-02-05T00:00:00-00:00"
   49 
   50     def get_extended_resources(self, version):
   51         if version == "2.0":
   52             return EXTENDED_ATTRIBUTES_2_0
   53         else:
   54             return {}