d1a23a3c28
Support container based VNF AutoHeal and AutoScale operation with External Monitoring Tools. Add the Fault Management interfaces and CLI to support AutoHeal. Add the Performance Management interfaces and CLI to support AutoScale. The Fault Management and Performance Management interfaces are based on ETSI NFV-SOL 002 v3.3.1 and ETSI NFV-SOL 003 v3.3.1, which are Version "2.0.0" API of Tacker. Add the Prometheus Plugin that has a interface between tacker and Prometheus as a sample of External Monitoring Tool. Implements: blueprint support-auto-lcm Change-Id: Ib74305f0b1da4eb8d996ebae400e75902aaa1321
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
# Copyright (C) 2022 Fujitsu
|
|
# 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 functools
|
|
|
|
from tacker.api.validation import validators
|
|
from tacker.common import exceptions as tacker_ex
|
|
|
|
from tacker.sol_refactored.common import exceptions as sol_ex
|
|
|
|
|
|
class PrometheusPluginSchemaValidator(validators._SchemaValidator):
|
|
def validate(self, *args, **kwargs):
|
|
try:
|
|
super(PrometheusPluginSchemaValidator, self).validate(
|
|
*args, **kwargs)
|
|
except tacker_ex.ValidationError as ex:
|
|
raise sol_ex.PrometheusPluginValidationError(detail=str(ex))
|
|
|
|
|
|
def schema(request_body_schema):
|
|
def add_validator(func):
|
|
@functools.wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
if 'body' not in kwargs:
|
|
raise sol_ex.PrometheusPluginValidationError(
|
|
detail="body is missing.")
|
|
schema_validator = PrometheusPluginSchemaValidator(
|
|
request_body_schema)
|
|
schema_validator.validate(kwargs['body'])
|
|
|
|
return func(*args, **kwargs)
|
|
return wrapper
|
|
return add_validator
|