summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-05-06 13:31:32 +0300
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-05-06 13:31:32 +0300
commit9e8835dd593b382f369308fac3cc1cfc64c0971c (patch)
treef1e2af99695f2cbb91173a0547d991a9cb72652b /vid-app-common/src/main/java/org/onap
parentcaf0ab3707f8177e4b20d1cf735e5e20c2e6ec14 (diff)
VoLTE support
Change-Id: I593b9c92bf9330c2d28f2ccbd59c0651b67fe94a Issue-ID: VID-189 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java38
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controllers/MsoController.java22
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java15
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java10
9 files changed, 111 insertions, 5 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java
index bee92440d..1d0e84952 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java
@@ -12,6 +12,9 @@ public class GetTenantsResponse {
@JsonProperty("cloudRegionID")
public String cloudRegionId;
+ @JsonProperty("cloudOwner")
+ public String cloudOwner;
+
@JsonProperty("tenantName")
public String tenantName;
@@ -24,8 +27,9 @@ public class GetTenantsResponse {
public GetTenantsResponse() {
}
- public GetTenantsResponse(String cloudRegionId, String tenantName, String tenantID, boolean isPermitted) {
+ public GetTenantsResponse(String cloudRegionId, String cloudOwner, String tenantName, String tenantID, boolean isPermitted) {
this.cloudRegionId = cloudRegionId;
+ this.cloudOwner = cloudOwner;
this.tenantName = tenantName;
this.tenantID = tenantID;
this.isPermitted = isPermitted;
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java
index 9f3ae429d..6b2f39eca 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java
@@ -49,6 +49,12 @@ public class Input {
/** The required field. If not set, the default is true */
private boolean required = true;
+ /** Details the inputs template */
+ private String templateName;
+ private String templateUUID;
+ private String templateInvariantUUID;
+ private String templateCustomizationUUID;
+
/**
* Instantiates a new input.
*/
@@ -165,4 +171,36 @@ public class Input {
public String toString() {
return "type=" + type + ",description=" + description + ",default=" + _default;
}
+
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public void setTemplateName(String templateName) {
+ this.templateName = templateName;
+ }
+
+ public String getTemplateUUID() {
+ return templateUUID;
+ }
+
+ public void setTemplateUUID(String templateUUID) {
+ this.templateUUID = templateUUID;
+ }
+
+ public String getTemplateInvariantUUID() {
+ return templateInvariantUUID;
+ }
+
+ public void setTemplateInvariantUUID(String templateInvariantUUID) {
+ this.templateInvariantUUID = templateInvariantUUID;
+ }
+
+ public String getTemplateCustomizationUUID() {
+ return templateCustomizationUUID;
+ }
+
+ public void setTemplateCustomizationUUID(String templateCustomizationUUID) {
+ this.templateCustomizationUUID = templateCustomizationUUID;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java
index f0d056a0f..2200b7988 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/ToscaParserImpl2.java
@@ -8,6 +8,7 @@ import org.onap.sdc.tosca.parser.impl.FilterType;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.tosca.parser.impl.SdcTypes;
import org.onap.sdc.toscaparser.api.*;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.parameters.Input;
import java.nio.file.Path;
@@ -238,7 +239,7 @@ public class ToscaParserImpl2 {
private Map<String, org.onap.vid.asdc.beans.tosca.Input> inputsListToInputsMap(List<org.onap.sdc.toscaparser.api.parameters.Input> inputList) {
Map<String, org.onap.vid.asdc.beans.tosca.Input> inputs = new HashMap<>();
for (org.onap.sdc.toscaparser.api.parameters.Input input : inputList) {
- inputs.put(input.getName(), convertInput(input, new org.onap.vid.asdc.beans.tosca.Input()));
+ inputs.put(input.getName(), convertInput(input, new org.onap.vid.asdc.beans.tosca.Input(), null));
}
return inputs;
}
@@ -297,7 +298,7 @@ public class ToscaParserImpl2 {
for (Input input: inputs){
if(input.getName().equals(key)){
org.onap.vid.asdc.beans.tosca.Input localInput = new org.onap.vid.asdc.beans.tosca.Input();
- localInput = convertInput(input, localInput);
+ localInput = convertInput(input, localInput, nodeTemplate);
String name = property.getKey();
commandPropertyMap.put(name, extractCommands(name, key));
inputMap.put(name, localInput);
@@ -312,13 +313,23 @@ public class ToscaParserImpl2 {
return inputKey.substring(inputKey.indexOf(":") + 1);
}
- private org.onap.vid.asdc.beans.tosca.Input convertInput(Input parserInput, org.onap.vid.asdc.beans.tosca.Input localInput){
+ private org.onap.vid.asdc.beans.tosca.Input convertInput(Input parserInput, org.onap.vid.asdc.beans.tosca.Input localInput, NodeTemplate nodeTemplate){
localInput.setDefault(parserInput.getDefault());
localInput.setDescription(parserInput.getDescription());
localInput.setRequired(parserInput.isRequired());
localInput.setType(parserInput.getType());
localInput.setConstraints(parserInput.getConstraints());
// localInput.setentry_schema()
+
+ //if inputs of inner nodeTemplate - tell its details
+ if(nodeTemplate != null) {
+ Metadata metadata = nodeTemplate.getMetaData();
+ localInput.setTemplateName(metadata.getValue("name"));
+ localInput.setTemplateUUID(metadata.getValue("UUID"));
+ localInput.setTemplateInvariantUUID(metadata.getValue("invariantUUID"));
+ localInput.setTemplateCustomizationUUID(metadata.getValue("customizationUUID"));
+ }
+
return localInput;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controllers/MsoController.java b/vid-app-common/src/main/java/org/onap/vid/controllers/MsoController.java
index 420ae23e5..bbca06e9b 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controllers/MsoController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controllers/MsoController.java
@@ -43,6 +43,7 @@ import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.List;
//import java.util.UUID;
@@ -109,6 +110,27 @@ public class MsoController extends RestrictedBaseController {
return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
}
+
+ /**
+ * Creates the e2e svc instance.
+ *
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)
+ public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> mso_request) throws Exception {
+ String methodName = "createE2eSvcInstance";
+
+ LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ // always return OK, the MSO status code is embedded in the body
+
+ MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(mso_request.get("requestDetails"));
+
+ return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
+
+ }
/**
* Creates the vnf.
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
index 8db7c3c57..f38a7fc6d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
@@ -16,6 +16,8 @@ public interface MsoBusinessLogic {
// this function should get params from tosca and send them to instance at mso, then return success response.
MsoResponseWrapper createSvcInstance(RequestDetails msoRequest) throws Exception;
+ MsoResponseWrapper createE2eSvcInstance(Object msoRequest) throws Exception;
+
MsoResponseWrapper createVnf(RequestDetails requestDetails, String serviceInstanceId) throws Exception;
MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String serviceInstanceId) throws Exception;
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index 95b175aaf..f15c7e5b2 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -82,6 +82,21 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
return msoClientInterface.createSvcInstance(msoRequest, endpoint);
}
+ @Override
+ public MsoResponseWrapper createE2eSvcInstance(Object msoRequest) throws Exception {
+ String methodName = "createE2eSvcInstance ";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ String endpoint;
+ try {
+ endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_E2E_SVC_INSTANCE);
+ } catch (Exception exception) {
+ throw exception;
+ }
+
+ return msoClientInterface.createE2eSvcInstance(msoRequest, endpoint);
+ }
+
void validateLineOfBusiness(RequestDetails requestDetails) {
Object value = requestDetails.getAdditionalProperties();
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
index 2d09630f0..a84775638 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
@@ -17,6 +17,9 @@ public interface MsoInterface {
* @throws Exception
*/
MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) throws Exception;
+
+ //For VoLTE E2E services
+ MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint) throws Exception;
/**
* will create a virtual network function using MSO service.
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
index 584e8581d..f6b3f946e 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
@@ -70,6 +70,9 @@ public class MsoProperties extends SystemProperties {
public static final String MSO_PASSWORD = "mso.password.x";
/** The Constant MSO_REST_API_SVC_INSTANCE. */
+ public static final String MSO_REST_API_E2E_SVC_INSTANCE = "mso.restapi.svc.e2einstance"; // /e2eServiceInstances/v3
+
+ /** The Constant MSO_REST_API_SVC_INSTANCE. */
public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2
/** The Constant MSO_REST_API_VNF_INSTANCE. */
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
index 20f22afa0..c3deec325 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
@@ -33,6 +33,14 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
return createInstance(requestDetails, endpoint);
}
+
+ @Override
+ public MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint) throws Exception {
+ String methodName = "createE2eSvcInstance ";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ return createInstance(requestDetails, endpoint);
+ }
@Override
public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) throws Exception {
@@ -126,7 +134,7 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
}
- public MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception {
+ public MsoResponseWrapper createInstance(Object request, String path) throws Exception {
String methodName = "createInstance";
logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start");