2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 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 * ===================================================================
24 package org.onap.clamp.clds.config;
26 import javax.annotation.PostConstruct;
27 import org.onap.clamp.tosca.Dictionary;
28 import org.onap.clamp.tosca.DictionaryElement;
29 import org.onap.clamp.tosca.DictionaryService;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.context.annotation.Configuration;
32 import org.springframework.context.annotation.Profile;
35 @Profile("default-dictionary-elements")
36 public class DefaultDictionaryElements {
39 private DictionaryService dictionaryService;
46 preProvisionDefaultActors();
47 preProvisionDefaultOperations();
50 private void preProvisionDefaultActors () {
51 // Set up dictionary elements
52 Dictionary actorDictionary = new Dictionary();
53 actorDictionary.setName("DefaultActors");
54 actorDictionary.setSecondLevelDictionary(0);
55 actorDictionary.setSubDictionaryType("");
57 DictionaryElement elementSo = new DictionaryElement();
58 elementSo.setName("SO");
59 elementSo.setShortName("SO");
60 elementSo.setType("string");
61 elementSo.setDescription("SO component");
62 actorDictionary.addDictionaryElements(elementSo);
64 DictionaryElement elementSdnc = new DictionaryElement();
65 elementSdnc.setName("SDNC");
66 elementSdnc.setShortName("SDNC");
67 elementSdnc.setType("string");
68 elementSdnc.setDescription("SDNC component");
69 actorDictionary.addDictionaryElements(elementSdnc);
71 DictionaryElement elementAppc = new DictionaryElement();
72 elementAppc.setName("APPC");
73 elementAppc.setShortName("APPC");
74 elementAppc.setType("string");
75 elementAppc.setDescription("APPC component");
76 actorDictionary.addDictionaryElements(elementAppc);
78 DictionaryElement elementVfc = new DictionaryElement();
79 elementVfc.setName("VFC");
80 elementVfc.setShortName("VFC");
81 elementVfc.setType("string");
82 elementVfc.setDescription("VFC component");
83 actorDictionary.addDictionaryElements(elementVfc);
85 DictionaryElement elementSdnr = new DictionaryElement();
86 elementSdnr.setName("SDNR");
87 elementSdnr.setShortName("SDNR");
88 elementSdnr.setType("string");
89 elementSdnr.setDescription("SDNR component");
90 actorDictionary.addDictionaryElements(elementSdnr);
92 dictionaryService.saveOrUpdateDictionary(actorDictionary);
95 private void preProvisionDefaultOperations () {
96 // Set up dictionary elements
97 Dictionary operationDictionary = new Dictionary();
98 operationDictionary.setName("DefaultOperations");
99 operationDictionary.setSecondLevelDictionary(0);
100 operationDictionary.setSubDictionaryType("");
102 DictionaryElement elementRestart = new DictionaryElement();
103 elementRestart.setName("Restart");
104 elementRestart.setShortName("Restart (APPC operation)");
105 elementRestart.setType("string");
106 elementRestart.setDescription("APPC operation");
107 operationDictionary.addDictionaryElements(elementRestart);
109 DictionaryElement elementRebuild = new DictionaryElement();
110 elementRebuild.setName("Rebuild");
111 elementRebuild.setShortName("Rebuild (APPC operation)");
112 elementRebuild.setType("string");
113 elementRebuild.setDescription("APPC operation");
114 operationDictionary.addDictionaryElements(elementRebuild);
116 DictionaryElement elementMigrate = new DictionaryElement();
117 elementMigrate.setName("Migrate");
118 elementMigrate.setShortName("Migrate (APPC operation)");
119 elementMigrate.setType("string");
120 elementMigrate.setDescription("APPC operation");
121 operationDictionary.addDictionaryElements(elementMigrate);
123 DictionaryElement elementHealthCheck = new DictionaryElement();
124 elementHealthCheck.setName("Health-Check");
125 elementHealthCheck.setShortName("Health-Check (APPC operation)");
126 elementHealthCheck.setType("string");
127 elementHealthCheck.setDescription("APPC operation");
128 operationDictionary.addDictionaryElements(elementHealthCheck);
130 DictionaryElement elementModifyConfig = new DictionaryElement();
131 elementModifyConfig.setName("ModifyConfig");
132 elementModifyConfig.setShortName("ModifyConfig (APPC/VFC operation)");
133 elementModifyConfig.setType("string");
134 elementModifyConfig.setDescription("APPC/VFC operation");
135 operationDictionary.addDictionaryElements(elementModifyConfig);
137 DictionaryElement elementVfModuleCreate = new DictionaryElement();
138 elementVfModuleCreate.setName("VF Module Create");
139 elementVfModuleCreate.setShortName("VF Module Create (SO operation)");
140 elementVfModuleCreate.setType("string");
141 elementVfModuleCreate.setDescription("SO operation");
142 operationDictionary.addDictionaryElements(elementVfModuleCreate);
144 DictionaryElement elementVfModuleDelete = new DictionaryElement();
145 elementVfModuleDelete.setName("VF Module Delete");
146 elementVfModuleDelete.setShortName("VF Module Delete (SO operation)");
147 elementVfModuleDelete.setType("string");
148 elementVfModuleDelete.setDescription("SO operation");
149 operationDictionary.addDictionaryElements(elementVfModuleDelete);
151 DictionaryElement elementReroute = new DictionaryElement();
152 elementReroute.setName("Reroute");
153 elementReroute.setShortName("Reroute (SDNC operation)");
154 elementReroute.setType("string");
155 elementReroute.setDescription("SDNC operation");
156 operationDictionary.addDictionaryElements(elementReroute);
158 DictionaryElement elementBandwidthOnDemand = new DictionaryElement();
159 elementBandwidthOnDemand.setName("BandwidthOnDemand");
160 elementBandwidthOnDemand.setShortName("BandwidthOnDemand (SDNC operation)");
161 elementBandwidthOnDemand.setType("string");
162 elementBandwidthOnDemand.setDescription("SDNC operation");
163 operationDictionary.addDictionaryElements(elementBandwidthOnDemand);
165 dictionaryService.saveOrUpdateDictionary(operationDictionary);