1 /*============LICENSE_START=======================================================
3 ================================================================================
4 Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
5 Copyright (c) 2020 Nokia. All rights reserved.
6 ================================================================================
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ============LICENSE_END=========================================================
22 package org.onap.blueprintgenerator.models.blueprint;
24 import java.util.LinkedHashMap;
25 import java.util.TreeMap;
27 import lombok.AllArgsConstructor;
28 import lombok.Builder;
30 import lombok.NoArgsConstructor;
33 //TODO: Auto-generated Javadoc
35 * @see java.lang.Object#toString()
40 * @see java.lang.Object#toString()
45 * Instantiates a new resource config obj.
50 * Instantiates a new resource config obj.
52 * @param limits the limits
53 * @param requests the requests
57 public class ResourceConfig {
60 private TreeMap<String, GetInput> limits;
63 private TreeMap<String, GetInput> requests;
67 * Creates the resource config.
69 * @param inps the inps
70 * @param name the name
71 * @return the tree map
73 public TreeMap<String, LinkedHashMap<String, Object>> createResourceConfig(TreeMap<String, LinkedHashMap<String, Object>> inps, String name){
75 LinkedHashMap<String, Object> mi = new LinkedHashMap<>();
76 mi.put("type", "string");
77 mi.put("default", "128Mi");
79 LinkedHashMap<String, Object> m = new LinkedHashMap<>();
80 m.put("type", "string");
81 m.put("default", "250m");
84 if(!name.equals("")) {
89 TreeMap<String, GetInput> lim = new TreeMap<>();
91 GetInput cpu = new GetInput();
92 cpu.setBpInputName(name + "cpu_limit");
95 GetInput memL = new GetInput();
96 memL.setBpInputName(name + "memory_limit");
97 lim.put("memory", memL);
99 inps.put(name + "cpu_limit", m);
100 inps.put(name + "memory_limit", mi);
105 TreeMap<String, GetInput> req = new TreeMap<>();
107 GetInput cpuR = new GetInput();
108 cpuR.setBpInputName(name + "cpu_request");
109 req.put("cpu", cpuR);
111 GetInput memR = new GetInput();
112 memR.setBpInputName(name + "memory_request");
113 req.put("memory", memR);
115 inps.put(name + "cpu_request", m);
116 inps.put(name + "memory_request", mi);
118 this.setRequests(req);