blob: 561891ff28dc142502e3fbbc112692dc932ec45b [file] [log] [blame]
Alex Shatovb9b955c2018-03-08 13:12:23 -05001# ================================================================================
2# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3# ================================================================================
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ============LICENSE_END=========================================================
16#
17# ECOMP is a trademark and service mark of AT&T Intellectual Property.
18
19"""
20contains the base class :CustomizerBase:
21that defines the signatures and default behavior of the methods called by the policy-handler
22
23the methods are expected to be overriden by the child class Cutomizer that is company specific
24
25:do NOT change: this class and/or this file - it is owned by ONAP
26"""
27
28import logging
29
30class CustomizerBase(object):
31 """
32 base class for Customizer class
33
34 do NOT change this class and/or this file - it is owned by ONAP
35
36 policy-hanlder is using the instance of the child Customizer class to get the overriden methods
37
Alex Shatovc9ec2312018-06-14 12:06:42 -040038 the methods defined in this class are the placeholders and are expected
39 to be overriden by the Customizer class
Alex Shatovb9b955c2018-03-08 13:12:23 -050040 """
41
42 def __init__(self):
43 """base class for customization contains the default methods"""
44 self._logger = logging.getLogger("policy_handler.customizer")
45 self._logger.info("created customizer")
46
47 def get_service_url(self, audit, service_name, service):
48 """returns the service url when called from DiscoveryClient"""
49 service_url = "http://{0}:{1}".format(
50 service.get("ServiceAddress", ""), service.get("ServicePort", ""))
51
52 info = "no customization for service_url: {0} on {1}".format(service_url, service_name)
53 self._logger.info(info)
54 audit.info(info)
55 return service_url
56
57 def get_deploy_handler_kwargs(self, audit):
Alex Shatovd7f34d42018-08-07 12:11:35 -040058 """returns the optional dict-kwargs for requests.put to deploy_handler"""
59 info = "no optional kwargs for requests.put to deploy_handler"
Alex Shatovb9b955c2018-03-08 13:12:23 -050060 self._logger.info(info)
61 audit.info(info)
62 kwargs = {}
63 return kwargs