From 94ee92559b051f2f82ed681f841f4f13016842ed Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Tue, 2 May 2017 03:53:18 -0700 Subject: [MSO-8] Second step of the rebase for MSO Second rebase containing additional features for MSO + total reworking of the BPMN structure + Notification flow can now be added at the end of some BPMN flows Change-Id: I7e937c7a0ba1593ca85e164a093f79c7e38b6ce0 Signed-off-by: Determe, Sebastien (sd378r) --- .../mso/adapters/network/MsoNetworkAdapter.java | 9 ++++- .../adapters/network/MsoNetworkAdapterAsync.java | 11 +++-- .../network/MsoNetworkAdapterAsyncImpl.java | 11 +++-- .../adapters/network/MsoNetworkAdapterImpl.java | 47 +++++++++++++++++++--- .../mso/adapters/network/NetworkAdapterRest.java | 9 ++++- 5 files changed, 71 insertions(+), 16 deletions(-) (limited to 'adapters/mso-network-adapter/src/main') diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java index 4f6fc3ca7f..01f2e752e4 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java @@ -7,9 +7,9 @@ * 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. @@ -50,6 +50,7 @@ public interface MsoNetworkAdapter public void createNetwork (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") String physicalNetworkName, @WebParam(name="vlans") List vlans, @@ -67,6 +68,7 @@ public interface MsoNetworkAdapter public void createNetworkContrail (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="routeTargets") List routeTargets, @WebParam(name="shared") String shared, @@ -92,6 +94,7 @@ public interface MsoNetworkAdapter public void updateNetwork (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkId") @XmlElement(required=true) String networkId, @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") @XmlElement(required=true) String physicalNetworkName, @@ -106,6 +109,7 @@ public interface MsoNetworkAdapter public void updateNetworkContrail (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkId") @XmlElement(required=true) String networkId, @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="routeTargets") List routeTargets, @@ -199,6 +203,7 @@ public interface MsoNetworkAdapter public void deleteNetwork (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkId") @XmlElement(required=true) String networkId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="networkDeleted", mode=Mode.OUT) Holder networkDeleted) diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java index 99394f2256..e5152578bb 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java @@ -7,9 +7,9 @@ * 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. @@ -49,6 +49,7 @@ public interface MsoNetworkAdapterAsync public void createNetworkA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") String physicalNetworkName, @WebParam(name="vlans") List vlans, @@ -58,12 +59,13 @@ public interface MsoNetworkAdapterAsync @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); - + @WebMethod @Oneway public void updateNetworkA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkId") @XmlElement(required=true) String networkId, @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") @XmlElement(required=true) String physicalNetworkName, @@ -87,6 +89,7 @@ public interface MsoNetworkAdapterAsync public void deleteNetworkA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="networkType") @XmlElement(required=true) String networkType, + @WebParam(name="modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name="networkId") @XmlElement(required=true) String networkId, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @@ -97,7 +100,7 @@ public interface MsoNetworkAdapterAsync public void rollbackNetworkA (@WebParam(name="rollback") @XmlElement(required=true) NetworkRollback rollback, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); - + @WebMethod public void healthCheckA (); } diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java index 11b16365d9..c643443791 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -7,9 +7,9 @@ * 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. @@ -105,6 +105,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { public void createNetworkA (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkName, String physicalNetworkName, List vlans, @@ -140,6 +141,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { networkAdapter.createNetwork (cloudSiteId, tenantId, networkType, + modelCustomizationUuid, networkName, physicalNetworkName, vlans, @@ -222,6 +224,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { public void updateNetworkA (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkId, String networkName, String physicalNetworkName, @@ -255,6 +258,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { networkAdapter.updateNetwork (cloudSiteId, tenantId, networkType, + modelCustomizationUuid, networkId, networkName, physicalNetworkName, @@ -416,6 +420,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { public void deleteNetworkA (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkId, String messageId, MsoRequest msoRequest, @@ -435,7 +440,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Holder networkDeleted = new Holder (); try { - networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, networkId, msoRequest, networkDeleted); + networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted); MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java index c1c351916c..e9288ab408 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java @@ -117,6 +117,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { public void createNetwork (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkName, String physicalNetworkName, List vlans, @@ -132,6 +133,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { createNetwork (cloudSiteId, tenantId, networkType, + modelCustomizationUuid, networkName, physicalNetworkName, vlans, @@ -155,6 +157,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { public void createNetworkContrail (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkName, List routeTargets, String shared, @@ -173,6 +176,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { createNetwork (cloudSiteId, tenantId, networkType, + modelCustomizationUuid, networkName, null, null, @@ -224,6 +228,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private void createNetwork (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkName, String physicalNetworkName, List vlans, @@ -260,6 +265,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkRollback.setCloudId (cloudSiteId); networkRollback.setTenantId (tenantId); networkRollback.setMsoRequest (msoRequest); + networkRollback.setModelCustomizationUuid(modelCustomizationUuid); // tenant query is not required here. // If the tenant doesn’t exist, the Heat calls will fail anyway (when the HeatUtils try to obtain a token). @@ -289,6 +295,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { NetworkResource networkResource = networkCheck (db, startTime, networkType, + modelCustomizationUuid, networkName, physicalNetworkName, vlans, @@ -661,6 +668,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { public void updateNetwork (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkId, String networkName, String physicalNetworkName, @@ -672,6 +680,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { updateNetwork (cloudSiteId, tenantId, networkType, + modelCustomizationUuid, networkId, networkName, physicalNetworkName, @@ -692,6 +701,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { public void updateNetworkContrail (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkId, String networkName, List routeTargets, @@ -706,6 +716,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { updateNetwork (cloudSiteId, tenantId, networkType, + modelCustomizationUuid, networkId, networkName, null, @@ -750,6 +761,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private void updateNetwork (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkId, String networkName, String physicalNetworkName, @@ -806,6 +818,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { NetworkResource networkResource = networkCheck(db, startTime, networkType, + modelCustomizationUuid, networkName, physicalNetworkName, vlans, @@ -1116,16 +1129,24 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private NetworkResource networkCheck (CatalogDatabase db, long startTime, String networkType, + String modelCustomizationUuid, String networkName, String physicalNetworkName, List vlans, List routeTargets, CloudSite cloudSite) throws NetworkException { // Retrieve the Network Resource definition - NetworkResource networkResource = db.getNetworkResource (networkType); + NetworkResource networkResource = null; + if (isNullOrEmpty(modelCustomizationUuid)) { + networkResource = db.getNetworkResource (networkType); + } + else + { + networkResource = db.getNetworkResourceByModelCustUuid(modelCustomizationUuid); + } if (networkResource == null) { - String error = "CreateNetwork: Unknown Network Type: " + networkType; - LOGGER.error (MessageEnum.RA_UNKOWN_PARAM, "Network Type", networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "CreateNetwork: Unknown Network Type"); + String error = "Create/UpdateNetwork: Unable to get network resource with NetworkType:" + networkType + " or ModelCustomizationUUID:" + modelCustomizationUuid ; + LOGGER.error (MessageEnum.RA_UNKOWN_PARAM, "NetworkType/ModelCustomizationUUID", networkType + "/" + modelCustomizationUuid, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create/UpdateNetwork: Unknown NetworkType/ModelCustomizationUUID"); throw new NetworkException (error, MsoExceptionCategory.USERDATA); } @@ -1424,6 +1445,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { public void deleteNetwork (String cloudSiteId, String tenantId, String networkType, + String modelCustomizationUuid, String networkId, MsoRequest msoRequest, Holder networkDeleted) throws NetworkException { @@ -1453,7 +1475,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } // Retrieve the Network Resource definition - NetworkResource networkResource = db.getNetworkResource (networkType); + NetworkResource networkResource = null; + if (isNullOrEmpty(modelCustomizationUuid)) { + networkResource = db.getNetworkResource (networkType); + } + else if (!isNullOrEmpty(networkType)) + { + networkResource = db.getNetworkResourceByModelCustUuid(modelCustomizationUuid); + } String mode = ""; if (networkResource != null) { LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); @@ -1562,6 +1591,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String tenantId = rollback.getTenantId (); String networkId = rollback.getNetworkStackId (); String networkType = rollback.getNetworkType (); + String modelCustomizationUuid = rollback.getModelCustomizationUuid(); LOGGER.debug ("*** ROLLBACK Network " + networkId + " in " + cloudSiteId + "/" + tenantId); @@ -1573,7 +1603,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { try { // Retrieve the Network Resource definition - NetworkResource networkResource = db.getNetworkResource (networkType); + NetworkResource networkResource = null; + if (isNullOrEmpty(modelCustomizationUuid)) { + networkResource = db.getNetworkResource (networkType); + } + else + { + networkResource = db.getNetworkResourceByModelCustUuid(modelCustomizationUuid); + } String mode = ""; if (networkResource != null) { diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java index c813534212..18d55096e4 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java @@ -7,9 +7,9 @@ * 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. @@ -162,6 +162,7 @@ public class NetworkAdapterRest { req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkName(), req.getContrailNetwork().getRouteTargets(), req.getContrailNetwork().getShared(), @@ -187,6 +188,7 @@ public class NetworkAdapterRest { req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), req.getProviderVlanNetwork().getVlans(), @@ -298,6 +300,7 @@ public class NetworkAdapterRest { req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getMsoRequest(), networkDeleted); @@ -538,6 +541,7 @@ public class NetworkAdapterRest { req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), req.getContrailNetwork().getRouteTargets(), @@ -559,6 +563,7 @@ public class NetworkAdapterRest { req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), -- cgit 1.2.3-korg