diff options
author | Haddox, Anthony <ah0647@att.com> | 2019-01-25 08:57:39 -0800 |
---|---|---|
committer | Haddox, Anthony <ah0647@att.com> | 2019-01-25 08:57:39 -0800 |
commit | 81fd4cee0d7ca6a014eb33d5ffba63f731249141 (patch) | |
tree | 66eb3fdb283d315de03c4e2278a319765c3dedb0 /daexim-offsite-backup | |
parent | 50bd4a0f591d9d00335b008a9e66f1906d40bc20 (diff) |
[CCSDK-1008]Generalize offsite backup
Revised the provider to use file names designated in
the properties file. This is for those who use vendor
provided distributions of OpenDaylight
Change-Id: Ib120452fa989fff371a832416a34d95745fead1b
Issue-ID: CCSDK-1008
Signed-off-by: Haddox, Anthony <ah0647@att.com>
Diffstat (limited to 'daexim-offsite-backup')
4 files changed, 64 insertions, 5 deletions
diff --git a/daexim-offsite-backup/README.md b/daexim-offsite-backup/README.md index 26d8a7ed..e3f13aee 100755 --- a/daexim-offsite-backup/README.md +++ b/daexim-offsite-backup/README.md @@ -78,5 +78,10 @@ Before each RPC execution this module pulls information from a user supplied pro - credentials - nexusUrl - podName +- file.operational +- file.models +- file.config + +> Refer to the example properties file If the module cannot find the properties file it will default to generic values and attempt to move forward. diff --git a/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java b/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java index cc16bf70..09c8f92f 100755 --- a/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java +++ b/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java @@ -75,11 +75,11 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite private static String CREDENTIALS; private static String NEXUS_URL; private static String POD_NAME; + private static String OPERATIONAL_JSON; + private static String MODELS_JSON; + private static String CONFIG_JSON; private static String PROPERTIES_FILE = System.getenv("SDNC_CONFIG_DIR") + "/daexim-offsite-backup.properties"; - private static final String OPERATIONAL_JSON = "odl_backup_operational.json"; - private static final String MODELS_JSON = "odl_backup_models.json"; - private static final String CONFIG_JSON = "odl_backup_config.json"; private static final String BACKUP_ARCHIVE = "odl_backup.zip"; private static final String appName = "daexim-offsite-backup"; @@ -122,6 +122,9 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite properties.put("credentials", "admin:enc:YWRtaW4xMjM="); properties.put("nexusUrl", "http://localhost:8081/nexus/content/repositories/"); properties.put("podName", "UNKNOWN_ODL"); + properties.put("file.operational", "odl_backup_operational.json"); + properties.put("file.models", "odl_backup_models.json"); + properties.put("file.config", "odl_backup_config.json"); return; } FileInputStream fileInputStream; @@ -133,6 +136,9 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite LOG.info("daeximDirectory: " + properties.getProperty("daeximDirectory")); LOG.info("nexusUrl: " + properties.getProperty("nexusUrl")); LOG.info("podName: " + properties.getProperty("podName")); + LOG.info("file.operational: " + properties.getProperty("file.operational")); + LOG.info("file.models: " + properties.getProperty("file.models")); + LOG.info("file.config: " + properties.getProperty("file.config")); } catch(IOException e) { LOG.error("Error loading properties.", e); } @@ -147,6 +153,10 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite DAEXIM_DIR = properties.getProperty("daeximDirectory"); NEXUS_URL = properties.getProperty("nexusUrl"); + OPERATIONAL_JSON = properties.getProperty("file.operational"); + MODELS_JSON = properties.getProperty("file.models"); + CONFIG_JSON = properties.getProperty("file.config"); + if(!properties.getProperty("credentials").contains(":")) { //Entire thing is encoded CREDENTIALS = new String(Base64.getDecoder().decode(properties.getProperty("credentials"))); } diff --git a/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties b/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties index bdfa8155..51efc1f1 100755 --- a/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties +++ b/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties @@ -1,6 +1,28 @@ +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2019 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========================================================= + # Example properties file daeximDirectory=/opt/opendaylight/current/daexim/ credentials=admin:enc:YWRtaW4xMjM= nexusUrl=http://localhost:8081/nexus/content/repositories/ -podName=UNKNOWN_ODL
\ No newline at end of file +podName=UNKNOWN_ODL +file.operational=odl_backup_operational.json +file.models=odl_backup_models.json +file.config=odl_backup_config.json
\ No newline at end of file diff --git a/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties b/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties index 49dd133b..b6902790 100755 --- a/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties +++ b/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties @@ -1,4 +1,26 @@ +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2019 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========================================================= + daeximDirectory=/opt/opendaylight/current/daexim/ credentials=admin:admin123 nexusUrl=http://localhost:8081/nexus/content/repositories/ -podName=UNKNOWN_ODL
\ No newline at end of file +podName=UNKNOWN_ODL +file.operational=odl_backup_operational.json +file.models=odl_backup_models.json +file.config=odl_backup_config.json
\ No newline at end of file |