From 3f336cecddbc7adf45489e0d4a0b1b19deeee1ef Mon Sep 17 00:00:00 2001 From: "lalena.aria" Date: Wed, 7 Aug 2019 19:59:04 +0000 Subject: Use getEntity to populate Complex Resource-Related tables Changes made: Clean up in SdncBaseModel for unused methods. Fixes in SdncGroupModel. Convert SdncNodeModel to entity. Corrected logging in SdncVFCModel. Corresponding Group-related and logging fixes in SdncVFModel. Corresponding SdncBaseModel changes for getEntity migration. Corresponding junit changes for getEntity migration. Issue-ID: CCSDK-1578 Change-Id: Ic7f7ec38325aeddcad2d86c8f8425ec825512714 Signed-off-by: lalena.aria --- artifacts/pom.xml | 4 +- asdcApi/features/ccsdk-asdcApi/pom.xml | 4 +- asdcApi/features/features-asdcApi/pom.xml | 4 +- asdcApi/features/pom.xml | 4 +- asdcApi/installer/pom.xml | 4 +- asdcApi/model/pom.xml | 4 +- asdcApi/pom.xml | 4 +- asdcApi/provider/pom.xml | 4 +- .../features/ccsdk-daexim-offsite-backup/pom.xml | 4 +- .../features-daexim-offsite-backup/pom.xml | 4 +- daexim-offsite-backup/features/pom.xml | 4 +- daexim-offsite-backup/installer/pom.xml | 4 +- daexim-offsite-backup/model/pom.xml | 4 +- daexim-offsite-backup/pom.xml | 4 +- daexim-offsite-backup/provider/pom.xml | 4 +- dataChange/features/ccsdk-dataChange/pom.xml | 4 +- dataChange/features/features-dataChange/pom.xml | 4 +- dataChange/features/pom.xml | 4 +- dataChange/installer/pom.xml | 4 +- dataChange/model/pom.xml | 4 +- dataChange/pom.xml | 4 +- dataChange/provider/pom.xml | 4 +- dmaap-listener/pom.xml | 4 +- features/ccsdk-sli-northbound-all/pom.xml | 4 +- features/features-sli-northbound/pom.xml | 4 +- features/installer/pom.xml | 4 +- features/pom.xml | 4 +- lcm/features/ccsdk-lcm/pom.xml | 4 +- lcm/features/features-lcm/pom.xml | 4 +- lcm/features/pom.xml | 4 +- lcm/installer/pom.xml | 4 +- lcm/model/pom.xml | 4 +- lcm/pom.xml | 4 +- lcm/provider/pom.xml | 4 +- pom.xml | 4 +- ueb-listener/pom.xml | 4 +- .../sli/northbound/uebclient/SdncBaseModel.java | 281 ++++++--------------- .../sli/northbound/uebclient/SdncGroupModel.java | 24 +- .../sli/northbound/uebclient/SdncNodeModel.java | 126 ++++----- .../sli/northbound/uebclient/SdncUebCallback.java | 24 +- .../sli/northbound/uebclient/SdncVFCModel.java | 4 +- .../sli/northbound/uebclient/SdncVFModel.java | 25 +- .../northbound/uebclient/SdncGroupModelTest.java | 6 +- .../northbound/uebclient/SdncNodeModelTest.java | 18 +- .../northbound/uebclient/TestSdncUebCallback.java | 152 +++++++++++ .../src/test/resources/ueb-listener.properties | 3 +- version.properties | 2 +- 47 files changed, 428 insertions(+), 381 deletions(-) diff --git a/artifacts/pom.xml b/artifacts/pom.xml index 1ca2f727..42eeb71f 100755 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.sli.northbound sli-northbound-artifacts - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: sli-northbound-artifacts @@ -17,7 +17,7 @@ org.onap.ccsdk.parent parent - 1.3.2 + 1.3.3-SNAPSHOT diff --git a/asdcApi/features/ccsdk-asdcApi/pom.xml b/asdcApi/features/ccsdk-asdcApi/pom.xml index 5cb47d9c..be3dee2b 100644 --- a/asdcApi/features/ccsdk-asdcApi/pom.xml +++ b/asdcApi/features/ccsdk-asdcApi/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound ccsdk-asdcApi - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: asdcApi :: ${project.artifactId} diff --git a/asdcApi/features/features-asdcApi/pom.xml b/asdcApi/features/features-asdcApi/pom.xml index 4c0762b5..2917abd7 100644 --- a/asdcApi/features/features-asdcApi/pom.xml +++ b/asdcApi/features/features-asdcApi/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound features-asdcApi - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: asdcApi :: ${project.artifactId} diff --git a/asdcApi/features/pom.xml b/asdcApi/features/pom.xml index 37929d87..6f6ac13f 100755 --- a/asdcApi/features/pom.xml +++ b/asdcApi/features/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound asdcApi-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: asdcApi :: ${project.artifactId} diff --git a/asdcApi/installer/pom.xml b/asdcApi/installer/pom.xml index 70b8ad89..33af1bd5 100755 --- a/asdcApi/installer/pom.xml +++ b/asdcApi/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound asdcApi-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: asdcApi :: ${project.artifactId} diff --git a/asdcApi/model/pom.xml b/asdcApi/model/pom.xml index 5c11f7fe..a5bb371c 100755 --- a/asdcApi/model/pom.xml +++ b/asdcApi/model/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound asdcApi-model - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-northbound :: asdcApi :: ${project.artifactId} diff --git a/asdcApi/pom.xml b/asdcApi/pom.xml index 7909602c..d00afcb4 100755 --- a/asdcApi/pom.xml +++ b/asdcApi/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound asdcApi - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: asdcApi diff --git a/asdcApi/provider/pom.xml b/asdcApi/provider/pom.xml index fff19f63..34f65285 100755 --- a/asdcApi/provider/pom.xml +++ b/asdcApi/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound asdcApi-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-northbound :: asdcApi :: ${project.artifactId} diff --git a/daexim-offsite-backup/features/ccsdk-daexim-offsite-backup/pom.xml b/daexim-offsite-backup/features/ccsdk-daexim-offsite-backup/pom.xml index 6e5e3985..d54eb208 100644 --- a/daexim-offsite-backup/features/ccsdk-daexim-offsite-backup/pom.xml +++ b/daexim-offsite-backup/features/ccsdk-daexim-offsite-backup/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound ccsdk-daexim-offsite-backup - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId} diff --git a/daexim-offsite-backup/features/features-daexim-offsite-backup/pom.xml b/daexim-offsite-backup/features/features-daexim-offsite-backup/pom.xml index fa5fce03..632cad58 100644 --- a/daexim-offsite-backup/features/features-daexim-offsite-backup/pom.xml +++ b/daexim-offsite-backup/features/features-daexim-offsite-backup/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound features-daexim-offsite-backup - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId} diff --git a/daexim-offsite-backup/features/pom.xml b/daexim-offsite-backup/features/pom.xml index 904aa5a0..d23a039c 100755 --- a/daexim-offsite-backup/features/pom.xml +++ b/daexim-offsite-backup/features/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound daexim-offsite-backup-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId} diff --git a/daexim-offsite-backup/installer/pom.xml b/daexim-offsite-backup/installer/pom.xml index 3b48a535..d58467bb 100755 --- a/daexim-offsite-backup/installer/pom.xml +++ b/daexim-offsite-backup/installer/pom.xml @@ -4,14 +4,14 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId} org.onap.ccsdk.sli.northbound daexim-offsite-backup-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-daexim-offsite-backup diff --git a/daexim-offsite-backup/model/pom.xml b/daexim-offsite-backup/model/pom.xml index b842ee67..e0702fee 100755 --- a/daexim-offsite-backup/model/pom.xml +++ b/daexim-offsite-backup/model/pom.xml @@ -4,14 +4,14 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId} org.onap.ccsdk.sli.northbound daexim-offsite-backup-model - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/daexim-offsite-backup/pom.xml b/daexim-offsite-backup/pom.xml index a2c624e8..34e4e195 100755 --- a/daexim-offsite-backup/pom.xml +++ b/daexim-offsite-backup/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound daexim-offsite-backup - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: daexim-offsite-backup diff --git a/daexim-offsite-backup/provider/pom.xml b/daexim-offsite-backup/provider/pom.xml index e91fc6b1..49bd6e7e 100755 --- a/daexim-offsite-backup/provider/pom.xml +++ b/daexim-offsite-backup/provider/pom.xml @@ -4,14 +4,14 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId} org.onap.ccsdk.sli.northbound daexim-offsite-backup-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle diff --git a/dataChange/features/ccsdk-dataChange/pom.xml b/dataChange/features/ccsdk-dataChange/pom.xml index 7aca371c..635cbe5f 100644 --- a/dataChange/features/ccsdk-dataChange/pom.xml +++ b/dataChange/features/ccsdk-dataChange/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound ccsdk-dataChange - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: dataChange :: ${project.artifactId} diff --git a/dataChange/features/features-dataChange/pom.xml b/dataChange/features/features-dataChange/pom.xml index a5523550..5a50ef10 100644 --- a/dataChange/features/features-dataChange/pom.xml +++ b/dataChange/features/features-dataChange/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound features-dataChange - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: dataChange :: ${project.artifactId} diff --git a/dataChange/features/pom.xml b/dataChange/features/pom.xml index b9652a11..d4fab812 100755 --- a/dataChange/features/pom.xml +++ b/dataChange/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound dataChange-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: dataChange :: ${project.artifactId} diff --git a/dataChange/installer/pom.xml b/dataChange/installer/pom.xml index c778296f..d3e7cb2b 100755 --- a/dataChange/installer/pom.xml +++ b/dataChange/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound dataChange-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: dataChange :: ${project.artifactId} diff --git a/dataChange/model/pom.xml b/dataChange/model/pom.xml index 5aa0825b..57a8a877 100755 --- a/dataChange/model/pom.xml +++ b/dataChange/model/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound dataChange-model - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-northbound :: dataChange :: ${project.artifactId} diff --git a/dataChange/pom.xml b/dataChange/pom.xml index a8def686..1419661b 100755 --- a/dataChange/pom.xml +++ b/dataChange/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound dataChange - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: dataChange diff --git a/dataChange/provider/pom.xml b/dataChange/provider/pom.xml index db1f3aff..204e9158 100755 --- a/dataChange/provider/pom.xml +++ b/dataChange/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound dataChange-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-northbound :: dataChange :: ${project.artifactId} diff --git a/dmaap-listener/pom.xml b/dmaap-listener/pom.xml index a6c6cdfe..d07f8111 100755 --- a/dmaap-listener/pom.xml +++ b/dmaap-listener/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent standalone-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound dmaap-listener - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT jar ccsdk-sli-northbound :: dmaap-listener diff --git a/features/ccsdk-sli-northbound-all/pom.xml b/features/ccsdk-sli-northbound-all/pom.xml index 0835eff1..c5c1b914 100644 --- a/features/ccsdk-sli-northbound-all/pom.xml +++ b/features/ccsdk-sli-northbound-all/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound ccsdk-sli-northbound-all - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: features :: ${project.artifactId} diff --git a/features/features-sli-northbound/pom.xml b/features/features-sli-northbound/pom.xml index e2cb8cf0..fce265bb 100644 --- a/features/features-sli-northbound/pom.xml +++ b/features/features-sli-northbound/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound features-sli-northbound - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: features :: ${project.artifactId} diff --git a/features/installer/pom.xml b/features/installer/pom.xml index fa17f17c..46bdfdf3 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound slinorthbound-features-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: features :: ${project.artifactId} diff --git a/features/pom.xml b/features/pom.xml index d20d77be..486ff093 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound slinorthbound-feature-aggregator - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: features diff --git a/lcm/features/ccsdk-lcm/pom.xml b/lcm/features/ccsdk-lcm/pom.xml index 1bc3a1e7..cd80fb34 100644 --- a/lcm/features/ccsdk-lcm/pom.xml +++ b/lcm/features/ccsdk-lcm/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent single-feature-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound ccsdk-lcm - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: lcm :: ${project.artifactId} diff --git a/lcm/features/features-lcm/pom.xml b/lcm/features/features-lcm/pom.xml index 54315d1c..cb712618 100644 --- a/lcm/features/features-lcm/pom.xml +++ b/lcm/features/features-lcm/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent feature-repo-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound features-lcm - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT feature ccsdk-sli-northbound :: lcm :: ${project.artifactId} diff --git a/lcm/features/pom.xml b/lcm/features/pom.xml index f177a06a..b59d2b92 100755 --- a/lcm/features/pom.xml +++ b/lcm/features/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound lcm-features - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: lcm :: ${project.artifactId} diff --git a/lcm/installer/pom.xml b/lcm/installer/pom.xml index 3625134c..3966c9d2 100755 --- a/lcm/installer/pom.xml +++ b/lcm/installer/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound lcm-installer - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: lcm :: ${project.artifactId} diff --git a/lcm/model/pom.xml b/lcm/model/pom.xml index f79e5718..6f41820c 100755 --- a/lcm/model/pom.xml +++ b/lcm/model/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound lcm-model - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-northbound :: lcm :: ${project.artifactId} diff --git a/lcm/pom.xml b/lcm/pom.xml index b9d1a770..455beb89 100755 --- a/lcm/pom.xml +++ b/lcm/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound lcm - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT pom ccsdk-sli-northbound :: lcm diff --git a/lcm/provider/pom.xml b/lcm/provider/pom.xml index 7734d929..def00a9b 100755 --- a/lcm/provider/pom.xml +++ b/lcm/provider/pom.xml @@ -5,13 +5,13 @@ org.onap.ccsdk.parent binding-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound lcm-provider - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT bundle ccsdk-sli-northbound :: lcm :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index 120548d9..76ad8082 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.onap.ccsdk.parent odlparent-lite - 1.3.2 + 1.3.3-SNAPSHOT 4.0.0 @@ -104,7 +104,7 @@ ONAP - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT diff --git a/ueb-listener/pom.xml b/ueb-listener/pom.xml index e3160310..63b849ec 100755 --- a/ueb-listener/pom.xml +++ b/ueb-listener/pom.xml @@ -5,12 +5,12 @@ org.onap.ccsdk.parent standalone-parent - 1.3.2 + 1.3.3-SNAPSHOT org.onap.ccsdk.sli.northbound ueb-listener - 0.5.1-SNAPSHOT + 0.5.2-SNAPSHOT jar ccsdk-sli-northbound :: ueb-listener diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java index 84918ab1..d3fef173 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java @@ -77,10 +77,6 @@ public class SdncBaseModel { protected NodeTemplate nodeTemplate = null; protected IEntityDetails entityDetails = null; - public SdncBaseModel(DBResourceManager jdbcDataSource) { - this.jdbcDataSource = jdbcDataSource; - } - public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, DBResourceManager jdbcDataSource) { this (sdcCsarHelper, nodeTemplate); this.sdcCsarHelper = sdcCsarHelper; @@ -159,28 +155,7 @@ public class SdncBaseModel { addParameter(PARAM_UUID_KEY, UUID); addParameter(PARAM_VERSION_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION)); } - - public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { - this (sdcCsarHelper, group); - this.sdcCsarHelper = sdcCsarHelper; - this.config = config; - this.jdbcDataSource = jdbcDataSource; - } - - public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group) { - - params = new HashMap(); - this.sdcCsarHelper = sdcCsarHelper; - attributeValueParams = new HashMap(); - // extract group metadata - Metadata metadata = group.getMetadata(); - //customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID); - returning null - customizationUUID = extractValue (metadata, "vfModuleModelCustomizationUUID"); - addParameter(PARAM_INVARIANT_UUID_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); - addParameter(PARAM_UUID_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); - addParameter(PARAM_VERSION_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)); - } /* This is the generic approach Shoujit attempted for 18.06 but can't be implemented without parser API to * get properties with substring match on the name @@ -238,7 +213,7 @@ public class SdncBaseModel { addParameter("resource_type", metadataType, attributeParams); addParameter("resource_customization_uuid", getCustomizationUUID(), attributeParams); - LOG.info("Call insertToscaData for ATTRIBUTE_VALUE_PAIR where resource_uuid = " + getUUID() + " and attriubute_name = " + paramName); + LOG.info("Call insertToscaData for ATTRIBUTE_VALUE_PAIR where resource_uuid = " + getUUID() + " and attribute_name = \"" + paramName + "\""); try { insertToscaData(buildSql("ATTRIBUTE_VALUE_PAIR", "resource_uuid", getUUID(), model_yaml, attributeParams), null); } catch (IOException e) { @@ -248,13 +223,13 @@ public class SdncBaseModel { } } - protected void insertGroupData (NodeTemplate nodeTemplate, NodeTemplate targetNode, String groupType) throws IOException { + protected void insertEntityGroupData (IEntityDetails entityDetails, IEntityDetails targetNode, String groupType) throws IOException { // Get the Groups on a node - Convert to use getEntity in 19.08 EntityQuery entityQuery = EntityQuery.newBuilder(groupType).build(); String customizationUuid = getCustomizationUUIDNoQuotes(); - SdcTypes nodeTemplateSdcType = SdcTypes.valueOf(extractValue(nodeTemplate.getMetaData(), SdcPropertyNames.PROPERTY_NAME_TYPE)); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(nodeTemplateSdcType) + SdcTypes entitySdcType = SdcTypes.valueOf(extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_TYPE)); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(entitySdcType) .customizationUUID(customizationUuid).build(); List groupList = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); if (groupList == null) { @@ -268,21 +243,22 @@ public class SdncBaseModel { // ATTRIBUTE_VALUE_PAIR (group properties): group_type, group_role, group_function // RESOURCE_GROUP_TO_TARGET_NODE_MAPPING: group_uuid, parent_uuid (CR node UUID), target_node_uuid, target_type, table_name - SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, nodeTemplate, config, jdbcDataSource); - groupModel.insertGroupData(nodeTemplate); + SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, entityDetails, config, jdbcDataSource); + String resourceUuid = getUUID(); + groupModel.insertGroupData(resourceUuid); // insert RESOURCE_GROUP_TO_TARGET_NODE_MAPPING try { Map mappingCleanupParams = new HashMap(); addParameter("group_uuid", groupModel.getUUID(), mappingCleanupParams); - addParameter("parent_uuid", extractValue(nodeTemplate.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); - addParameter("target_node_uuid", extractValue(targetNode.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); + addParameter("parent_uuid", extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); + addParameter("target_node_uuid", extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); cleanupExistingToscaData("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", mappingCleanupParams); Map mappingParams = new HashMap(); - addParameter("parent_uuid", extractValue(nodeTemplate.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); - addParameter("target_node_uuid", extractValue(targetNode.getMetaData(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); - String targetType = extractValue(targetNode.getMetaData(), PARAM_TYPE_KEY); + addParameter("parent_uuid", extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); + addParameter("target_node_uuid", extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); + String targetType = extractValue(targetNode.getMetadata(), PARAM_TYPE_KEY); addParameter("target_type", targetType, mappingParams); String tableName = ""; switch (targetType) { @@ -310,7 +286,7 @@ public class SdncBaseModel { TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(queryType).customizationUUID(nodeTemplateCustomizationUuid).build(); List policyEntities = sdcCsarHelper.getEntity(policyEntityQuery, topologyTemplateQuery, false); if (policyEntities == null || policyEntities.isEmpty()) { - LOG.info("insertPolicyData: Could not find policy data for: " + nodeTemplateCustomizationUuid); + LOG.debug("insertPolicyData: Could not find policy data for: " + nodeTemplateCustomizationUuid); return; } @@ -339,7 +315,7 @@ public class SdncBaseModel { List policyEntities = sdcCsarHelper.getEntity(policyEntityQuery, topologyTemplateQuery, false); if (policyEntities == null || policyEntities.isEmpty()) { - LOG.info("insertPolicyData: Could not find policy data for Service/VF: " + resourceUuid); + LOG.debug("insertPolicyData: Could not find policy data for Service/VF: " + resourceUuid); return; } @@ -352,7 +328,7 @@ public class SdncBaseModel { insertResourcePolicyData(policyEntity, resourceUuid); List targetEntities = policyEntity.getTargetEntities(); if (targetEntities == null || targetEntities.isEmpty()) { - LOG.info("insertPolicyData: Could not find targetEntites for policy: " + policyUuid); + LOG.debug("insertPolicyData: Could not find targetEntites for policy: " + policyUuid); continue; } @@ -483,7 +459,7 @@ public class SdncBaseModel { try { cleanupExistingToscaData("NODE_CAPABILITY", cleanupParams); // will also delete NODE_CAPABILITY_PROPERTY with same capability_id - LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = " + capability.getName()); + LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = \"" + capability.getName() + "\""); insertToscaData(buildSql("NODE_CAPABILITY", "capability_provider_uuid", capabilityProviderUuid, model_yaml, nodeCapabilityParams), null); // Get capabilityId for capability just inserted @@ -545,7 +521,7 @@ public class SdncBaseModel { try { cleanupExistingToscaData("NODE_CAPABILITY", cleanupParams); // will also delete NODE_CAPABILITY_PROPERTY with same capability_id - LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = " + capability.getName()); + LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = \"" + capability.getName()+ "\""); insertToscaData(buildSql("NODE_CAPABILITY", "capability_provider_uuid", capabilityProviderUuid, model_yaml, nodeCapabilityParams), null); // Get capabilityId for capability just inserted @@ -578,7 +554,7 @@ public class SdncBaseModel { try { // Data from NODE_CAPABILITY_PROPERTY is cleaned up via cascade delete on NODE_CAPABILITY - LOG.info("Call insertToscaData for NODE_CAPABILITY_PROPERTY where capability_id = " + capabilityId + " and property_name = " + property.getName() + ", property_value: " + property.getValue().toString()); + LOG.info("Call insertToscaData for NODE_CAPABILITY_PROPERTY where capability_id = \"" + capabilityId + "\" and capability_property_name = \"" + property.getName() + "\" and capability_property_type = \"" + property.getValue().toString() + "\""); insertToscaData(buildSql("NODE_CAPABILITY_PROPERTY", "capability_id", capabilityId, model_yaml, nodeCapabilityPropertyParams), null); } catch (IOException e) { LOG.error("Could not insert Tosca CSAR data into the NODE_CAPABILITY_PROPERTY table"); @@ -605,12 +581,6 @@ public class SdncBaseModel { } } - public static void addIntParameter (String name, String value, Map params) { - if (value != null && !value.isEmpty()) { - params.put(name, value); - } - } - public static void addParameter (String name, String value, Map params) { if (value != null && !value.isEmpty()) { // remove any quotes within the string @@ -682,7 +652,7 @@ public class SdncBaseModel { if (entityDetails.getProperties().containsKey(path)) { Property property = entityDetails.getProperties().get(path); - if (property != null && property.getLeafPropertyValue(name) != null) { + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { value = property.getLeafPropertyValue(name).get(0); } } @@ -693,34 +663,49 @@ public class SdncBaseModel { return ""; } } - - protected String extractValue (Property property, String name) { + + protected String extractValue (IEntityDetails entityDetails, String path1, String path2, String name) { String value = ""; - if (!property.getLeafPropertyValue(name).isEmpty()) { - value = property.getLeafPropertyValue(name).get(0); - } - + value = extractNestedValue (entityDetails, path1, path2, name); + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { return value; } else { return ""; } } - - protected String extractBooleanValue (Property property, String name) { + + protected String extractBooleanValue (IEntityDetails entityDetails, String path1, String path2, String name) { String value = ""; - if (!property.getLeafPropertyValue(name).isEmpty()) { - value = property.getLeafPropertyValue(name).get(0); - } + value = extractNestedValue (entityDetails, path1, path2, name); - if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + if (value != null && !value.isEmpty()) { return value.contains("true") ? "Y" : "N"; } else { return ""; } } + + protected String extractNestedValue (IEntityDetails entityDetails, String path1, String path2, String name) { + String value = ""; + + if (entityDetails.getProperties().containsKey(path1)) { + Property path1Property = entityDetails.getProperties().get(path1); + if (path1Property != null) { + Map path1PropertyValue = (Map) path1Property.getValue(); + if (path1PropertyValue.containsKey(path2)) { + Map path2PropertyValue = (Map) path1PropertyValue.get(path2); + if (path2PropertyValue != null && path2PropertyValue.containsKey(name)) { + value = path2PropertyValue.get(name).toString(); + } + } + } + } + + return value; + } protected String extractIntegerValue (Property property, String name) { String value = ""; @@ -735,35 +720,48 @@ public class SdncBaseModel { return ""; } } + + protected String extractGetInputValue (IEntityDetails group, IEntityDetails entityDetails, String name) { - protected String extractGetInputValue (Group group, NodeTemplate nodeTemplate, String name) { - - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, extractGetInputName (group, name)); - if (value != null) { - return value; + // Extract the property on entityDetails after getting the property name from the group + String getInputName = extractGetInputName (group, name); + String entityPropertyValue = ""; + + if (entityDetails.getProperties().containsKey(getInputName)) { + Property entityProperty = entityDetails.getProperties().get(getInputName); + entityPropertyValue = entityProperty.getValue().toString(); + } + + if (!entityPropertyValue.isEmpty()) { + return entityPropertyValue; } else { return ""; } } - protected String extractGetInputName (Group group, String name) { + protected String extractGetInputName (IEntityDetails group, String name) { String getInputName = name; - String groupProperty = sdcCsarHelper.getGroupPropertyLeafValue(group, name); - if (groupProperty != null) { - int getInputIndex = groupProperty.indexOf("{get_input="); + String groupPropertyValue = ""; + if (group.getProperties().containsKey(name)) { + Property groupProperty = group.getProperties().get(name); + groupPropertyValue = groupProperty.getValue().toString(); + } + if (!groupPropertyValue.isEmpty()) { + int getInputIndex = groupPropertyValue.indexOf("{get_input="); if (getInputIndex > -1) { - getInputName = groupProperty.substring(getInputIndex+11, groupProperty.length()-1); + getInputName = groupPropertyValue.substring(getInputIndex+11, groupPropertyValue.length()-1); } } return getInputName; } - - protected String extractGetInputValue (Policy policy, NodeTemplate nodeTemplate, String name) { - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, extractGetInputName (policy, name)); + // Remove this after migrate SdncVFModel to getEntity + protected String extractGetInputValue (Group group, NodeTemplate nodeTemplate, String name) { + + String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, extractGetInputName (group, name)); if (value != null) { return value; } else { @@ -771,13 +769,12 @@ public class SdncBaseModel { } } - protected String extractGetInputName (Policy policy, String name) { + // Remove this after migrate SdncVFModel to getEntity + protected String extractGetInputName (Group group, String name) { String getInputName = name; - //String groupProperty = sdcCsarHelper.getPolicyPropertyLeafValue(policy, name); - Map propMap = policy.getPolicyProperties(); - String groupProperty = nullCheck(propMap.get(name)); - if (!groupProperty.isEmpty()) { + String groupProperty = sdcCsarHelper.getGroupPropertyLeafValue(group, name); + if (groupProperty != null) { int getInputIndex = groupProperty.indexOf("{get_input="); if (getInputIndex > -1) { getInputName = groupProperty.substring(getInputIndex+11, groupProperty.length()-1); @@ -787,36 +784,7 @@ public class SdncBaseModel { return getInputName; } - - protected String extractValue (Policy policy, String name) { - - Map propMap = policy.getPolicyProperties(); - if (propMap == null) { - return ""; - } else { - return nullCheck(propMap.get(name)); - } - } - - protected static String extractValueStatic (Policy policy, String name) { - - Map propMap = policy.getPolicyProperties(); - if (propMap == null) { - return ""; - } else { - return nullCheckStatic(propMap.get(name)); - } - } - - public static String extractValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) { - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); - if (value != null) { - return value; - } else { - return ""; - } - } - + protected String extractValue (CapabilityAssignment capability, String name) { String value = sdcCsarHelper.getCapabilityPropertyLeafValue(capability, name); if (value != null) { @@ -855,8 +823,10 @@ public class SdncBaseModel { String value = null; if (entityDetails.getProperties().containsKey(path)) { Property property = entityDetails.getProperties().get(path); - if (property != null && property.getLeafPropertyValue(name) != null) { - value = property.getLeafPropertyValue(name).get(0); + if (property != null) { + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { + value = property.getLeafPropertyValue(name).get(0); + } } } @@ -867,15 +837,6 @@ public class SdncBaseModel { } } - public static String extractBooleanValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) { - String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - protected Object extractObjectValue (NodeTemplate nodeTemplate, String name) { Object value = sdcCsarHelper.getNodeTemplatePropertyValueAsObject(nodeTemplate, name); if (value != null) { @@ -885,60 +846,6 @@ public class SdncBaseModel { } } - protected String extractValue (Group group, String name) { - String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name); - if (value != null) { - return value; - } else { - return ""; - } - } - - protected String extractBooleanValue (Group group, String name) { - String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - - protected String extractInputDefaultValue (String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null) { - return value; - } else { - return ""; - } - } - - protected String extractBooleanInputDefaultValue (String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - - public static String extractInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null) { - return value; - } else { - return ""; - } - } - - public static String extractBooleanInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) { - String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name); - if (value != null && !value.isEmpty()) { - return value.contains("true") ? "Y" : "N"; - } else { - return ""; - } - } - public static String extractSubstitutionMappingTypeName (ISdcCsarHelper sdcCsarHelper) { String value = sdcCsarHelper.getServiceSubstitutionMappingsTypeName(); if (value != null) { @@ -1058,21 +965,6 @@ public class SdncBaseModel { throw new IOException (e); } - } - - protected static void insertToscaData(DBResourceManager jdbcDataSource, String toscaDataString, ArrayList arguments) throws IOException - { - LOG.debug("insertToscaData: " + toscaDataString); - - try { - - jdbcDataSource.writeData(toscaDataString, arguments, null); - - } catch (SQLException e) { - LOG.error("Could not insert Tosca data into the database"); - throw new IOException (e); - } - } protected void cleanUpExistingToscaData(String tableName, String keyName, String keyValue) throws IOException @@ -1188,7 +1080,7 @@ public class SdncBaseModel { rowCount ++; } if (rowCount != 0) { - LOG.info("checkForExistingToscaData in " + tableName + ": Data FOUND"); + LOG.debug("checkForExistingToscaData in " + tableName + ": Data FOUND"); dataExists = true; } @@ -1233,6 +1125,7 @@ public class SdncBaseModel { return data; } + protected void addParamsToMap (Map fromMap, Map toMap) { for (String key : fromMap.keySet()) { if (!toMap.containsKey(key)) { @@ -1249,12 +1142,4 @@ public class SdncBaseModel { return stringValue; } - protected static String nullCheckStatic (Object extractedObject) { - String stringValue = ""; - if (extractedObject != null) { - return extractedObject.toString(); - } - return stringValue; - } - } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java index 268590fe..62293665 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java @@ -27,8 +27,6 @@ import java.io.IOException; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.toscaparser.api.Group; -import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +38,7 @@ public class SdncGroupModel extends SdncBaseModel { private static final String groupType = "group_type"; - public SdncGroupModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails group, NodeTemplate nodeTemplate, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { + public SdncGroupModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails group, IEntityDetails entityDetails, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { super(sdcCsarHelper, group); @@ -60,24 +58,20 @@ public class SdncGroupModel extends SdncBaseModel { addParameter("vfc_parent_port_role", extractValue(group, "vfc_parent_port_role"), attributeValueParams); addParameter("subinterface_role", extractValue(group, "subinterface_role"), attributeValueParams); - // relevant complex group properties are extracted and inserted into ATTRIBUTE_VALUE_PAIR - String extractedGroupType = extractValue (group, groupType); - String extractedGroupRole = extractValue (group, "group_role"); - String extractedGroupFunction = extractValue (group, "group_function"); - addParameter(groupType, extractedGroupType, attributeValueParams); - addParameter("group_role", extractedGroupRole, attributeValueParams); - addParameter("group_function", extractedGroupFunction, attributeValueParams); + // relevant complex group properties are extracted and inserted into ATTRIBUTE_VALUE_PAIR + addParameter(extractGetInputName (group, groupType), extractGetInputValue(group, entityDetails, groupType), attributeValueParams); + addParameter(extractGetInputName (group, "group_role"), extractGetInputValue(group, entityDetails, "group_role"), attributeValueParams); + addParameter(extractGetInputName (group, "group_function"), extractGetInputValue(group, entityDetails, "group_function"), attributeValueParams); } - public void insertGroupData(NodeTemplate resourceNodeTemplate) throws IOException { + public void insertGroupData(String resourceUuid) throws IOException { try { // insert into RESOURCE_GROUP/ATTRIBUTE_VALUE_PAIR - String resourceNodeUuid = "\"" + extractValue (resourceNodeTemplate.getMetaData(), "UUID") + "\""; - cleanUpExistingToscaData("RESOURCE_GROUP", "resource_uuid", resourceNodeUuid, "group_uuid", getUUID()) ; - LOG.info("Call insertToscaData for RESOURCE_GROUP where group_uuid = " + getUUID() + " and resource_uuid = " + resourceNodeUuid); - insertToscaData(buildSql("RESOURCE_GROUP", "resource_uuid", resourceNodeUuid, model_yaml, params), null); + cleanUpExistingToscaData("RESOURCE_GROUP", "resource_uuid", resourceUuid, "group_uuid", getUUID()) ; + LOG.info("Call insertToscaData for RESOURCE_GROUP where group_uuid = " + getUUID() + " and resource_uuid = " + resourceUuid); + insertToscaData(buildSql("RESOURCE_GROUP", "resource_uuid", resourceUuid, model_yaml, params), null); insertRelevantAttributeData("group"); } catch (IOException e) { diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java index 4870f29e..cf81b3ca 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java @@ -24,11 +24,13 @@ package org.onap.ccsdk.sli.northbound.uebclient; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; -import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.Property; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,59 +45,53 @@ public class SdncNodeModel extends SdncBaseModel { private String [] bindingUuids = null; // Using ASDC TOSCA Parser 17.07 - public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, DBResourceManager jdbcDataSource) { + public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails nodeEntity, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { - super(sdcCsarHelper, nodeTemplate, jdbcDataSource); + super(sdcCsarHelper, nodeEntity, jdbcDataSource, config); - // extract inpuecompGeneratedNamingts - String ecompGeneratedNaming = extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING); - addParameter("ecomp_generated_naming",ecompGeneratedNaming); - addParameter("naming_policy", extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY)); - // extract properties - addParameter("network_type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); - addParameter("network_role", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); - addParameter("network_scope", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); - addParameter("network_technology", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + addParameter("ecomp_generated_naming", extractBooleanValue (nodeEntity, "exVL_naming", "ecomp_generated_naming")); // should be extractBooleanValue? + addParameter("naming_policy", extractValue (nodeEntity, "exVL_naming", "naming_policy")); + + addParameter("network_type", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + addParameter("network_role", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + addParameter("network_scope", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + addParameter("network_technology", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); // extract properties - network_assignments - addParameter("is_shared_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISSHAREDNETWORK)); - addParameter("is_external_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISEXTERNALNETWORK)); - String trunkNetworkIndicator = extractBooleanValue(nodeTemplate, "network_assignments#is_trunked"); + addParameter("is_shared_network", extractBooleanValue (nodeEntity, "network_assignments", "is_shared_network")); + addParameter("is_external_network", extractBooleanValue (nodeEntity, "network_assignments", "is_external_network")); + String trunkNetworkIndicator = extractBooleanValue(nodeEntity, "network_assignments", "is_trunked"); addParameter("trunk_network_indicator", trunkNetworkIndicator); // extract properties - network_assignments - ipv4_subnet_default_assignment - String useIpv4 = extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#use_ipv4"); + String useIpv4 = extractBooleanValue(nodeEntity, "network_assignments", "use_ipv4"); addParameter("use_ipv4", useIpv4); - addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#dhcp_enabled")); - if (useIpv4.contains("Y")) { - addParameter("ipv4_ip_version", "ipv4"); - } - addParameter("ipv4_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#cidr_mask")); - addParameter("eipam_v4_address_plan", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#ip_network_address_plan")); + addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "dhcp_enabled")); + addParameter("ipv4_ip_version", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "ip_version")); + addParameter("ipv4_cidr_mask", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "cidr_mask")); + addParameter("eipam_v4_address_plan", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "ip_network_address_plan")); // extract properties - network_assignments - ipv6_subnet_default_assignment - String useIpv6 = extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#use_ipv6"); + String useIpv6 = extractBooleanValue(nodeEntity, "network_assignments", "use_ipv6"); addParameter("use_ipv6", useIpv6); - addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#dhcp_enabled")); - if (useIpv6.contains("Y")) { - addParameter("ipv6_ip_version", "ipv6"); - } - addParameter("ipv6_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#cidr_mask")); - addParameter("eipam_v6_address_plan", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#ip_network_address_plan")); + addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "dhcp_enabled")); + addParameter("ipv6_ip_version", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "ip_version")); + addParameter("ipv6_cidr_mask", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "cidr_mask")); + addParameter("eipam_v6_address_plan", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "ip_network_address_plan")); // extract properties - provider_network - addParameter("is_provider_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK)); - addParameter("physical_network_name", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_PHYSICALNETWORKNAME)); + addParameter("is_provider_network", extractBooleanValue (nodeEntity, "provider_network", "is_provider_network")); + addParameter("physical_network_name", extractValue(nodeEntity, "provider_network", "physical_network_name")); // extract properties - network_flows - addParameter("is_bound_to_vpn", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_ISBOUNDTOVPN)); + addParameter("is_bound_to_vpn", extractBooleanValue (nodeEntity, "network_flows", "is_bound_to_vpn")); // extract properties - network_flows - vpn_bindings - String vpnBindingString = extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_VPNBINDING); + String vpnBindingString = extractValue (nodeEntity, "network_flows", "vpn_binding"); bindingUuids = vpnBindingString.split(","); -} + } public String getServiceUUID() { return serviceUUID; @@ -113,13 +109,24 @@ public class SdncNodeModel extends SdncBaseModel { params.put("ecomp_generated_naming", "\"" + ecompGeneratedNaming + "\""); } } + public void setComplexResourceUUID(String complexResourceUuid) { + if (complexResourceUuid != null && !complexResourceUuid.isEmpty()) { + params.put("complex_resource_uuid", complexResourceUuid); + } + } + + public void setComplexResourceCustomizationUUID(String complexResourceCustomizationUuid) { + if (complexResourceCustomizationUuid != null && !complexResourceCustomizationUuid.isEmpty()) { + params.put("complex_resource_customization_uuid", complexResourceCustomizationUuid); + } + } public void insertNetworkModelData () throws IOException { try { // Clean up NETWORK_MODEL data for this customization_uuid and service_uuid? cleanUpExistingToscaData("NETWORK_MODEL", "customization_uuid", getCustomizationUUID()); cleanUpExistingToscaData("VPN_BINDINGS", "network_customization_uuid", getCustomizationUUID()); - LOG.info("Call insertToscaData for NETWORK_MODEL customizationUUID = " + getCustomizationUUID()); + LOG.info("Call insertToscaData for NETWORK_MODEL where customization_uuid = " + getCustomizationUUID()); insertToscaData(getSql(model_yaml), null); insertToscaData(getVpnBindingsSql(), null); } catch (IOException e) { @@ -127,48 +134,47 @@ public class SdncNodeModel extends SdncBaseModel { throw new IOException (e); } } - + public void insertRelatedNetworkRoleData () throws IOException { - Object propertyValue = sdcCsarHelper.getNodeTemplatePropertyValueAsObject(nodeTemplate, "network_assignments#related_networks"); - ArrayList> relatedNetworkList = (ArrayList)propertyValue; - - String networkModelCustomizationUUID = getCustomizationUUID(); + if (entityDetails.getProperties().containsKey("related_networks")) { + + Property relatedNetworksProperty = entityDetails.getProperties().get("related_networks"); + List relatedNetworkRoles = relatedNetworksProperty.getLeafPropertyValue("related_network_role"); + + String networkModelCustomizationUUID = getCustomizationUUID(); - if (relatedNetworkList != null) { - - try { - cleanUpExistingToscaData("RELATED_NETWORK_ROLE", "network_model_customization_uuid", networkModelCustomizationUUID); - } catch (IOException e) { - LOG.error("Could not clean up Tosca CSAR data in the RELATED_NETWORK_ROLE table"); - throw new IOException (e); - } - - for (Map relatedNetworkValue : relatedNetworkList) { - LOG.debug("Node Template [" + nodeTemplate.getName() + "], property [" + "related_network_role" + "] property value: " + relatedNetworkValue.get("related_network_role")); + try { + cleanUpExistingToscaData("RELATED_NETWORK_ROLE", "network_model_customization_uuid", networkModelCustomizationUUID); + } catch (IOException e) { + LOG.error("Could not clean up Tosca CSAR data in the RELATED_NETWORK_ROLE table"); + throw new IOException (e); + } + + for (String relatedNetworkRole : relatedNetworkRoles) { + + LOG.debug("Node Template [" + entityDetails.getName() + "], property [" + "related_network_role" + "] property value: " + relatedNetworkRole); - String relatedNetworkRoleValue = relatedNetworkValue.get("related_network_role"); - try { // Table cleanup RELATED_NETWORK_ROLE occurs per network // If related_network_role for this service already exist in RELATED_NETWORK_ROLE, don't attempt insertion Map relatedNetworkRoleParamsCheck = new HashMap(); - addParameter("related_network_role", relatedNetworkRoleValue, relatedNetworkRoleParamsCheck); + addParameter("related_network_role", relatedNetworkRole, relatedNetworkRoleParamsCheck); addParameter("network_model_customization_uuid", networkModelCustomizationUUID, relatedNetworkRoleParamsCheck); if (checkForExistingToscaData("RELATED_NETWORK_ROLE", relatedNetworkRoleParamsCheck) == false) { relatedNetworkRoleParamsCheck.remove("related_network_role"); LOG.info("Call insertToscaData for RELATED_NETWORK_ROLE where network_model_customization_uuid = " + networkModelCustomizationUUID); - insertToscaData(buildSql("RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRoleValue + "\"", model_yaml, relatedNetworkRoleParamsCheck), null); + insertToscaData(buildSql("RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRole + "\"", model_yaml, relatedNetworkRoleParamsCheck), null); } } catch (IOException e) { LOG.debug("Could not insert Tosca CSAR data into the RELATED_NETWORK_ROLE table"); throw new IOException (e); } - } - } - else { - LOG.debug("Node Template [" + nodeTemplate.getName() + "], property [" + "related_networks" + "] property value: " + null); - } + } + } + else { + LOG.debug("Node Template [" + entityDetails.getName() + "], property [" + "related_networks" + "] property value: " + null); + } } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java index d3962262..d7418824 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java @@ -703,18 +703,22 @@ public class SdncUebCallback implements INotificationCallback { } - // Ingest Network (VL) Data - 1707 - List vlNodeTemplatesList = sdcCsarHelper.getServiceVlList(); + // Ingest Network (VL) Data - 1707 / migrate to getEntity - 1908 + EntityQuery vlEntityQuery = EntityQuery.newBuilder(SdcTypes.VL).build(); + TopologyTemplateQuery vlTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List vlEntities = sdcCsarHelper.getEntity(vlEntityQuery, vlTopologyTemplateQuery, false); // false to not recurse + if (vlEntities != null && !vlEntities.isEmpty()) { + for (IEntityDetails vlEntity : vlEntities){ - for (NodeTemplate nodeTemplate : vlNodeTemplatesList) { - SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, nodeTemplate, jdbcDataSource); - nodeModel.setServiceUUID(serviceModel.getServiceUUID()); + try { + SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, vlEntity, jdbcDataSource, config); + nodeModel.setServiceUUID(serviceModel.getServiceUUID()); - try { - nodeModel.insertNetworkModelData(); - nodeModel.insertRelatedNetworkRoleData(); - } catch (IOException e) { - deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + nodeModel.insertNetworkModelData(); + nodeModel.insertRelatedNetworkRoleData(); + } catch (IOException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } } } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java index bd71c024..fc288aaa 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java @@ -94,7 +94,7 @@ public class SdncVFCModel extends SdncBaseModel { TopologyTemplateQuery topologyTemplateQueryVFC = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(vfcCustomizationUuid).build(); List cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVFC, true); if (cpEntities == null || cpEntities.isEmpty()) { - LOG.info("insertVFCtoNetworkRoleMappingData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); + LOG.debug("insertVFCtoNetworkRoleMappingData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); return; } @@ -282,7 +282,7 @@ public class SdncVFCModel extends SdncBaseModel { TopologyTemplateQuery topologyTemplateQueryVFC = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(vfcCustomizationUuid).build(); List cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVFC, true); if (cpEntities == null || cpEntities.isEmpty()) { - LOG.info("insertVFCRelatedNetworkRoleData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); + LOG.debug("insertVFCRelatedNetworkRoleData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); return; } diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java index 2b2d078f..dd93f45d 100644 --- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java +++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java @@ -54,7 +54,14 @@ public class SdncVFModel extends SdncBaseModel { public SdncVFModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { super(sdcCsarHelper, nodeTemplate, jdbcDataSource, config); - + + // Since SdncVFModel is not yet converted for getEntity, find the entity for this nodeTemplate + EntityQuery vfEntityQuery = EntityQuery.newBuilder(SdcTypes.VF).customizationUUID(getCustomizationUUIDNoQuotes()).build(); + TopologyTemplateQuery vfTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List vfEntities = sdcCsarHelper.getEntity(vfEntityQuery, vfTopologyTemplateQuery, true); + if (vfEntities != null && !vfEntities.isEmpty()) { + entityDetails = vfEntities.get(0); + } // extract metadata Metadata metadata = nodeTemplate.getMetaData(); addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME)); @@ -158,7 +165,7 @@ public class SdncVFModel extends SdncBaseModel { try { cleanUpExistingToscaData("VF_MODULE_MODEL", "customization_uuid", vfModuleModel.getCustomizationUUID()); cleanUpExistingToscaData("VF_MODULE_TO_VFC_MAPPING", "vf_module_customization_uuid", vfModuleModel.getCustomizationUUID()); - LOG.info("Call insertToscaData for VF_MODULE_MODEL where vf_module_customization_uuid = " + vfModuleModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_MODULE_MODEL where customization_uuid = " + vfModuleModel.getCustomizationUUID()); insertToscaData(vfModuleModel.buildSql("VF_MODULE_MODEL", model_yaml), null); } catch (IOException e) { LOG.error("Could not insert Tosca CSAR data into the VF_MODULE_MODEL table "); @@ -175,7 +182,7 @@ public class SdncVFModel extends SdncBaseModel { .build(); List vfModulesNonCatalog = sdcCsarHelper.getEntity(entityQuery2, topologyTemplateQuery2, false); if (vfModulesNonCatalog == null || vfModulesNonCatalog.isEmpty()) { - LOG.info("insertVFModuleData: Could not find the non-catelog VF Module for: " + vfModuleModel.getCustomizationUUID() + ". Unable to insert members into VF_MODULE_TO_VFC_MAPPING"); + LOG.debug("insertVFModuleData: Could not find the non-catelog VF Module for: " + vfModuleModel.getCustomizationUUID() + ". Unable to insert members into VF_MODULE_TO_VFC_MAPPING"); continue; } @@ -217,7 +224,7 @@ public class SdncVFModel extends SdncBaseModel { .build(); List nestedCvfcs = sdcCsarHelper.getEntity(entityQuery3, topologyTemplateQuery3, true); // true allows for nested search if (nestedCvfcs == null || nestedCvfcs.isEmpty()) { - LOG.info("insertVFModuleData: Could not find the nested CVFCs for: " + cvfcCustomizationUuid); + LOG.debug("insertVFModuleData: Could not find the nested CVFCs for: " + cvfcCustomizationUuid); continue; } @@ -284,7 +291,7 @@ public class SdncVFModel extends SdncBaseModel { TopologyTemplateQuery topologyTemplateQueryVF = TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(getCustomizationUUIDNoQuotes()).build(); List cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVF, true); if (cpEntities == null || cpEntities.isEmpty()) { - LOG.info("insertVFtoNetworkRoleMappingData: Could not find CPs for VF: " + getCustomizationUUIDNoQuotes()); + LOG.debug("insertVFtoNetworkRoleMappingData: Could not find CPs for VF: " + getCustomizationUUIDNoQuotes()); return; } @@ -343,7 +350,7 @@ public class SdncVFModel extends SdncBaseModel { .build(); List cvfcEntities = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, true); // true allows for nested search if (cvfcEntities == null || cvfcEntities.isEmpty()) { - LOG.info("insertVFCDataEntity: Could not find the CVFCs for: " + vfCustomizationUid); + LOG.debug("insertVFCDataEntity: Could not find the CVFCs for: " + vfCustomizationUid); } for (IEntityDetails cvfcEntity: cvfcEntities) { @@ -382,8 +389,8 @@ public class SdncVFModel extends SdncBaseModel { for (IEntityDetails group : vfcInstanceGroupListForVf){ - SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, nodeTemplate, config, jdbcDataSource); - groupModel.insertGroupData(nodeTemplate); + SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, entityDetails, config, jdbcDataSource); + groupModel.insertGroupData(getUUID()); // For each group, populate NODE_CAPABILITY/NODE_CAPABILITY_PROPERTY insertNodeCapabilitiesEntityData(group.getCapabilities()); @@ -419,7 +426,7 @@ public class SdncVFModel extends SdncBaseModel { break; } addParameter("table_name", tableName, mappingParams); - LOG.info("Call insertToscaData for RESOURCE_GROUP_TO_TARGET_NODE_MAPPING where group_uuid = " + groupModel.getUUID() + " and target_node_uuid = " + targetNodeUuid); + LOG.info("Call insertToscaData for RESOURCE_GROUP_TO_TARGET_NODE_MAPPING where group_uuid = " + groupModel.getUUID() + " and target_node_uuid = \"" + targetNodeUuid + "\""); insertToscaData(buildSql("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", "group_uuid", groupModel.getUUID(), model_yaml, mappingParams), null); } catch (IOException e) { LOG.error("Could not insert Tosca CSAR data into the RESOURCE_GROUP_TO_TARGET_NODE_MAPPING"); diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java index 8bf3c914..3b2cd96a 100644 --- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java +++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java @@ -8,8 +8,6 @@ import java.io.IOException; import org.junit.Test; import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.toscaparser.api.NodeTemplate; -import org.onap.sdc.toscaparser.api.Group; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; public class SdncGroupModelTest { @@ -17,13 +15,13 @@ import org.onap.ccsdk.sli.core.dblib.DBResourceManager; @Test public void testSdncGroupModelConstructor() { ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); - NodeTemplate nodeTemplate = mock(NodeTemplate.class); IEntityDetails group = mock(IEntityDetails.class); + IEntityDetails entityDetails = mock(IEntityDetails.class); DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); SdncGroupModel testSdncGroupModel = null; try { - testSdncGroupModel = new SdncGroupModel(mockCsarHelper,group,nodeTemplate,mockSdncUebConfiguration,mockDBResourceManager); + testSdncGroupModel = new SdncGroupModel(mockCsarHelper,group,entityDetails,mockSdncUebConfiguration,mockDBResourceManager); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java index a77c5adb..9f859e79 100644 --- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java +++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java @@ -7,9 +7,9 @@ import static org.mockito.Mockito.*; import java.io.IOException; import org.junit.Before; -import org.junit.Test; -import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.ccsdk.sli.core.dblib.DBResourceManager; @@ -18,17 +18,17 @@ public class SdncNodeModelTest { SdncNodeModel sdncNodeModel; @Before - public void setUp() throws Exception { + public void setUp() throws Exception { + SdncUebConfiguration config = mock(SdncUebConfiguration.class); ISdcCsarHelper isdcCsarHelper = mock(ISdcCsarHelper.class); - NodeTemplate nodeTemplate = mock(NodeTemplate.class); + IEntityDetails entityDetails = mock(IEntityDetails.class); Metadata mockMetadata = mock(Metadata.class); DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); - when(nodeTemplate.getMetaData()).thenReturn(mockMetadata); + when(entityDetails.getMetadata()).thenReturn(mockMetadata); when(isdcCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); - when(isdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "network_type")).thenReturn("test-network-type"); - sdncNodeModel = new SdncNodeModel(isdcCsarHelper, nodeTemplate, mockDBResourceManager); + sdncNodeModel = new SdncNodeModel(isdcCsarHelper, entityDetails, mockDBResourceManager, config); sdncNodeModel.setServiceUUID("0e8d757f-1c80-40af-85de-31d64f1f5af8"); sdncNodeModel.setEcompGeneratedNaming("hello-world"); } @@ -48,7 +48,7 @@ public class SdncNodeModelTest { @Test public void testGetSqlString() { String result = sdncNodeModel.getSql("TEST-HELLO"); - String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming, network_type) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"hello-world\", \"test-network-type\");"; + String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"hello-world\");"; assertEquals(test, result); } diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java index 5b4637ea..2c44ba73 100644 --- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java +++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java @@ -46,6 +46,23 @@ public class TestSdncUebCallback { " `naming_policy` varchar(255) DEFAULT NULL,\n" + " PRIMARY KEY (`service_uuid`)\n" + ") "; + + private static final String CRTBL_SERVICE_MODEL_TO_VF_MODEL_MAPPING = "CREATE TABLE `SERVICE_MODEL_TO_VF_MODEL_MAPPING` (\n" + + " `service_uuid` varchar(255) NOT NULL,\n" + + " `vf_uuid` varchar(255) DEFAULT NULL,\n" + + " `vf_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " `service_invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`service_uuid`)\n" + + ") "; + + private static final String CRTBL_ATTRIBUTE_VALUE_PAIR = "CREATE TABLE `ATTRIBUTE_VALUE_PAIR` (\n" + + " `resource_uuid` varchar(255) NOT NULL,\n" + + " `attribute_name` varchar(255) NOT NULL,\n" + + " `resource_type` varchar(255) NOT NULL,\n" + + " `attribute_value` varchar(255) DEFAULT NULL,\n" + + " `resource_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`resource_uuid`,`attribute_name`,`resource_type`)\n" + + ") "; private static final String CRTBL_NETWORK_MODEL = "CREATE TABLE `NETWORK_MODEL` (\n" + " `customization_uuid` varchar(255) NOT NULL,\n" + @@ -118,6 +135,39 @@ public class TestSdncUebCallback { " PRIMARY KEY (`customization_uuid`)\n" + ") "; + private static final String CRTBL_VFC_RELATED_NETWORK_ROLE = "CREATE TABLE `VFC_RELATED_NETWORK_ROLE` (\n" + + " `vfc_customization_uuid` varchar(255) NOT NULL,\n" + + " `vm_type` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " `related_network_role` varchar(255) NOT NULL,\n" + + " PRIMARY KEY (`vfc_customization_uuid`,`vm_type`,`network_role`,`related_network_role`)\n" + + ") "; + + private static final String CRTBL_VFC_TO_NETWORK_ROLE_MAPPING = "CREATE TABLE `VFC_TO_NETWORK_ROLE_MAPPING` (\n" + + " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `vfc_customization_uuid` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " `vm_type` varchar(255) DEFAULT NULL,\n" + + " `network_role_tag` varchar(255) DEFAULT NULL,\n" + + " `ipv4_count` int(11) NOT NULL,\n" + + " `ipv6_count` int(11) NOT NULL,\n" + + " `ipv4_use_dhcp` char(1) DEFAULT NULL,\n" + + " `ipv6_use_dhcp` char(1) DEFAULT NULL,\n" + + " `ipv4_ip_version` char(1) DEFAULT NULL,\n" + + " `ipv6_ip_version` char(1) DEFAULT NULL,\n" + + " `extcp_subnetpool_id` varchar(512) DEFAULT NULL,\n" + + " `ipv4_floating_count` int(11) DEFAULT NULL,\n" + + " `ipv6_floating_count` int(11) DEFAULT NULL,\n" + + " `ipv4_address_plan_name` varchar(512) DEFAULT NULL,\n" + + " `ipv6_address_plan_name` varchar(512) DEFAULT NULL,\n" + + " `ipv4_vrf_name` varchar(512) DEFAULT NULL,\n" + + " `ipv6_vrf_name` varchar(512) DEFAULT NULL,\n" + + " `subnet_role` varchar(255) DEFAULT NULL,\n" + + " `subinterface_indicator` char(1) DEFAULT NULL,\n" + + " PRIMARY KEY (`seq`),\n" + + " KEY `IX1_VFC_TO_NETWORK_ROLE_MAPPING` (`vfc_customization_uuid`)\n" + + ") "; + private static final String CRTBL_VF_MODEL = "CREATE TABLE `VF_MODEL` (\n" + " `customization_uuid` varchar(255) NOT NULL,\n" + " `model_yaml` longblob,\n" + @@ -137,6 +187,21 @@ public class TestSdncUebCallback { " PRIMARY KEY (`customization_uuid`)\n" + ")"; + private static final String CRTBL_VNF_RELATED_NETWORK_ROLE = "CREATE TABLE `VNF_RELATED_NETWORK_ROLE` (\n" + + " `vnf_customization_uuid` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " `related_network_role` varchar(255) NOT NULL,\n" + + " PRIMARY KEY (`vnf_customization_uuid`,`network_role`,`related_network_role`)\n" + + ")"; + + private static final String CRTBL_VF_TO_NETWORK_ROLE_MAPPING = "CREATE TABLE `VF_TO_NETWORK_ROLE_MAPPING` (\n" + + " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `vf_customization_uuid` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " PRIMARY KEY (`seq`),\n" + + " KEY `IX1_VF_TO_NETWORK_ROLE_MAPPING` (`vf_customization_uuid`)\n" + + ")"; + private static final String CRTBL_VF_MODULE_MODEL = "CREATE TABLE `VF_MODULE_MODEL` (\n" + " `customization_uuid` varchar(255) NOT NULL,\n" + " `model_yaml` longblob,\n" + @@ -146,8 +211,82 @@ public class TestSdncUebCallback { " `vf_module_type` varchar(255) DEFAULT NULL,\n" + " `availability_zone_count` int(11) DEFAULT NULL,\n" + " `ecomp_generated_vm_assignments` char(1) DEFAULT NULL,\n" + + " `vf_customization_uuid` char(255) DEFAULT NULL,\n" + + " `vf_module_label` char(255) DEFAULT NULL,\n" + " PRIMARY KEY (`customization_uuid`)\n" + ")"; + + private static final String CRTBL_VF_MODULE_TO_VFC_MAPPING = "CREATE TABLE `VF_MODULE_TO_VFC_MAPPING` (\n" + + " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `vf_module_customization_uuid` varchar(255) NOT NULL,\n" + + " `vfc_customization_uuid` varchar(255) NOT NULL,\n" + + " `vm_type` varchar(255) NOT NULL,\n" + + " `vm_count` int(11) NOT NULL,\n" + + " PRIMARY KEY (`seq`),\n" + + " KEY `IX1_VF_MODULE_TO_VFC_MAPPING` (`vf_module_customization_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_GROUP = "CREATE TABLE `RESOURCE_GROUP` (\n" + + " `resource_uuid` varchar(255) NOT NULL,\n" + + " `group_uuid` varchar(255) NOT NULL,\n" + + " `group_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " `group_invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `group_name` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `group_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`resource_uuid`,`group_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_GROUP_TO_TARGET_NODE_MAPPING = "CREATE TABLE `RESOURCE_GROUP_TO_TARGET_NODE_MAPPING` (\n" + + " `group_uuid` varchar(255) NOT NULL,\n" + + " `parent_uuid` varchar(255) NOT NULL,\n" + + " `target_node_uuid` varchar(255) NOT NULL,\n" + + " `target_type` varchar(255) DEFAULT NULL,\n" + + " `table_name` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`group_uuid`,`parent_uuid`,`target_node_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_POLICY = "CREATE TABLE `RESOURCE_POLICY` (\n" + + " `resource_uuid` varchar(255) NOT NULL,\n" + + " `policy_uuid` varchar(255) NOT NULL,\n" + + " `policy_invariant_uuid` varchar(255) NOT NULL,\n" + + " `policy_name` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `policy_type` varchar(255) DEFAULT NULL,\n" + + " `property_type` varchar(255) DEFAULT NULL,\n" + + " `property_source` varchar(255) DEFAULT NULL,\n" + + " `property_name` varchar(255) DEFAULT NULL,\n" + + " `policy_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`resource_uuid`,`policy_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_POLICY_TO_TARGET_NODE_MAPPING = "CREATE TABLE `RESOURCE_POLICY_TO_TARGET_NODE_MAPPING` (\n" + + " `policy_uuid` varchar(255) NOT NULL,\n" + + " `parent_uuid` varchar(255) NOT NULL,\n" + + " `target_node_uuid` varchar(255) NOT NULL,\n" + + " `target_type` varchar(255) DEFAULT NULL,\n" + + " `target_node_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " `policy_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`policy_uuid`,`parent_uuid`,`target_node_uuid`)\n" + + ")"; + + private static final String CRTBL_NODE_CAPABILITY = "CREATE TABLE `NODE_CAPABILITY` (\n" + + " `capability_id` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `capability_provider_uuid` varchar(255) NOT NULL,\n" + + " `capability_provider_customization_uuid` varchar(255) NOT NULL,\n" + + " `capability_name` varchar(255) DEFAULT NULL,\n" + + " `capability_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`capability_id`)\n" + + ")"; + + private static final String CRTBL_NODE_CAPABILITY_PROPERTY = "CREATE TABLE `NODE_CAPABILITY_PROPERTY` (\n" + + " `capability_id` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `capability_property_name` varchar(255) NOT NULL,\n" + + " `capability_property_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`capability_id`,`capability_property_name`),\n" + + " CONSTRAINT `NODE_CAPABILITY_PROPERTY_TO_NODE_CAPABILITY` FOREIGN KEY (`capability_id`) REFERENCES `NODE_CAPABILITY` (`capability_id`) ON DELETE CASCADE\n" + + ")"; + private static final Logger LOG = LoggerFactory .getLogger(TestSdncUebCallback.class); @@ -195,11 +334,24 @@ public class TestSdncUebCallback { // Create TOSCA tables dblibSvc.writeData(CRTBL_SERVICE_MODEL, null, null); + dblibSvc.writeData(CRTBL_SERVICE_MODEL_TO_VF_MODEL_MAPPING, null, null); + dblibSvc.writeData(CRTBL_ATTRIBUTE_VALUE_PAIR, null, null); dblibSvc.writeData(CRTBL_NETWORK_MODEL, null, null); dblibSvc.writeData(CRTBL_VFC_MODEL, null, null); + dblibSvc.writeData(CRTBL_VFC_RELATED_NETWORK_ROLE, null, null); + dblibSvc.writeData(CRTBL_VFC_TO_NETWORK_ROLE_MAPPING, null, null); dblibSvc.writeData(CRTBL_VF_MODEL, null, null); + dblibSvc.writeData(CRTBL_VNF_RELATED_NETWORK_ROLE, null, null); + dblibSvc.writeData(CRTBL_VF_TO_NETWORK_ROLE_MAPPING, null, null); dblibSvc.writeData(CRTBL_VF_MODULE_MODEL, null, null); + dblibSvc.writeData(CRTBL_VF_MODULE_TO_VFC_MAPPING, null, null); dblibSvc.writeData(CRTBL_ALLOTTED_RESOURCE_MODEL, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_GROUP, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_GROUP_TO_TARGET_NODE_MAPPING, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_POLICY, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_POLICY_TO_TARGET_NODE_MAPPING, null, null); + dblibSvc.writeData(CRTBL_NODE_CAPABILITY, null, null); + dblibSvc.writeData(CRTBL_NODE_CAPABILITY_PROPERTY, null, null); processLevelArtifactList = new ArrayList<>(); serviceLevelArtifactList = new ArrayList<>(); diff --git a/ueb-listener/src/test/resources/ueb-listener.properties b/ueb-listener/src/test/resources/ueb-listener.properties index 35c38059..c017cbd7 100755 --- a/ueb-listener/src/test/resources/ueb-listener.properties +++ b/ueb-listener/src/test/resources/ueb-listener.properties @@ -14,8 +14,9 @@ org.onap.ccsdk.sli.northbound.uebclient.polling-interval=30 org.onap.ccsdk.sli.northbound.uebclient.polling-timeout=15 org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout=60 org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION +org.onap.ccsdk.sli.northbound.uebclient.relevant-capability-names=RoutingConfiguration,routing_configuration,VLANAssignment,vlan_assignment org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth=false org.onap.ccsdk.sli.northbound.uebclient.keystore-path= org.onap.ccsdk.sli.northbound.uebclient.keystore-password= org.onap.ccsdk.sli.northbound.uebclient.xslt-path-list= -org.onap.ccsdk.sli.northbound.uebclient.artifact-map=src/test/resources/artifact.map \ No newline at end of file +org.onap.ccsdk.sli.northbound.uebclient.artifact-map=src/test/resources/artifact.map diff --git a/version.properties b/version.properties index 71ba554c..74fd9991 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ release_name=0 sprint_number=5 -feature_revision=1 +feature_revision=2 base_version=${release_name}.${sprint_number}.${feature_revision} -- cgit 1.2.3-korg