<commit_before># Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import abc

from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper

from networking_vsphere.common import constants

RESOURCE_ATTRIBUTE_MAP = {
    'ovsvapp_mitigated_clusters': {
        'tenant_id': {'allow_post': True, 'allow_put': False,
                      'validate': {'type:string': None},
                      'required_by_policy': True,
                      'is_visible': False},
        'vcenter_id': {'allow_post': True, 'allow_put': True,
                       'is_visible': True, 'default': ''},
        'cluster_id': {'allow_post': True, 'allow_put': True,
                       'is_visible': True, 'default': ''},
        'being_mitigated': {'allow_post': True, 'allow_put': True,
                            'is_visible': True, 'default': False,
                            'convert_to': attr.convert_to_boolean},
        'threshold_reached': {'allow_post': True, 'allow_put': True,
                              'is_visible': True, 'default': False,
                              'convert_to': attr.convert_to_boolean},
    }
}


class Ovsvapp_mitigated_cluster(extensions.ExtensionDescriptor):
    """Extension class supporting mitigation of clusters."""

    @classmethod
    def get_name(cls):
        return "ovsvapp-mitigated-cluster"

    @classmethod
    def get_alias(cls):
        return "ovsvapp-mitigated-cluster"

    @classmethod
    def get_description(cls):
        return "Configure mitigation properties of a Cluster"

    @classmethod
    def get_namespace(cls):
        return "ovsvapp-mitigated-cluster"

    @classmethod<commit_msg>AttributeError: 'module' object has no attribute 'convert_to_boolean'<commit_after># Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import abc

from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import resource_helper

from neutron_lib.api import converters

from networking_vsphere.common import constants

RESOURCE_ATTRIBUTE_MAP = {
    'ovsvapp_mitigated_clusters': {
        'tenant_id': {'allow_post': True, 'allow_put': False,
                      'validate': {'type:string': None},
                      'required_by_policy': True,
                      'is_visible': False},
        'vcenter_id': {'allow_post': True, 'allow_put': True,
                       'is_visible': True, 'default': ''},
        'cluster_id': {'allow_post': True, 'allow_put': True,
                       'is_visible': True, 'default': ''},
        'being_mitigated': {'allow_post': True, 'allow_put': True,
                            'is_visible': True, 'default': False,
                            'convert_to': converters.convert_to_boolean},
        'threshold_reached': {'allow_post': True, 'allow_put': True,
                              'is_visible': True, 'default': False,
                              'convert_to': converters.convert_to_boolean},
    }
}


class Ovsvapp_mitigated_cluster(extensions.ExtensionDescriptor):
    """Extension class supporting mitigation of clusters."""

    @classmethod
    def get_name(cls):
        return "ovsvapp-mitigated-cluster"

    @classmethod
    def get_alias(cls):
        return "ovsvapp-mitigated-cluster"

    @classmethod
    def get_description(cls):
        return "Configure mitigation properties of a Cluster"

    @classmethod
    def get_namespace(cls):
        return "ovsvapp-mitigated-cluster"

    @classmethod
{'fraction_non_alphanumeric': 0.09936842105263158, 'fraction_numerical': 0.004210526315789474, 'mean_word_length': 2.6915306915306916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3953335', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1277, 'n_words': 399}