2 # ============LICENSE_START=======================================================
3 # ORAN SMO PACKAGE - PYTHONSDK TESTS
4 # ================================================================================
5 # Copyright (C) 2021-2022 AT&T Intellectual Property. All rights
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END============================================
20 # ===================================================================
25 from jinja2 import Environment, PackageLoader, select_autoescape, ChoiceLoader
28 def jinja_env() -> Environment:
29 """Create Jinja environment.
31 jinja_env allow to fetch simply jinja templates where they are.
32 by default jinja engine will look for templates in `templates` directory of
33 the package. So to load a template, you just have to do:
36 >>> template = jinja_env().get_template('vendor_create.json.j2')
37 >>> data = template.render(name="vendor")
40 SdcElement.create() for real use
43 Environment: the Jinja environment to use
46 return Environment(autoescape=select_autoescape(['html', 'htm', 'xml']),
48 PackageLoader("oransdk.a1sim"),
49 PackageLoader("oransdk.aai"),
50 PackageLoader("oransdk.dmaap"),
51 PackageLoader("oransdk.enrichmentservice"),
52 PackageLoader("oransdk.policy"),
53 PackageLoader("oransdk.sdc")