diff options
author | Arul.Nambi <arul.nambi@amdocs.com> | 2018-12-13 15:34:17 -0500 |
---|---|---|
committer | Arul.Nambi <arul.nambi@amdocs.com> | 2018-12-14 10:30:26 -0500 |
commit | 885545697c79b299a372956b1b368e13bab3426c (patch) | |
tree | 9be5faaf897bbd03eb700760e9da5ba436e4c0c4 | |
parent | 53d13ff36532723582f55febce79de2282e46cde (diff) |
Updating the new schema service ingest
Issue-ID: AAI-2006
Change-Id: I25360ea42d1e09ada6af00dbe99ceace978ee09a
Signed-off-by: Arul.Nambi <arul.nambi@amdocs.com>
16 files changed, 132 insertions, 45 deletions
diff --git a/sparkybe-onap-application/config/application-oxm-default.properties b/sparkybe-onap-application/config/application-oxm-default.properties index 5c362d8..ef3db64 100644 --- a/sparkybe-onap-application/config/application-oxm-default.properties +++ b/sparkybe-onap-application/config/application-oxm-default.properties @@ -1 +1,12 @@ -oxm.apiVersion=v14
\ No newline at end of file +oxm.apiVersion=v14
+oxm.apiVersionList=v10,v11,v12,v13,v14
+
+oxm.schemaServiceTranslatorList=config
+oxm.schemaServiceBaseUrl=https://<hostname>:<port>/onap/schema-service/v1/
+oxm.schemaServiceKeystore=file:${CONFIG_HOME}/auth/tomcat_keystore
+oxm.schemaServiceTruststore=file:${CONFIG_HOME}/auth/tomcat_keystore
+oxm.schemaServiceKeystorePassword=OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10
+oxm.schemaServiceTruststorePassword=OBF:1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10
+
+# Schema Service need this variable for the time being with 7.0.1-SNAPSHOT
+spring.applicationName=sparky
\ No newline at end of file diff --git a/sparkybe-onap-application/config/application.properties b/sparkybe-onap-application/config/application.properties index c49bf5a..1c37fa7 100644 --- a/sparkybe-onap-application/config/application.properties +++ b/sparkybe-onap-application/config/application.properties @@ -9,7 +9,7 @@ spring.mvc.favicon.enabled=false # # Gizmo profile # -spring.profiles.active=camel,ssl,fe-dev,oxm-schema-dev,gizmo,oxm-override +spring.profiles.active=camel,ssl,fe-dev,oxm-schema-dev,gizmo,oxm-default # # Resources profile @@ -23,4 +23,6 @@ searchservice.client-cert=client-cert-onap.p12 searchservice.client-cert-password=1y0q1uvc1uum1uvg1pil1pjl1uuq1uvk1uuu1y10 searchservice.truststore=tomcat_keystore -spring.mvc.favicon.enabled=false
\ No newline at end of file +spring.mvc.favicon.enabled=false + +schema.ingest.file=${CONFIG_HOME}/schemaIngest.properties
\ No newline at end of file diff --git a/sparkybe-onap-application/config/schemaIngest.properties b/sparkybe-onap-application/config/schemaIngest.properties index 1f5a13a..f88a7ef 100644 --- a/sparkybe-onap-application/config/schemaIngest.properties +++ b/sparkybe-onap-application/config/schemaIngest.properties @@ -1,15 +1,32 @@ # Properties for the SchemaLocationsBean # Files named aai_oxm_v*.xml are unpacked here: -nodeDir=${oxm.schemaNodeDir} -# Dummy folder/directory: -edgeDir= +# Schema Version Related Attributes +schema.uri.base.path=/aai +# Lists all of the versions in the schema +schema.version.list=v9,v10,v11,v12,v13,v14 +# Specifies from which version should the depth parameter to default to zero +schema.version.depth.start=v10 +# Specifies from which version should the related link be displayed in response payload +schema.version.related.link.start=v10 +# Specifies from which version should the client see only the uri excluding host info +# Before this version server base will also be included +schema.version.app.root.start=v11 +# Specifies from which version should the namespace be changed +schema.version.namespace.change.start=v12 +# Specifies from which version should the client start seeing the edge label in payload +schema.version.edge.label.start=v12 +# Specifies the version that the application should default to +schema.version.api.default=v14 + +# Schema Location Related Attributes +schema.configuration.location=NA # New propterties required by the aai-common - aai-schema-ingest lib as of 1.3.0 schema.configuration.location=N/A schema.nodes.location=${oxm.schemaNodeDir} schema.edges.location= # These versions need to exist if they are included in the list -schema.version.list=v8,v9,v10,v11,v12,v13,v14 +schema.version.list=${oxm.apiVersionList} # Decalares the oxm version to load schema.version.api.default=${oxm.apiVersion} @@ -18,4 +35,23 @@ schema.version.depth.start=${oxm.apiVersion} schema.version.related.link.start=${oxm.apiVersion} schema.version.app.root.start=${oxm.apiVersion} schema.version.namespace.change.start=${oxm.apiVersion} -schema.version.edge.label.start=${oxm.apiVersion}
\ No newline at end of file +schema.version.edge.label.start=${oxm.apiVersion} + +# Properties required by AAI Schema Service MS +schema.translator.list=config +schema.service.base.url=${oxm.schemaServiceBaseUrl} +schema.service.nodes.endpoint=nodes?version= +schema.service.edges.endpoint=edgerules?version= +schema.service.versions.endpoint=versions +schema.local=true +schema.filename=mockrequests +#Default rest client is the two-way-ssl +#schema.service.client=two-way-ssl +#Replace the below with the A&AI client key store +schema.service.ssl.key-store=${oxm.schemaServiceKeystore} +#Replace the below with the A&AI tomcat trust store +schema.service.ssl.trust-store=${oxm.schemaServiceTruststore} +schema.service.ssl.key-store-password=${oxm.schemaServiceKeystorePassword} +schema.service.ssl.trust-store-password=${oxm.schemaServiceTruststorePassword} + +spring.application.name=sparky
\ No newline at end of file diff --git a/sparkybe-onap-application/config/spring-beans/sparky-oxm-default.xml b/sparkybe-onap-application/config/spring-beans/sparky-oxm-default.xml index b44d626..5eb2184 100644 --- a/sparkybe-onap-application/config/spring-beans/sparky-oxm-default.xml +++ b/sparkybe-onap-application/config/spring-beans/sparky-oxm-default.xml @@ -3,11 +3,10 @@ xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + <bean id="oxmModelLoader" class="org.onap.aai.sparky.config.oxm.OxmModelLoader" init-method="loadModel"> <constructor-arg ref="oxmModelProcessorSet" /> - <constructor-arg ref="nodeIngestor" /> <constructor-arg ref="schemaVersions" /> </bean> diff --git a/sparkybe-onap-application/config/spring-beans/sparky-oxm-override.xml b/sparkybe-onap-application/config/spring-beans/sparky-oxm-override.xml index 3c2d76b..c6db248 100644 --- a/sparkybe-onap-application/config/spring-beans/sparky-oxm-override.xml +++ b/sparkybe-onap-application/config/spring-beans/sparky-oxm-override.xml @@ -8,7 +8,6 @@ init-method="loadModel"> <constructor-arg name="apiVersionOverride" value="${oxm.apiVersion}" /> <constructor-arg ref="oxmModelProcessorSet" /> - <constructor-arg ref="nodeIngestor" /> </bean> </beans>
\ No newline at end of file diff --git a/sparkybe-onap-application/config/spring-beans/sparky-oxm.xml b/sparkybe-onap-application/config/spring-beans/sparky-oxm.xml index c392153..a210d12 100644 --- a/sparkybe-onap-application/config/spring-beans/sparky-oxm.xml +++ b/sparkybe-onap-application/config/spring-beans/sparky-oxm.xml @@ -35,24 +35,6 @@ </property> </bean> - <bean id="schemaLocationsBean" class="org.onap.aai.setup.SchemaLocationsBean"> - <!-- When running with AJSC these properties must be injected directly. - The reason for this is unknown. --> - <property name="nodeDirectory" value="${nodeDir}" /> - <property name="edgeDirectory" value="${edgeDir}" /> - </bean> - - <bean id="schemaVersions" class="org.onap.aai.setup.SchemaVersions"/> - - <bean id="oxmConfigTranslator" class="org.onap.aai.setup.AAIConfigTranslator"> - <constructor-arg ref="schemaLocationsBean" /> - <constructor-arg ref="schemaVersions" /> - </bean> - - <bean id="nodeIngestor" class="org.onap.aai.nodes.NodeIngestor"> - <constructor-arg ref="oxmConfigTranslator" /> - </bean> - <bean id="searchProviderRegistry" class="org.onap.aai.sparky.search.registry.SearchProviderRegistry" /> diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java index 9958d72..02e390f 100644 --- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java @@ -20,11 +20,19 @@ */ package org.onap.aai.sparky; +import org.onap.aai.config.EdgesConfiguration; import org.onap.aai.sparky.config.PropertyPasswordConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.PropertySource; @SpringBootApplication +@ComponentScan(basePackages = {"org.onap.aai.config", "org.onap.aai.setup", "org.onap.aai.sparky"}, excludeFilters = { +@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, +value = EdgesConfiguration.class)}) +@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true) public class Application { public static void main(String[] args) { diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SchemaConfiguration.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SchemaConfiguration.java new file mode 100644 index 0000000..ccaa833 --- /dev/null +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SchemaConfiguration.java @@ -0,0 +1,43 @@ +/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.aai.sparky.config;
+
+import org.onap.aai.setup.AAIConfigTranslator;
+import org.onap.aai.setup.ConfigTranslator;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersions;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+@Configuration
+@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
+@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
+public class SchemaConfiguration {
+
+ @Bean(name = "configTranslator")
+ @ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true)
+ public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) {
+ return new AAIConfigTranslator(schemaLocationsBean, schemaVersions);
+ }
+}
diff --git a/sparkybe-onap-service/pom.xml b/sparkybe-onap-service/pom.xml index 0bcfd09..e397109 100644 --- a/sparkybe-onap-service/pom.xml +++ b/sparkybe-onap-service/pom.xml @@ -23,7 +23,7 @@ <nexusproxy>https://nexus.onap.org</nexusproxy> <camel-spring-boot.version>2.21.1</camel-spring-boot.version> <config-home>${basedir}/</config-home> - <version.aai.aai-schema-ingest>1.3.0</version.aai.aai-schema-ingest> + <version.aai.aai-schema-ingest>1.4.1-SNAPSHOT</version.aai.aai-schema-ingest> <version.aai-schema>1.3.0</version.aai-schema> <sitePath>/content/sites/site/org/onap/aai/sparky-be/${project.artifactId}/${project.version}</sitePath> <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/OxmModelLoader.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/OxmModelLoader.java index 7ad01c7..a5c1525 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/OxmModelLoader.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/config/oxm/OxmModelLoader.java @@ -29,7 +29,10 @@ import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.setup.SchemaVersion; import org.onap.aai.setup.SchemaVersions; import org.onap.aai.sparky.logging.AaiUiMsgs; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component("oxmModelLoader") public class OxmModelLoader { private static final Logger LOG = LoggerFactory.getInstance().getLogger(OxmModelLoader.class); @@ -48,16 +51,14 @@ public class OxmModelLoader { private NodeIngestor nodeIngestor; - public OxmModelLoader(String apiVersionOverride, Set<OxmModelProcessor> oxmModelProcessors, NodeIngestor nodeIngestor) { + public OxmModelLoader(String apiVersionOverride, Set<OxmModelProcessor> oxmModelProcessors) { this.oxmApiVersion = new SchemaVersion(apiVersionOverride); this.processors = oxmModelProcessors; - this.nodeIngestor = nodeIngestor; } - public OxmModelLoader(Set<OxmModelProcessor> oxmModelProcessors, NodeIngestor nodeIngestor, SchemaVersions schemaVersions) { + public OxmModelLoader(Set<OxmModelProcessor> oxmModelProcessors, SchemaVersions schemaVersions) { this.oxmApiVersion = schemaVersions.getDefaultVersion(); this.processors = oxmModelProcessors; - this.nodeIngestor = nodeIngestor; } public SchemaVersion getOxmApiVersion() { @@ -66,6 +67,15 @@ public class OxmModelLoader { + public NodeIngestor getNodeIngestor() { + return nodeIngestor; + } + + @Autowired + public void setNodeIngestor(NodeIngestor nodeIngestor) { + this.nodeIngestor = nodeIngestor; + } + /** * Load an oxm model. * diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java index 8a83ca7..02d27f3 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizerTest.java @@ -171,7 +171,8 @@ public class AutosuggestionSynchronizerTest { suggestionEntityLookup = new SuggestionEntityLookup(filtersConfig); processors.add(suggestionEntityLookup); - OxmModelLoader oxmModelLoader = new OxmModelLoader("v11", processors,nodeInjest); + OxmModelLoader oxmModelLoader = new OxmModelLoader("v11", processors); + oxmModelLoader.setNodeIngestor(nodeInjest); oxmModelLoader.loadModel(); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/ActiveInventoryAdapterTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/ActiveInventoryAdapterTest.java index 6ec7513..d01c5bb 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/ActiveInventoryAdapterTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/ActiveInventoryAdapterTest.java @@ -22,7 +22,7 @@ public class ActiveInventoryAdapterTest { @Before public void init() throws Exception { - oxmModelLoader = new OxmModelLoader("v11",null,null); + oxmModelLoader = new OxmModelLoader("v11",null); oxmEntityLookup = new OxmEntityLookup(); endpointConfig = new RestEndpointConfig(); queryParams = new ArrayList<String>(); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/GizmoEntitySummarizer.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/GizmoEntitySummarizer.java index 435fbfb..b245943 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/GizmoEntitySummarizer.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/GizmoEntitySummarizer.java @@ -71,7 +71,6 @@ public class GizmoEntitySummarizer { gizmoConfig.setValidateServerHostname(false); gizmoAdapter = new GizmoAdapter(oxmModelLoader, gizmoConfig); - gizmoAdapter.setInventoryBasePath("/services/inventory/v12/"); gizmoAdapter.setRelationshipsBasePath("/services/inventory/relationships/v12/"); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/OxmModelAndProcessorHelper.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/OxmModelAndProcessorHelper.java index 0c72f33..fa05d71 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/OxmModelAndProcessorHelper.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/OxmModelAndProcessorHelper.java @@ -56,7 +56,7 @@ public class OxmModelAndProcessorHelper { processors.add(searchableEntityLookup); processors.add(suggestionEntityLookup); processors.add(oxmEntityContainerLookup); - this.modelLoader = new OxmModelLoader(API_VERSION_OVERRIDE, processors, null); + this.modelLoader = new OxmModelLoader(API_VERSION_OVERRIDE, processors); } diff --git a/sparkybe-onap-service/src/test/resources/oxm-reader/oxm-reader-bean.xml b/sparkybe-onap-service/src/test/resources/oxm-reader/oxm-reader-bean.xml index 3722fdd..76e5f17 100644 --- a/sparkybe-onap-service/src/test/resources/oxm-reader/oxm-reader-bean.xml +++ b/sparkybe-onap-service/src/test/resources/oxm-reader/oxm-reader-bean.xml @@ -57,8 +57,7 @@ init-method="loadModel"> <!-- <constructor-arg name="apiVersionOverride" value="V11" /> --> <constructor-arg ref="oxmModelProcessorSet" /> - <constructor-arg ref="nodeIngestor" /> - <constructor-arg ref="schemaVersions" /> + <constructor-arg ref="schemaVersions" /> </bean> </beans>
\ No newline at end of file diff --git a/sparkybe-onap-service/src/test/resources/oxm-reader/sparky-core.xml b/sparkybe-onap-service/src/test/resources/oxm-reader/sparky-core.xml index 3a811ed..28ad9b4 100644 --- a/sparkybe-onap-service/src/test/resources/oxm-reader/sparky-core.xml +++ b/sparkybe-onap-service/src/test/resources/oxm-reader/sparky-core.xml @@ -59,12 +59,10 @@ <property name="nodeDirectory" value="bundleconfig-local/etc/oxm/" /> <property name="edgeDirectory" value="bundleconfig-local/etc/oxm/" /> </bean> - - <bean id="schemaVersions" class="org.onap.aai.setup.SchemaVersions"/> - + <bean id="oxmConfigTranslator" class="org.onap.aai.setup.AAIConfigTranslator"> - <constructor-arg ref="schemaLocationsBean" /> - <constructor-arg ref="schemaVersions" /> + <constructor-arg ref="schemaLocationsBean" /> + <constructor-arg ref="schemaVersions" /> </bean> <bean id="nodeIngestor" class="org.onap.aai.nodes.NodeIngestor"> |