2 # Licensed under the Apache License, Version 2.0 (the "License"); you may
3 # not use this file except in compliance with the License. You may obtain
4 # a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 # License for the specific language governing permissions and limitations
14 # Copyright 2016 RIFT.io Inc
16 from collections
import OrderedDict
18 from rift
.mano
.tosca_translator
.common
.utils
import _
21 KEYS
= (TYPE
, DESCRIPTION
, DEFAULT
, CONSTRAINTS
, HIDDEN
, LABEL
) = \
22 ('type', 'description', 'default', 'constraints', 'hidden', 'label')
25 class ManoParameter(object):
26 '''Attributes for RIFT.io MANO parameter section.'''
28 def __init__(self
, log
, name
, type, label
=None, description
=None,
29 default
=None, hidden
=None, constraints
=None):
34 self
.description
= description
35 self
.default
= default
37 self
.constraints
= constraints
38 log
.info(_('Initialized the input parameters.'))
41 return "%s(%s,%s)" % (self
.name
, self
.type, self
.label
)
43 # TODO(Philip): Harcoding for now, need to make this generic
45 xpath
= '/rw-project:project/project-nsd:nsd-catalog/project-nsd:nsd/nsd:' + self
.name
48 def get_dict_output(self
):
49 param_sections
= OrderedDict()
50 param_sections
[TYPE
] = self
.type
52 param_sections
[LABEL
] = self
.label
54 param_sections
[DESCRIPTION
] = self
.description
56 param_sections
[DEFAULT
] = self
.default
58 param_sections
[HIDDEN
] = self
.hidden
60 param_sections
[CONSTRAINTS
] = self
.constraints
62 return {self
.name
: param_sections
}