diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai')
16 files changed, 0 insertions, 938 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java deleted file mode 100644 index 4d97c4df71..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java +++ /dev/null @@ -1,91 +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.client.aai; - -import java.io.IOException; - -import javax.annotation.Priority; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.ForbiddenException; -import javax.ws.rs.InternalServerErrorException; -import javax.ws.rs.NotAcceptableException; -import javax.ws.rs.NotAllowedException; -import javax.ws.rs.NotAuthorizedException; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.NotSupportedException; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; - -import org.openecomp.mso.client.aai.entities.AAIError; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Provider -@Priority(value = 1) -public class AAIClientResponseExceptionMapper implements ClientResponseFilter { - - @Override - public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { - if (responseContext.getStatus() != Response.Status.OK.getStatusCode() && responseContext.hasEntity()) { - AAIError error = new ObjectMapper().readValue(responseContext.getEntityStream(), AAIError.class); - String message = error.getRequestError().getServiceException().getText(); - - Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus()); - WebApplicationException webAppException; - switch (status) { - case BAD_REQUEST: - webAppException = new BadRequestException(message); - break; - case UNAUTHORIZED: - webAppException = new NotAuthorizedException(message); - break; - case FORBIDDEN: - webAppException = new ForbiddenException(message); - break; - case NOT_FOUND: - webAppException = new NotFoundException(message); - break; - case METHOD_NOT_ALLOWED: - webAppException = new NotAllowedException(message); - break; - case NOT_ACCEPTABLE: - webAppException = new NotAcceptableException(message); - break; - case UNSUPPORTED_MEDIA_TYPE: - webAppException = new NotSupportedException(message); - break; - case INTERNAL_SERVER_ERROR: - webAppException = new InternalServerErrorException(message); - break; - case SERVICE_UNAVAILABLE: - webAppException = new WebApplicationException(message); - break; - default: - webAppException = new WebApplicationException(message); - } - throw webAppException; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java deleted file mode 100644 index b15059e87b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java +++ /dev/null @@ -1,49 +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.client.aai; - -import javax.ws.rs.ext.ContextResolver; -import javax.ws.rs.ext.Provider; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@Provider -public class AAICommonObjectMapperProvider implements ContextResolver<ObjectMapper> { - - final ObjectMapper mapper; - - public AAICommonObjectMapperProvider() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); - } - - @Override - public ObjectMapper getContext(Class<?> type) { - return mapper; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java deleted file mode 100644 index f261408c83..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.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.client.aai; - -import javax.ws.rs.ext.Provider; - -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; -import com.fasterxml.jackson.databind.type.TypeFactory; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; - -@Provider -public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider { - - public AAIQueryObjectMapperProvider() { - super(); - AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); - AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); - // first Jaxb, second Jackson annotations - mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); - - } - - @Override - public ObjectMapper getContext(Class<?> type) { - return mapper; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java deleted file mode 100644 index a10225956b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java +++ /dev/null @@ -1,38 +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.client.aai; - -import javax.ws.rs.ext.Provider; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Provider -public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider { - - public AAIResourcesObjectMapperProvider() { - super(); - } - - @Override - public ObjectMapper getContext(Class<?> type) { - return mapper; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java deleted file mode 100644 index 214be060e3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java +++ /dev/null @@ -1,40 +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.client.aai; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.List; - -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pserver; -import org.onap.aai.domain.yang.Pservers; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -public interface AAIRestClient { - -Pservers getPhysicalServers(String hostName, String uuid); -List<Pserver> getPhysicalServerByVnfId(String vnfId, String transactionLoggingUuid) throws UnsupportedEncodingException, JsonParseException, JsonMappingException, IOException; -void updateMaintenceFlag(String vnfId,boolean inMaint, String transactionLoggingUuid) throws JsonParseException, JsonMappingException, IOException; -void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws JsonParseException, JsonMappingException , IOException; -GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws JsonParseException, JsonMappingException , IOException; -} 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 deleted file mode 100644 index af1eddf491..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java +++ /dev/null @@ -1,179 +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.client.aai; - -import java.io.File; -import java.io.IOException; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.net.ssl.SSLContext; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; - -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.GenericVnfs; -import org.onap.aai.domain.yang.Pserver; -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.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class AAIRestClientImpl implements AAIRestClient { - - private final WebTarget webTarget; - - 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_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(" - + ".out(‘has’).has(‘aai-node-type’,’vf-module’).store(‘x’),out(‘uses’).has(‘aai-node-type’,’volume-group’).store(‘x’)," - + ".out(‘hasLInterface’).has(‘aai-node-type’,’l-interface’).union(" - + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv4-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’)," - + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv6-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’)" - + ")," + ".out(‘runsOnVserver’).has(‘aai-node-type’,’vserver’).store(‘x’).union(" - + ".in(‘owns’).has(‘aai-node-type’,’tenant’).store(‘x’).in(‘has’).has(‘aai-node-type’,’cloud-region’).store(‘x’)," - + ".out(‘runsOnPserver’).has(‘aai-node-type’,’pserver’).store(‘x’)," - + ".out(‘hasLInterface’).has(‘aai-node-type’,’l-interface’).union(" - + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv4-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’)," - + ".out(‘hasIpAddress’).has(‘aai-node-type’,’l3-interface-ipv6-address’).store(‘x’).out(‘isMemberOf’).has(‘aai-node-type’,’l3-network’).store(‘x’)" - + ")" + ")" + ")" + ").cap(‘x’).unfold().dedup()"; - - public AAIRestClientImpl() throws NoSuchAlgorithmException { - - Logger logger = Logger.getLogger(getClass().getName()); - Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - Client client = this.getSSLClient(); - webTarget = client.register(logger).register(new AAIClientResponseExceptionMapper()) - .target(properties.get("aai.endpoint") + "/aai"); - } - - public AAIRestClientImpl(final String host) throws NoSuchAlgorithmException { - Logger logger = Logger.getLogger(getClass().getName()); - Client client = this.getSSLClient(); - webTarget = client.register(logger).register(new AAIClientResponseExceptionMapper()).target(host + "/aai"); - } - - @Override - public Pservers getPhysicalServers(String hostName, String uuid) { - return webTarget.register(AAIResourcesObjectMapperProvider.class).path(ENDPOINT_GET_ALL).request() - .header("X-FromAppId", "MSO").header("X-TransactionId", uuid) - .header("Content-Type", MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON_TYPE).get() - .readEntity(Pservers.class); - } - - @Override - public List<Pserver> getPhysicalServerByVnfId(String vnfId, String transactionLoggingUuid) - throws JsonParseException, JsonMappingException, IOException { - 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") - .header("X-TransactionId", transactionLoggingUuid) - .header("Content-Type", MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON_TYPE) - .put(Entity.entity(new CustomQuery(startNodes, PSERVER_VNF_QUERY), MediaType.APPLICATION_JSON)) - .readEntity(String.class); - - - return this.getListOfPservers(jsonInput); - } - - protected List<Pserver> getListOfPservers(String jsonInput) throws JsonParseException, JsonMappingException, IOException - { - ObjectMapper mapper = new AAIQueryObjectMapperProvider().getContext(Object.class); - Results<Map<String, Pserver>> resultsFromJson = mapper.readValue(jsonInput, - new TypeReference<Results<Map<String, Pserver>>>() { - }); - List<Pserver> results = new ArrayList<>(); - for (Map<String, Pserver> m : resultsFromJson.getResult()) { - results.add(m.get("pserver")); - } - return results; - } - - protected List<Pserver> getListOfPservers(File jsonInput) throws JsonParseException, JsonMappingException, IOException - { - ObjectMapper mapper = new AAIQueryObjectMapperProvider().getContext(Object.class); - Results<Map<String, Pserver>> resultsFromJson = mapper.readValue(jsonInput, - new TypeReference<Results<Map<String, Pserver>>>() { - }); - List<Pserver> results = new ArrayList<>(); - for (Map<String, Pserver> m : resultsFromJson.getResult()) { - results.add(m.get("pserver")); - } - return results; - } - - @Override - public void updateMaintenceFlag(String vnfName, boolean inMaint, String transactionLoggingUuid) throws JsonParseException, JsonMappingException, IOException { - GenericVnfs genericVnfs = webTarget.register(AAIResourcesObjectMapperProvider.class).path(ENDPOINT_GET_ALL_VNFS) - .queryParam("vnf-name", vnfName).request().header("X-FromAppId", "MSO") - .header("X-TransactionId", transactionLoggingUuid).header("Content-Type", "application/json") - .accept(MediaType.APPLICATION_JSON_TYPE).get().readEntity(GenericVnfs.class); - - if (genericVnfs.getGenericVnf().size() > 1) - throw new IndexOutOfBoundsException ("Multiple Generic Vnfs Returned"); - - GenericVnf genericVnf = genericVnfs.getGenericVnf().get(0); - updateMaintenceFlagVnfId(genericVnf.getVnfId(), inMaint, transactionLoggingUuid); - } - - @Override - public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) - throws JsonParseException, JsonMappingException, IOException { - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setInMaint(inMaint); - webTarget.register(AAIResourcesObjectMapperProvider.class).path(GENERIC_VNF_PATH + "/" + vnfId).request() - .header("X-FromAppId", "MSO").header("X-TransactionId", transactionLoggingUuid) - .header("Content-Type", "application/merge-patch+json") - .header("Accept", MediaType.APPLICATION_JSON_TYPE).header("X-HTTP-Method-Override", "PATCH") - .put(Entity.entity(genericVnf, MediaType.valueOf("application/merge-patch+json"))); - } - - @Override - public GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws JsonParseException, JsonMappingException, IOException { - return webTarget.register(AAIResourcesObjectMapperProvider.class).path(GENERIC_VNF_PATH + "/" + vnfId).request() - .header("X-FromAppId", "MSO").header("X-TransactionId", transactionLoggingUuid) - .header("Content-Type", "application/json").accept(MediaType.APPLICATION_JSON_TYPE).get() - .readEntity(GenericVnf.class); - } - - protected Client getSSLClient() throws NoSuchAlgorithmException { - return ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java deleted file mode 100644 index 3bdcdc56a3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java +++ /dev/null @@ -1,31 +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.client.aai; - -import java.io.IOException; - -public interface AAIUpdator { - - void updateVnfToLocked(String vnfName, String uuid) throws IOException, Exception; - - void updateVnfToUnLocked(String vnfName, String uuid) throws IOException, Exception; - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java deleted file mode 100644 index 575a65fa0f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java +++ /dev/null @@ -1,49 +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.client.aai; - -import org.springframework.beans.factory.annotation.Autowired; - -public class AAIUpdatorImpl implements AAIUpdator { - - @Autowired - protected AAIRestClient client; - - public AAIRestClient getClient() { - return client; - } - - - public void setClient(AAIRestClient client) { - this.client = client; - } - - @Override - public void updateVnfToLocked(String vnfId, String uuid) throws Exception { - client.updateMaintenceFlagVnfId(vnfId, true, uuid); - } - - @Override - public void updateVnfToUnLocked(String vnfId, String uuid) throws Exception { - client.updateMaintenceFlagVnfId(vnfId, false, uuid); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java deleted file mode 100644 index 117ec42a36..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java +++ /dev/null @@ -1,32 +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.client.aai; - -import java.io.IOException; - -public interface AAIValidator { - - boolean isPhysicalServerLocked(String hostName, String transactionLoggingUuid) throws IOException; - - boolean isVNFLocked(String vnfId, String transactionLoggingUuid) throws IOException, Exception; - - -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java deleted file mode 100644 index ce248f010c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java +++ /dev/null @@ -1,71 +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.client.aai; - -import java.io.IOException; -import java.util.List; - -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pserver; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - - -@Service -public class AAIValidatorImpl implements AAIValidator { - - - @Autowired - protected AAIRestClient client; - - public AAIRestClient getClient() { - return client; - } - - - public void setClient(AAIRestClient client) { - this.client = client; - } - - @Override - public boolean isPhysicalServerLocked(String vnfId, String transactionLoggingUuid) throws IOException { - List<Pserver> pservers; - boolean isLocked = false; - pservers = client.getPhysicalServerByVnfId(vnfId, transactionLoggingUuid); - for (Pserver pserver : pservers) - if (pserver.isInMaint()) - isLocked = true; - - return isLocked; - } - - @Override - public boolean isVNFLocked(String vnfId, String transactionLoggingUuid) throws Exception { - boolean isLocked = false; - GenericVnf genericVnf = client.getVnfByName(vnfId, transactionLoggingUuid); - if (genericVnf.isInMaint()) - isLocked = true; - - return isLocked; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java deleted file mode 100644 index eb0fb48678..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java +++ /dev/null @@ -1,25 +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.client.aai.entities; - -public class AAIEntity { - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java deleted file mode 100644 index 5f895ef862..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java +++ /dev/null @@ -1,46 +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.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "requestError" -}) -public class AAIError { - - @JsonProperty("requestError") - private RequestError requestError; - - @JsonProperty("requestError") - public RequestError getRequestError() { - return requestError; - } - - @JsonProperty("requestError") - public void setRequestError(RequestError requestError) { - this.requestError = requestError; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java deleted file mode 100644 index fab8d64e09..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.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.client.aai.entities; - -import java.io.UnsupportedEncodingException; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; - - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class CustomQuery { - - List<String> start; - - public String getGremlin() { - return gremlin; - } - - public void setGremlin(String gremlin) { - this.gremlin = gremlin; - } - String query; - String gremlin; - - public CustomQuery(List<String>start, String query){ - this.start=start; - this.query= "query/" + query; - } - - public CustomQuery(String gremlin) throws UnsupportedEncodingException{ - this.gremlin=gremlin; - } - - public List<String> getStart() { - return start; - } - - public void setStart(List<String> start) { - this.start = start; - } - - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java deleted file mode 100644 index 2fd3572401..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java +++ /dev/null @@ -1,46 +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.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "serviceException" -}) -public class RequestError { - - @JsonProperty("serviceException") - private ServiceException serviceException; - - @JsonProperty("serviceException") - public ServiceException getServiceException() { - return serviceException; - } - - @JsonProperty("serviceException") - public void setServiceException(ServiceException serviceException) { - this.serviceException = serviceException; - } - -} 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 deleted file mode 100644 index aea223da56..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/Results.java +++ /dev/null @@ -1,53 +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.client.aai.entities; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "results" -}) -@XmlRootElement(name = "results") -public class Results<T> { - - @XmlElement(name="results") - protected List<T> result; - - public List<T> getResult() { - if (result == null) { - result = new ArrayList<>(); - } - return this.result; - } - - public void setResult(List<T> result) { - this.result=result; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java deleted file mode 100644 index 5ae1d5242b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java +++ /dev/null @@ -1,73 +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.client.aai.entities; - -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "messageId", - "text", - "variables" -}) -public class ServiceException { - - @JsonProperty("messageId") - private String messageId; - @JsonProperty("text") - private String text; - @JsonProperty("variables") - private List<String> variables = null; - - @JsonProperty("messageId") - public String getMessageId() { - return messageId; - } - - @JsonProperty("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - @JsonProperty("text") - public String getText() { - return text; - } - - @JsonProperty("text") - public void setText(String text) { - this.text = text; - } - - @JsonProperty("variables") - public List<String> getVariables() { - return variables; - } - - @JsonProperty("variables") - public void setVariables(List<String> variables) { - this.variables = variables; - } - -} |