aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java4
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java12
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java12
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java14
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java94
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetIp.java23
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetPool.java1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java64
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java3
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java45
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java2
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/Results.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java14
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/pom.xml4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncOperationTaskYangToolsImpl.java68
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java80
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkTopologyRequestBodyBuilder.java147
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java3
-rw-r--r--bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java4
-rw-r--r--common/pom.xml4
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/base/DataBrokerTestCustomizer.java141
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/base/MockSchemaService.java62
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlBase.java107
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlOSGIBase.java36
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/ITransformJava2StringService.java47
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/NormalizedNodeVisitor.java26
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/JsonParserStream.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodeNavigator.java111
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodePrinter.java113
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NotificationAsContainer.java149
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java90
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonServiceImpl.java113
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java92
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLServiceImpl.java134
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransfromJava2StringFactory.java75
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/XmlNormalizedNodeBodyReaderUmeImpl.java44
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformJava2NNServiceImpl.java164
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2JsonServiceImpl.java70
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2XMLServiceImpl.java273
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNN2XMLImpl.java126
-rw-r--r--common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNNC2XMLImpl.java84
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java17
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java6
-rw-r--r--packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json5
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final6
-rw-r--r--packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whlbin0 -> 7382 bytes
64 files changed, 304 insertions, 2514 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
index 6d3f8f7b1c..f51cb0dd64 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
@@ -55,7 +55,7 @@ public class MapDeserializer extends JsonDeserializer<Map<String, String>> {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(parser);
- Map<String, String> map = new LinkedHashMap<String, String>();
+ Map<String, String> map = new LinkedHashMap<>();
Iterator<JsonNode> iterator = tree.iterator();
while (iterator.hasNext()) {
@@ -71,4 +71,4 @@ public class MapDeserializer extends JsonDeserializer<Map<String, String>> {
return map;
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java
index 1db69f41ab..c2ea8242c3 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java
@@ -53,8 +53,9 @@ public class MapSerializer extends JsonSerializer<Map<String, String>> {
jsonGenerator.writeStartObject();
jsonGenerator.writeArrayFieldStart("entry");
- for (String key : map.keySet()) {
- String value = map.get(key);
+ for (Map.Entry<String,String> entry : map.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("key", key);
jsonGenerator.writeStringField("value", value);
@@ -64,4 +65,4 @@ public class MapSerializer extends JsonSerializer<Map<String, String>> {
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
index 9f709140ec..a1bc08599b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
@@ -40,7 +40,7 @@ public abstract class CatalogQueryExceptionCommon {
public String toJsonString() {
try {
- String jsonString = null;
+ String jsonString;
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index 75262e3597..9a82ed2c6e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -54,7 +54,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<AllottedResourceCustomization>(); }
+ public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<>(); }
public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) { allottedResourceCustomization = vlist; }
public List<AllottedResourceCustomization> getServiceAllottedResources(){ return this.allottedResourceCustomization; }
@@ -62,7 +62,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -76,10 +76,10 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (!isEmbed && isArray) buf.append("{ ");
if (isArray) buf.append("\"serviceAllottedResources\": [");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -114,4 +114,4 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index 0e2aa714f6..e5147671f3 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -60,8 +60,8 @@ public class QueryServiceMacroHolder extends CatalogQuery {
Service service = serviceMacroHolder.getService();
if (service == null) return "\"serviceResources\": null";
- StringBuffer buf = new StringBuffer();
- Map<String, String> valueMap = new HashMap<String, String>();
+ StringBuilder buf = new StringBuilder();
+ Map<String, String> valueMap = new HashMap<>();
put(valueMap, "SERVICE_MODEL_NAME", service.getModelName()); //getServiceModelName());
put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID()); //getServiceModelUuid());
@@ -84,4 +84,4 @@ public class QueryServiceMacroHolder extends CatalogQuery {
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 42b6b651ef..59c601ef19 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -51,10 +51,10 @@ public class QueryServiceNetworks extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<NetworkResourceCustomization>(); }
+ public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<>(); }
public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) {
LOGGER.debug ("QueryServiceNetworks:");
- serviceNetworks = new ArrayList<NetworkResourceCustomization>();
+ serviceNetworks = new ArrayList<>();
for (NetworkResourceCustomization o : vlist) {
LOGGER.debug (o.toString());
serviceNetworks.add(o);
@@ -67,7 +67,7 @@ public class QueryServiceNetworks extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -81,11 +81,11 @@ public class QueryServiceNetworks extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (!isEmbed && isArray) buf.append("{ ");
if (isArray) buf.append("\"serviceNetworks\": [");
//if (isArray) buf.append("[");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -112,4 +112,4 @@ public class QueryServiceNetworks extends CatalogQuery {
if (!isEmbed && isArray) buf.append("}");
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index ee3c86ab94..cfbb781ae8 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -55,10 +55,10 @@ public class QueryServiceVnfs extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<VnfResourceCustomization>(); }
+ public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<>(); }
public QueryServiceVnfs(List<VnfResourceCustomization> vlist) {
LOGGER.debug ("QueryServiceVnfs:");
- serviceVnfs = new ArrayList<VnfResourceCustomization>();
+ serviceVnfs = new ArrayList<>();
for (VnfResourceCustomization o : vlist) {
LOGGER.debug ("-- o is a serviceVnfs ----");
LOGGER.debug (o.toString());
@@ -72,7 +72,7 @@ public class QueryServiceVnfs extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -86,10 +86,10 @@ public class QueryServiceVnfs extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (!isEmbed && isArray) buf.append("{ ");
if (isArray) buf.append("\"serviceVnfs\": [");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -121,4 +121,4 @@ public class QueryServiceVnfs extends CatalogQuery {
if (!isEmbed && isArray) buf.append("}");
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
index 4675858936..309aa0641a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -50,10 +50,10 @@ public class QueryVfModule extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryVfModule() { super(); vfModules = new ArrayList<VfModuleCustomization>(); }
+ public QueryVfModule() { super(); vfModules = new ArrayList<>(); }
public QueryVfModule(List<VfModuleCustomization> vlist) {
LOGGER.debug ("QueryVfModule:");
- vfModules = new ArrayList<VfModuleCustomization>();
+ vfModules = new ArrayList<>();
if (vlist != null) {
for (VfModuleCustomization o : vlist) {
LOGGER.debug ("-- o is a vfModules ----");
@@ -69,7 +69,7 @@ public class QueryVfModule extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -83,9 +83,9 @@ public class QueryVfModule extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean x) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (isArray) buf.append("\"vfModules\": [");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -95,7 +95,7 @@ public class QueryVfModule extends CatalogQuery {
boolean vfNull = o.getVfModule() == null ? true : false;
boolean hasVolumeGroup = false;
String envt = o.getHeatEnvironmentArtifactUuid();
- if (envt != null && !envt.equals("")) {
+ if (envt != null && !"".equals(envt)) {
hasVolumeGroup = true;
}
@@ -116,4 +116,4 @@ public class QueryVfModule extends CatalogQuery {
if (isArray) buf.append("]");
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java
index b755cad220..ec523b87d9 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java
@@ -34,22 +34,22 @@ import org.openecomp.mso.openstack.beans.Subnet;
import static org.openecomp.mso.openstack.utils.MsoCommonUtils.isNullOrEmpty;
public class ContrailSubnet {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
@JsonProperty("network_ipam_refs_data_ipam_subnets_subnet")
private ContrailSubnetIp subnet = new ContrailSubnetIp();
@JsonProperty("network_ipam_refs_data_ipam_subnets_default_gateway")
- private String default_gateway;
+ private String defaultGateway;
@JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_name")
- private String subnet_name;
+ private String subnetName;
@JsonProperty("network_ipam_refs_data_ipam_subnets_enable_dhcp")
- private Boolean enable_dhcp;
+ private Boolean enableDhcp;
@JsonProperty("network_ipam_refs_data_ipam_subnets_addr_from_start")
- private Boolean addr_from_start = true;
+ private Boolean addrFromStart = true;
/** future - leave this commented
private String subnet_uuid;
@@ -60,18 +60,18 @@ public class ContrailSubnet {
**/
@JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools")
- private List<ContrailSubnetPool> allocation_pools = new ArrayList <> ();
+ private List<ContrailSubnetPool> allocationPools = new ArrayList <> ();
public ContrailSubnet() {
super();
}
- public String getDefault_gateway() {
- return default_gateway;
+ public String getDefaultGateway() {
+ return defaultGateway;
}
- public void setDefault_gateway(String default_gateway) {
- this.default_gateway = default_gateway;
+ public void setDefaultGateway(String defaultGateway) {
+ this.defaultGateway = defaultGateway;
}
public ContrailSubnetIp getSubnet() {
@@ -82,36 +82,36 @@ public class ContrailSubnet {
this.subnet = subnet;
}
- public Boolean isEnable_dhcp() {
- return enable_dhcp;
+ public Boolean isEnableDhcp() {
+ return enableDhcp;
}
- public void setEnable_dhcp(Boolean enable_dhcp) {
- this.enable_dhcp = enable_dhcp;
+ public void setEnableDhcp(Boolean enableDhcp) {
+ this.enableDhcp = enableDhcp;
}
- public String getSubnet_name() {
- return subnet_name;
+ public String getSubnetName() {
+ return subnetName;
}
- public void setSubnet_name(String subnet_name) {
- this.subnet_name = subnet_name;
+ public void setSubnetName(String subnetName) {
+ this.subnetName = subnetName;
}
- public List<ContrailSubnetPool> getAllocation_pools() {
- return allocation_pools;
+ public List<ContrailSubnetPool> getAllocationPools() {
+ return allocationPools;
}
- public void setPools(List<ContrailSubnetPool> allocation_pools) {
- this.allocation_pools = allocation_pools;
+ public void setPools(List<ContrailSubnetPool> allocationPools) {
+ this.allocationPools = allocationPools;
}
- public Boolean isAddr_from_start() {
- return addr_from_start;
+ public Boolean isAddrFromStart() {
+ return addrFromStart;
}
- public void setAddr_from_start(Boolean addr_from_start) {
- this.addr_from_start = addr_from_start;
+ public void setAddrFromStart(Boolean addrFromStart) {
+ this.addrFromStart = addrFromStart;
}
public JsonNode toJsonNode()
@@ -124,8 +124,8 @@ public class ContrailSubnet {
}
catch (Exception e)
{
- String error = "Error creating JsonNode for Contrail Subnet:" + subnet_name;
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonNode for Contrail Subnet", e);
+ String error = "Error creating JsonNode for Contrail Subnet:" + subnetName;
+ logger.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonNode for Contrail Subnet", e);
}
return node;
@@ -141,41 +141,41 @@ public class ContrailSubnet {
}
catch (Exception e)
{
- String error = "Error creating JsonString for Contrail Subnet:" + subnet_name;
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Subnet", e);
+ String error = "Error creating JsonString for Contrail Subnet:" + subnetName;
+ logger.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Subnet", e);
}
return jsonString;
}
//poulate contrail subnet with input(from bopel) subnet
- public void populateWith(Subnet i_subnet)
+ public void populateWith(Subnet inputSubnet)
{
- if (i_subnet != null)
+ if (inputSubnet != null)
{
- if (!isNullOrEmpty(i_subnet.getSubnetName()))
- subnet_name = i_subnet.getSubnetName();
+ if (!isNullOrEmpty(inputSubnet.getSubnetName()))
+ subnetName = inputSubnet.getSubnetName();
else
- subnet_name = i_subnet.getSubnetId();
- enable_dhcp = i_subnet.getEnableDHCP();
- default_gateway = i_subnet.getGatewayIp();
- if (!isNullOrEmpty(i_subnet.getCidr()) )
+ subnetName = inputSubnet.getSubnetId();
+ enableDhcp = inputSubnet.getEnableDHCP();
+ defaultGateway = inputSubnet.getGatewayIp();
+ if (!isNullOrEmpty(inputSubnet.getCidr()) )
{
- int idx = i_subnet.getCidr().indexOf("/");
+ int idx = inputSubnet.getCidr().indexOf("/");
if (idx != -1)
{
- subnet.setIp_prefix(i_subnet.getCidr().substring(0, idx));
- subnet.setIp_prefix_len(i_subnet.getCidr().substring(idx+1));
+ subnet.setIpPrefix(inputSubnet.getCidr().substring(0, idx));
+ subnet.setIpPrefixLen(inputSubnet.getCidr().substring(idx+1));
}
}
- if (i_subnet.getAllocationPools() != null)
+ if (inputSubnet.getAllocationPools() != null)
{
- for (Pool pool : i_subnet.getAllocationPools())
+ for (Pool pool : inputSubnet.getAllocationPools())
{
if ( !isNullOrEmpty(pool.getStart()) && !isNullOrEmpty(pool.getEnd()) )
{
ContrailSubnetPool csp = new ContrailSubnetPool();
csp.populateWith(pool);
- allocation_pools.add (csp);
+ allocationPools.add (csp);
}
}
}
@@ -186,11 +186,11 @@ public class ContrailSubnet {
public String toString() {
StringBuilder buf = new StringBuilder ();
- for (ContrailSubnetPool pool : allocation_pools)
+ for (ContrailSubnetPool pool : allocationPools)
{
buf.append(pool.toString());
}
- return "ContrailSubnet [subnet=" + subnet.toString() + " default_gateway=" + default_gateway
- + " enable_dhcp=" + enable_dhcp + " addr_from_start=" + addr_from_start + " subnet_name=" + subnet_name + " allocation_pools=" + buf + " ]";
+ return "ContrailSubnet [subnet=" + subnet.toString() + " default_gateway=" + defaultGateway
+ + " enable_dhcp=" + enableDhcp + " addr_from_start=" + addrFromStart + " subnet_name=" + subnetName + " allocation_pools=" + buf + " ]";
}
}
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetIp.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetIp.java
index ce7fec392c..b7af894f8b 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetIp.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetIp.java
@@ -26,33 +26,34 @@ import org.codehaus.jackson.annotate.JsonProperty;
public class ContrailSubnetIp {
@JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_ip_prefix")
- private String ip_prefix;
+ private String ipPrefix;
@JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len")
- private String ip_prefix_len;
+ private String ipPrefixLen;
public ContrailSubnetIp() {
+ /* Empty constructor */
}
- public String getIp_prefix() {
- return ip_prefix;
+ public String getIpPrefix() {
+ return ipPrefix;
}
- public void setIp_prefix(String ip_prefix) {
- this.ip_prefix = ip_prefix;
+ public void setIpPrefix(String ipPrefix) {
+ this.ipPrefix = ipPrefix;
}
- public String getIp_prefix_len() {
- return ip_prefix_len;
+ public String getIpPrefixLen() {
+ return ipPrefixLen;
}
- public void setIp_prefix_len(String ip_prefix_len) {
- this.ip_prefix_len = ip_prefix_len;
+ public void setIpPrefixLen(String ipPrefixLen) {
+ this.ipPrefixLen = ipPrefixLen;
}
@Override
public String toString() {
- return "ContrailSubnetIp [ip_prefix=" + ip_prefix + ", ip_prefix_len=" + ip_prefix_len + "]";
+ return "ContrailSubnetIp [ip_prefix=" + ipPrefix + ", ip_prefix_len=" + ipPrefixLen + "]";
}
}
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetPool.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetPool.java
index 71b9ebb4e2..6429e49e41 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetPool.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetPool.java
@@ -32,6 +32,7 @@ public class ContrailSubnetPool {
private String end;
public ContrailSubnetPool() {
+ /* Empty constructor */
}
public String getStart() {
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
index 15f74c4d94..9648922d41 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
@@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlElement;
import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
-import org.openecomp.mso.requestsdb.SiteStatus;
/**
* MSO Request DB Adapter Web Service
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index a5e9690252..f8a2c986da 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -21,7 +21,6 @@
package org.openecomp.mso.adapters.requestsdb;
import java.sql.Timestamp;
-import java.util.List;
import javax.jws.WebService;
@@ -43,7 +42,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager ();
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
@Override
public void updateInfraRequest (String requestId,
@@ -110,90 +109,90 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
}
queryString += "lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId";
- LOGGER.debug("Executing update: " + queryString);
+ logger.debug("Executing update: " + queryString);
Query query = session.createQuery (queryString);
query.setParameter ("requestId", requestId);
if (statusMessage != null) {
query.setParameter ("statusMessage", statusMessage);
- LOGGER.debug ("StatusMessage in updateInfraRequest is set to: " + statusMessage);
+ logger.debug ("StatusMessage in updateInfraRequest is set to: " + statusMessage);
}
if (responseBody != null) {
query.setParameter ("responseBody", responseBody);
- LOGGER.debug ("ResponseBody in updateInfraRequest is set to: " + responseBody);
+ logger.debug ("ResponseBody in updateInfraRequest is set to: " + responseBody);
}
if (requestStatus != null) {
query.setParameter ("requestStatus", requestStatus.toString ());
- LOGGER.debug ("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString());
+ logger.debug ("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString());
}
if (progress != null) {
query.setParameter ("progress", Long.parseLong (progress));
- LOGGER.debug ("Progress in updateInfraRequest is set to: " + progress);
+ logger.debug ("Progress in updateInfraRequest is set to: " + progress);
}
if (vnfOutputs != null) {
query.setParameter ("vnfOutputs", vnfOutputs);
- LOGGER.debug ("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs);
+ logger.debug ("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs);
}
if (serviceInstanceId != null) {
query.setParameter ("serviceInstanceId", serviceInstanceId);
- LOGGER.debug ("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId);
+ logger.debug ("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId);
}
if (networkId != null) {
query.setParameter ("networkId", networkId);
- LOGGER.debug ("NetworkId in updateInfraRequest is set to: " + networkId);
+ logger.debug ("NetworkId in updateInfraRequest is set to: " + networkId);
}
if (vnfId != null) {
query.setParameter ("vnfId", vnfId);
- LOGGER.debug ("VnfId in updateInfraRequest is set to: " + vnfId);
+ logger.debug ("VnfId in updateInfraRequest is set to: " + vnfId);
}
if (vfModuleId != null) {
query.setParameter ("vfModuleId", vfModuleId);
- LOGGER.debug ("vfModuleId in updateInfraRequest is set to: " + vfModuleId);
+ logger.debug ("vfModuleId in updateInfraRequest is set to: " + vfModuleId);
}
if (volumeGroupId != null) {
query.setParameter ("volumeGroupId", volumeGroupId);
- LOGGER.debug ("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId);
+ logger.debug ("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId);
}
if (serviceInstanceName != null) {
query.setParameter ("serviceInstanceName", serviceInstanceName);
- LOGGER.debug ("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName);
+ logger.debug ("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName);
}
if (vfModuleName != null) {
query.setParameter ("vfModuleName", vfModuleName);
- LOGGER.debug ("vfModuleName in updateInfraRequest is set to: " + vfModuleName);
+ logger.debug ("vfModuleName in updateInfraRequest is set to: " + vfModuleName);
}
Timestamp nowTimeStamp = new Timestamp (System.currentTimeMillis ());
if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) {
query.setParameter ("endTime", nowTimeStamp);
- LOGGER.debug ("EndTime in updateInfraRequest is set to: " + nowTimeStamp);
+ logger.debug ("EndTime in updateInfraRequest is set to: " + nowTimeStamp);
} else {
query.setParameter ("modifyTime", nowTimeStamp);
- LOGGER.debug ("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp);
+ logger.debug ("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp);
}
query.setParameter ("lastModifiedBy", lastModifiedBy);
- LOGGER.debug ("LastModifiedBy in updateInfraRequest is set to: " + lastModifiedBy);
+ logger.debug ("LastModifiedBy in updateInfraRequest is set to: " + lastModifiedBy);
result = query.executeUpdate ();
- checkIfExists (result, requestId, startTime);
+ checkIfExists (result, requestId);
session.getTransaction ().commit ();
} catch (HibernateException e) {
String error = "Unable to update MSO Requests DB: " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
+ logger.error (MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
throw new MsoRequestsDbException (error, e);
} finally {
if (session != null && session.isOpen ()) {
session.close ();
}
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
}
- private void checkIfExists (int result, String requestId, long startTime) throws MsoRequestsDbException {
+ private void checkIfExists (int result, String requestId) throws MsoRequestsDbException {
if (result == 0) {
String error = "Request ID does not exist in MSO Requests DB: " + requestId;
- LOGGER.error (MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error);
+ logger.error (MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error);
throw new MsoRequestsDbException (error);
}
}
@@ -205,7 +204,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
MsoLogger.setLogContext (requestId, null);
Session session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
- LOGGER.debug ("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId);
+ logger.debug ("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId);
InfraActiveRequests request = null;
try {
@@ -216,15 +215,15 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
} catch (HibernateException e) {
String error = "Unable to retrieve MSO Infra Requests DB for Request ID "
+ requestId;
- LOGGER.error (MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
+ logger.error (MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
throw new MsoRequestsDbException (error, e);
} finally {
if (session != null && session.isOpen ()) {
session.close ();
}
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
return request;
}
@@ -235,13 +234,14 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
* @param siteName The unique name of the site
* @return Status of that site
*/
+ @Override
public boolean getSiteStatus (String siteName) {
- UUIDChecker.generateUUID (LOGGER);
+ UUIDChecker.generateUUID (logger);
Session session = requestsDbSessionFactoryManager.getSessionFactory ().openSession ();
long startTime = System.currentTimeMillis ();
SiteStatus siteStatus = null;
- LOGGER.debug ("Request database - get Site Status with Site name:" + siteName);
+ logger.debug ("Request database - get Site Status with Site name:" + siteName);
try {
String hql = "FROM SiteStatus WHERE siteName = :site_name";
Query query = session.createQuery (hql);
@@ -255,10 +255,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
}
if (siteStatus == null) {
// if not exist in DB, it means the site is not disabled, thus return true
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
return true;
} else {
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
return siteStatus.getStatus();
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java
index 0e72861f39..1b717b483a 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java
@@ -40,6 +40,7 @@ import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse;
@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@FunctionalInterface
public interface SDNCCallbackAdapterPortType {
@WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java
index 9e0718cba5..d63e852258 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -45,14 +45,13 @@ public class SDNCCallbackAdapterService extends Service {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- public final static URL WSDL_LOCATION;
- public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService");
- public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort");
+ public static final URL WSDL_LOCATION;
+ public static final QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService");
+ public static final QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort");
static {
URL wsdlUrl = null;
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl");
- //wsdlUrl = SDNCCallbackAdapterService.class.getClassLoader().getResource("SDNCCallbackAdapter.wsdl");
} catch (Exception e) {
msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java
index 525002f73d..6ab9ade143 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java
@@ -41,6 +41,9 @@ public class Utils {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private Utils() {
+ }
+
public static String genSdncReq(Document reqDoc, RequestTunables rt) {
try {
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
index c8c036d58a..cba378eab0 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
@@ -22,10 +22,17 @@
package org.openecomp.mso.adapters.vnf;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -540,6 +547,41 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return string;
}
+ private boolean callHeatbridge(String heatStackId) {
+ String executionDir = "/usr/local/lib/python2.7/dist-packages/heatbridge";
+ String openstackIdentityUrl = "", username = "", password = "", tenant = "", region = "", owner = "";
+ long waitTimeMs = 10000l;
+ try {
+ String[] cmdarray = {"/usr/bin/python", "HeatBridgeMain.py", openstackIdentityUrl, username, password, tenant, region, owner, heatStackId};
+ String[] envp = null;
+ File dir = new File(executionDir);
+ LOGGER.debug("Calling HeatBridgeMain.py in " + dir + " with arguments " + Arrays.toString(cmdarray));
+ Runtime r = Runtime.getRuntime();
+ Process p = r.exec(cmdarray, envp, dir);
+ /*
+ BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String linein = stdout.readLine();
+ while (linein!=null) {
+ System.out.println(linein);
+ linein = stdout.readLine();
+ }
+ */
+ boolean wait = p.waitFor(waitTimeMs, TimeUnit.MILLISECONDS);
+
+ LOGGER.debug(" HeatBridgeMain.py returned " + wait + " with code " + p.exitValue());
+ return (wait && p.exitValue()==0);
+ } catch (IOException e) {
+ LOGGER.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+ return false;
+ } catch (InterruptedException e) {
+ LOGGER.debug(" HeatBridgeMain.py failed when interrupted! " + e);
+ return false;
+ } catch (RuntimeException e) {
+ LOGGER.debug(" HeatBridgeMain.py failed for unknown reasons!" + e);
+ return false;
+ }
+ }
+
private void sendMapToDebug(Map<String, Object> inputs, String optionalName) {
int i = 0;
StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
@@ -731,6 +773,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfRollback.setIsBase(isBaseRequest);
vfRollback.setModelCustomizationUuid(mcu);
+ // Put data into A&AI through Heatstack
+ boolean heatStackCallSuccess = callHeatbridge(baseVfHeatStackId);
+
// First, look up to see if the VF already exists.
MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
index 3ca8527b05..22c4b04ff4 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
@@ -442,7 +442,7 @@ public class ASDCController {
try {
String resourceType = resourceStructure.getResourceInstance().getResourceType();
String category = resourceStructure.getResourceInstance().getCategory();
- if(resourceType.equals("VF") && !category.equalsIgnoreCase("Allotted Resource")){
+ if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
resourceStructure.createVfModuleStructures();
}
//resourceInstaller.installTheResource (resourceStructure);
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
index 11199dc04b..24950db916 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
@@ -786,7 +786,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
- if(providerNetwork != null && providerNetwork.equalsIgnoreCase("true")){
+ if("true".equalsIgnoreCase(providerNetwork)){
networkResource.setNeutronNetworkType("PROVIDER");
} else {
networkResource.setNeutronNetworkType("BASIC");
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
index c58f22f949..ae8638f0b7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
@@ -42,8 +42,6 @@ import org.onap.aai.domain.yang.Pservers;
import org.openecomp.mso.bpmn.core.PropertyConfiguration;
import org.openecomp.mso.client.aai.entities.CustomQuery;
import org.openecomp.mso.client.aai.entities.Results;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.JsonParseException;
@@ -56,15 +54,10 @@ public class AAIRestClientImpl implements AAIRestClient {
private final WebTarget webTarget;
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
private static final String ENDPOINT_VERSION = "v10";
private static final String ENDPOINT_GET_ALL = ENDPOINT_VERSION + "/cloud-infrastructure/pservers";
private static final String ENDPOINT_GET_ALL_VNFS = ENDPOINT_VERSION + "/network/generic-vnfs";
private static final String ENDPOINT_CUSTOM_QUERY = ENDPOINT_VERSION + "/query";
- private static final String PSERVER_BY_VNF_QUERY = "g.V().has('aai-node-type', 'generic-vnf').has('vnf-name','USAUTOUFTIL2001UJDM02').out('runsOnPserver').has('aai-node-type', 'pserver')";
private static final String PSERVER_VNF_QUERY = "pservers-fromVnf";
private static final String GENERIC_VNF_PATH = ENDPOINT_VERSION + "/network/generic-vnfs/generic-vnf";
private static final String SERVICE_TOPOLOGY_BY_SERVICE_INSTANCE_ID = "store(‘x’).union(__.in(‘subscribesTo’).has(‘aai-node-type’,’customer’).store(‘x’),__.out(‘uses’).has(‘aai-node-type’,’allotted-resource’).store(‘x’),__.in(‘hasInstance’).has(‘aai-node-type’,’generic-vnf’).store(‘x’).union("
@@ -92,7 +85,6 @@ public class AAIRestClientImpl implements AAIRestClient {
public AAIRestClientImpl(final String host) throws NoSuchAlgorithmException {
Logger logger = Logger.getLogger(getClass().getName());
Client client = this.getSSLClient();
- Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
webTarget = client.register(logger).register(new AAIClientResponseExceptionMapper()).target(host + "/aai");
}
@@ -107,7 +99,7 @@ public class AAIRestClientImpl implements AAIRestClient {
@Override
public List<Pserver> getPhysicalServerByVnfId(String vnfId, String transactionLoggingUuid)
throws JsonParseException, JsonMappingException, IOException {
- List<String> startNodes = new ArrayList<String>();
+ List<String> startNodes = new ArrayList<>();
startNodes.add("network/generic-vnfs/generic-vnf/" + vnfId);
String jsonInput = webTarget.register(AAIQueryObjectMapperProvider.class).path(ENDPOINT_CUSTOM_QUERY)
.queryParam("format", "resource").request().header("X-FromAppId", "MSO")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/Results.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
index c9c12c4afb..aea223da56 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
@@ -42,7 +42,7 @@ public class Results<T> {
public List<T> getResult() {
if (result == null) {
- result = new ArrayList<T>();
+ result = new ArrayList<>();
}
return this.result;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
index b164682bc7..26c1c4acd2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java
@@ -63,15 +63,7 @@ public class ApplicationControllerClient {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
- private static final int ACCEPT_SERIES = 100;
- private static final int ERROR_SERIES = 200;
- private static final int REJECT_SERIES = 300;
- private static final int SUCCESS_SERIES = 400;
- private static final int SUCCESS_STATUS = SUCCESS_SERIES + 0;
private static final int PARTIAL_SERIES = 500;
- private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES + 0;
-
- private final boolean useLCMBypass = false;
private final String apiVer = "2.00";
private final String originatorId = "MSO";
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
index abd8543f84..665b9052eb 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
@@ -53,19 +53,20 @@ public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter,
private InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
throws IOException {
- if (!stream.markSupported()) {
- stream = new BufferedInputStream(stream);
+ InputStream inputStream = stream;
+ if (!inputStream.markSupported()) {
+ inputStream = new BufferedInputStream(inputStream);
}
- stream.mark(maxEntitySize + 1);
+ inputStream.mark(maxEntitySize + 1);
final byte[] entity = new byte[maxEntitySize + 1];
- final int entitySize = stream.read(entity);
+ final int entitySize = inputStream.read(entity);
b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
if (entitySize > maxEntitySize) {
b.append("...more...");
}
b.append('\n');
- stream.reset();
- return stream;
+ inputStream.reset();
+ return inputStream;
}
@Override
@@ -126,4 +127,4 @@ public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter,
out.write(i);
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java
index 3138349fd2..2db4dea069 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Body.java
@@ -41,7 +41,7 @@ public class Body implements Serializable
@JsonProperty("input")
private Input input;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
private final static long serialVersionUID = 9101706044452851559L;
@JsonProperty("input")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java
index 27efe03243..25eb2ed270 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/Input.java
@@ -41,7 +41,7 @@ public class Input implements Serializable
@JsonProperty("request-healthdiagnostic")
private RequestHealthDiagnostic RequestHealthDiagnostic;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
private final static long serialVersionUID = 7155546785389227528L;
@JsonProperty("request-healthdiagnostic")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java
index 20bd735ae2..b1ed77b513 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/RequestHealthDiagnostic.java
@@ -59,7 +59,7 @@ public class RequestHealthDiagnostic implements Serializable
@JsonProperty("health-diagnostic-code")
private String healthDiagnosticCode;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
private final static long serialVersionUID = 1166788526178388021L;
@JsonProperty("request-client-name")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java
index 63894b9c16..0997b2df90 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/ResultInfo.java
@@ -51,7 +51,7 @@ private String requestId;
@JsonProperty("status")
private String status;
@JsonIgnore
-private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+private Map<String, Object> additionalProperties = new HashMap<>();
@JsonProperty("client-name")
public String getClientName() {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java
index 6080768cee..419f4aacf5 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java
@@ -71,6 +71,7 @@ public class XQueryScriptTask extends BaseTask {
private Expression atomicInputVariables;
private Expression outputVariable;
+ @Override
public void execute(DelegateExecution execution) throws Exception {
if (msoLogger.isDebugEnabled()) {
msoLogger.debug("Started Executing " + getTaskName());
@@ -222,12 +223,11 @@ public class XQueryScriptTask extends BaseTask {
*/
private XQueryExecutable compile(XQueryCompiler compiler, String resource)
throws Exception {
- try (InputStream xqStream = getClass().getResourceAsStream(resource)) {
- XQueryExecutable executable = compiler.compile(xqStream);
- return executable;
- } catch (Exception e) {
- msoLogger.debug ("Exception at resourceFile stream:", e);
- return null;
- }
+ try (InputStream xqStream = getClass().getResourceAsStream(resource)) {
+ return compiler.compile(xqStream);
+ } catch (Exception e) {
+ msoLogger.debug ("Exception at resourceFile stream:", e);
+ return null;
+ }
}
} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
index da340a02f7..1e68c84878 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
@@ -235,7 +235,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
Resource resource = iter.next();
//resource.getModelInfo().getModelInvariantId();
- if (resourceObjectId.equals("extracted information")){
+ if ("extracted information".equals(resourceObjectId)){
return resource.toJsonString();
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml
index be03cb44f5..3ca9c636a3 100644
--- a/bpmn/MSOInfrastructureBPMN/pom.xml
+++ b/bpmn/MSOInfrastructureBPMN/pom.xml
@@ -414,7 +414,7 @@
</dependency>
<!--for yang tools-->
- <dependency>
+<!-- <dependency>
<groupId>org.openecomp.so</groupId>
<artifactId>common</artifactId>
<version>1.1.0-SNAPSHOT</version>
@@ -424,6 +424,6 @@
<groupId>org.onap.sdnc.northbound</groupId>
<artifactId>generic-resource-api.model</artifactId>
<version>1.2.0</version>
- </dependency>
+ </dependency>-->
</dependencies>
</project>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncOperationTaskYangToolsImpl.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncOperationTaskYangToolsImpl.java
deleted file mode 100644
index 25727bdcd0..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncOperationTaskYangToolsImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.bpmn.infrastructure.workflow.serviceTask;
-
-import okhttp3.RequestBody;
-import okhttp3.ResponseBody;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutput;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
-import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkTopologyRequestBodyBuilder;
-import org.openecomp.mso.requestsdb.RequestsDbConstant;
-import org.openecomp.mso.yangDecoder.transform.api.ITransformJava2StringService;
-import org.openecomp.mso.yangDecoder.transform.impl.TransfromJava2StringFactory;
-
-import java.util.Map;
-
-/**
- * Created by 10112215 on 2017/9/20.
- */
-public class SdncOperationTaskYangToolsImpl extends AbstractSdncOperationTask {
-
- public void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception {
- updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
- NetworkTopologyRequestBodyBuilder builder = new NetworkTopologyRequestBodyBuilder();
- RequestBody body = builder.build(execution, inputs);
- updateProgress(execution, null, null, "50", "RequestBody build finished!");
- ResponseBody responseBody = genericResourceApiClient.postNetworkTopologyOperation(body).execute().body();
- updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveResponse(execution, responseBody);
- }
-
- private void saveResponse(DelegateExecution execution, ResponseBody responseBody) throws Exception {
- ITransformJava2StringService java2jsonService = TransfromJava2StringFactory.getJava2jsonService();
- NetworkTopologyOperationOutput output = (NetworkTopologyOperationOutput) java2jsonService.
- transformRpcDataObjectFromString(NetworkTopologyRequestBodyBuilder.URI_PATH, responseBody.string());
- String responseCode = output.getResponseCode();
- if (!"200".equals(responseCode)) {
- String processKey = getProcessKey(execution);
- int errorCode = Integer.valueOf(responseCode);
- String errorMessage = output.getResponseMessage();
- WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage);
- execution.setVariable("SDNCA_SuccessIndicator", workflowException);
- updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage);
- throw new Exception("");
- }
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
index 91b95df1b2..41fa8f250a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
@@ -22,8 +22,6 @@ package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builde
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncUnderlayVpnPreprocessTask;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity;
@@ -36,35 +34,101 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+//import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
+//import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
+
/**
* Created by 10112215 on 2017/9/20.
*/
public abstract class AbstractBuilder<IN, OUT> {
+ public static enum RequestAction {
+ CreateNetworkInstance(0, "CreateNetworkInstance"),
+ ActivateNetworkInstance(1, "ActivateNetworkInstance"),
+ CreateServiceInstance(2, "CreateServiceInstance"),
+ DeleteServiceInstance(3, "DeleteServiceInstance"),
+ DeleteNetworkInstance(4, "DeleteNetworkInstance"),
+ CreateVnfInstance(5, "CreateVnfInstance"),
+ ActivateVnfInstance(6, "ActivateVnfInstance"),
+ DeleteVnfInstance(7, "DeleteVnfInstance"),
+ CreateVfModuleInstance(8, "CreateVfModuleInstance"),
+ ActivateVfModuleInstance(9, "ActivateVfModuleInstance"),
+ DeleteVfModuleInstance(10, "DeleteVfModuleInstance"),
+ CreateContrailRouteInstance(11, "CreateContrailRouteInstance"),
+ DeleteContrailRouteInstance(12, "DeleteContrailRouteInstance"),
+ CreateSecurityZoneInstance(13, "CreateSecurityZoneInstance"),
+ DeleteSecurityZoneInstance(14, "DeleteSecurityZoneInstance");
+
+ String name;
+ int value;
+
+ private RequestAction(int value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public int getIntValue() {
+ return this.value;
+ }
+ }
+
+ public enum SvcAction {
+ Reserve(0, "reserve"),
+ Assign(1, "assign"),
+ Activate(2, "activate"),
+ Delete(3, "delete"),
+ Changeassign(4, "changeassign"),
+ Changedelete(5, "changedelete"),
+ Rollback(6, "rollback"),
+ Deactivate(7, "deactivate"),
+ Unassign(8, "unassign"),
+ Create(9, "create");
+
+ String name;
+ int value;
+
+ private SvcAction(int value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public int getIntValue() {
+ return this.value;
+ }
+ }
+
protected String requestId = null;
abstract OUT build(DelegateExecution execution, IN input) throws Exception;
protected String getRequestActoin(DelegateExecution execution) {
- String action = RequestInformation.RequestAction.CreateNetworkInstance.name();
+ String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.name();
String operType = getOperType(execution);
if (!StringUtils.isBlank(operType)) {
if (RequestsDbConstant.OperationType.DELETE.equals(operType)) {
- action = RequestInformation.RequestAction.DeleteNetworkInstance.name();
+ action = /*RequestInformation.*/RequestAction.DeleteNetworkInstance.name();
} else if (RequestsDbConstant.OperationType.CREATE.equals(operType)) {
- action = RequestInformation.RequestAction.CreateNetworkInstance.name();
+ action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.name();
}
}
return action;
}
protected String getOperationType(DelegateExecution execution) {
- String action = SdncRequestHeader.SvcAction.Create.name();
+ String action = /*SdncRequestHeader.*/SvcAction.Create.name();
String operType = getOperType(execution);
if (!StringUtils.isBlank(operType)) {
if (RequestsDbConstant.OperationType.DELETE.equals(operType)) {
- action = SdncRequestHeader.SvcAction.Delete.name();
+ action = /*SdncRequestHeader.*/SvcAction.Delete.name();
} else if (RequestsDbConstant.OperationType.CREATE.equals(operType)) {
- action = SdncRequestHeader.SvcAction.Create.name();
+ action = /*SdncRequestHeader.*/SvcAction.Create.name();
}
}
return action;
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkTopologyRequestBodyBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkTopologyRequestBodyBuilder.java
deleted file mode 100644
index d5ba528911..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkTopologyRequestBodyBuilder.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder;
-
-import okhttp3.RequestBody;
-import org.apache.commons.lang3.StringUtils;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.json.JSONObject;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.NetworkRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.network.request.input.NetworkInputParametersBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.Param;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.ParamBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.ParamKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder;
-import org.openecomp.mso.yangDecoder.transform.api.ITransformJava2StringService;
-import org.openecomp.mso.yangDecoder.transform.impl.TransfromJava2StringFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by 10112215 on 2017/9/20.
- */
-public class NetworkTopologyRequestBodyBuilder extends AbstractBuilder<Map<String, String>, RequestBody> {
-
- public static final String URI_PATH = "GENERIC-RESOURCE-API:network-topology-operation";
- public static final SdncRequestHeader.SvcAction SVC_DEFAULT_ACTION = SdncRequestHeader.SvcAction.Create;
- public static final String SVC_REQUEST_ID = "MSO";
- public static final String SDC_ACTION = "SDC_ACTION";
- public static final RequestInformation.RequestAction REQUEST_ACTION = RequestInformation.RequestAction.CreateNetworkInstance;
- protected static ITransformJava2StringService java2jsonService;
-
- static
- {
- try {
- java2jsonService = TransfromJava2StringFactory.getJava2jsonService();
- } catch (Exception e) {
- e.printStackTrace();
- java2jsonService = null;
- }
- }
-
- @Override
- public RequestBody build(DelegateExecution execution, Map<String, String> input) throws Exception {
- NetworkTopologyOperationInput sdncInput = getSdncInput(input);
- RequestBody body = getRequestBody(sdncInput);
- return body;
- }
-
- protected String getJsonInput(NetworkTopologyOperationInput sdncInput) throws Exception {
- return java2jsonService.transformRpcDataObjectToString(URI_PATH, sdncInput);
- }
-
- private RequestBody getRequestBody(NetworkTopologyOperationInput sdncInput) throws Exception {
- String jsonString = getJsonInput(sdncInput);
- String json = (new JSONObject(jsonString)).toString();
- return RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"),json);
- }
-
- protected NetworkTopologyOperationInput getSdncInput(Map<String, String> inputs) {
- NetworkTopologyOperationInputBuilder networkTopologyOperationInputBuilder = new NetworkTopologyOperationInputBuilder();
- {
- loadSdncRequestHeader(inputs, networkTopologyOperationInputBuilder);
- loadRequestInformation(networkTopologyOperationInputBuilder);
- loadNetworkInputParameters(inputs, networkTopologyOperationInputBuilder);
- }
- return networkTopologyOperationInputBuilder.build();
- }
-
- private void loadNetworkInputParameters(Map<String, String> inputs, NetworkTopologyOperationInputBuilder networkTopologyOperationInputBuilder) {
- NetworkRequestInputBuilder networkRequestInputBuilder = new NetworkRequestInputBuilder();
- {
- NetworkInputParametersBuilder networkInputParametersBuilder = new NetworkInputParametersBuilder();
- {
- List<Param> paramList = getParamList(inputs);
- networkInputParametersBuilder.setParam(paramList);
- }
- networkRequestInputBuilder.setNetworkInputParameters(networkInputParametersBuilder.build());
- }
- networkTopologyOperationInputBuilder.setNetworkRequestInput(networkRequestInputBuilder.build());
- }
-
- private void loadRequestInformation(NetworkTopologyOperationInputBuilder networkTopologyOperationInputBuilder) {
- RequestInformationBuilder requestInformationBuilder = new RequestInformationBuilder();
- {
- requestInformationBuilder.setRequestId(SVC_REQUEST_ID);
- requestInformationBuilder.setRequestAction(REQUEST_ACTION);
- }
- networkTopologyOperationInputBuilder.setRequestInformation(requestInformationBuilder.build());
- }
-
- private void loadSdncRequestHeader(Map<String, String> inputs, NetworkTopologyOperationInputBuilder networkTopologyOperationInputBuilder) {
- SdncRequestHeaderBuilder sdncRequestHeaderBuilder = new SdncRequestHeaderBuilder();
- {
- sdncRequestHeaderBuilder.setSvcRequestId(SVC_REQUEST_ID);
- SdncRequestHeader.SvcAction svcAction = SVC_DEFAULT_ACTION;
- String action = inputs.get(SDC_ACTION);
- if (!StringUtils.isBlank(action)) {
- if (action.toLowerCase().contains("delete")) {
- svcAction = SdncRequestHeader.SvcAction.Delete;
- } else if (action.toLowerCase().contains("create")) {
- svcAction = SdncRequestHeader.SvcAction.Create;
- }
- }
- sdncRequestHeaderBuilder.setSvcAction(svcAction);
- }
- networkTopologyOperationInputBuilder.setSdncRequestHeader(sdncRequestHeaderBuilder.build());
- }
-
- private List<Param> getParamList(Map<String, String> inputs) {
- List<Param> paramList = new ArrayList<>();
- if (inputs != null && !inputs.isEmpty()) {
- inputs.keySet().forEach(key -> {
- ParamBuilder paramBuilder = new ParamBuilder();
- paramBuilder.setName(key);
- paramBuilder.setValue(inputs.get(key));
- paramBuilder.setKey(new ParamKey(key));
- paramList.add(paramBuilder.build());
- });
- }
- return paramList;
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java
index dbddbee928..b11a1d022d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java
@@ -39,7 +39,8 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
*/
@Path("/async")
public class WorkflowAsyncVcpeResource extends WorkflowAsyncResource {
-
+
+ @Override
protected ProcessEngineServices getProcessEngineServices() {
return pes4junit.orElse(ProcessEngines.getProcessEngine("vcpe"));
}
diff --git a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java
index 9e43ee3512..60d65665fe 100644
--- a/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java
+++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java
@@ -37,6 +37,7 @@ public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfig
private String resourceName;
+ @Override
protected void init() {
throw new IllegalArgumentException(
"Normal 'init' on process engine only used for extended MyBatis mappings is not allowed, please use 'initFromProcessEngineConfiguration'. You cannot construct a process engine with this configuration.");
@@ -55,7 +56,6 @@ public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfig
setDatabaseTablePrefix(processEngineConfiguration.getDatabaseTablePrefix());
initDataSource();
- //initVariableTypes();
initCommandContextFactory();
initTransactionFactory();
initTransactionContextFactory();
@@ -75,7 +75,7 @@ public class MyBatisExtendedSessionFactory extends StandaloneProcessEngineConfig
*/
@Override
protected Collection<? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequired() {
- List<CommandInterceptor> defaultCommandInterceptorsTxRequired = new ArrayList<CommandInterceptor>();
+ List<CommandInterceptor> defaultCommandInterceptorsTxRequired = new ArrayList<>();
defaultCommandInterceptorsTxRequired.add(new LogInterceptor());
defaultCommandInterceptorsTxRequired.add(new CommandContextInterceptor(commandContextFactory, this, true));
return defaultCommandInterceptorsTxRequired;
diff --git a/common/pom.xml b/common/pom.xml
index 4c756ae532..5726ae926c 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -151,7 +151,7 @@
<version>1.3.0</version>
</dependency>
<!--for yang decoder-->
- <dependency>
+ <!--<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-codec-gson</artifactId>
<version>1.1.1-Carbon</version>
@@ -175,7 +175,7 @@
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.0.0</version>
- </dependency>
+ </dependency>-->
</dependencies>
<build>
<resources>
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/base/DataBrokerTestCustomizer.java b/common/src/main/java/org/openecomp/mso/yangDecoder/base/DataBrokerTestCustomizer.java
deleted file mode 100644
index 8560cbdb1e..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/base/DataBrokerTestCustomizer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.base;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import javassist.ClassPool;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
-import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
-import org.opendaylight.mdsal.dom.spi.store.DOMStore;
-import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
-import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-public class DataBrokerTestCustomizer {
-
- private DOMDataBroker domDataBroker;
- private final DOMNotificationRouter domNotificationRouter;
- private final MockSchemaService schemaService;
- private ImmutableMap<LogicalDatastoreType, DOMStore> datastores;
- private final BindingToNormalizedNodeCodec bindingToNormalized;
-
- public ImmutableMap<LogicalDatastoreType, DOMStore> createDatastores() {
- return ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
- .put(LogicalDatastoreType.OPERATIONAL, createOperationalDatastore())
- .put(LogicalDatastoreType.CONFIGURATION,createConfigurationDatastore())
- .build();
- }
-
- public DataBrokerTestCustomizer() {
- schemaService = new MockSchemaService();
- final ClassPool pool = ClassPool.getDefault();
- final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(pool));
- final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
- final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
- bindingToNormalized = new BindingToNormalizedNodeCodec(loading, codecRegistry);
- schemaService.registerSchemaContextListener(bindingToNormalized);
- domNotificationRouter = DOMNotificationRouter.create(16);
- }
-
- public DOMStore createConfigurationDatastore() {
- final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", MoreExecutors.sameThreadExecutor());
- schemaService.registerSchemaContextListener(store);
- return store;
- }
-
- public DOMStore createOperationalDatastore() {
- final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.sameThreadExecutor());
- schemaService.registerSchemaContextListener(store);
- return store;
- }
-
- public DOMDataBroker createDOMDataBroker() {
- return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
- }
-
- public NotificationService createNotificationService() {
- return new BindingDOMNotificationServiceAdapter(bindingToNormalized.getCodecRegistry(), domNotificationRouter);
- }
-
- public NotificationPublishService createNotificationPublishService() {
- return new BindingDOMNotificationPublishServiceAdapter(bindingToNormalized, domNotificationRouter);
- }
-
-
- public ListeningExecutorService getCommitCoordinatorExecutor() {
- return MoreExecutors.sameThreadExecutor();
- }
-
- public DataBroker createDataBroker() {
- return new BindingDOMDataBrokerAdapter(getDOMDataBroker(), bindingToNormalized);
- }
-
- public BindingToNormalizedNodeCodec getBindingToNormalized() {
- return bindingToNormalized;
- }
-
- public DOMSchemaService getSchemaService() {
- return schemaService;
- }
-
- private DOMDataBroker getDOMDataBroker() {
- if(domDataBroker == null) {
- domDataBroker = createDOMDataBroker();
- }
- return domDataBroker;
- }
-
- private synchronized ImmutableMap<LogicalDatastoreType, DOMStore> getDatastores() {
- if (datastores == null) {
- datastores = createDatastores();
- }
- return datastores;
- }
-
- public void updateSchema(final SchemaContext ctx) {
- schemaService.changeSchema(ctx);
- }
-
- public DOMNotificationRouter getDomNotificationRouter() {
- return domNotificationRouter;
- }
- public void close()
- {
- if(bindingToNormalized!=null)bindingToNormalized.close();
- if(domNotificationRouter!=null)domNotificationRouter.close();
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/base/MockSchemaService.java b/common/src/main/java/org/openecomp/mso/yangDecoder/base/MockSchemaService.java
deleted file mode 100644
index 5c4883c56a..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/base/MockSchemaService.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.base;
-import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
-
-public final class MockSchemaService implements DOMSchemaService, SchemaContextProvider {
-
- private SchemaContext schemaContext;
-
- ListenerRegistry<SchemaContextListener> listeners = ListenerRegistry.create();
-
- @Override
- public synchronized SchemaContext getGlobalContext() {
- return schemaContext;
- }
-
- @Override
- public synchronized SchemaContext getSessionContext() {
- return schemaContext;
- }
-
- @Override
- public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
- final SchemaContextListener listener) {
- return listeners.register(listener);
- }
-
- @Override
- public synchronized SchemaContext getSchemaContext() {
- return schemaContext;
- }
-
- public synchronized void changeSchema(final SchemaContext newContext) {
- schemaContext = newContext;
- for (ListenerRegistration<SchemaContextListener> listener : listeners) {
- listener.getInstance().onGlobalContextUpdated(schemaContext);
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlBase.java b/common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlBase.java
deleted file mode 100644
index 16af7a848c..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlBase.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.base;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-
-//--
-
-public abstract class TYangJsonXmlBase {
-
- private Iterable<YangModuleInfo> moduleInfos;
- protected SchemaContext schemaContext;
-//----------
- private DataBrokerTestCustomizer testCustomizer;
- private DataBroker dataBroker;
- private DOMDataBroker domBroker;
-
- protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
- return BindingReflections.loadModuleInfos();
- }
- public static void writefile(String confname, String strx)
- {
- final String outd="outdir";
- File dir = new File(outd);
- dir.mkdir();
- String fn = outd+File.separatorChar+confname;
- try(FileWriter fw = new FileWriter(fn); BufferedWriter writer = new BufferedWriter(fw))
- {
- // FileWriter fw = new FileWriter(fn);
- // BufferedWriter writer = new BufferedWriter(fw);
- writer.write(strx);
- // writer.close();
- // fw.close();
- }
- catch (Exception e)
- {
- }
- }
-
- public final void setup() throws Exception {
- moduleInfos = getModuleInfos();
- ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
- moduleContext.addModuleInfos(moduleInfos);
- schemaContext = moduleContext.tryToCreateSchemaContext().get();
- setupWithSchema(schemaContext);
- }
-
- /**
- * Setups test with Schema context.
- *
- * @param context schema context
- */
- protected void setupWithSchema(SchemaContext context){
- testCustomizer = createDataBrokerTestCustomizer();
- dataBroker = testCustomizer.createDataBroker();
- domBroker = testCustomizer.createDOMDataBroker();
- testCustomizer.updateSchema(context);
- setupWithDataBroker(dataBroker);
- }
- protected void setupWithDataBroker(final DataBroker dataBroker) {
- // Intentionally left No-op, subclasses may customize it
- }
-
- protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
- return new DataBrokerTestCustomizer();
- }
-
- public DataBroker getDataBroker() {
- return dataBroker;
- }
-
- public DOMDataBroker getDomBroker() {
- return domBroker;
- }
- public void close()
- {
- //domBroker.
- testCustomizer.close();
- }
-} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlOSGIBase.java b/common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlOSGIBase.java
deleted file mode 100644
index 7ec9637d60..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/base/TYangJsonXmlOSGIBase.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.base;
-
-import org.openecomp.mso.yangDecoder.transform.api.ITransformJava2StringService;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
-
-public interface TYangJsonXmlOSGIBase {
-
- public abstract void init(BindingNormalizedNodeSerializer mappingService)
- throws Exception;
-
- public abstract ITransformJava2StringService getJava2StringService(
- String jsonorxml);
-
- public abstract void close();
-
-} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/ITransformJava2StringService.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/ITransformJava2StringService.java
deleted file mode 100644
index 978ce4b3a3..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/ITransformJava2StringService.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.api;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.Notification;
-
-/**
- * Created by Administrator on 2017/3/21.
- */
-public interface ITransformJava2StringService {
- //following function encode
- <T extends DataObject>
- String transformContrainerDataObjectToString(InstanceIdentifier<T> instanceIdentifier, String uriPath, T dataObject)
- throws Exception;
- <T extends Notification>
- String transformNotificationToString(String uriPath, T notification) throws Exception;
- <T extends DataObject>
- String transformRpcDataObjectToString(String uriPath, T dataObject) throws Exception;
-
- //following function decode
- //for container
- DataObject transformContrainerDataObjectFromString(String uriPath, String sxml, boolean ispost) throws Exception;
- //notification
- Notification transformNotificationFromString(String notficationName, String sxml) throws Exception;
- //for rpc
- DataObject transformRpcDataObjectFromString(String rpcName, String sxml) throws Exception;
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/NormalizedNodeVisitor.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/NormalizedNodeVisitor.java
deleted file mode 100644
index 179b9958e8..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/api/NormalizedNodeVisitor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.api;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-public interface NormalizedNodeVisitor {
- void visitNode(int var1, String var2, NormalizedNode<?, ?> var3, boolean start);
-} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/JsonParserStream.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/JsonParserStream.java
deleted file mode 100644
index 7795a4cfec..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/JsonParserStream.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import com.google.common.base.Preconditions;
-import org.opendaylight.yangtools.yang.data.util.RpcAsContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-
-/**
- * Created by 10112215 on 2017/9/17.
- */
-public class JsonParserStream {
- public static DataSchemaNode getWrapSchemaNode(SchemaNode parentNode) {
- if(parentNode instanceof RpcDefinition) {
- return new RpcAsContainer((RpcDefinition)parentNode);
- } else if(parentNode instanceof NotificationDefinition) {
- return new NotificationAsContainer((NotificationDefinition)parentNode);
- } else {
- Preconditions.checkArgument(parentNode instanceof DataSchemaNode, "Instance of DataSchemaNode class awaited.");
- return (DataSchemaNode)parentNode;
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodeNavigator.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodeNavigator.java
deleted file mode 100644
index 8623dc981a..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodeNavigator.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import com.google.common.base.Preconditions;
-import org.openecomp.mso.yangDecoder.transform.api.NormalizedNodeVisitor;
-import org.opendaylight.yangtools.yang.data.api.schema.*;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Created by 10036837 on 16-7-22.
- */
-public class NormalizedNodeNavigator {
- private final NormalizedNodeVisitor visitor;
-
- public NormalizedNodeNavigator(NormalizedNodeVisitor visitor) {
- Preconditions.checkNotNull(visitor, "visitor should not be null");
- this.visitor = visitor;
- }
-
- public void navigate(String parentPath, NormalizedNode<?, ?> normalizedNode) {
- if (parentPath == null) {
- parentPath = "";
- }
-
- this.navigateNormalizedNode(0, parentPath, normalizedNode);
-
- }
-
- private void navigateDataContainerNode(int level, String parentPath, DataContainerNode<?> dataContainerNode) {
- this.visitor.visitNode(level, parentPath, dataContainerNode, true);
- String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString();
- Collection value = dataContainerNode.getValue();
- Iterator var6 = value.iterator();
-
- while (var6.hasNext()) {
- NormalizedNode node = (NormalizedNode) var6.next();
- if (node instanceof MixinNode && node instanceof NormalizedNodeContainer) {
- this.navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer) node);
- } else {
- this.navigateNormalizedNode(level, newParentPath, node);
- }
- }
- this.visitor.visitNode(level, parentPath, dataContainerNode, false);
- }
-
- private void navigateOrderedNodeContainer(int level, String parentPath, OrderedNodeContainer<?> node) {
- String newParentPath = parentPath + "/" + node.getIdentifier().toString();
- Collection value = node.getValue();
- Iterator var6 = value.iterator();
-
- while (var6.hasNext()) {
- NormalizedNode normalizedNode = (NormalizedNode) var6.next();
- if (normalizedNode instanceof OrderedNodeContainer) {
- this.navigateOrderedNodeContainer(level, newParentPath, (OrderedNodeContainer) normalizedNode);
- } else {
- this.navigateNormalizedNode(level, newParentPath, normalizedNode);
- }
- }
-
- }
-
- private void navigateNormalizedNodeContainerMixin(int level, String parentPath, NormalizedNodeContainer<?, ?, ?> node) {
-
- String newParentPath = parentPath + "/" + node.getIdentifier().toString();
- Collection value = node.getValue();
- Iterator var6 = value.iterator();
-
- while (var6.hasNext()) {
- NormalizedNode normalizedNode = (NormalizedNode) var6.next();
- if (normalizedNode instanceof MixinNode && normalizedNode instanceof NormalizedNodeContainer) {
- this.navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer) normalizedNode);
- } else {
- this.navigateNormalizedNode(level, newParentPath, normalizedNode);
- }
- }
-
- }
-
- private void navigateNormalizedNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
- if (normalizedNode instanceof DataContainerNode) {
- DataContainerNode dataContainerNode = (DataContainerNode) normalizedNode;
- this.navigateDataContainerNode(level+1, parentPath, dataContainerNode);
- } else if (normalizedNode instanceof OrderedNodeContainer) {
- this.navigateOrderedNodeContainer(level, parentPath, (OrderedNodeContainer) normalizedNode);
- } else {
- this.visitor.visitNode(level + 1, parentPath, normalizedNode, false);
- }
-
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodePrinter.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodePrinter.java
deleted file mode 100644
index 1c3ff2c5cf..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NormalizedNodePrinter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-import org.openecomp.mso.yangDecoder.transform.api.NormalizedNodeVisitor;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-
-/**
- * Created by 10036837 on 16-7-21.
- */
-public class NormalizedNodePrinter implements NormalizedNodeVisitor {
- StringBuilder result;
- private static final String CODES = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- public NormalizedNodePrinter(StringBuilder result) {
- this.result = result;
- }
- private final static String endl=System.getProperty("line.separator");
- public final static String getEndl(){
- return endl;
- }
- private static String spaces(int n) {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < n; i++) {
- builder.append(' ');
- }
- return builder.toString();
- }
-
- @Override
- public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode, boolean start) {
- if(normalizedNode == null)
- {
- return;
- }
- if(normalizedNode.getNodeType() == null)
- {
- return;
- }
-
- String localName = normalizedNode.getNodeType().getLocalName();
- if (normalizedNode instanceof LeafNode || normalizedNode instanceof LeafSetEntryNode) {
- if(normalizedNode.getValue() instanceof byte[]){
- result.append(spaces((level-1) * 4) + "<" + localName + ">" + (normalizedNode.getValue() == null ? "" : base64Encode((byte[]) normalizedNode.getValue())) + "</" + localName + ">"+endl);
- }
- else {
- String svalue=normalizedNode.getValue().toString();
- if(normalizedNode.getValue() instanceof QName){
- QName qn=(QName)normalizedNode.getValue();
- svalue= qn.getLocalName();
- }
- result.append(spaces((level - 1) * 4) + "<" + localName + ">" + (normalizedNode.getValue() == null ? "" :svalue) + "</" + localName + ">"+endl);
- }
- } else {
- if (start) {
- if (level == 1) {
- result.append(spaces((level-1) * 4) + "<" + localName + " xmlns=\"" + normalizedNode.getNodeType().getNamespace() + "\">"+endl);
- } else {
- result.append(spaces((level-1) * 4) + "<" + localName + ">"+endl);
- }
- } else {
- result.append(spaces((level-1) * 4) + "</" + localName + ">"+endl);
- }
- }
- }
- private String base64Encode(byte[] in) {
- StringBuilder out = new StringBuilder((in.length * 4) / 3);
- int b;
- for (int i = 0; i < in.length; i += 3) {
- b = (in[i] & 0xFC) >> 2;
- out.append(CODES.charAt(b));
- b = (in[i] & 0x03) << 4;
- if (i + 1 < in.length) {
- b |= (in[i + 1] & 0xF0) >> 4;
- out.append(CODES.charAt(b));
- b = (in[i + 1] & 0x0F) << 2;
- if (i + 2 < in.length) {
- b |= (in[i + 2] & 0xC0) >> 6;
- out.append(CODES.charAt(b));
- b = in[i + 2] & 0x3F;
- out.append(CODES.charAt(b));
- } else {
- out.append(CODES.charAt(b));
- out.append('=');
- }
- } else {
- out.append(CODES.charAt(b));
- out.append("==");
- }
- }
- return out.toString();
- }
-} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NotificationAsContainer.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NotificationAsContainer.java
deleted file mode 100644
index 8e468b99ce..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/NotificationAsContainer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-
-final class NotificationAsContainer implements ContainerSchemaNode {
- private final NotificationDefinition delegate;
-
- public String getDescription() {
- return this.delegate.getDescription();
- }
-
- public String getReference() {
- return this.delegate.getReference();
- }
-
- public Set<TypeDefinition<?>> getTypeDefinitions() {
- return this.delegate.getTypeDefinitions();
- }
-
- public Set<GroupingDefinition> getGroupings() {
- return this.delegate.getGroupings();
- }
-
- public Status getStatus() {
- return this.delegate.getStatus();
- }
-
- public ContainerSchemaNode getInput() {
- return null;
- }
-
- public ContainerSchemaNode getOutput() {
- return null;
- }
-
- NotificationAsContainer(NotificationDefinition parentNode) {
- this.delegate = parentNode;
- }
-
- public QName getQName() {
- return this.delegate.getQName();
- }
-
- public SchemaPath getPath() {
- return this.delegate.getPath();
- }
-
- public List<UnknownSchemaNode> getUnknownSchemaNodes() {
- return Collections.emptyList();
- }
-
- public DataSchemaNode getDataChildByName(QName name) {
- return this.getDataChildByName(name.getLocalName());
- }
-
- public DataSchemaNode getDataChildByName(String name) {
- byte var3 = -1;
- switch(name.hashCode()) {
- case -1005512447:
- if(name.equals("output")) {
- var3 = 1;
- }
- break;
- case 100358090:
- if(name.equals("input")) {
- var3 = 0;
- }
- }
-
- switch(var3) {
- case 0:
- return null;
- case 1:
- return null;
- default:
- return null;
- }
- }
-
- public Set<UsesNode> getUses() {
- return Collections.emptySet();
- }
-
- public Set<AugmentationSchema> getAvailableAugmentations() {
- return Collections.emptySet();
- }
-
- public boolean isPresenceContainer() {
- return false;
- }
-
- public Collection<DataSchemaNode> getChildNodes() {
- ArrayList ret = new ArrayList();
- ret.addAll(this.delegate.getChildNodes());
- return ret;
- }
-
- public boolean isAugmenting() {
- return false;
- }
-
- public boolean isAddedByUses() {
- return false;
- }
-
- public boolean isConfiguration() {
- return false;
- }
-
- public ConstraintDefinition getConstraints() {
- return null;
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java
deleted file mode 100644
index b99cd1a843..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import javassist.ClassPool;
-import org.openecomp.mso.yangDecoder.base.TYangJsonXmlBase;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
-import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
-import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-
-/**
- * Created by 10112215 on 2017/3/26.
- */
-public class TransformJava2JsonFactory extends TYangJsonXmlBase {
- BindingToNormalizedNodeCodec mappingservice;
- ModuleInfoBackedContext moduleInfoBackedContext;
- protected final static ControllerContext controllerContext = ControllerContext.getInstance();
-
- public TransformJava2JsonServiceImpl getJava2jsonService() {
- if (java2jsonService == null) {
- try {
- setup2();
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
- return java2jsonService;
- }
-
- TransformJava2JsonServiceImpl java2jsonService;
-
- @Override
- protected void setupWithDataBroker(final DataBroker dataBroker) {
- // Intentionally left No-op, subclasses may customize it
-
- // moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SncTunnels.class));
-
- try {
- mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(),
- new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
- moduleInfoBackedContext = ModuleInfoBackedContext.create();
-
- for (YangModuleInfo yangModuleInfo : getModuleInfos()) {
- moduleInfoBackedContext.registerModuleInfo(yangModuleInfo);
- }
- schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get();
- mappingservice.onGlobalContextUpdated(schemaContext);
- controllerContext.setSchemas(schemaContext);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if(null != mappingservice){
- mappingservice.close();
- }
- }
-
-
- }
-
- public final void setup2() throws Exception {
- super.setup();
- if(java2jsonService==null)
- java2jsonService = new TransformJava2JsonServiceImpl(mappingservice, schemaContext);
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonServiceImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonServiceImpl.java
deleted file mode 100644
index ef9bdc45fe..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonServiceImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import org.openecomp.mso.yangDecoder.transform.api.ITransformJava2StringService;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Created by Administrator on 2017/3/20.
- */
-public class TransformJava2JsonServiceImpl implements ITransformJava2StringService {
- private static final Logger LOG = LoggerFactory.getLogger(TransformJava2JsonServiceImpl.class);
- BindingNormalizedNodeSerializer mappingservice;
- SchemaContext schemaContext;
- YangDataTransformNN2JsonServiceImpl nn2jsonService;
- YangDataTransformJava2NNServiceImpl java2nnService;
- public TransformJava2JsonServiceImpl(BindingNormalizedNodeSerializer mappingservice, SchemaContext schemaContext){
- this.mappingservice=mappingservice;
- this.schemaContext=schemaContext;
- nn2jsonService=new YangDataTransformNN2JsonServiceImpl();
- java2nnService=new YangDataTransformJava2NNServiceImpl(mappingservice);
- }
- @Override
- public <T extends DataObject> String transformContrainerDataObjectToString(InstanceIdentifier<T> instanceIdentifier, String uriPath,T dataObject) throws Exception {
- // TODO Auto-generated method stub
- NormalizedNode nn = java2nnService.yangDataObjecttoNN(instanceIdentifier, dataObject);
- NormalizedNodeContext nnc = java2nnService.yangNNtoNNC(nn, uriPath);
- String sjson = nn2jsonService.transformNNCToString(nnc);
- return sjson;
- }
- @Override
- public <T extends Notification> String transformNotificationToString(String uriPath,T notification)throws Exception {
- NormalizedNode nn = mappingservice.toNormalizedNodeNotification(notification);
- NormalizedNodeContext nnc = java2nnService.yangNNtoNNC(nn, uriPath);
- String sjson = nn2jsonService.transformNNCToString(nnc);
- return sjson;
- }
- @Override
- public <T extends DataObject> String transformRpcDataObjectToString(String uriPath,T dataObject) throws Exception {
- NormalizedNode nn = mappingservice.toNormalizedNodeRpcData(dataObject);
- NormalizedNodeContext nnc = java2nnService.yangNNtoNNC(nn, uriPath);
- String sjson = nn2jsonService.transformNNCToString(nnc);
- return sjson;
- }
- @Override
- public DataObject transformContrainerDataObjectFromString(String uriPath,String sjson,boolean ispost) throws Exception {
- NormalizedNodeContext nnc= nn2jsonService.transformDataObjectNNCFromString(uriPath,sjson,ispost);
- return java2nnService.yangDataObjectfromNNC(nnc);
- }
- @Override
- public Notification transformNotificationFromString(String notficationName,String sjson) throws Exception {
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(notficationName);
- NormalizedNodeContext nnc= nn2jsonService.transformNotficationNNCFromString(notficationName,sjson);
- ContainerNode contn= (ContainerNode)nnc.getData();
- return mappingservice.fromNormalizedNodeNotification(iicontext.getSchemaNode().getPath(),contn);
- }
- @Override
- public DataObject transformRpcDataObjectFromString(String rpcName,String sjson) throws Exception {
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(rpcName);
- NormalizedNodeContext nnc= nn2jsonService.transformRPCNNCFromString(rpcName,sjson);
- return java2nnService.yangRpcDatafromNN(iicontext,nnc.getData());
- /* ContainerNode contn= (ContainerNode)nnc.getData();
- DataSchemaNode schemaNode;
- final SchemaNode schemaNode0 = iicontext.getSchemaNode();
- boolean isInput = false;
- if (schemaNode0 instanceof RpcDefinition) {
- if (contn.getNodeType().getLocalName().contains("output")) {
- schemaNode = ((RpcDefinition) schemaNode0).getOutput();
- isInput = false;
- } else {
- schemaNode = ((RpcDefinition) schemaNode0).getInput();
- isInput = true;
- }
-
- } else if (schemaNode0 instanceof DataSchemaNode) {
- schemaNode = (DataSchemaNode) schemaNode0;
- } else {
- throw new IllegalStateException("Unknow SchemaNode");
- }
- return mappingservice.fromNormalizedNodeRpcData(schemaNode.getPath(),contn); */
- //return mappingservice.toNormalizedNodeRpcData((DataContainer) nnc.getData());
- // return java2nnService.yangDataObjectfromNNC(nnc);
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java
deleted file mode 100644
index 85959882c4..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import javassist.ClassPool;
-import org.openecomp.mso.yangDecoder.base.TYangJsonXmlBase;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
-import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
-import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
-
-/**
- * Created by 10112215 on 2017/3/26.
- */
-public class TransformJava2XMLFactory extends TYangJsonXmlBase {
- BindingToNormalizedNodeCodec mappingservice;
- ModuleInfoBackedContext moduleInfoBackedContext;
- protected final static ControllerContext controllerContext = ControllerContext.getInstance();
-
- public TransformJava2XMLServiceImpl getJava2xmlService() {
- if (java2xmlService == null) {
- try {
- setup2();
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
- return java2xmlService;
- }
-
- TransformJava2XMLServiceImpl java2xmlService;
-
- @Override
- protected void setupWithDataBroker(final DataBroker dataBroker) {
- // Intentionally left No-op, subclasses may customize it
-
- // moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SncTunnels.class));
- try {
- mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(),
- new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
- moduleInfoBackedContext = ModuleInfoBackedContext.create();
-
- for (YangModuleInfo yangModuleInfo : getModuleInfos()) {
- moduleInfoBackedContext.registerModuleInfo(yangModuleInfo);
- }
-
- schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get();
- mappingservice.onGlobalContextUpdated(schemaContext);
- controllerContext.setSchemas(schemaContext);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if(null != mappingservice){
- mappingservice.close();
- }
- }
-
-
- }
-
- public final void setup2() throws Exception {
- super.setup();
- if(java2xmlService==null)
- java2xmlService = new TransformJava2XMLServiceImpl(mappingservice, schemaContext);
- }
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLServiceImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLServiceImpl.java
deleted file mode 100644
index 9a1d570b46..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLServiceImpl.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import org.openecomp.mso.yangDecoder.transform.api.ITransformJava2StringService;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.Notification;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-
-/**
- * Created by Administrator on 2017/3/20.
- */
-public class TransformJava2XMLServiceImpl implements ITransformJava2StringService {
- private static final Logger LOG = LoggerFactory.getLogger(TransformJava2XMLServiceImpl.class);
- BindingNormalizedNodeSerializer mappingservice;
- SchemaContext schemaContext;
- YangDataTransformJava2NNServiceImpl java2nnService;
- YangDataTransformNN2XMLServiceImpl nn2xmlService;
- YangOdlNN2XMLImpl yangODLnn2xml;
- public TransformJava2XMLServiceImpl(BindingNormalizedNodeSerializer mappingService, SchemaContext schemaContext){
- this.mappingservice=mappingService;
- this.schemaContext=schemaContext;
- java2nnService=new YangDataTransformJava2NNServiceImpl(mappingService);
- nn2xmlService=new YangDataTransformNN2XMLServiceImpl(mappingService,schemaContext);
- yangODLnn2xml=new YangOdlNN2XMLImpl(schemaContext);
- }
- @Override
- public <T extends DataObject> String transformContrainerDataObjectToString(InstanceIdentifier<T> instanceIdentifier, String uriPath, T dataObject)
- throws Exception {
- // TODO Auto-generated method stub
- NormalizedNode nn=java2nnService.yangDataObjecttoNN(instanceIdentifier,dataObject);
- return yangODLnn2xml.yangNNtoXML(uriPath,nn);
- }
- @Override
- public <T extends Notification> String transformNotificationToString(String uriPath, T notification)
- throws Exception {
- NormalizedNode nn= mappingservice.toNormalizedNodeNotification(notification);
- return yangODLnn2xml.yangNNtoXML(uriPath,nn);
- }
- @Override
- public <T extends DataObject> String transformRpcDataObjectToString(String uriPath, T dataObject)
- throws Exception {
- NormalizedNode nn=mappingservice.toNormalizedNodeRpcData(dataObject);
- return yangODLnn2xml.yangNNtoXML(uriPath,nn);
- }
- //for container
- public <T extends DataObject> String transformContrainerDataObjectToString(InstanceIdentifier<T> instanceIdentifier, T dataObject) {
- // TODO Auto-generated method stub
- NormalizedNode nn=java2nnService.yangDataObjecttoNN(instanceIdentifier,dataObject);
- return nn2xmlService.transformNNToString(nn);
- }
-
- public <T extends Notification> String transformNotificationToString(T notification) {
- NormalizedNode nn= mappingservice.toNormalizedNodeNotification(notification);
- return nn2xmlService.transformNNToString(nn);
- }
-
- //for rpc
- public <T extends DataObject> String transformRpcDataObjectToString(T dataObject) {
- NormalizedNode nn=mappingservice.toNormalizedNodeRpcData(dataObject);
- return nn2xmlService.transformNNToString(nn);
- }
-
- //for container
- @Override
- public DataObject transformContrainerDataObjectFromString(String uriPath, String sxml,boolean ispost) throws Exception {
- // TODO Auto-generated method stub
- if(ispost)
- {
- NormalizedNodeContext nnc=YangOdlNNC2XMLImpl.fromXML(uriPath,sxml, ispost);
- final InstanceIdentifierContext<?> iicontext=nnc.getInstanceIdentifierContext();
- Map.Entry<InstanceIdentifier<?>, DataObject> temp = mappingservice.fromNormalizedNode(iicontext.getInstanceIdentifier(),nnc.getData());
- return (DataObject)temp.getValue();
- }
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(uriPath);
- NormalizedNode nn =nn2xmlService.transformNNFromString(sxml);
- Map.Entry<InstanceIdentifier<?>, DataObject> temp = mappingservice.fromNormalizedNode(iicontext.getInstanceIdentifier(),nn);
- if (null == temp) {
- return null;
- } else {
- return temp.getValue();
- }
- }
- @Override
- public Notification transformNotificationFromString(String notficationName, String sxml) throws Exception {
-
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(notficationName);
- NormalizedNode nn = nn2xmlService.transformNotificationStringtoNN(sxml, notficationName);
- ContainerNode noti = (ContainerNode) nn;
- SchemaNode snode=iicontext.getSchemaNode() ;
- Notification obj = mappingservice.fromNormalizedNodeNotification(snode.getPath(), noti);
- return obj;
- }
- //for rpc
- @Override
- public DataObject transformRpcDataObjectFromString(String rpcName, String sxml) throws Exception {
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(rpcName);
- Map.Entry<DataSchemaNode, NormalizedNode> nnentry = nn2xmlService.transformRpcNNEntryfromString(sxml,iicontext);
- ContainerNode rpc = (ContainerNode) nnentry.getValue();
- DataObject rpcdata= mappingservice.fromNormalizedNodeRpcData(nnentry.getKey().getPath(),rpc);
- return rpcdata;
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransfromJava2StringFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransfromJava2StringFactory.java
deleted file mode 100644
index a45b587e18..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransfromJava2StringFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
-import org.openecomp.mso.yangDecoder.transform.api.ITransformJava2StringService;
-
-/**
- * Created by 10112215 on 2017/3/24.
- */
-public class TransfromJava2StringFactory {
-
- private static TransformJava2JsonServiceImpl java2jsonService = (new TransformJava2JsonFactory()).getJava2jsonService();
-
- private static TransformJava2XMLServiceImpl java2XMLService/* = (new TransformJava2XMLFactory()).getJava2xmlService()*/;
-
- public static boolean isXML(String value) {
- try {
- DocumentHelper.parseText(value);
- } catch (DocumentException e) {
- return false;
- }
- return true;
- }
-
- public static ITransformJava2StringService getJava2StringService(String input) throws Exception {
- ITransformJava2StringService java2jsonService;
- if (isXML(input)) {
- java2jsonService = getJava2XMLService();
- } else {
- java2jsonService = getJava2jsonService();
- }
- return java2jsonService;
- }
-
- public static void init() {
- // do no shit for static initialization
- }
-
- public static ITransformJava2StringService getJava2jsonService() throws Exception {
- if (java2jsonService == null) {
- TransformJava2JsonFactory transformJava2JsonFactory = new TransformJava2JsonFactory();
- java2jsonService = transformJava2JsonFactory.getJava2jsonService();
- }
- return java2jsonService;
- }
-
- public static ITransformJava2StringService getJava2XMLService() throws Exception {
- if (java2XMLService == null) {
- TransformJava2XMLFactory transformJava2XMLFactory = new TransformJava2XMLFactory();
- java2XMLService = transformJava2XMLFactory.getJava2xmlService();
- }
- return java2XMLService;
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/XmlNormalizedNodeBodyReaderUmeImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/XmlNormalizedNodeBodyReaderUmeImpl.java
deleted file mode 100644
index d9add789ee..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/XmlNormalizedNodeBodyReaderUmeImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import org.opendaylight.netconf.sal.rest.impl.XmlNormalizedNodeBodyReader;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-
-public class XmlNormalizedNodeBodyReaderUmeImpl extends
- XmlNormalizedNodeBodyReader {
- InstanceIdentifierContext<?> iic;
- boolean ispost=false;
- @Override
- protected InstanceIdentifierContext<?> getInstanceIdentifierContext() {
- return iic;
- }
- @Override
- protected boolean isPost() {
- return ispost;
- }
- public void Set(InstanceIdentifierContext<?> iic,boolean ispost)
- {
- this.iic=iic;
- this.ispost=ispost;
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformJava2NNServiceImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformJava2NNServiceImpl.java
deleted file mode 100644
index 4d567676bc..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformJava2NNServiceImpl.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-//import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
-
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
-import org.opendaylight.netconf.sal.restconf.impl.WriterParameters;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.*;
-
-import java.util.Map;
-
-/**
- * Created by Administrator on 2017/3/17.
- */
-public class YangDataTransformJava2NNServiceImpl {
- BindingNormalizedNodeSerializer mappingService;
- public YangDataTransformJava2NNServiceImpl(BindingNormalizedNodeSerializer mappingService)
- {
- this.mappingService=mappingService;
- }
- public <T extends DataObject> NormalizedNodeContext yangDataObjecttoNNC(InstanceIdentifier<T> identifier, String uri, T dobj)
- {
- final InstanceIdentifierContext<?> iiContext = ControllerContext.getInstance().toInstanceIdentifier(uri);
- Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> temp = mappingService.toNormalizedNode(identifier, dobj);
- WriterParameters.WriterParametersBuilder aa=new WriterParameters.WriterParametersBuilder();
- aa.setPrettyPrint(true);
- return new NormalizedNodeContext( iiContext, temp.getValue() ,aa.build());
- }
- public <T extends DataObject> NormalizedNode yangDataObjecttoNN( InstanceIdentifier<T> identifier,T dobj) {
- Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> temp = mappingService.toNormalizedNode(identifier, dobj);
- if (null == temp) {
- return null;
- } else {
- return temp.getValue();
- }
- }
- public NormalizedNodeContext yangNNtoNNC(NormalizedNode nn, String uri){
- final InstanceIdentifierContext<?> iiContext = ControllerContext.getInstance().toInstanceIdentifier(uri);
- WriterParameters.WriterParametersBuilder aa=new WriterParameters.WriterParametersBuilder();
- aa.setPrettyPrint(true);
- return new NormalizedNodeContext(iiContext, nn,aa.build());
- }
- public <T extends DataObject> T yangDataObjectfromNN(YangInstanceIdentifier identifier,NormalizedNode node) {
- Map.Entry<InstanceIdentifier<?>, DataObject> temp = mappingService.fromNormalizedNode(identifier, node);
- if (null == temp) {
- return null;
- } else {
- return (T) temp.getValue();
- }
- }
- public <T extends DataObject> T yangDataObjectfromNNC(NormalizedNodeContext nnc)
- {
- return yangDataObjectfromNN(nnc.getInstanceIdentifierContext().getInstanceIdentifier(),nnc.getData());
- }
- public ContainerNode yangRpcDatatoNN(final DataContainer rpcdata){
- return mappingService.toNormalizedNodeRpcData(rpcdata);
- }
- public DataObject yangRpcDatafromNN(SchemaPath path, final ContainerNode data)
- {
- return mappingService.fromNormalizedNodeRpcData(path,data);
- }
- public static DataSchemaNode findDataSchemaNode(String uriPath,String inputoroutput)
- {
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(uriPath);
- DataSchemaNode dsn=JsonParserStream.getWrapSchemaNode( iicontext.getSchemaNode());
- return dsn;
- }
- public static SchemaNode findSchemaNode(final InstanceIdentifierContext<?> iicontext ,String inputoroutput)
- {
- SchemaNode schemaNode;
-
- final SchemaNode schemaNode0 = iicontext.getSchemaNode();
- if (schemaNode0 instanceof RpcDefinition) {
- if (inputoroutput.contains("output")) {
- schemaNode = ((RpcDefinition) schemaNode0).getOutput();
- } else {
- schemaNode = ((RpcDefinition) schemaNode0).getInput();
- }
-
- } else if(schemaNode0 instanceof NotificationDefinition)
- {
- schemaNode=schemaNode0;
- }
- else if (schemaNode0 instanceof DataSchemaNode) {
- schemaNode = schemaNode0;
- } else {
- throw new IllegalStateException("Unknow SchemaNode");
- }
- return schemaNode;
- }
-
- public static DataSchemaNode findRpcSchemaNode(final InstanceIdentifierContext<?> iicontext,String inputoroutput)
- {
- DataSchemaNode schemaNode;
- final SchemaNode schemaNode0 = iicontext.getSchemaNode();
- boolean isInput = false;
- if (schemaNode0 instanceof RpcDefinition) {
- if (inputoroutput.contains("output")) {
- schemaNode = ((RpcDefinition) schemaNode0).getOutput();
- isInput = false;
- } else {
- schemaNode = ((RpcDefinition) schemaNode0).getInput();
- isInput = true;
- }
-
- } else if (schemaNode0 instanceof DataSchemaNode) {
- schemaNode = (DataSchemaNode) schemaNode0;
- } else {
- throw new IllegalStateException("Unknow SchemaNode");
- }
- return schemaNode;
- }
- public DataObject yangRpcDatafromNN(final InstanceIdentifierContext<?> iicontext , final NormalizedNode data) {
- // final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(uriPath);
- ContainerNode contn= (ContainerNode)data;
- DataSchemaNode schemaNode= findRpcSchemaNode(iicontext,contn.getNodeType().getLocalName());;
- /* final SchemaNode schemaNode0 = iicontext.getSchemaNode();
- boolean isInput = false;
- if (schemaNode0 instanceof RpcDefinition) {
- if (contn.getNodeType().getLocalName().contains("output")) {
- schemaNode = ((RpcDefinition) schemaNode0).getOutput();
- isInput = false;
- } else {
- schemaNode = ((RpcDefinition) schemaNode0).getInput();
- isInput = true;
- }
-
- } else if (schemaNode0 instanceof DataSchemaNode) {
- schemaNode = (DataSchemaNode) schemaNode0;
- } else {
- throw new IllegalStateException("Unknow SchemaNode");
- }*/
- SchemaPath path=schemaNode.getPath();
- return mappingService.fromNormalizedNodeRpcData(path,contn);
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2JsonServiceImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2JsonServiceImpl.java
deleted file mode 100644
index 23872cadfa..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2JsonServiceImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import com.google.common.base.Charsets;
-import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader;
-import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeJsonBodyWriter;
-import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-
-/**
- * Created by Administrator on 2017/3/17.
- */
-public class YangDataTransformNN2JsonServiceImpl {
- private static final Logger LOG = LoggerFactory.getLogger(YangDataTransformNN2JsonServiceImpl.class);
- private static final Annotation[] EMPTY_ANNOTATIONS = new Annotation[0];
-
- public NormalizedNodeContext transformNNCFromString(String uriPath,String jsonpayload,boolean isPost){
-
- InputStream entityStream = new ByteArrayInputStream(jsonpayload.getBytes(Charsets.UTF_8));
- NormalizedNodeContext normalnodes3 = JsonNormalizedNodeBodyReader.readFrom(uriPath, entityStream, isPost);
- return normalnodes3;
- }
- public String transformNNCToString(NormalizedNodeContext readData) throws IOException {
- NormalizedNodeJsonBodyWriter writer = new NormalizedNodeJsonBodyWriter();
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- //readData.getWriterParameters().isPrettyPrint()
- writer.writeTo(readData, NormalizedNodeContext.class, null, EMPTY_ANNOTATIONS,
- MediaType.APPLICATION_JSON_TYPE, null, outputStream );
- return outputStream.toString(Charsets.UTF_8.name());
- }
- public NormalizedNodeContext transformRPCNNCFromString(String uriPath,String jsonpayload)
- {
- return transformNNCFromString(uriPath,jsonpayload,true);
- }
- public NormalizedNodeContext transformDataObjectNNCFromString(String uriPath,String jsonpayload,boolean ispost)
- {
- return transformNNCFromString(uriPath,jsonpayload,ispost);
- }
- public NormalizedNodeContext transformNotficationNNCFromString(String uriPath,String jsonpayload)
- {
- return transformNNCFromString(uriPath,jsonpayload,true);
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2XMLServiceImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2XMLServiceImpl.java
deleted file mode 100644
index a77977e322..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangDataTransformNN2XMLServiceImpl.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
-import org.opendaylight.yangtools.yang.model.api.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLOutputFactory;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import static org.openecomp.mso.yangDecoder.transform.impl.JsonParserStream.getWrapSchemaNode;
-
-public class YangDataTransformNN2XMLServiceImpl {
- private static final XMLOutputFactory XML_FACTORY;
- private static final DocumentBuilderFactory BUILDERFACTORY;
- static {
- XML_FACTORY = XMLOutputFactory.newFactory();
- XML_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
- final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- factory.setCoalescing(true);
- factory.setIgnoringElementContentWhitespace(true);
- factory.setIgnoringComments(true);
- BUILDERFACTORY = factory;
- }
- BindingNormalizedNodeSerializer mappingservice;
- SchemaContext schemaContext;
- private static final Logger LOG = LoggerFactory.getLogger(YangDataTransformNN2XMLServiceImpl.class);
-
- public YangDataTransformNN2XMLServiceImpl(BindingNormalizedNodeSerializer mappingservice, SchemaContext context ) {
-
- this.schemaContext = context;
- this.mappingservice=mappingservice;
- }
-
- public String transformNNToString(NormalizedNode nn)
- {
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.append(YangOdlNNC2XMLImpl.getXMLHeader());
- new NormalizedNodeNavigator(new NormalizedNodePrinter(stringBuilder)).navigate(null, nn);
- return stringBuilder.toString();
- }
-
-
- public static DataSchemaNode getSchemaNodebyNs(final SchemaContext context, final String ns, final String childNodeName) {
- for (Module module : context.getModules()) {
- if (module.getNamespace().toString().equals(ns)) {
- DataSchemaNode found = findChildNode(module.getChildNodes(), childNodeName);
- Preconditions.checkState(found != null, "Unable to find %s", childNodeName);
- return found;
- }
- }
- throw new IllegalStateException("Unable to find child node " + childNodeName);
- }
- private static DataSchemaNode findChildNode(final Iterable<DataSchemaNode> children, final String name) {
- List<DataNodeContainer> containers = Lists.newArrayList();
-
- for (DataSchemaNode dataSchemaNode : children) {
- if (dataSchemaNode.getQName().getLocalName().equals(name)) {
- return dataSchemaNode;
- }
- if (dataSchemaNode instanceof DataNodeContainer) {
- containers.add((DataNodeContainer) dataSchemaNode);
- } else if (dataSchemaNode instanceof ChoiceSchemaNode) {
- containers.addAll(((ChoiceSchemaNode) dataSchemaNode).getCases());
- }
- }
-
- for (DataNodeContainer container : containers) {
- DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
- if (retVal != null) {
- return retVal;
- }
- }
-
- return null;
- }
- public NormalizedNode transformNNFromString(String sxml) throws Exception {
- InputStream in_nocode = new ByteArrayInputStream(sxml.getBytes(Charsets.UTF_8));//.getBytes("UTF-8")
- //xml2nn
- final Document docxml = readXmlToDocument(in_nocode);
- Element element0 = docxml.getDocumentElement();
- String localname = element0.getNodeName();
- String ns = element0.getAttribute("xmlns");
- // final ContainerSchemaNode containerNodex = (ContainerSchemaNode)null;
- final DataSchemaNode dsn=getSchemaNodebyNs(schemaContext, ns, localname);
- //cn.getNodeType().getNamespace().toString(), cn.getNodeType().getLocalName());
- DomToNormalizedNodeParserFactory parserFactory =DomToNormalizedNodeParserFactory.getInstance(DomUtils.defaultValueCodecProvider(), schemaContext);
- NormalizedNode parsed = null;
- final List<Element> elements = Collections.singletonList(docxml.getDocumentElement());
- if (dsn instanceof ContainerSchemaNode) {
- parsed= parserFactory.getContainerNodeParser().parse(elements, (ContainerSchemaNode)dsn);
- }else if (dsn instanceof ListSchemaNode) {
- final ListSchemaNode casted = (ListSchemaNode) dsn;
- parsed=parserFactory.getMapEntryNodeParser().parse(elements, casted);
- }
- return parsed;
-
- }
-
-
-
- public NormalizedNode transformNotificationNNfromString(String sxml, final InstanceIdentifierContext<?> iicontext) throws Exception
- {
- SchemaNode schemaNode = getWrapSchemaNode(iicontext.getSchemaNode());
- InputStream in_nocode = new ByteArrayInputStream(sxml.getBytes(Charsets.UTF_8));//.getBytes("UTF-8")
- //xml2nn
- final Document docxml = readXmlToDocument(in_nocode);
- Element element0 = docxml.getDocumentElement();
- String localname = element0.getNodeName();
- String ns = element0.getAttribute("xmlns");
- // final ContainerSchemaNode containerNodex = (ContainerSchemaNode)null;
- // final DataSchemaNode dsn=(DataSchemaNode)schemaNode;/*getSchemaNodebyNs(schemaContext, ns, localname);*/
- //cn.getNodeType().getNamespace().toString(), cn.getNodeType().getLocalName());
- DomToNormalizedNodeParserFactory parserFactory =DomToNormalizedNodeParserFactory.getInstance(DomUtils.defaultValueCodecProvider(), schemaContext);
- NormalizedNode parsed = null;
- final List<Element> elements = Collections.singletonList(docxml.getDocumentElement());
- if (schemaNode instanceof ContainerSchemaNode) {
- parsed= parserFactory.getContainerNodeParser().parse(elements, (ContainerSchemaNode)schemaNode);
- }else if (schemaNode instanceof ListSchemaNode) {
- final ListSchemaNode casted = (ListSchemaNode) schemaNode;
- parsed=parserFactory.getMapEntryNodeParser().parse(elements, casted);
- }
- return parsed;
- }
- public NormalizedNode transformNotificationStringtoNN(String sxml,String notficationName) throws Exception {
- final InstanceIdentifierContext<?> iicontext= ControllerContext.getInstance().toInstanceIdentifier(notficationName);
- return transformNotificationNNfromString(sxml,iicontext);
- }
- public Map.Entry<DataSchemaNode, NormalizedNode> transformRpcNNEntryfromString(String sxml, final InstanceIdentifierContext<?> iirpccontext) throws Exception{
- InputStream in_nocode = new ByteArrayInputStream(sxml.getBytes(Charsets.UTF_8));//.getBytes("UTF-8")
- //xml2nn
- final Document docxml = readXmlToDocument(in_nocode);
- Element element0 = docxml.getDocumentElement();
- String localname = element0.getNodeName();
- String ns = element0.getAttribute("xmlns");
- DataSchemaNode schemaNode;
- final SchemaNode schemaNode0 = iirpccontext.getSchemaNode();
- boolean isInput = false;
- if (schemaNode0 instanceof RpcDefinition) {
- if (docxml.getDocumentElement().getLocalName().contains("output")) {
- schemaNode = ((RpcDefinition) schemaNode0).getOutput();
- isInput = false;
- } else {
- schemaNode = ((RpcDefinition) schemaNode0).getInput();
- isInput = true;
- }
-
- } else if (docxml instanceof DataSchemaNode) {
- schemaNode = (DataSchemaNode) docxml;
- } else {
- throw new IllegalStateException("Unknow SchemaNode");
- }
-
- final List<YangInstanceIdentifier.PathArgument> iiToDataList = new ArrayList<>();
- InstanceIdentifierContext<? extends SchemaNode> outIIContext;
- // final ContainerSchemaNode containerNodex = (ContainerSchemaNode)null;
- // final DataSchemaNode dsn=(DataSchemaNode)schemaNode;/*getSchemaNodebyNs(schemaContext, ns, localname);*/
- //cn.getNodeType().getNamespace().toString(), cn.getNodeType().getLocalName());
- DomToNormalizedNodeParserFactory parserFactory =DomToNormalizedNodeParserFactory.getInstance(DomUtils.defaultValueCodecProvider(), schemaContext);
- NormalizedNode parsed = null;
- final List<Element> elements = Collections.singletonList(docxml.getDocumentElement());
- if (schemaNode instanceof ContainerSchemaNode) {
- parsed= parserFactory.getContainerNodeParser().parse(elements, (ContainerSchemaNode)schemaNode);
- }else if (schemaNode instanceof ListSchemaNode) {
- final ListSchemaNode casted = (ListSchemaNode) schemaNode;
- parsed=parserFactory.getMapEntryNodeParser().parse(elements, casted);
- }
- return new SimpleEntry<DataSchemaNode, NormalizedNode>(schemaNode,parsed);
- }
- public NormalizedNode transformRpcNNfromString(String sxml, final InstanceIdentifierContext<?> iirpccontext) throws Exception{
-
- InputStream in_nocode = new ByteArrayInputStream(sxml.getBytes(Charsets.UTF_8));//.getBytes("UTF-8")
- //xml2nn
- final Document docxml = readXmlToDocument(in_nocode);
- Element element0 = docxml.getDocumentElement();
- String localname = element0.getNodeName();
- String ns = element0.getAttribute("xmlns");
- DataSchemaNode schemaNode;
- final SchemaNode schemaNode0 = iirpccontext.getSchemaNode();
- boolean isInput = false;
- if (schemaNode0 instanceof RpcDefinition) {
- if (docxml.getDocumentElement().getLocalName().contains("output")) {
- schemaNode = ((RpcDefinition) schemaNode0).getOutput();
- isInput = false;
- } else {
- schemaNode = ((RpcDefinition) schemaNode0).getInput();
- isInput = true;
- }
-
- } else if (docxml instanceof DataSchemaNode) {
- schemaNode = (DataSchemaNode) docxml;
- } else {
- throw new IllegalStateException("Unknow SchemaNode");
- }
-
- final List<YangInstanceIdentifier.PathArgument> iiToDataList = new ArrayList<>();
- InstanceIdentifierContext<? extends SchemaNode> outIIContext;
- // final ContainerSchemaNode containerNodex = (ContainerSchemaNode)null;
- // final DataSchemaNode dsn=(DataSchemaNode)schemaNode;/*getSchemaNodebyNs(schemaContext, ns, localname);*/
- //cn.getNodeType().getNamespace().toString(), cn.getNodeType().getLocalName());
- DomToNormalizedNodeParserFactory parserFactory =DomToNormalizedNodeParserFactory.getInstance(DomUtils.defaultValueCodecProvider(), schemaContext);
- NormalizedNode parsed = null;
- final List<Element> elements = Collections.singletonList(docxml.getDocumentElement());
- if (schemaNode instanceof ContainerSchemaNode) {
- parsed= parserFactory.getContainerNodeParser().parse(elements, (ContainerSchemaNode)schemaNode);
- }else if (schemaNode instanceof ListSchemaNode) {
- final ListSchemaNode casted = (ListSchemaNode) schemaNode;
- parsed=parserFactory.getMapEntryNodeParser().parse(elements, casted);
- }
- return parsed;
- }
- public NormalizedNode transformRpcNNfromString(String sxml, String rpcName) throws Exception {
- final InstanceIdentifierContext<?> iicontext= ControllerContext.getInstance().toInstanceIdentifier(rpcName);
- return this.transformRpcNNfromString(sxml,iicontext);
-
- }
- public static Document readXmlToDocument(final InputStream xmlContent) throws IOException, SAXException {
- final DocumentBuilder dBuilder;
- try {
- dBuilder = BUILDERFACTORY.newDocumentBuilder();
- } catch (final ParserConfigurationException e) {
- throw new RuntimeException("Failed to parse XML document", e);
- }
- final Document doc = dBuilder.parse(xmlContent);
-
- doc.getDocumentElement().normalize();
- return doc;
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNN2XMLImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNN2XMLImpl.java
deleted file mode 100644
index 9ad2336430..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNN2XMLImpl.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.IOException;
-import java.io.StringWriter;
-
-/**
- * Created by Administrator on 2017/3/21.
- */
-public class YangOdlNN2XMLImpl {
- private static final XMLOutputFactory XML_FACTORY;
- static {
- XML_FACTORY = XMLOutputFactory.newFactory();
- XML_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
- }
- SchemaContext schemaContext;
- public YangOdlNN2XMLImpl(SchemaContext schemaContext){
- this.schemaContext=schemaContext;
- }
- //general for contain/listitem/rpc/notification
- public String yangNNtoXML(String uriPath,NormalizedNode nn) throws Exception {
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(uriPath);
- SchemaNode snode = YangDataTransformJava2NNServiceImpl.findSchemaNode(iicontext, nn.getNodeType().getLocalName());
- String strx = snode.toString();
- SchemaPath path = snode.getPath();
- int it=uriPath.lastIndexOf("/");
- if (strx.contains("container ")&&(it<0)) {
- // path = SchemaPath.create(true);
- }
- String sxml =writeNormalizedNodetoXml(nn,path,schemaContext);
- return sxml;
- }
- public static String writeNormalizedNodetoXml(final NormalizedNode<?, ?> cn,
- final SchemaPath schemaPath, final SchemaContext schemaContext)
- {
-
- String serializationResultXMLString = null;
- try {
- //nn2xml
- final Document doc = XmlDocumentUtils.getDocument();
- final DOMResult serializationResult = new DOMResult(doc);
- writeNormalizedNode(cn,serializationResult,schemaPath, schemaContext);
- serializationResultXMLString = toString(serializationResult.getNode());
- } catch (IOException |XMLStreamException e) {
- e.printStackTrace();
- }
- return serializationResultXMLString;
- }
- public static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result,
- final SchemaPath schemaPath, final SchemaContext context) throws IOException, XMLStreamException {
- NormalizedNodeWriter normalizedNodeWriter = null;
- NormalizedNodeStreamWriter normalizedNodeStreamWriter = null;
- XMLStreamWriter writer = null;
- try {
- writer = XML_FACTORY.createXMLStreamWriter(result);
- normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, context, schemaPath);
- normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(normalizedNodeStreamWriter);
-
- normalizedNodeWriter.write(normalized);
-
- normalizedNodeWriter.flush();
- } finally {
- if (normalizedNodeWriter != null) {
- normalizedNodeWriter.close();
- }
- if (normalizedNodeStreamWriter != null) {
- normalizedNodeStreamWriter.close();
- }
- if (writer != null) {
- writer.close();
- }
- }
- }
- public static String toString(final Node xml) {
- try {
- final Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
- final StreamResult result = new StreamResult(new StringWriter());
- final DOMSource source = new DOMSource(xml);
- transformer.transform(source, result);
- return result.getWriter().toString();
- } catch (IllegalArgumentException | TransformerFactoryConfigurationError | TransformerException e) {
- throw new RuntimeException("Unable to serialize xml element " + xml, e);
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNNC2XMLImpl.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNNC2XMLImpl.java
deleted file mode 100644
index 023a4a2d4d..0000000000
--- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/YangOdlNNC2XMLImpl.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.openecomp.mso.yangDecoder.transform.impl;
-
-import com.google.common.base.Charsets;
-import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeXmlBodyWriter;
-import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
-import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
-import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
-import org.opendaylight.netconf.sal.restconf.impl.WriterParameters;
-
-import javax.ws.rs.core.MediaType;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Field;
-
-public class YangOdlNNC2XMLImpl {
- final static MediaType mediaType=getMediaType();
- static protected MediaType getMediaType() {
- return new MediaType(MediaType.APPLICATION_XML, null);
- }
- static Field requestField=getprettyPrintField();
-
- private static Field getprettyPrintField( )
- {
- Field rf=null;
- try {
- rf = WriterParameters.class.getDeclaredField("prettyPrint");
- rf.setAccessible(true);
- } catch (NoSuchFieldException | SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return rf;
- }
- public static String getXMLHeader()
- {
- return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"+NormalizedNodePrinter.getEndl();
- }
- public static String toXML(final NormalizedNodeContext normalizedNodeContext) throws Exception
- {
- final NormalizedNodeXmlBodyWriter xmlBodyWriter = new NormalizedNodeXmlBodyWriter();
- final OutputStream output = new ByteArrayOutputStream();
- requestField.set(normalizedNodeContext.getWriterParameters(), true);
- output.write(getXMLHeader().getBytes(Charsets.UTF_8));
- xmlBodyWriter.writeTo(normalizedNodeContext, null, null, null,
- mediaType, null, output);
- final String outputXML = output.toString();
- return outputXML;
- }
-
- public static NormalizedNodeContext fromXML(String uriPath,final String xmlpayload,boolean ispost) throws Exception
- {
- final InstanceIdentifierContext<?> iicontext = ControllerContext.getInstance().toInstanceIdentifier(uriPath);
- InputStream inputStream = new ByteArrayInputStream(xmlpayload.getBytes(Charsets.UTF_8));
- XmlNormalizedNodeBodyReaderUmeImpl xmlBodyReader = new XmlNormalizedNodeBodyReaderUmeImpl();
- xmlBodyReader.Set(iicontext, ispost);
-// final NormalizedNodeContext returnValue = xmlBodyReader.readFrom(iicontext, inputStream);
- final NormalizedNodeContext returnValue = xmlBodyReader.readFrom(null,
- null, null, mediaType, null, inputStream);
- return returnValue;
- }
-
-}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java
index f63e12910c..27a310fd2d 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/BpmnRequest.java
@@ -40,11 +40,7 @@ import org.openecomp.mso.apihandler.common.CommonConstants;
CommonConstants.REQUEST_DETAILS_VARIABLE})
@JsonRootName(CommonConstants.CAMUNDA_ROOT_INPUT)
public class BpmnRequest {
-
- public BpmnRequest() {
-
- }
-
+
@JsonProperty(CommonConstants.CAMUNDA_HOST)
private CamundaInput host;
@@ -89,8 +85,11 @@ public class BpmnRequest {
@JsonProperty(CommonConstants.REQUEST_DETAILS_VARIABLE)
private CamundaInput requestDetails;
-
-
+
+ public BpmnRequest() {
+ /* Empty constructor */
+
+ }
@JsonProperty(CommonConstants.CAMUNDA_HOST)
public CamundaInput getHost() {
@@ -246,9 +245,7 @@ public class BpmnRequest {
@Override
public String toString() {
- //return "CamundaRequest [requestId=" + + ", host="
- // + host + ", schema=" + schema + ", reqid=" + reqid + ", svcid="
- // + svcid + ", timeout=" + timeout + "]";
+
return "BpmnRequest";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java
index 7c882bea1b..f73829688c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaBpmnRequestInput.java
@@ -21,7 +21,6 @@
package org.openecomp.mso.apihandler.camundabeans;
import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonRootName;
import org.openecomp.mso.apihandler.common.CommonConstants;
@@ -38,6 +37,7 @@ public class CamundaBpmnRequestInput {
public CamundaBpmnRequestInput() {
+ /* Empty constructor */
}
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java
index 8a90db675c..0c69a76b14 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaInput.java
@@ -22,7 +22,6 @@ package org.openecomp.mso.apihandler.camundabeans;
import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.annotate.JsonRootName;
import org.openecomp.mso.apihandler.common.CommonConstants;
@@ -42,6 +41,7 @@ public class CamundaInput {
public CamundaInput() {
+ /* Empty constructor */
}
@JsonProperty(CommonConstants.CAMUNDA_VALUE)
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
index c4ded174ba..e3c7cda3bd 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/MockRequestsDatabase.java
@@ -60,10 +60,10 @@ public class MockRequestsDatabase {
InfraActiveRequests returnRecord = null;
if (record != null) {
String requestAction = record.getRequestAction();
- if (requestAction == null || !requestAction.equals("GetLayer3ServiceDetailsRequest")) {
+ if (!"GetLayer3ServiceDetailsRequest".equals(requestAction)) {
String status = record.getRequestStatus();
- if (status != null && status.equals("COMPLETED")) {
- return returnRecord = record;
+ if ("COMPLETED".equals(status)) {
+ returnRecord = record;
}
}
}
diff --git a/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json b/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json
index 5552efe6a5..3d24819c2f 100644
--- a/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json
+++ b/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json
@@ -59,7 +59,10 @@
"https://localhost:8443/restconf/operations/Firewall-API:",
"https://localhost:8443/restconf/config",
"https://localhost:8443/restconf/operations/VNF-API:",
- "https://localhost:8443/restconf/operations/NBNC-API:"
+ "https://localhost:8443/restconf/operations/NBNC-API:",
+ "https://localhost:8443/restconf/operations/NORTHBOUND-API:service-topology-operation",
+ "https://localhost:8443/restconf/operations/GENERIC-RESOURCE-API:",
+ "https://localhost:8443/restconf/operations/VNFTOPOLOGYAIC-API:"
],
"bpelurl": "http://mso:8080/mso/SDNCAdapterCallbackService",
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
index 2e227bef0d..8238923139 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final
@@ -81,6 +81,12 @@ COPY ./maven/artifacts/* $JBOSS_HOME/standalone/deployments/
RUN mkdir -p /etc/mso/config.d/ASDC && chown -R jboss:jboss /etc/mso/config.d/ASDC && chmod u+xrw /etc/mso/config.d/ASDC
+## Install heatbridge
+RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip
+RUN mkdir /opt/mso/heatbridge
+COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge
+RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
+
### Open Ports
EXPOSE 8080
diff --git a/packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl b/packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
new file mode 100644
index 0000000000..357a669c1a
--- /dev/null
+++ b/packages/docker/src/main/docker/docker-files/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
Binary files differ