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 static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createInputValue;
26 import java.util.LinkedHashMap;
27 import java.util.TreeMap;
29 import lombok.AllArgsConstructor;
30 import lombok.Builder;
32 import lombok.NoArgsConstructor;
35 //TODO: Auto-generated Javadoc
37 * @see java.lang.Object#toString()
42 * @see java.lang.Object#toString()
47 * Instantiates a new resource config obj.
52 * Instantiates a new resource config obj.
54 * @param limits the limits
55 * @param requests the requests
59 public class ResourceConfig {
62 private TreeMap<String, GetInput> limits;
65 private TreeMap<String, GetInput> requests;
69 * Creates the resource config.
71 * @param inps the inps
72 * @param name the name
73 * @return the tree map
75 public TreeMap<String, LinkedHashMap<String, Object>> createResourceConfig(TreeMap<String, LinkedHashMap<String, Object>> inps, String name){
77 LinkedHashMap<String, Object> memoryLimit = createInputValue("string", "", "128Mi");
78 LinkedHashMap<String, Object> cpuLimit = createInputValue("string", "", "250m");
80 if(!name.equals("")) {
85 TreeMap<String, GetInput> limits = new TreeMap<>();
87 GetInput cpu = new GetInput();
88 cpu.setBpInputName(name + "cpu_limit");
89 limits.put("cpu", cpu);
91 GetInput memL = new GetInput();
92 memL.setBpInputName(name + "memory_limit");
93 limits.put("memory", memL);
95 inps.put(name + "cpu_limit", cpuLimit);
96 inps.put(name + "memory_limit", memoryLimit);
98 this.setLimits(limits);
101 TreeMap<String, GetInput> requests = new TreeMap<>();
103 GetInput cpuR = new GetInput();
104 cpuR.setBpInputName(name + "cpu_request");
105 requests.put("cpu", cpuR);
107 GetInput memR = new GetInput();
108 memR.setBpInputName(name + "memory_request");
109 requests.put("memory", memR);
111 inps.put(name + "cpu_request", cpuLimit);
112 inps.put(name + "memory_request", memoryLimit);
114 this.setRequests(requests);