update link to upper-constraints.txt
[optf/osdf.git] / osdf / __init__.py
1 # -------------------------------------------------------------------------
2 #   Copyright (c) 2015-2018 AT&T Intellectual Property
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 #
16 # -------------------------------------------------------------------------
17 #
18
19 """Core functions for OSDF Application, including flask app"""
20
21 from jinja2 import Template
22
23 end_point_auth_mapping = {  # map a URL endpoint to auth group
24     "cmscheduler": "CMScheduler",
25     "placement": "Placement",
26     "pci": "PCIOpt",
27     "optmodel": "OptEngine",
28     "optengine": "OptEngine"
29 }
30
31 userid_suffix, passwd_suffix = "Username", "Password"
32 auth_groups = set(end_point_auth_mapping.values())
33
34 ERROR_TEMPLATE = Template("""
35 {
36      "serviceException": {
37         "text": "{{ description }}"
38      }
39 }
40 """)
41
42 ACCEPTED_MESSAGE_TEMPLATE = Template("""
43 {
44    "requestId": "{{ request_id }}",
45    "transactionId": "{{ transaction_id }}",
46    "requestStatus": "{{ request_status }}",
47    "statusMessage": "{{ status_message }}"
48 }
49 """)