diff options
Diffstat (limited to 'src/main')
3 files changed, 132 insertions, 16 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java new file mode 100644 index 000000000..b383c18bf --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryCache.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.model.dcae; + +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.ConcurrentHashMap; + +/** + * This class stores the multiple DcaeInventoryResponse coming back from DCAE. + * The structure is a map of list indexed by asdcServiceId. The list is sorted + * by asdcResourceId. Therefore it's possible to retrieve all the loops defined + * in the DCAE inventory and created by DCAE Mod. + */ +public class DcaeInventoryCache { + + private Map<String, Set<DcaeInventoryResponse>> blueprintsMap = new ConcurrentHashMap<>(); + + public void addDcaeInventoryResponse(DcaeInventoryResponse inventoryResponse) { + Set<DcaeInventoryResponse> responsesSet = blueprintsMap.get(inventoryResponse.getAsdcServiceId()); + if (responsesSet == null) { + responsesSet = new TreeSet<DcaeInventoryResponse>(); + blueprintsMap.put(inventoryResponse.getAsdcServiceId(), responsesSet); + } + responsesSet.add(inventoryResponse); + } + + public Set<String> getAllLoopIds() { + return this.blueprintsMap.keySet(); + } + + public Set<DcaeInventoryResponse> getAllBlueprintsPerLoopId(String loopId) { + return blueprintsMap.getOrDefault(loopId, new TreeSet<>()); + } +} diff --git a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java index 972450665..bdf6e70f5 100644 --- a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java +++ b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java @@ -3,7 +3,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights + * Copyright (C) 2019 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,7 +29,7 @@ import com.google.gson.annotations.Expose; /** * This class maps the DCAE inventory answer to a nice pojo. */ -public class DcaeInventoryResponse { +public class DcaeInventoryResponse implements Comparable<DcaeInventoryResponse> { @Expose private String typeName; @@ -37,6 +37,25 @@ public class DcaeInventoryResponse { @Expose private String typeId; + @Expose + private String blueprintTemplate; + + /** + * This field will be used to know all blueprints associated a loop. + */ + @Expose + private String asdcServiceId; + + /** + * This field will be used to know to order of each blueprint microservice in a + * loop. + */ + @Expose + private String asdcResourceId; + + @Expose + private String selfLink; + public String getTypeName() { return typeName; } @@ -52,4 +71,43 @@ public class DcaeInventoryResponse { public void setTypeId(String typeId) { this.typeId = typeId; } + + public String getBlueprintTemplate() { + return blueprintTemplate; + } + + public void setBlueprintTemplate(String blueprintTemplate) { + this.blueprintTemplate = blueprintTemplate; + } + + public String getAsdcServiceId() { + return asdcServiceId; + } + + public void setAsdcServiceId(String asdcServiceId) { + this.asdcServiceId = asdcServiceId; + } + + public String getAsdcResourceId() { + return asdcResourceId; + } + + public void setAsdcResourceId(String asdcResourceId) { + this.asdcResourceId = asdcResourceId; + } + + public String getSelfLink() { + return selfLink; + } + + public void setSelfLink(String selfLink) { + this.selfLink = selfLink; + } + + @Override + public int compareTo(DcaeInventoryResponse otherResponse) { + int thisResourceId = Integer.parseInt(this.asdcResourceId); + int otherResourceId = Integer.parseInt(otherResponse.getAsdcResourceId()); + return (thisResourceId < otherResourceId ? -1 : (thisResourceId > otherResourceId ? 1 : 0)); + } } diff --git a/src/main/resources/boot-message.txt b/src/main/resources/boot-message.txt index 46b0a6faa..a1c646f53 100644 --- a/src/main/resources/boot-message.txt +++ b/src/main/resources/boot-message.txt @@ -1,15 +1,16 @@ - - - ▐ ▄ ▄▄▄· ▄▄▄· ▄▄▄ .▄▄▌ ▄▄▄· ▄▄▌ ▄▄▄▄▄ -▪ •█▌▐█▐█ ▀█ ▐█ ▄█ ▀▄.▀·██• ▐█ ▀█ ██• •██ ▪ - ▄█▀▄ ▐█▐▐▌▄█▀▀█ ██▀· ▐▀▀▪▄██▪ ▄█▀▀█ ██▪ ▐█.▪ ▄█▀▄ -▐█▌.▐▌██▐█▌▐█ ▪▐▌▐█▪·• ▐█▄▄▌▐█▌▐▌ ▐█ ▪▐▌▐█▌▐▌▐█▌·▐█▌.▐▌ - ▀█▄▀▪▀▀ █▪ ▀ ▀ .▀ ▀▀▀ .▀▀▀ ▀ ▀ .▀▀▀ ▀▀▀ ▀█▄▀▪ - ▄▄· ▄▄▌ ▄▄▄· • ▌ ▄ ·. ▄▄▄· - ▐█ ▌▪██• ▐█ ▀█ ·██ ▐███▪▐█ ▄█ - ██ ▄▄██▪ ▄█▀▀█ ▐█ ▌▐▌▐█· ██▀· - ▐███▌▐█▌▐▌▐█ ▪▐▌██ ██▌▐█▌▐█▪·• - ·▀▀▀ .▀▀▀ ▀ ▀ ▀▀ █▪▀▀▀.▀ - - :: Starting ::
\ No newline at end of file + ___ ____ ____ ____ _____ ____ ____ ____ __ _ _____ __ __ ____ ______ + / \ | \ / T| \ | || \ / T| \ | l/ ]| || T T| \| T +Y Y| _ YY o || o ) | __j| D )Y o || _ Y| ' / | __j| | || D ) | +| O || | || || _/ | l_ | / | || | || \ | l_ | | || /l_j l_j +| || | || _ || | | _] | \ | _ || | || Y| _] | : || \ | | +l !| | || | || | | T | . Y| | || | || . || T l || . Y | | + \___/ l__j__jl__j__jl__j l__j l__j\_jl__j__jl__j__jl__j\_jl__j \__,_jl__j\_j l__j + __ _ ____ ___ ___ ____ + / ]| T / T| T T| \ + / / | | Y o || _ _ || o ) + / / | l___ | || \_/ || _/ + / \_ | T| _ || | || | + \ || || | || | || | + \____jl_____jl__j__jl___j___jl__j + :: Starting ::
\ No newline at end of file |