2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
21 package org.openecomp.vid.model;
24 import java.util.UUID;
26 import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
29 * The Class ServiceModel.
31 public class ServiceModel {
34 private Service service;
37 private Map<UUID, VNF> vnfs;
40 private Map<UUID, Network> networks;
43 * Instantiates a new service model.
45 public ServiceModel() {}
52 public Service getService() {
61 public Map<UUID, VNF> getVnfs() {
68 * @return the networks
70 public Map<UUID, Network> getNetworks() {
77 * @param service the new service
79 public void setService(Service service) {
80 this.service = service;
86 * @param vnfs the vnfs
88 public void setVnfs(Map<UUID, VNF> vnfs) {
95 * @param networks the networks
97 public void setNetworks(Map<UUID, Network> networks) {
98 this.networks = networks;
104 * @param serviceToscaModel the service tosca model
105 * @param asdcServiceMetadata the asdc service metadata
106 * @return the service
108 public static Service extractService(ToscaModel serviceToscaModel, org.openecomp.vid.asdc.beans.Service asdcServiceMetadata) {
110 final Service service = new Service();
112 service.setCategory(serviceToscaModel.getMetadata().getCategory());
113 service.setInvariantUuid(serviceToscaModel.getMetadata().getInvariantUUID());
114 service.setName(serviceToscaModel.getMetadata().getName());
115 service.setUuid(serviceToscaModel.getMetadata().getUUID());
116 service.setDescription(serviceToscaModel.getMetadata().getDescription());
117 service.setInputs(serviceToscaModel.gettopology_template().getInputs());
119 //FIXME: ASDC is not sending the Version with the Tosca Model for 1610 - they should send it in 1702
120 //THIS IS A TEMPORARY FIX, AT SOME POINT UNCOMMENT ME
121 //service.setVersion(serviceToscaModel.getMetadata().getVersion());
122 service.setVersion(asdcServiceMetadata.getVersion());