From 781b1a6df324419c846c84ea983c18fc8362bfd3 Mon Sep 17 00:00:00 2001 From: Patrick Brady Date: Wed, 13 Dec 2017 11:19:06 -0800 Subject: Third part of onap rename This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady Issue-ID: APPC-13 --- .../onap/appc/dg/licmgr/LicenseManagerPlugin.java | 55 ++++++++ .../dg/licmgr/impl/LicenseManagerPluginImpl.java | 148 +++++++++++++++++++++ .../appc/dg/licmgr/LicenseManagerPlugin.java | 55 -------- .../dg/licmgr/impl/LicenseManagerPluginImpl.java | 148 --------------------- 4 files changed, 203 insertions(+), 203 deletions(-) create mode 100644 appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/LicenseManagerPlugin.java create mode 100644 appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java delete mode 100644 appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/LicenseManagerPlugin.java delete mode 100644 appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java (limited to 'appc-dg/appc-dg-shared/appc-dg-license-manager') diff --git a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/LicenseManagerPlugin.java b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/LicenseManagerPlugin.java new file mode 100644 index 000000000..cfe263ff9 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/LicenseManagerPlugin.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.dg.licmgr; + +import java.util.Map; + +import org.onap.appc.exceptions.APPCException; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; + + +public interface LicenseManagerPlugin extends SvcLogicJavaPlugin { + /** + * Retrieves license model from APPC database and populate flags into svc context + * @param params map with parameters: + * org.onap.appc.vftype - the vnf type / service type; + * org.onap.appc.resource-version - the vnf version / service version + * @param ctx service logic context + * 1. supposed properties already in context: + * aai.input.data.entitlement-assignment-group-uuid - entitlement-group-uuid asset tag already stored in AAI + * aai.input.data.license-assignment-group-uuid - license-key-uuid asset tag already stored in AAI + * 2. properties and flags stored in context after bean execution: + * model.entitlement.pool.uuid - entitlement-group-uuid from license model + * model.license.key.uuid - license-key-uuid from license model + * is.acquire-entitlement.require + * is.release-entitlement.require + * is.acquire-license.require + * is.release-license.require + * + * @throws APPCException throws in case of any error + */ + void retrieveLicenseModel(Map params, SvcLogicContext ctx) throws APPCException; +} diff --git a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java new file mode 100644 index 000000000..4a72c2358 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java @@ -0,0 +1,148 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.onap.appc.dg.licmgr.impl; + +import java.util.Map; + +import org.onap.appc.dg.licmgr.LicenseManagerPlugin; +import org.onap.appc.exceptions.APPCException; +import org.onap.appc.licmgr.Constants; +import org.onap.appc.licmgr.LicenseManager; +import org.onap.appc.licmgr.exception.DataAccessException; +import org.onap.appc.licmgr.objects.LicenseModel; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + + + +public class LicenseManagerPluginImpl implements LicenseManagerPlugin { + + private static EELFLogger logger = EELFManager.getInstance().getApplicationLogger(); + + // populated by blueprint framework + private LicenseManager licenseManager; + + public void setLicenseManager(LicenseManager licenseManager) { + this.licenseManager = licenseManager; + } + + /** + * Retrieves license model from APPC database and populate flags into svc context + * @param params map with parameters: + * org.onap.appc.vftype - the vnf type / service type; + * org.onap.appc.resource-version - the vnf version / service version + * @param ctx service logic context + * 1. supposed properties already in context: + * aai.input.data.entitlement-assignment-group-uuid - entitlement-group-uuid asset tag already stored in AAI + * aai.input.data.license-assignment-group-uuid - license-key-uuid asset tag already stored in AAI + * 2. properties and flags stored in context after bean execution: + * model.entitlement.pool.uuid - entitlement-group-uuid from license model + * model.license.key.uuid - license-key-uuid from license model + * is.acquire-entitlement.require + * is.release-entitlement.require + * is.acquire-license.require + * is.release-license.require + * is.aai-entitlement-update.require + * is.aai-license-update.require + * + * @throws APPCException throws in case of any error + */ + @Override + public void retrieveLicenseModel(Map params, SvcLogicContext ctx) throws APPCException { + + try { + + LicenseModel licenseModel = licenseManager.retrieveLicenseModel(params.get(Constants.VNF_TYPE_FIELD_NAME), params.get(Constants.VNF_RESOURCE_VERSION_FIELD_NAME)); + + String modelEntitlementPoolUuid = licenseModel.getEntitlementPoolUuid(); if (null == modelEntitlementPoolUuid) modelEntitlementPoolUuid = ""; + String aaiEntitlementPoolUuid = ctx.getAttribute(Constants.AAI_ENTITLMENT_POOL_UUID_NAME); if (null == aaiEntitlementPoolUuid) aaiEntitlementPoolUuid = ""; + boolean isAcquireEntitlementRequire = !modelEntitlementPoolUuid.isEmpty() && !modelEntitlementPoolUuid.equals(aaiEntitlementPoolUuid); + boolean isReleaseEntitlementRequire = !aaiEntitlementPoolUuid.isEmpty() && (isAcquireEntitlementRequire || modelEntitlementPoolUuid.isEmpty()); + boolean isAAIEntitlementUpdateRequire = isAcquireEntitlementRequire || isReleaseEntitlementRequire; + ctx.setAttribute(Constants.MODEL_ENTITLMENT_POOL_UUID_NAME, modelEntitlementPoolUuid); + ctx.setAttribute(Constants.IS_ACQUIRE_ENTITLEMENT_REQUIRE, Boolean.toString(isAcquireEntitlementRequire)); + ctx.setAttribute(Constants.IS_RELEASE_ENTITLEMENT_REQUIRE, Boolean.toString(isReleaseEntitlementRequire)); + ctx.setAttribute(Constants.IS_AAI_ENTITLEMENT_UPDATE_REQUIRE, Boolean.toString(isAAIEntitlementUpdateRequire)); + + + String modelLicenseKeyGroupUuid = licenseModel.getLicenseKeyGroupUuid(); if (null == modelLicenseKeyGroupUuid) modelLicenseKeyGroupUuid = ""; + String aaiLicenseKeyGroupUuid = ctx.getAttribute(Constants.AAI_LICENSE_KEY_UUID_NAME); if (null == aaiLicenseKeyGroupUuid) aaiLicenseKeyGroupUuid = ""; + String aaiLicenseKeyValue = ctx.getAttribute(Constants.AAI_LICENSE_KEY_VALUE); if (null == aaiLicenseKeyValue) aaiLicenseKeyValue = ""; + boolean isAcquireLicenseRequire = !modelLicenseKeyGroupUuid.isEmpty() && !modelLicenseKeyGroupUuid.equals(aaiLicenseKeyGroupUuid); + boolean isReleaseLicenseRequire = !aaiLicenseKeyGroupUuid.isEmpty() && (isAcquireLicenseRequire || modelLicenseKeyGroupUuid.isEmpty()); + boolean isAAILicenseUpdateRequire = isAcquireLicenseRequire || isReleaseLicenseRequire; + ctx.setAttribute(Constants.MODEL_LICENSE_KEY_UUID_NAME, modelLicenseKeyGroupUuid); + ctx.setAttribute(Constants.IS_ACQUIRE_LICENSE_REQUIRE, Boolean.toString(isAcquireLicenseRequire)); + ctx.setAttribute(Constants.IS_RELEASE_LICENSE_REQUIRE, Boolean.toString(isReleaseLicenseRequire)); + ctx.setAttribute(Constants.IS_AAI_LICENSE_UPDATE_REQUIRE, Boolean.toString(isAAILicenseUpdateRequire)); + + ctx.setAttribute("license-key", aaiLicenseKeyValue); + + } catch (DataAccessException le) { + logger.error("Error " + le.getMessage()); + ctx.setAttribute("output.status.message", le.getMessage()); + throw new APPCException(le); + } + + } + + + + //////// code uses jaxb license model, should be fixed + /* + final VfLicenseModel.FeatureGroupList featureGroupList = licenseModel.getFeatureGroupList(); + if (null != featureGroupList) { + final VfLicenseModel.FeatureGroupList.FeatureGroup featureGroup = featureGroupList.getFeatureGroup(); + if (null != featureGroup) { + final VfLicenseModel.FeatureGroupList.FeatureGroup.EntitlementPoolList + entitlementPoolList = featureGroup.getEntitlementPoolList(); + if (null != entitlementPoolList) { + final VfLicenseModel.FeatureGroupList.FeatureGroup.EntitlementPoolList.EntitlementPool + entitlementPool = entitlementPoolList.getEntitlementPool(); + if (null != entitlementPool) { + final String entitlementPoolUuid = entitlementPool.getEntitlementPoolUuid(); + // add entitlementPoolUuid into context + ctx.setAttribute(Constants.MODEL_ENTITLMENT_POOL_UUID_NAME, entitlementPoolUuid); + } + } + + final VfLicenseModel.FeatureGroupList.FeatureGroup.LicenseKeyGroupList + licenseKeyGroupList = featureGroup.getLicenseKeyGroupList(); + if (null != licenseKeyGroupList) { + final VfLicenseModel.FeatureGroupList.FeatureGroup.LicenseKeyGroupList.LicenseKeyGroup + licenseKeyGroup = licenseKeyGroupList.getLicenseKeyGroup(); + if (null != licenseKeyGroup) { + final String licenseKeyGroupUuid = licenseKeyGroup.getLicenseKeyGroupUuid(); + // add licenseKeyGroupUuid into context + ctx.setAttribute(Constants.MODEL_LICENSE_KEY_UUID_NAME, licenseKeyGroupUuid); + } + } + } + } + */ + + +} diff --git a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/LicenseManagerPlugin.java b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/LicenseManagerPlugin.java deleted file mode 100644 index cfe263ff9..000000000 --- a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/LicenseManagerPlugin.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.dg.licmgr; - -import java.util.Map; - -import org.onap.appc.exceptions.APPCException; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; - - -public interface LicenseManagerPlugin extends SvcLogicJavaPlugin { - /** - * Retrieves license model from APPC database and populate flags into svc context - * @param params map with parameters: - * org.onap.appc.vftype - the vnf type / service type; - * org.onap.appc.resource-version - the vnf version / service version - * @param ctx service logic context - * 1. supposed properties already in context: - * aai.input.data.entitlement-assignment-group-uuid - entitlement-group-uuid asset tag already stored in AAI - * aai.input.data.license-assignment-group-uuid - license-key-uuid asset tag already stored in AAI - * 2. properties and flags stored in context after bean execution: - * model.entitlement.pool.uuid - entitlement-group-uuid from license model - * model.license.key.uuid - license-key-uuid from license model - * is.acquire-entitlement.require - * is.release-entitlement.require - * is.acquire-license.require - * is.release-license.require - * - * @throws APPCException throws in case of any error - */ - void retrieveLicenseModel(Map params, SvcLogicContext ctx) throws APPCException; -} diff --git a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java deleted file mode 100644 index 4a72c2358..000000000 --- a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/main/java/org/openecomp/appc/dg/licmgr/impl/LicenseManagerPluginImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.appc.dg.licmgr.impl; - -import java.util.Map; - -import org.onap.appc.dg.licmgr.LicenseManagerPlugin; -import org.onap.appc.exceptions.APPCException; -import org.onap.appc.licmgr.Constants; -import org.onap.appc.licmgr.LicenseManager; -import org.onap.appc.licmgr.exception.DataAccessException; -import org.onap.appc.licmgr.objects.LicenseModel; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - - - -public class LicenseManagerPluginImpl implements LicenseManagerPlugin { - - private static EELFLogger logger = EELFManager.getInstance().getApplicationLogger(); - - // populated by blueprint framework - private LicenseManager licenseManager; - - public void setLicenseManager(LicenseManager licenseManager) { - this.licenseManager = licenseManager; - } - - /** - * Retrieves license model from APPC database and populate flags into svc context - * @param params map with parameters: - * org.onap.appc.vftype - the vnf type / service type; - * org.onap.appc.resource-version - the vnf version / service version - * @param ctx service logic context - * 1. supposed properties already in context: - * aai.input.data.entitlement-assignment-group-uuid - entitlement-group-uuid asset tag already stored in AAI - * aai.input.data.license-assignment-group-uuid - license-key-uuid asset tag already stored in AAI - * 2. properties and flags stored in context after bean execution: - * model.entitlement.pool.uuid - entitlement-group-uuid from license model - * model.license.key.uuid - license-key-uuid from license model - * is.acquire-entitlement.require - * is.release-entitlement.require - * is.acquire-license.require - * is.release-license.require - * is.aai-entitlement-update.require - * is.aai-license-update.require - * - * @throws APPCException throws in case of any error - */ - @Override - public void retrieveLicenseModel(Map params, SvcLogicContext ctx) throws APPCException { - - try { - - LicenseModel licenseModel = licenseManager.retrieveLicenseModel(params.get(Constants.VNF_TYPE_FIELD_NAME), params.get(Constants.VNF_RESOURCE_VERSION_FIELD_NAME)); - - String modelEntitlementPoolUuid = licenseModel.getEntitlementPoolUuid(); if (null == modelEntitlementPoolUuid) modelEntitlementPoolUuid = ""; - String aaiEntitlementPoolUuid = ctx.getAttribute(Constants.AAI_ENTITLMENT_POOL_UUID_NAME); if (null == aaiEntitlementPoolUuid) aaiEntitlementPoolUuid = ""; - boolean isAcquireEntitlementRequire = !modelEntitlementPoolUuid.isEmpty() && !modelEntitlementPoolUuid.equals(aaiEntitlementPoolUuid); - boolean isReleaseEntitlementRequire = !aaiEntitlementPoolUuid.isEmpty() && (isAcquireEntitlementRequire || modelEntitlementPoolUuid.isEmpty()); - boolean isAAIEntitlementUpdateRequire = isAcquireEntitlementRequire || isReleaseEntitlementRequire; - ctx.setAttribute(Constants.MODEL_ENTITLMENT_POOL_UUID_NAME, modelEntitlementPoolUuid); - ctx.setAttribute(Constants.IS_ACQUIRE_ENTITLEMENT_REQUIRE, Boolean.toString(isAcquireEntitlementRequire)); - ctx.setAttribute(Constants.IS_RELEASE_ENTITLEMENT_REQUIRE, Boolean.toString(isReleaseEntitlementRequire)); - ctx.setAttribute(Constants.IS_AAI_ENTITLEMENT_UPDATE_REQUIRE, Boolean.toString(isAAIEntitlementUpdateRequire)); - - - String modelLicenseKeyGroupUuid = licenseModel.getLicenseKeyGroupUuid(); if (null == modelLicenseKeyGroupUuid) modelLicenseKeyGroupUuid = ""; - String aaiLicenseKeyGroupUuid = ctx.getAttribute(Constants.AAI_LICENSE_KEY_UUID_NAME); if (null == aaiLicenseKeyGroupUuid) aaiLicenseKeyGroupUuid = ""; - String aaiLicenseKeyValue = ctx.getAttribute(Constants.AAI_LICENSE_KEY_VALUE); if (null == aaiLicenseKeyValue) aaiLicenseKeyValue = ""; - boolean isAcquireLicenseRequire = !modelLicenseKeyGroupUuid.isEmpty() && !modelLicenseKeyGroupUuid.equals(aaiLicenseKeyGroupUuid); - boolean isReleaseLicenseRequire = !aaiLicenseKeyGroupUuid.isEmpty() && (isAcquireLicenseRequire || modelLicenseKeyGroupUuid.isEmpty()); - boolean isAAILicenseUpdateRequire = isAcquireLicenseRequire || isReleaseLicenseRequire; - ctx.setAttribute(Constants.MODEL_LICENSE_KEY_UUID_NAME, modelLicenseKeyGroupUuid); - ctx.setAttribute(Constants.IS_ACQUIRE_LICENSE_REQUIRE, Boolean.toString(isAcquireLicenseRequire)); - ctx.setAttribute(Constants.IS_RELEASE_LICENSE_REQUIRE, Boolean.toString(isReleaseLicenseRequire)); - ctx.setAttribute(Constants.IS_AAI_LICENSE_UPDATE_REQUIRE, Boolean.toString(isAAILicenseUpdateRequire)); - - ctx.setAttribute("license-key", aaiLicenseKeyValue); - - } catch (DataAccessException le) { - logger.error("Error " + le.getMessage()); - ctx.setAttribute("output.status.message", le.getMessage()); - throw new APPCException(le); - } - - } - - - - //////// code uses jaxb license model, should be fixed - /* - final VfLicenseModel.FeatureGroupList featureGroupList = licenseModel.getFeatureGroupList(); - if (null != featureGroupList) { - final VfLicenseModel.FeatureGroupList.FeatureGroup featureGroup = featureGroupList.getFeatureGroup(); - if (null != featureGroup) { - final VfLicenseModel.FeatureGroupList.FeatureGroup.EntitlementPoolList - entitlementPoolList = featureGroup.getEntitlementPoolList(); - if (null != entitlementPoolList) { - final VfLicenseModel.FeatureGroupList.FeatureGroup.EntitlementPoolList.EntitlementPool - entitlementPool = entitlementPoolList.getEntitlementPool(); - if (null != entitlementPool) { - final String entitlementPoolUuid = entitlementPool.getEntitlementPoolUuid(); - // add entitlementPoolUuid into context - ctx.setAttribute(Constants.MODEL_ENTITLMENT_POOL_UUID_NAME, entitlementPoolUuid); - } - } - - final VfLicenseModel.FeatureGroupList.FeatureGroup.LicenseKeyGroupList - licenseKeyGroupList = featureGroup.getLicenseKeyGroupList(); - if (null != licenseKeyGroupList) { - final VfLicenseModel.FeatureGroupList.FeatureGroup.LicenseKeyGroupList.LicenseKeyGroup - licenseKeyGroup = licenseKeyGroupList.getLicenseKeyGroup(); - if (null != licenseKeyGroup) { - final String licenseKeyGroupUuid = licenseKeyGroup.getLicenseKeyGroupUuid(); - // add licenseKeyGroupUuid into context - ctx.setAttribute(Constants.MODEL_LICENSE_KEY_UUID_NAME, licenseKeyGroupUuid); - } - } - } - } - */ - - -} -- cgit 1.2.3-korg