1 # ============LICENSE_START=======================================================
3 # ================================================================================
4 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
19 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 Functions for handling inputs
25 class InputsValidationError(RuntimeError):
28 def filter_entries(inputs_map, spec):
29 """Filter inputs entries that are not in the spec"""
30 param_names = [ p["name"] for p in spec["parameters"] \
31 if "sourced_at_deployment" in p and p["sourced_at_deployment"] ]
33 # Identify any missing parameters from inputs_map
34 missing = list(filter(lambda pn: pn not in inputs_map, param_names))
37 raise InputsValidationError(
38 "Inputs map is missing keys: {0}".format(missing))
40 return { pn: inputs_map[pn] for pn in param_names }