aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/model
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/model')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java120
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java139
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/CommandProperty.java93
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java91
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ExceptionTranslator.java39
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ListOfErrorsResponse.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ModelConstants.java44
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java45
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/MsoExceptionResponse.java32
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Network.java62
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/NewNetwork.java56
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/NewNode.java209
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/NewService.java252
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/NewServiceModel.java288
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/NewVNF.java123
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Node.java322
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/PortMirroringConfig.java77
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ProxyResponse.java30
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/RequestReferencesContainer.java42
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Resource.java28
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Result.java58
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Service.java283
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java139
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java330
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/ServiceProxy.java46
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/SubscriberList.java15
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VNF.java165
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VNFDao.java105
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VersionByInvariantIdsRequest.java11
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VfModule.java308
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VidWorkflow.java83
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VolumeGroup.java196
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Workflow.java47
34 files changed, 3928 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java
new file mode 100644
index 00000000..e2939996
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameter.java
@@ -0,0 +1,120 @@
+package org.onap.vid.model;
+
+//import org.hibernate.annotations.Table;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+import org.onap.vid.controller.MaintenanceController;
+
+//import javax.persistence.*;
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+@Entity
+@Table(name = "vid_category_parameter", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
+public class CategoryParameter extends DomainVo {
+
+ public enum Family {
+ PARAMETER_STANDARDIZATION,
+ TENANT_ISOLATION
+ }
+
+ private String name;
+ private boolean idSupported;
+
+ @Column(name = "FAMILY")
+ @Enumerated(EnumType.STRING)
+ private String family;
+
+ public String getFamily() {
+ return family;
+ }
+
+ public void setFamily(String family) {
+ this.family = family;
+ }
+
+ private Set<CategoryParameterOption> options = new HashSet<>(0);
+
+ @Override
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "CATEGORY_ID")
+ public Long getId() {
+ return super.getId();
+ }
+
+ @Override
+ @Column(name = "CREATED_DATE")
+ public Date getCreated() {
+ return super.getCreated();
+ }
+
+ @Override
+ @Column(name = "MODIFIED_DATE")
+ public Date getModified() {
+ return super.getModified();
+ }
+
+ @Override
+ @Transient
+ public Long getCreatedId() {
+ return super.getCreatedId();
+ }
+
+ @Override
+ @Transient
+ public Long getModifiedId() {
+ return super.getModifiedId();
+ }
+
+ @Column(name = "NAME", unique = true, nullable = false, length=50)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ @Transient
+ public Serializable getAuditUserId() {
+ return super.getAuditUserId();
+ }
+
+ @Override
+ @Transient
+ public Long getRowNum() {
+ return super.getRowNum();
+ }
+
+ @Override
+ @Transient
+ public Set getAuditTrail() {
+ return super.getAuditTrail();
+ }
+
+ @OneToMany(fetch = FetchType.EAGER, mappedBy = "categoryParameter")
+ public Set<CategoryParameterOption> getOptions() {
+ return options;
+ }
+
+ public void setOptions(Set<CategoryParameterOption> options) {
+ this.options = options;
+ }
+
+ public boolean addOption(CategoryParameterOption option) {
+ return options.add(option);
+ }
+
+ @Column(name = "ID_SUPPORTED")
+ public boolean isIdSupported() {
+ return idSupported;
+ }
+
+ public void setIdSupported(boolean idSupported) {
+ this.idSupported = idSupported;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java
new file mode 100644
index 00000000..39efb2c5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java
@@ -0,0 +1,139 @@
+package org.onap.vid.model;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+@Entity
+@Table(name = "vid_category_parameter_option")
+public class CategoryParameterOption extends DomainVo {
+
+ private Long id;
+ private String appId;
+ private String name;
+
+ private CategoryParameter categoryParameter;
+
+ public CategoryParameterOption() {
+ }
+
+ public CategoryParameterOption(String appId, String name, CategoryParameter categoryParameter) {
+ setAppId(appId);
+ setName(name);
+ setCategoryParameter(categoryParameter);
+ }
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "CATEGORY_OPT_DB_ID")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "CATEGORY_OPT_APP_ID")
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
+ @Column(name = "NAME")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManyToOne
+ @JoinColumn(name="CATEGORY_ID", nullable=false)
+ public CategoryParameter getCategoryParameter() {
+ return categoryParameter;
+ }
+
+ public void setCategoryParameter(CategoryParameter categoryParameter) {
+ this.categoryParameter = categoryParameter;
+ }
+
+ @Override
+ @Column(name = "CREATED_DATE")
+ public Date getCreated() {
+ return super.getCreated();
+ }
+
+ @Override
+ @Column(name = "MODIFIED_DATE")
+ public Date getModified() {
+ return super.getModified();
+ }
+
+ @Override
+ @Transient
+ public Long getCreatedId() {
+ return super.getCreatedId();
+ }
+
+ @Override
+ @Transient
+ public Long getModifiedId() {
+ return super.getModifiedId();
+ }
+
+ @Override
+ @Transient
+ public Serializable getAuditUserId() {
+ return super.getAuditUserId();
+ }
+
+ @Override
+ @Transient
+ public Long getRowNum() {
+ return super.getRowNum();
+ }
+
+ @Override
+ @Transient
+ public Set getAuditTrail() {
+ return super.getAuditTrail();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ CategoryParameterOption that = (CategoryParameterOption) o;
+
+ if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) return false;
+ if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
+ return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter()) : that.getCategoryParameter() == null;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getAppId() != null ? getAppId().hashCode() : 0;
+ result = 31 * result + (getName() != null ? getName().hashCode() : 0);
+ result = 31 * result + (getCategoryParameter() != null ? getCategoryParameter().hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "CategoryParameterOption{" +
+ "id=" + id +
+ ", key='" + appId + '\'' +
+ ", value='" + name + '\'' +
+ ", categoryParameterId=" + categoryParameter.getId() +
+ '}';
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/CommandProperty.java b/vid-app-common/src/main/java/org/onap/vid/model/CommandProperty.java
new file mode 100644
index 00000000..4f5ee173
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/CommandProperty.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.util.Map;
+
+/**
+ * The Class Command Property.
+ */
+public class CommandProperty {
+
+ /** The display name for this input */
+ private String displayName;
+
+ /** The command, "get_input" */
+ private String command;
+
+ /** The input name we refer to back under the inputs section */
+ private String inputName;
+
+ /**
+ * Gets the display name.
+ *
+ * @return the displayName
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+ /**
+ * Gets the command.
+ *
+ * @return the command
+ */
+ public String getCommand() {
+ return command;
+ }
+ /**
+ * Gets the inputName.
+ *
+ * @return the inputName
+ */
+ public String getInputName() {
+ return inputName;
+ }
+ /**
+ * Sets the display name value.
+ *
+ * @param i the new get_input value
+ */
+ public void setDisplayName(String i) {
+ this.displayName = i;
+ }
+ /**
+ * Sets the command value.
+ *
+ * @param i the new command value
+ */
+ public void setCommand(String i) {
+ this.command = i;
+ }
+
+ /**
+ * Sets the input name value.
+ *
+ * @param i the new input name value
+ */
+ public void setInputName(String i) {
+ this.inputName=i;
+ }
+
+ public String toString () {
+ String result = "displayName=" + displayName + " command=" + command + " inputName" + inputName;
+ return result;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java b/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java
new file mode 100644
index 00000000..444a4ba1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ExceptionResponse.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import org.slf4j.MDC;
+
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+
+/**
+ * The Class ExceptionResponse.
+ */
+public class ExceptionResponse {
+
+ public ExceptionResponse() {
+ }
+
+ /** The exception. */
+ private String exception;
+
+ /** The message. */
+ private String message;
+
+ public ExceptionResponse(String exception, String message) {
+ this.exception = exception;
+ this.message = message;
+ }
+
+ public ExceptionResponse(Exception exception) {
+ setException(exception);
+ }
+
+ /**
+ * Gets the exception.
+ *
+ * @return the exception
+ */
+ public String getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the exception.
+ *
+ * @param exception the new exception
+ */
+ public void setException(String exception) {
+ this.exception = exception;
+ }
+
+ public void setException(Exception exception) {
+ setException(exception.getClass().toString().replaceFirst("^.*[\\.$]", ""));
+ setMessage(exception.getMessage() + " (Request id: " + MDC.get(MDC_KEY_REQUEST_ID) + ")");
+ }
+
+ /**
+ * Gets the message.
+ *
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the message.
+ *
+ * @param message the new message
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ExceptionTranslator.java b/vid-app-common/src/main/java/org/onap/vid/model/ExceptionTranslator.java
new file mode 100644
index 00000000..c600243a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ExceptionTranslator.java
@@ -0,0 +1,39 @@
+package org.onap.vid.model;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
+
+import static org.onap.vid.utils.Logging.getMethodCallerName;
+
+@ControllerAdvice
+public class ExceptionTranslator {
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExceptionTranslator.class);
+
+ @ExceptionHandler(MethodArgumentTypeMismatchException.class)
+ @ResponseBody
+ public ExceptionResponse handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "{}: {}", getMethodCallerName(), ExceptionUtils.getMessage(e), e);
+ Class<?> type = e.getRequiredType();
+ String message;
+ if (type.isEnum()) {
+ message = "The parameter " + e.getName() + " must have a value among : " + StringUtils.join(type.getEnumConstants(), ", ");
+ }
+ else {
+ message = "The parameter " + e.getName() + " must be of type " + type.getTypeName();
+ }
+ return new ExceptionResponse(new ArgumentTypeMismatchException(message));
+ }
+
+ public static class ArgumentTypeMismatchException extends RuntimeException {
+ public ArgumentTypeMismatchException(String message) {
+ super(message);
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ListOfErrorsResponse.java b/vid-app-common/src/main/java/org/onap/vid/model/ListOfErrorsResponse.java
new file mode 100644
index 00000000..9339d7cd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ListOfErrorsResponse.java
@@ -0,0 +1,24 @@
+package org.onap.vid.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ListOfErrorsResponse {
+ protected List<String> errors;
+
+ public ListOfErrorsResponse() {
+ this.errors = new ArrayList<>();
+ }
+
+ public ListOfErrorsResponse(List<String> errors) {
+ this.errors = errors;
+ }
+
+ public List<String> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<String> errors) {
+ this.errors = errors;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ModelConstants.java b/vid-app-common/src/main/java/org/onap/vid/model/ModelConstants.java
new file mode 100644
index 00000000..cb1a5f9a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ModelConstants.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+/**
+ * The Class ModelConstants
+ */
+public class ModelConstants {
+
+ /** The Constant GET_INPUT_TAG. */
+ public final static String GET_INPUT_TAG = "get_input";
+
+ public static final String ASDC_MODEL_NAMESPACE = "asdc.model.namespace";
+ public static final String ASDC_SVC_API_PATH = "sdc.svc.api.path";
+ public static final String ASDC_RESOURCE_API_PATH = "sdc.resource.api.path";
+
+ public static final String DEFAULT_ASDC_MODEL_NAMESPACE = "org.openecomp.";
+ public static final String DEFAULT_ASDC_SVC_API_PATH = "sdc/v1/catalog/services";
+ public static final String DEFAULT_ASDC_RESOURCE_API_PATH = "sdc/v1/catalog/resources";
+
+ public final static String VF_MODULE = "groups.VfModule";
+ public final static String VNF = "resource.vf";
+ public final static String NETWORK = "resource.vl";
+
+ public final static String ROLE_DELIMITER = "___";
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java b/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java
new file mode 100644
index 00000000..897c6e76
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ModelUtil.java
@@ -0,0 +1,45 @@
+/**
+ *
+ */
+package org.onap.vid.model;
+
+/**
+ * The Class ModelUtil.
+ *
+ */
+public class ModelUtil {
+ /**
+ * Gets the tags for the given element according to the configured namespace
+ * @param namespaces the namespace list from the configuration
+ * @param constantValue the constant portion of the tag name, i.e. resource.vf...
+ * @return the tags
+ */
+ public static String[] getTags ( String[] namespaces, String constantValue ) {
+ String[] tags;
+ if ( namespaces == null || namespaces.length == 0 ) {
+ return null;
+ }
+ int le = namespaces.length;
+ tags = new String[le];
+ for ( int i = 0; i < le; i++ ) {
+ tags[i] = namespaces[i] + constantValue;
+ }
+ return (tags);
+ }
+ /**
+ * Determine if a note template type matches a set of configurable tags
+ * @param type the node template type
+ * @param tags the model configurable namespaces
+ * @return true if type starts with a tag in the array, false otherwise
+ */
+ public static boolean isType ( String type, String[] tags ) {
+ if ( (tags != null) && (tags.length > 0) ) {
+ for ( int i = 0; i < tags.length; i++ ) {
+ if ( type.startsWith (tags[i]) ) {
+ return (true);
+ }
+ }
+ }
+ return (false);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/MsoExceptionResponse.java b/vid-app-common/src/main/java/org/onap/vid/model/MsoExceptionResponse.java
new file mode 100644
index 00000000..0fe49d60
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/MsoExceptionResponse.java
@@ -0,0 +1,32 @@
+package org.onap.vid.model;
+
+public class MsoExceptionResponse {
+
+ public static class ServiceException {
+
+ public ServiceException(String messageId, String text) {
+ this.messageId = messageId;
+ this.text = text;
+ }
+
+ public ServiceException() {
+ }
+
+ public String messageId;
+ public String text;
+ }
+
+ public ServiceException serviceException;
+
+ public MsoExceptionResponse() {
+ }
+
+ public MsoExceptionResponse(String messageId, String text) {
+ this.serviceException = new ServiceException(messageId, text);
+ }
+
+ public MsoExceptionResponse(Exception exception) {
+ ExceptionResponse exceptionResponse = new ExceptionResponse(exception);
+ this.serviceException = new ServiceException(exceptionResponse.getException(), exceptionResponse.getMessage());
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/Network.java
new file mode 100644
index 00000000..ef342e40
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Network.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import org.onap.vid.asdc.beans.tosca.NodeTemplate;
+
+/**
+ * The Class Network.
+ */
+public class Network extends Node {
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /**
+ * Instantiates a new network.
+ */
+ public Network() {
+ super();
+ }
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public void extractNetwork(String modelCustomizationName, NodeTemplate nodeTemplate) {
+
+ super.extractNode(nodeTemplate);
+ setModelCustomizationName(modelCustomizationName);
+
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/NewNetwork.java b/vid-app-common/src/main/java/org/onap/vid/model/NewNetwork.java
new file mode 100644
index 00000000..9f1ffd35
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/NewNetwork.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import org.onap.vid.asdc.beans.tosca.NodeTemplate;
+
+/**
+ * The Class Network.
+ */
+public class NewNetwork extends NewNode {
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /**
+ * Instantiates a new network.
+ */
+ public NewNetwork() {
+ super();
+ }
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/NewNode.java b/vid-app-common/src/main/java/org/onap/vid/model/NewNode.java
new file mode 100644
index 00000000..89a808b1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/NewNode.java
@@ -0,0 +1,209 @@
+package org.onap.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.asdc.beans.tosca.Input;
+
+
+public class NewNode {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(Node.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The model customization uuid. */
+ private String customizationUuid;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /** The get_input or other constructs from node template properties. */
+ private Map<String, CommandProperty> commands;
+
+ /** The get_input or other constructs from node template properties. */
+ private Map<String, String> properties;
+ /**
+ * Instantiates a new node.
+ */
+ public NewNode() {
+ this.commands = new HashMap<String, CommandProperty>();
+ this.properties = new HashMap<String, String>();
+ }
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the model customization uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+ /**
+ * Gets the commands.
+ *
+ * @return the commands
+ */
+ public Map<String, CommandProperty> getCommands() {
+ return commands;
+ }
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param u the new customization uuid
+ */
+ public void setCustomizationUuid(String u) {
+ this.customizationUuid = u;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+ /**
+ * Sets the commands.
+ *
+ * @param m the commands
+ */
+ public void setCommands( Map<String, CommandProperty>m ) {
+ commands = m;
+ }
+ /**
+ * Sets the properties.
+ *
+ * @param p the properties
+ */
+ public void setProperties( Map<String, String>p) {
+ properties = p;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/NewService.java b/vid-app-common/src/main/java/org/onap/vid/model/NewService.java
new file mode 100644
index 00000000..1346c0d9
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/NewService.java
@@ -0,0 +1,252 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.vid.asdc.beans.tosca.Input;
+
+/**
+ * The Class Service.
+ */
+public class NewService {
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The description. */
+ private String description;
+
+ /** The service ecomp naming flag */
+ private String serviceEcompNaming;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+ /**
+ * Get the serviceEcompNaming value
+ *
+ * @return serviceEcompNaming
+ */
+ public String getServiceEcompNaming() {
+ return serviceEcompNaming;
+ }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+ /**
+ * Sets the service ecomp naming.
+ *
+ * @param serviceEcompNaming the new service ecomp naming
+ */
+ public void setServiceEcompNaming(String serviceEcompNaming) {
+ this.serviceEcompNaming = serviceEcompNaming;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof NewService)) return false;
+
+ final NewService service = (NewService) o;
+
+ return (service.getUuid().equals(getUuid()));
+ }
+ /*public static void extractVfModuleCustomizationUUID (Service s, String vnfCustomizationName, VfModule vfMod ) {
+
+ //Look for vnfCustomizationName..vfModuleCustomizationName
+ String nameToFind = vnfCustomizationName + ".." + vfMod.getModelCustomizationName();
+ for (Entry<UUID, VfModule> vfModuleComponent : s.getVfModules().entrySet()) {
+ VfModule xMod = vfModuleComponent.getValue();
+ if ( (xMod.getModelCustomizationName() != null) && (xMod.getModelCustomizationName().equalsIgnoreCase(nameToFind)) ) {
+ vfMod.setCustomizationUuid( xMod.getCustomizationUuid());
+ return;
+ }
+ }
+ }*/
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/NewServiceModel.java b/vid-app-common/src/main/java/org/onap/vid/model/NewServiceModel.java
new file mode 100644
index 00000000..e343b6de
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/NewServiceModel.java
@@ -0,0 +1,288 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.onap.vid.asdc.beans.tosca.Group;
+import org.onap.vid.asdc.beans.tosca.ToscaModel;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.properties.VidProperties;
+/**
+ * The Class ServiceModel.
+ */
+
+public class NewServiceModel {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(NewServiceModel.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+ /** The service. */
+ private Service service;
+
+ /** The vnfs. */
+ private Map<String, VNF> vnfs;
+
+ /** The networks. */
+ private Map<String, Network> networks;
+
+ /**
+ * The vf modules. The VNF also has vfmodules but the vfmodules at the service level may have additional info
+ * that is not present in the VNF, like the vf module customization String
+ */
+ private Map<String, VfModule> vfModules;
+ /**
+ * The volume groups. The VNF also has volume groups but the volume groups will be populated at the service level
+ * for newer models
+ */
+ private Map<String, VolumeGroup> volumeGroups;
+
+ private Map<String, PortMirroringConfig> configurations;
+
+ private Map<String, ServiceProxy> serviceProxies;
+
+ private Map<String, Node> pnfs;
+
+ /**
+ * Instantiates a new service model.
+ */
+ public NewServiceModel() {}
+
+ /**
+ * Gets the service.
+ *
+ * @return the service
+ */
+ public Service getService() {
+ return service;
+ }
+
+ /**
+ * Gets the vnfs.
+ *
+ * @return the vnfs
+ */
+ public Map<String, VNF> getVnfs() {
+ return vnfs;
+ }
+
+ /**
+ * Gets the networks.
+ *
+ * @return the networks
+ */
+ public Map<String, Network> getNetworks() {
+ return networks;
+ }
+
+ /**
+ * Sets the service.
+ *
+ * @param service the new service
+ */
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ /**
+ * Sets the vnfs.
+ *
+ * @param vnfs the vnfs
+ */
+ public void setVnfs(Map<String, VNF> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ /**
+ * Sets the networks.
+ *
+ * @param networks the networks
+ */
+ public void setNetworks(Map<String, Network> networks) {
+ this.networks = networks;
+ }
+ /**
+ * Gets the vf modules.
+ *
+ * @return the vf modules
+ */
+ public Map<String, VfModule> getVfModules() {
+ return vfModules;
+ }
+ /**
+ * Gets the volume groups.
+ *
+ * @return the volume groups
+ */
+ public Map<String, VolumeGroup> getVolumeGroups() {
+ return volumeGroups;
+ }
+
+ public Map<String, PortMirroringConfig> getConfigurations() {
+ return configurations;
+ }
+
+ public Map<String, ServiceProxy> getServiceProxies() {
+ return serviceProxies;
+ }
+
+ /**
+ * Sets the vf modules.
+ *
+ * @param vfModules the vf modules
+ */
+
+
+ public void setVfModules(Map<String, VfModule> vfModules) {
+ this.vfModules = vfModules;
+ }
+ /**
+ * Sets the volume groups.
+ *
+ * @param volumeGroups the volume groups
+ */
+ public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
+ this.volumeGroups = volumeGroups;
+ }
+
+
+ public Map<String, Node> getPnfs() {
+ return pnfs;
+ }
+
+ public void setPnfs(Map<String, Node> pnfs) {
+ this.pnfs = pnfs;
+ }
+
+ /**
+ * Extract service.
+ *
+ * @param serviceToscaModel the service tosca model
+ * @param asdcServiceMetadata the asdc service metadata
+ * @return the service
+ */
+ public static Service extractService(ToscaModel serviceToscaModel, org.onap.vid.asdc.beans.Service asdcServiceMetadata) {
+
+ final Service service = new Service();
+
+ service.setCategory(serviceToscaModel.getMetadata().getCategory());
+ service.setInvariantUuid(serviceToscaModel.getMetadata().getInvariantUUID());
+ service.setName(serviceToscaModel.getMetadata().getName());
+ service.setUuid(serviceToscaModel.getMetadata().getUUID());
+ service.setDescription(serviceToscaModel.getMetadata().getDescription());
+ service.setServiceEcompNaming(serviceToscaModel.getMetadata().getServiceEcompNaming());
+ service.setInputs(serviceToscaModel.gettopology_template().getInputs());
+ //FIXME: SDC is not sending the Version with the Tosca Model for 1610 - they should send it in 1702
+ //THIS IS A TEMPORARY FIX, AT SOME POINT UNCOMMENT ME
+ //service.setVersion(serviceToscaModel.getMetadata().getVersion());
+ service.setVersion(asdcServiceMetadata.getVersion());
+
+ return service;
+ }
+ public static void extractGroups (ToscaModel serviceToscaModel,NewServiceModel serviceModel) {
+ // Get the groups. The groups may duplicate the groups that are in the VNF model and have
+ // additional data like the VF module customization String>
+
+ final Map<String, VfModule> vfModules = new HashMap<String, VfModule> ();
+ final Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup> ();
+
+ String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
+ String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
+
+ for (Entry<String, Group> component : serviceToscaModel.gettopology_template().getGroups().entrySet()) {
+ final Group group = component.getValue();
+ final String type = group.getType();
+ final String customizationName = component.getKey();
+
+ if (type.startsWith(vfModuleTag)) {
+ VfModule vfMod = VfModule.extractVfModule(customizationName, group);
+ vfModules.put(customizationName, vfMod);
+ if ( vfMod.isVolumeGroupAllowed() ) {
+ //volume groups have the same customization name as the vf module
+ volumeGroups.put(customizationName, VolumeGroup.extractVolumeGroup(customizationName,group));
+ }
+ }
+ }
+ // add this point vfModules and volume groups are disconnected from VNF
+ serviceModel.setVfModules (vfModules);
+ serviceModel.setVolumeGroups (volumeGroups);
+
+ }
+ /**
+ * Populate the vf modules and volume groups that we may have under the service level under each VNF.
+ */
+// public void associateGroups() {
+// String methodName = "associateGroups()";
+// LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
+// // go through the vnfs, get the vnf normalized name and look for a vf module with a customization name that starts
+// // with vnf + ".."
+// String vnfCustomizationName = null;
+// String normalizedVnfCustomizationName = null;
+// String vfModuleCustomizationName = null;
+// NewVNF tmpVnf = null;
+//
+// if ( ( getVnfs() != null ) && (!(getVnfs().isEmpty())) ) {
+// for (Entry<String, NewVNF> vnfComponent : getVnfs().entrySet()) {
+// vnfCustomizationName = vnfComponent.getValue().getModelCustomizationName();
+// normalizedVnfCustomizationName = VNF.normalizeName(vnfCustomizationName);
+//
+// LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+// " VNF customizationName=" + vnfCustomizationName + "normalized customization name=" + normalizedVnfCustomizationName);
+//
+// // now check to see if there is a vf module with customization name that starts with normalizedVnfCustomizationName
+//
+// if (( getVfModules() != null ) && (!(getVfModules().isEmpty()))) {
+// for (Entry<String, VfModule> vfModuleComponent : getVfModules().entrySet()) {
+// vfModuleCustomizationName = vfModuleComponent.getValue().getModelCustomizationName();
+//
+// LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+// " VF Module customizationName=" + vfModuleCustomizationName );
+// if ( vfModuleCustomizationName.startsWith(normalizedVnfCustomizationName + ".." )) {
+//
+// // this vf module belongs to the VNF
+// tmpVnf = vnfComponent.getValue();
+// (tmpVnf.getVfModules()).put(vfModuleComponent.getKey(), vfModuleComponent.getValue());
+//
+// LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+// " Associated VF Module customizationName=" + vfModuleComponent.getKey() + " with VNF customization name=" + vnfCustomizationName);
+//
+// // now find if this vf module has volume groups, if so, find the volume group with the same customization name and put it under the VNF
+// if ( vfModuleComponent.getValue().isVolumeGroupAllowed() ) {
+// if (( getVolumeGroups() != null ) && (!(getVolumeGroups().isEmpty()))) {
+// if (getVolumeGroups().containsKey((vfModuleCustomizationName))) {
+// (vnfComponent.getValue().getVolumeGroups()).put(vfModuleCustomizationName, (getVolumeGroups()).get(vfModuleCustomizationName));
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+
+// }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/NewVNF.java b/vid-app-common/src/main/java/org/onap/vid/model/NewVNF.java
new file mode 100644
index 00000000..8e8c89f5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/NewVNF.java
@@ -0,0 +1,123 @@
+package org.onap.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.asdc.beans.tosca.NodeTemplate;
+
+public class NewVNF extends NewNode {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VNF.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The pattern used to normalize VNF names */
+ final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /** The vf modules. */
+ private Map<String, VfModule> vfModules = new HashMap<String, VfModule>();
+
+ /** The volume groups. */
+ private Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup>();
+
+ /**
+ * Instantiates a newvnf.
+ */
+ public NewVNF() {
+ super();
+ }
+
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ /**
+ * Gets the vf modules.
+ *
+ * @return the vf modules
+ */
+ public Map<String, VfModule> getVfModules() {
+ return vfModules;
+ }
+
+ /**
+ * Sets the vf modules.
+ *
+ * @param vfModules the vf modules
+ */
+ public void setVfModules(Map<String, VfModule> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ /**
+ * Gets the volume groups.
+ *
+ * @return the volume groups
+ */
+ public Map<String, VolumeGroup> getVolumeGroups() {
+ return volumeGroups;
+ }
+
+ /**
+ * Sets the volume groups.
+ *
+ * @param volumeGroups the volume groups
+ */
+ public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
+ this.volumeGroups = volumeGroups;
+ }
+
+
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ /**
+ * Normalize the VNF name
+ * @param originalName
+ * @return the normalized name
+ */
+ public static String normalizeName (String originalName) {
+
+ String normalizedName = originalName.toLowerCase();
+ normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
+ String[] splitArr = null;
+
+ try {
+ splitArr = normalizedName.split(" ");
+ }
+ catch (Exception ex ) {
+ return (normalizedName);
+ }
+ StringBuffer sb = new StringBuffer();
+ if ( splitArr != null ) {
+ for (String splitElement : splitArr) {
+ sb.append(splitElement);
+ }
+ return (sb.toString());
+ }
+ else {
+ return (normalizedName);
+ }
+
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Node.java b/vid-app-common/src/main/java/org/onap/vid/model/Node.java
new file mode 100644
index 00000000..7623a386
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Node.java
@@ -0,0 +1,322 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.onap.vid.asdc.beans.tosca.Input;
+import org.onap.vid.asdc.beans.tosca.NodeTemplate;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+/**
+ * The Class Node.
+ */
+public class Node {
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(Node.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The model customization uuid. */
+ private String customizationUuid;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /** The get_input or other constructs from node template properties. */
+ private Map<String, CommandProperty> commands;
+
+ /** The get_input or other constructs from node template properties. */
+ private Map<String, String> properties;
+
+ /** Type from Metadata */
+ private String type;
+ /**
+ * Instantiates a new node.
+ */
+ public Node() {
+ this.commands = new HashMap<String, CommandProperty>();
+ this.properties = new HashMap<String, String>();
+ }
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the model customization uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+ /**
+ * Gets the commands.
+ *
+ * @return the commands
+ */
+ public Map<String, CommandProperty> getCommands() {
+ return commands;
+ }
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param u the new customization uuid
+ */
+ public void setCustomizationUuid(String u) {
+ this.customizationUuid = u;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+ /**
+ * Sets the commands.
+ *
+ * @param m the commands
+ */
+ public void setCommands( Map<String, CommandProperty>m ) {
+ commands = m;
+ }
+ /**
+ * Sets the properties.
+ *
+ * @param p the properties
+ */
+ public void setProperties( Map<String, String>p) {
+ properties = p;
+ }
+
+
+ /**
+ * @return metadata type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Set metadata type
+ *
+ * @param type e.g. VF/CP/SERVICE_PROXY
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Extract node.
+ *
+ * @param modelCustomizationName the model customization name
+ * @param nodeTemplate the node template
+ * @return the node
+ */
+ public void extractNode (NodeTemplate nodeTemplate) {
+
+ String methodName = "extractNode";
+
+ setUuid(nodeTemplate.getMetadata().getUUID());
+ setInvariantUuid(nodeTemplate.getMetadata().getInvariantUUID());
+ setDescription(nodeTemplate.getMetadata().getDescription());
+ setName(nodeTemplate.getMetadata().getName());
+ setVersion(nodeTemplate.getMetadata().getVersion());
+ // add customizationUUID
+ setCustomizationUuid(nodeTemplate.getMetadata().getCustomizationUUID());
+
+ try {
+ // nodeTemplate.getProperties() map of String->Object
+ for (Entry<String, Object> e : nodeTemplate.getProperties().entrySet()) {
+
+ String k = e.getKey();
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " node template property: " + k );
+
+ if ( e.getValue() != null ) {
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " property: " +
+ k + "=" + e.getValue());
+ //LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " V class name: " +
+ // e.getValue().getClass().getName());
+ Class<?> c = e.getValue().getClass();
+ if ( c.getName().equalsIgnoreCase(java.lang.String.class.getName())) {
+ getProperties().put (k, (String)e.getValue());
+ }
+ else {
+ Class<?>[] interfaces = e.getValue().getClass().getInterfaces();
+
+ for(Class<?> ifc: interfaces ) {
+ //LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " ifc name: " +
+ // ifc.getName());
+ if ( ifc.getName().equalsIgnoreCase(java.util.Map.class.getName()) ) {
+ // only extract get_input for now
+ @SuppressWarnings("unchecked")
+ HashMap<String,String> v = (HashMap<String,String>)e.getValue();
+ for (Entry<String, String> entry : v.entrySet()) {
+ // only include get_input for now
+ if ( ModelConstants.GET_INPUT_TAG.equalsIgnoreCase ( entry.getKey() ) ) {
+ CommandProperty cp = new CommandProperty();
+ cp.setCommand(entry.getKey());
+ cp.setInputName(entry.getValue());
+ cp.setDisplayName(k);
+ getCommands().put(k,cp);
+ }
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + " Unable to parse node properties: e=" +
+ e.toString());
+ }
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/PortMirroringConfig.java b/vid-app-common/src/main/java/org/onap/vid/model/PortMirroringConfig.java
new file mode 100644
index 00000000..dd3d5db7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/PortMirroringConfig.java
@@ -0,0 +1,77 @@
+package org.onap.vid.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.toscaparser.api.RequirementAssignments;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+public class PortMirroringConfig extends Node {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(PortMirroringConfig.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /** The port miroring requirements for source/collector */
+ @JsonIgnore
+ private RequirementAssignments requirementAssignments;
+
+ private List<String> sourceNodes;
+
+ private List<String> collectorNodes;
+
+ private boolean configurationByPolicy;
+
+ public PortMirroringConfig() {
+ super();
+ this.configurationByPolicy = false;
+ }
+
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public RequirementAssignments getRequirementAssignments() {
+ return requirementAssignments;
+ }
+
+ public void setRequirementAssignments(RequirementAssignments requirementAssignments) {
+ this.requirementAssignments = requirementAssignments;
+ }
+
+ public List<String> getSourceNodes() {
+ return sourceNodes;
+ }
+
+ public void setSourceNodes(List<String> sourceNodes) {
+ this.sourceNodes = sourceNodes;
+ }
+
+ public List<String> getCollectorNodes() {
+ return collectorNodes;
+ }
+
+ public void setCollectorNodes(List<String> collectorNodes) {
+ this.collectorNodes = collectorNodes;
+ }
+
+ public void setConfigurationByPolicy(boolean configurationByPolicy) {
+ this.configurationByPolicy = configurationByPolicy;
+ }
+
+ public boolean isConfigurationByPolicy() {
+ return configurationByPolicy;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ProxyResponse.java b/vid-app-common/src/main/java/org/onap/vid/model/ProxyResponse.java
new file mode 100644
index 00000000..1931fa39
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ProxyResponse.java
@@ -0,0 +1,30 @@
+package org.onap.vid.model;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Created by Oren on 7/10/17.
+ */
+public class ProxyResponse {
+
+ protected String errorMessage;
+
+ protected int httpCode;
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+
+ public int getHttpCode() {
+ return httpCode;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("httpCode", httpCode)
+ .add("errorMessage", errorMessage)
+ .toString();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/RequestReferencesContainer.java b/vid-app-common/src/main/java/org/onap/vid/model/RequestReferencesContainer.java
new file mode 100644
index 00000000..9c12a52a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/RequestReferencesContainer.java
@@ -0,0 +1,42 @@
+package org.onap.vid.model;
+
+import com.fasterxml.jackson.annotation.*;
+import com.google.common.base.MoreObjects;
+import org.onap.vid.domain.mso.RequestReferences;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class RequestReferencesContainer {
+ private final RequestReferences requestReferences;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public RequestReferencesContainer(@JsonProperty("requestReferences") RequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+ public RequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("requestReferences", requestReferences)
+ .add("additionalProperties", additionalProperties)
+ .toString();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Resource.java b/vid-app-common/src/main/java/org/onap/vid/model/Resource.java
new file mode 100644
index 00000000..184f9ee6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Resource.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+/**
+ * The Class Resource.
+ */
+public class Resource {
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Result.java b/vid-app-common/src/main/java/org/onap/vid/model/Result.java
new file mode 100644
index 00000000..c972bcca
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Result.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+/**
+ * The Class Result.
+ */
+public class Result {
+
+ /** The result. */
+ private String result;
+
+ /**
+ * Instantiates a new result.
+ *
+ * @param result the result
+ */
+ public Result(String result) {
+ this.result = result;
+ }
+
+ /**
+ * Gets the result.
+ *
+ * @return the result
+ */
+ public String getResult() {
+ return result;
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param result the new result
+ */
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Service.java b/vid-app-common/src/main/java/org/onap/vid/model/Service.java
new file mode 100644
index 00000000..b0597c64
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Service.java
@@ -0,0 +1,283 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import org.onap.vid.asdc.beans.tosca.Input;
+
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * The Class Service.
+ */
+public class Service {
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The Service Type. */
+ private String serviceType;
+
+ /** The Service Role */
+ private String serviceRole;
+
+ /** The description. */
+ private String description;
+
+ /** The service ecomp naming flag */
+ private String serviceEcompNaming;
+
+ private String instantiationType;
+
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+ /**
+ * Get the serviceEcompNaming value
+ *
+ * @return serviceEcompNaming
+ */
+ public String getServiceEcompNaming() {
+ return serviceEcompNaming;
+ }
+
+
+ public String getInstantiationType() { return instantiationType; }
+
+ public void setInstantiationType(String instantiationType) { this.instantiationType = instantiationType; }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+ /**
+ * Sets the service ecomp naming.
+ *
+ * @param serviceEcompNaming the new service ecomp naming
+ */
+ public void setServiceEcompNaming(String serviceEcompNaming) {
+ this.serviceEcompNaming = serviceEcompNaming;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Service)) return false;
+
+ final Service service = (Service) o;
+
+ return (service.getUuid().equals(getUuid()));
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ /*public static void extractVfModuleCustomizationUUID (Service s, String vnfCustomizationName, VfModule vfMod ) {
+
+ //Look for vnfCustomizationName..vfModuleCustomizationName
+ String nameToFind = vnfCustomizationName + ".." + vfMod.getModelCustomizationName();
+ for (Entry<UUID, VfModule> vfModuleComponent : s.getVfModules().entrySet()) {
+ VfModule xMod = vfModuleComponent.getValue();
+ if ( (xMod.getModelCustomizationName() != null) && (xMod.getModelCustomizationName().equalsIgnoreCase(nameToFind)) ) {
+ vfMod.setCustomizationUuid( xMod.getCustomizationUuid());
+ return;
+ }
+ }
+ }*/
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java b/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java
new file mode 100644
index 00000000..abf60d68
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ServiceInstanceSearchResult.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+public class ServiceInstanceSearchResult {
+
+ private String serviceInstanceId;
+
+ private String globalCustomerId;
+
+ private String serviceType;
+
+ private String serviceInstanceName;
+
+ private String subscriberName;
+
+ private String aaiModelInvariantId;
+
+ private String aaiModelVersionId;
+
+ private boolean isPermitted;
+
+ public ServiceInstanceSearchResult(){
+
+ }
+ public ServiceInstanceSearchResult(String serviceInstanceId, String globalCustomerId, String serviceType,
+ String serviceInstanceName, String subscriberName, String aaiModelInvariantId,
+ String aaiModelVersionId, boolean isPermitted) {
+ this.serviceInstanceId = serviceInstanceId;
+ this.globalCustomerId = globalCustomerId;
+ this.serviceType = serviceType;
+ this.serviceInstanceName = serviceInstanceName;
+ this.subscriberName = subscriberName;
+ this.aaiModelInvariantId = aaiModelInvariantId;
+ this.aaiModelVersionId = aaiModelVersionId;
+ this.isPermitted = isPermitted;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getGlobalCustomerId() {
+ return globalCustomerId;
+ }
+
+ public void setGlobalCustomerId(String globalCustomerId) {
+ this.globalCustomerId = globalCustomerId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+ public String getAaiModelInvariantId() {
+ return aaiModelInvariantId;
+ }
+
+ public void setAaiModelInvariantId(String aaiModelInvariantId) {
+ this.aaiModelInvariantId = aaiModelInvariantId;
+ }
+
+ public String getAaiModelVersionId() {
+ return aaiModelVersionId;
+ }
+
+ public void setAaiModelVersionId(String aaiModelVersionId) {
+ this.aaiModelVersionId = aaiModelVersionId;
+ }
+
+ public boolean getIsPermitted() {
+ return isPermitted;
+ }
+
+ public void setIsPermitted(boolean isPermitted) {
+ this.isPermitted = isPermitted;
+ }
+
+ @Override
+ public boolean equals(Object other){
+ if (other instanceof ServiceInstanceSearchResult) {
+ ServiceInstanceSearchResult serviceInstanceSearchResultOther = (ServiceInstanceSearchResult) other;
+ if (this.getServiceInstanceId().equals(serviceInstanceSearchResultOther.getServiceInstanceId())) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + serviceInstanceId.hashCode();
+ return result;
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java b/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java
new file mode 100644
index 00000000..dab18d51
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ServiceModel.java
@@ -0,0 +1,330 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.onap.vid.asdc.beans.tosca.Group;
+import org.onap.vid.asdc.beans.tosca.NodeTemplate;
+import org.onap.vid.asdc.beans.tosca.ToscaModel;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.properties.VidProperties;
+/**
+ * The Class ServiceModel.
+ */
+@SuppressWarnings("ALL")
+public class ServiceModel {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ServiceModel.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+ /** The service. */
+ private Service service;
+
+ /** The vnfs. */
+ private Map<String, VNF> vnfs;
+
+ /** The networks. */
+ private Map<String, Network> networks;
+
+ /** Port Mirroring Configuration node templates */
+ private Map<String, PortMirroringConfig> configurations;
+
+ /** Service Proxy Nodes */
+ private Map<String, ServiceProxy> serviceProxies;
+
+ /**
+ * The vf modules. The VNF also has vfmodules but the vfmodules at the service level may have additional info
+ * that is not present in the VNF, like the vf module customization String
+ */
+ private Map<String, VfModule> vfModules;
+ /**
+ * The volume groups. The VNF also has volume groups but the volume groups will be populated at the service level
+ * for newer models
+ */
+ private Map<String, VolumeGroup> volumeGroups;
+
+ /** The pnfs. */
+ private Map<String, Node> pnfs;
+ /**
+ * Instantiates a new service model.
+ */
+ public ServiceModel() {}
+
+ /**
+ * Gets the service.
+ *
+ * @return the service
+ */
+ public Service getService() {
+ return service;
+ }
+
+ /**
+ * Gets the vnfs.
+ *
+ * @return the vnfs
+ */
+ public Map<String, VNF> getVnfs() {
+ return vnfs;
+ }
+
+ /**
+ * Gets the networks.
+ *
+ * @return the networks
+ */
+ public Map<String, Network> getNetworks() {
+ return networks;
+ }
+
+
+ /**
+ * Gets the pnfs.
+ *
+ * @return the pnfs
+ */
+ public Map<String, Node> getPnfs() {
+ return pnfs;
+ }
+
+
+ /**
+ * Gets the Configuration Node Templates
+ *
+ * @return the configuration type node templates
+ */
+ public Map<String, PortMirroringConfig> getConfigurations() {
+ return configurations;
+ }
+
+ /**
+ * Gets the Service Proxy Node Templates
+ *
+ * @return the Service Proxy type node templates
+ */
+ public Map<String, ServiceProxy> getServiceProxies() {
+ return serviceProxies;
+ }
+
+ /**
+ * Sets the service.
+ *
+ * @param service the new service
+ */
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ /**
+ * Sets the vnfs.
+ *
+ * @param vnfs the vnfs
+ */
+ public void setVnfs(Map<String, VNF> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ /**
+ * Sets the networks.
+ *
+ * @param networks the networks
+ */
+ public void setNetworks(Map<String, Network> networks) {
+ this.networks = networks;
+ }
+
+ /**
+ * Sets the configuraion node templates.
+ *
+ * @param configurations
+ */
+ public void setConfigurations(Map<String, PortMirroringConfig> configurations) {
+ this.configurations = configurations;
+ }
+
+ /**
+ * Sets the service proxy node templates.
+ *
+ * @param serviceProxies
+ */
+ public void setServiceProxies(Map<String, ServiceProxy> serviceProxies) {
+ this.serviceProxies = serviceProxies;
+ }
+
+ /**
+ * Gets the vf modules.
+ *
+ * @return the vf modules
+ */
+ public Map<String, VfModule> getVfModules() {
+ return vfModules;
+ }
+
+
+ /**
+ * Gets the volume groups.
+ *
+ * @return the volume groups
+ */
+ public Map<String, VolumeGroup> getVolumeGroups() {
+ return volumeGroups;
+ }
+ /**
+ * Sets the vf modules.
+ *
+ * @param vfModules the vf modules
+ */
+ public void setVfModules(Map<String, VfModule> vfModules) {
+ this.vfModules = vfModules;
+ }
+ /**
+ * Sets the volume groups.
+ *
+ * @param volumeGroups the volume groups
+ */
+ public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
+ this.volumeGroups = volumeGroups;
+ }
+ /**
+ * Sets the pnfs.
+ *
+ * @param pnfs the pnfs
+ */
+ public void setPnfs(Map<String,Node> pnfs) {this.pnfs = pnfs;}
+
+ /**
+ * Extract service.
+ *
+ * @param serviceToscaModel the service tosca model
+ * @param asdcServiceMetadata the asdc service metadata
+ * @return the service
+ */
+ public static Service extractService(ToscaModel serviceToscaModel, org.onap.vid.asdc.beans.Service asdcServiceMetadata) {
+
+ final Service service = new Service();
+
+ service.setCategory(serviceToscaModel.getMetadata().getCategory());
+ service.setInvariantUuid(serviceToscaModel.getMetadata().getInvariantUUID());
+ service.setName(serviceToscaModel.getMetadata().getName());
+ service.setUuid(serviceToscaModel.getMetadata().getUUID());
+ service.setDescription(serviceToscaModel.getMetadata().getDescription());
+ service.setServiceEcompNaming(serviceToscaModel.getMetadata().getServiceEcompNaming());
+ service.setInputs(serviceToscaModel.gettopology_template().getInputs());
+ //FIXME: SDC is not sending the Version with the Tosca Model for 1610 - they should send it in 1702
+ //THIS IS A TEMPORARY FIX, AT SOME POINT UNCOMMENT ME
+ //service.setVersion(serviceToscaModel.getMetadata().getVersion());
+ service.setVersion(asdcServiceMetadata.getVersion());
+
+ return service;
+ }
+ public static void extractGroups (ToscaModel serviceToscaModel,ServiceModel serviceModel) {
+ // Get the groups. The groups may duplicate the groups that are in the VNF model and have
+ // additional data like the VF module customization String>
+
+ final Map<String, VfModule> vfModules = new HashMap<String, VfModule> ();
+ final Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup> ();
+
+ String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
+ String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
+
+ for (Entry<String, Group> component : serviceToscaModel.gettopology_template().getGroups().entrySet()) {
+ final Group group = component.getValue();
+ final String type = group.getType();
+ final String customizationName = component.getKey();
+
+ if (type.startsWith(vfModuleTag)) {
+ VfModule vfMod = VfModule.extractVfModule(customizationName, group);
+ vfModules.put(customizationName, vfMod);
+ if ( vfMod.isVolumeGroupAllowed() ) {
+ //volume groups have the same customization name as the vf module
+ volumeGroups.put(customizationName, VolumeGroup.extractVolumeGroup(customizationName,group));
+ }
+ }
+ }
+ // add this point vfModules and volume groups are disconnected from VNF
+ serviceModel.setVfModules (vfModules);
+ serviceModel.setVolumeGroups (volumeGroups);
+
+ }
+ /**
+ * Populate the vf modules and volume groups that we may have under the service level under each VNF.
+ */
+ public void associateGroups() {
+ String methodName = "associateGroups()";
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
+ // go through the vnfs, get the vnf normalized name and look for a vf module with a customization name that starts
+ // with vnf + ".."
+ String vnfCustomizationName = null;
+ String normalizedVnfCustomizationName = null;
+ String vfModuleCustomizationName = null;
+ VNF tmpVnf = null;
+
+ if ( ( getVnfs() != null ) && (!(getVnfs().isEmpty())) ) {
+ for (Entry<String, VNF> vnfComponent : getVnfs().entrySet()) {
+ vnfCustomizationName = vnfComponent.getValue().getModelCustomizationName();
+ normalizedVnfCustomizationName = VNF.normalizeName(vnfCustomizationName);
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+ " VNF customizationName=" + vnfCustomizationName + "normalized customization name=" + normalizedVnfCustomizationName);
+
+ // now check to see if there is a vf module with customization name that starts with normalizedVnfCustomizationName
+
+ if (( getVfModules() != null ) && (!(getVfModules().isEmpty()))) {
+ for (Entry<String, VfModule> vfModuleComponent : getVfModules().entrySet()) {
+ vfModuleCustomizationName = vfModuleComponent.getValue().getModelCustomizationName();
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+ " VF Module customizationName=" + vfModuleCustomizationName );
+ if ( vfModuleCustomizationName.startsWith(normalizedVnfCustomizationName + ".." )) {
+
+ // this vf module belongs to the VNF
+ tmpVnf = vnfComponent.getValue();
+ (tmpVnf.getVfModules()).put(vfModuleComponent.getKey(), vfModuleComponent.getValue());
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+ " Associated VF Module customizationName=" + vfModuleComponent.getKey() + " with VNF customization name=" + vnfCustomizationName);
+
+ // now find if this vf module has volume groups, if so, find the volume group with the same customization name and put it under the VNF
+ if ( vfModuleComponent.getValue().isVolumeGroupAllowed() ) {
+ if (( getVolumeGroups() != null ) && (!(getVolumeGroups().isEmpty()))) {
+ if (getVolumeGroups().containsKey((vfModuleCustomizationName))) {
+ (vnfComponent.getValue().getVolumeGroups()).put(vfModuleCustomizationName, (getVolumeGroups()).get(vfModuleCustomizationName));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/ServiceProxy.java b/vid-app-common/src/main/java/org/onap/vid/model/ServiceProxy.java
new file mode 100644
index 00000000..f412a1e5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/ServiceProxy.java
@@ -0,0 +1,46 @@
+package org.onap.vid.model;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+public class ServiceProxy extends Node {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ServiceProxy.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ private String sourceModelUuid;
+
+ private String sourceModelInvariant;
+
+ private String sourceModelName;
+
+ public String getSourceModelUuid() {
+ return sourceModelUuid;
+ }
+
+ public void setSourceModelUuid(String sourceModelUuid) {
+ this.sourceModelUuid = sourceModelUuid;
+ }
+
+ public String getSourceModelInvariant() {
+ return sourceModelInvariant;
+ }
+
+ public void setSourceModelInvariant(String sourceModelInvariant) {
+ this.sourceModelInvariant = sourceModelInvariant;
+ }
+
+ public String getSourceModelName() {
+ return sourceModelName;
+ }
+
+ public void setSourceModelName(String sourceModelName) {
+ this.sourceModelName = sourceModelName;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
new file mode 100644
index 00000000..70711b80
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
@@ -0,0 +1,26 @@
+package org.onap.vid.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by Oren on 7/4/17.
+ */
+public class Subscriber {
+
+ @JsonProperty("global-customer-id")
+ public String globalCustomerId;
+
+ @JsonProperty("subscriber-name")
+ public String subscriberName;
+
+ @JsonProperty("subscriber-type")
+ public String subscriberType;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/SubscriberList.java b/vid-app-common/src/main/java/org/onap/vid/model/SubscriberList.java
new file mode 100644
index 00000000..5f935971
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/SubscriberList.java
@@ -0,0 +1,15 @@
+package org.onap.vid.model;
+
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+
+import java.util.List;
+
+/**
+ * Created by Oren on 7/4/17.
+ */
+public class SubscriberList {
+
+ public List<Subscriber> customer;
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VNF.java b/vid-app-common/src/main/java/org/onap/vid/model/VNF.java
new file mode 100644
index 00000000..e558e957
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VNF.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.util.Map;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.onap.vid.asdc.beans.tosca.NodeTemplate;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.controller.VidController;
+
+import org.onap.vid.asdc.beans.tosca.Group;
+import org.onap.vid.asdc.beans.tosca.Input;
+
+/**
+ * The Class VNF.
+ */
+public class VNF extends Node {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VNF.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The pattern used to normalize VNF names */
+ final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /** The vf modules. */
+ private Map<String, VfModule> vfModules = new HashMap<String, VfModule>();
+
+ /** The volume groups. */
+ private Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup>();
+
+ /**
+ * Instantiates a new vnf.
+ */
+ public VNF() {
+ super();
+ }
+
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ /**
+ * Gets the vf modules.
+ *
+ * @return the vf modules
+ */
+ public Map<String, VfModule> getVfModules() {
+ return vfModules;
+ }
+
+ /**
+ * Sets the vf modules.
+ *
+ * @param vfModules the vf modules
+ */
+ public void setVfModules(Map<String, VfModule> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ /**
+ * Gets the volume groups.
+ *
+ * @return the volume groups
+ */
+ public Map<String, VolumeGroup> getVolumeGroups() {
+ return volumeGroups;
+ }
+
+ /**
+ * Sets the volume groups.
+ *
+ * @param volumeGroups the volume groups
+ */
+ public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
+ this.volumeGroups = volumeGroups;
+ }
+
+ /**
+ * Extract vnf.
+ *
+ * @param modelCustomizationName the model customization name
+ * @param nodeTemplate the node template
+ * @return the vnf
+ */
+ public void extractVnf(String modelCustomizationName, NodeTemplate nodeTemplate) {
+
+ super.extractNode(nodeTemplate);
+ setModelCustomizationName(modelCustomizationName);
+
+ }
+
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ /**
+ * Normalize the VNF name
+ * @param originalName
+ * @return the normalized name
+ */
+ public static String normalizeName (String originalName) {
+
+ String normalizedName = originalName.toLowerCase();
+ normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
+ String[] splitArr = null;
+
+ try {
+ splitArr = normalizedName.split(" ");
+ }
+ catch (Exception ex ) {
+ return (normalizedName);
+ }
+ StringBuffer sb = new StringBuffer();
+ if ( splitArr != null ) {
+ for (String splitElement : splitArr) {
+ sb.append(splitElement);
+ }
+ return (sb.toString());
+ }
+ else {
+ return (normalizedName);
+ }
+
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VNFDao.java b/vid-app-common/src/main/java/org/onap/vid/model/VNFDao.java
new file mode 100644
index 00000000..13e2ebb5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VNFDao.java
@@ -0,0 +1,105 @@
+package org.onap.vid.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+@Entity
+@Table(name = "vid_vnf")
+public class VNFDao extends DomainVo {
+
+ private String vnfUUID;
+ private String vnfInvariantUUID;
+ private Set<VidWorkflow> workflows = new HashSet<>(0);
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "VNF_DB_ID")
+ @JsonIgnore
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ @Column(name = "CREATED_DATE")
+ @JsonIgnore
+ public Date getCreated() {
+ return super.getCreated();
+ }
+
+ @Override
+ @Column(name = "MODIFIED_DATE")
+ @JsonIgnore
+ public Date getModified() {
+ return super.getModified();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Long getCreatedId() {
+ return super.getCreatedId();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Long getModifiedId() {
+ return super.getModifiedId();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Serializable getAuditUserId() {
+ return super.getAuditUserId();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Long getRowNum() {
+ return super.getRowNum();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Set getAuditTrail() {
+ return super.getAuditTrail();
+ }
+
+ @Column(name = "VNF_APP_UUID")
+ public String getVnfUUID() {
+ return vnfUUID;
+ }
+
+ @Column(name = "VNF_APP_INVARIANT_UUID")
+ public String getVnfInvariantUUID() {
+ return vnfInvariantUUID;
+ }
+
+
+ public void setVnfUUID(String vnfUUID) {
+ this.vnfUUID = vnfUUID;
+ }
+
+ public void setVnfInvariantUUID(String vnfInvariantUUID) {
+ this.vnfInvariantUUID = vnfInvariantUUID;
+ }
+
+ @ManyToMany(cascade = CascadeType.ALL, fetch =FetchType.EAGER )
+ @JoinTable(name = "vid_vnf_workflow", joinColumns = { @JoinColumn(name = "VNF_DB_ID") }, inverseJoinColumns = { @JoinColumn(name = "WORKFLOW_DB_ID") })
+ public Set<VidWorkflow> getWorkflows() {
+ return workflows;
+ }
+
+ public void setWorkflows(Set<VidWorkflow> workflows) {
+ this.workflows = workflows;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VersionByInvariantIdsRequest.java b/vid-app-common/src/main/java/org/onap/vid/model/VersionByInvariantIdsRequest.java
new file mode 100644
index 00000000..907f4938
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VersionByInvariantIdsRequest.java
@@ -0,0 +1,11 @@
+package org.onap.vid.model;
+
+import java.util.List;
+
+/**
+ * Created by Oren on 9/5/17.
+ */
+public class VersionByInvariantIdsRequest {
+
+ public List<String> versions;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/VfModule.java
new file mode 100644
index 00000000..ac19587e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VfModule.java
@@ -0,0 +1,308 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.onap.vid.asdc.beans.tosca.Group;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**
+ * The Class VfModule.
+ */
+public class VfModule {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VfModule.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The customization uuid. */
+ private String customizationUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The volume group allowed. */
+ private boolean volumeGroupAllowed;
+
+ /** The get_input or other constructs for VF Module. */
+ private Map<String, CommandProperty> commands;
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /**
+ * Instantiates a new vf module.
+ */
+ public VfModule() {
+ commands = new HashMap<String, CommandProperty>();
+ }
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+ /**
+ * Gets the commands.
+ *
+ * @return the commands
+ */
+ public Map<String, CommandProperty> getCommands() {
+ return commands;
+ }
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Checks if is volume group allowed.
+ *
+ * @return true, if is volume group allowed
+ */
+ public boolean isVolumeGroupAllowed() {
+ return volumeGroupAllowed;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param customizationUuid the new customization uuid
+ */
+ public void setCustomizationUuid(String customizationUuid) {
+ this.customizationUuid = customizationUuid;
+ }
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the volume group allowed.
+ *
+ * @param volumeGroupAllowed the new volume group allowed
+ */
+ public void setVolumeGroupAllowed(boolean volumeGroupAllowed) {
+ this.volumeGroupAllowed = volumeGroupAllowed;
+ }
+ /**
+ * Sets the commands.
+ *
+ * @param m the commands
+ */
+ public void setCommands( Map<String, CommandProperty>m ) {
+ commands = m;
+ }
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ /**
+ * Extract vf module.
+ *
+ * @param group the group
+ * @return the vf module
+ */
+ public static VfModule extractVfModule(String modelCustomizationName, Group group) {
+
+ String methodName = "extractVfModule";
+
+ final VfModule vfModule = new VfModule();
+
+ try {
+ vfModule.setUuid(group.getMetadata().getVfModuleModelUUID());
+ vfModule.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
+ vfModule.setDescription(group.getMetadata().getDescription());
+ vfModule.setName(group.getMetadata().getVfModuleModelName());
+ vfModule.setVersion(group.getMetadata().getVfModuleModelVersion());
+ vfModule.setCustomizationUuid(group.getMetadata().getVfModuleModelCustomizationUUID());
+ vfModule.setModelCustomizationName (modelCustomizationName);
+
+ if (group.getProperties().containsKey("volume_group")) {
+ if (group.getProperties().get("volume_group") != null) {
+
+ Class<?> c = group.getProperties().get("volume_group").getClass();
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " class name=" +
+ c.getName());
+
+ if ( c.getName().equalsIgnoreCase(Boolean.class.getName()) ) {
+ Boolean b = (Boolean)group.getProperties().get("volume_group");
+ vfModule.setVolumeGroupAllowed( b.booleanValue() );
+ }
+ }
+ } else {
+ vfModule.setVolumeGroupAllowed(false);
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + " Unable to parse VF Module from group: e=" +
+ e.toString());
+ }
+ /* Not extracting other types of properties for 1702
+ try {
+
+ for (Entry<String, Object> e : group.getProperties().entrySet()) {
+
+ String k = e.getKey();
+ if ( e.getValue() != null ) {
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " property: " +
+ k + "=" + e.getValue());
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " V class name: " +
+ e.getValue().getClass().getName());
+ Class<?>[] interfaces = e.getValue().getClass().getInterfaces();
+
+ for(Class<?> ifc: interfaces ){
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " ifc name: " +
+ ifc.getName());
+ }
+
+ // only extract get_input for now
+ for (Entry<String, String> entry : v.entrySet()) {
+ // only include get_input for now
+ if ( ModelConstants.GET_INPUT_TAG.equalsIgnoreCase ( entry.getKey() ) ) {
+ CommandProperty cp = new CommandProperty();
+ cp.setDisplayName(entry.getValue());
+ cp.setCommand(entry.getKey());
+ cp.setInputName(k);
+ (vfModule.getCommands()).put(k,cp);
+ }
+ }
+ }
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + " Unable to parse VF Module properties: e=" +
+ e.toString());
+ }*/
+ return vfModule;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VidWorkflow.java b/vid-app-common/src/main/java/org/onap/vid/model/VidWorkflow.java
new file mode 100644
index 00000000..985289b4
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VidWorkflow.java
@@ -0,0 +1,83 @@
+package org.onap.vid.model;
+
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+@Entity
+@Table(name = "vid_workflow")
+public class VidWorkflow extends DomainVo {
+
+ private String wokflowName;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "WORKFLOW_DB_ID")
+ @JsonIgnore
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ @Column(name = "CREATED_DATE")
+ @JsonIgnore
+ public Date getCreated() {
+ return super.getCreated();
+ }
+
+ @Override
+ @Column(name = "MODIFIED_DATE")
+ @JsonIgnore
+ public Date getModified() {
+ return super.getModified();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Long getCreatedId() {
+ return super.getCreatedId();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Long getModifiedId() {
+ return super.getModifiedId();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Serializable getAuditUserId() {
+ return super.getAuditUserId();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Long getRowNum() {
+ return super.getRowNum();
+ }
+
+ @Override
+ @Transient
+ @JsonIgnore
+ public Set getAuditTrail() {
+ return super.getAuditTrail();
+ }
+
+ @Column(name = "WORKFLOW_APP_NAME")
+ public String getWokflowName() {
+ return wokflowName;
+ }
+
+ public void setWokflowName(String wokflowName) {
+ this.wokflowName = wokflowName;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VolumeGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/VolumeGroup.java
new file mode 100644
index 00000000..969c287c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/VolumeGroup.java
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 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.vid.model;
+
+import org.onap.vid.asdc.beans.tosca.Group;
+
+/**
+ * The Class VolumeGroup.
+ */
+public class VolumeGroup {
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The customization uuid. */
+ private String customizationUuid;
+
+ /** The customization uuid. */
+ private String modelCustomizationName;
+ /**
+ * Instantiates a new volume group.
+ */
+ public VolumeGroup() {}
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the customization uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the customization name.
+ *
+ * @return the customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param u the new customization uuid
+ */
+ public void setCustomizationUuid(String u) {
+ this.customizationUuid = u;
+
+ }
+ /**
+ * Sets the customization name.
+ *
+ * @param u the new customization name
+ */
+ public void setModelCustomizationName(String u) {
+ this.modelCustomizationName = u;
+
+ }
+ /**
+ * Extract volume group.
+ *
+ * @param group the group
+ * @return the volume group
+ */
+ public static VolumeGroup extractVolumeGroup(String modelCustomizationName, Group group) {
+ final VolumeGroup volumeGroup = new VolumeGroup();
+
+ volumeGroup.setUuid(group.getMetadata().getVfModuleModelUUID());
+ volumeGroup.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
+ volumeGroup.setDescription(group.getMetadata().getDescription());
+ volumeGroup.setName(group.getMetadata().getVfModuleModelName());
+ volumeGroup.setVersion(group.getMetadata().getVfModuleModelVersion());
+ volumeGroup.setCustomizationUuid(group.getMetadata().getVfModuleModelCustomizationUUID());
+ volumeGroup.setModelCustomizationName(modelCustomizationName);
+ return volumeGroup;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Workflow.java b/vid-app-common/src/main/java/org/onap/vid/model/Workflow.java
new file mode 100644
index 00000000..346138dc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Workflow.java
@@ -0,0 +1,47 @@
+package org.onap.vid.model;
+
+
+import java.util.Collection;
+
+public class Workflow {
+ //Private members:
+ private int id;
+ private String workflowName;
+ private Collection<String> vnfNames;
+
+
+ //Constructors:
+ public Workflow() {}
+
+ public Workflow(int id, String workflowName, Collection<String> vnfNames) {
+ this.id = id;
+ this.workflowName = workflowName;
+ this.vnfNames = vnfNames;
+ }
+
+
+ //Setters and getters:
+ public int getId() {
+ return id;
+ }
+
+ public String getWorkflowName() {
+ return workflowName;
+ }
+
+ public Collection<String> getVnfNames() {
+ return this.vnfNames;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setWorkflowName(String workflowName) {
+ this.workflowName = workflowName;
+ }
+
+ public void setVnfName(Collection<String> vnfNames) {
+ this.vnfNames = vnfNames;
+ }
+}