diff options
Diffstat (limited to 'aai-core')
261 files changed, 68482 insertions, 0 deletions
diff --git a/aai-core/.classpath b/aai-core/.classpath new file mode 100644 index 00000000..7dcc5272 --- /dev/null +++ b/aai-core/.classpath @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/aai-core/LICENSE.TXT b/aai-core/LICENSE.TXT new file mode 100644 index 00000000..32bbcba4 --- /dev/null +++ b/aai-core/LICENSE.TXT @@ -0,0 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ diff --git a/aai-core/pom.xml b/aai-core/pom.xml new file mode 100644 index 00000000..9a03fed6 --- /dev/null +++ b/aai-core/pom.xml @@ -0,0 +1,459 @@ +<?xml version="1.0"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openecomp.aai</groupId> + <artifactId>aai-core</artifactId> + <version>1.1.5-SNAPSHOT</version> + <name>aai-core</name> + <packaging>jar</packaging> + <properties> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <aai-schema.version>1.2.4-SNAPSHOT</aai-schema.version> + <nexusproxy>https://nexus.onap.org</nexusproxy> + <sitePath>/content/sites/site/${project.artifactId}/${project.version}</sitePath> + </properties> + <dependencies> + <dependency> + <groupId>org.openecomp.aai</groupId> + <artifactId>aai-schema</artifactId> + <version>${aai-schema.version}</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + <version>1.0.0</version> + </dependency> + <dependency> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + <version>1.8.0_101</version> + <scope>system</scope> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-core-asl</artifactId> + <version>1.9.13</version> + </dependency> + + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + <version>1.9.13</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-junit</artifactId> + <version>2.0.0.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + <version>1.3</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-module-junit4</artifactId> + <version>1.6.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-mockito</artifactId> + <version>1.6.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>16.0</version> + </dependency> + <dependency> + <groupId>com.thinkaurelius.titan</groupId> + <artifactId>titan-core</artifactId> + <version>1.0.0</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>2.1.4</version> + </dependency> + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>4.2.5.RELEASE</version> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.2.11</version> + </dependency> + <dependency> + <groupId>org.eclipse.persistence</groupId> + <artifactId>eclipselink</artifactId> + <version>2.6.2</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.7</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-util</artifactId> + <version>9.4.2.v20170220</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-core</artifactId> + <version>3.0.6</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + <version>2.1.4</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-core</artifactId> + <version>1.18</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>1.18</version> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.0.1</version> + </dependency> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-core</artifactId> + <version>3.0.1-incubating</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.5</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.1.4</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.1.4</version> + </dependency> + <dependency> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + <version>1.0.b2</version> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>com.beust</groupId> + <artifactId>jcommander</artifactId> + <version>1.48</version> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20160810</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.1.0</version> + </dependency> + <dependency> + <groupId>com.bazaarvoice.jolt</groupId> + <artifactId>jolt-complete</artifactId> + <version>0.0.24</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>1.1.7</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.7</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-access</artifactId> + <version>1.1.7</version> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-client</artifactId> + <version>0.98.4-hadoop2</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-protocol</artifactId> + <version>0.98.4-hadoop2</version> + <exclusions> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> + <artifactId>hbase-common</artifactId> + <version>0.98.4-hadoop2</version> + <exclusions> + <exclusion> + <artifactId>log4j</artifactId> + <groupId>log4j</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-broker</artifactId> + <version>5.14.4</version> + </dependency> + + <dependency> + <groupId>com.opencsv</groupId> + <artifactId>opencsv</artifactId> + <version>3.1</version> + </dependency> + <dependency> + <groupId>org.freemarker</groupId> + <artifactId>freemarker</artifactId> + <version>2.3.14</version> + </dependency> + <dependency> + <groupId>com.bazaarvoice.jolt</groupId> + <artifactId>jolt-complete</artifactId> + <version>0.0.24</version> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-module-junit4</artifactId> + <version>1.6.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-mockito</artifactId> + <version>1.6.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-module-javaagent</artifactId> + <version>1.6.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>3.6</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>2.10</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <version>1.12</version> + <configuration> + <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage> + <licenseName>apache_v2</licenseName> + <inceptionYear>2017</inceptionYear> + <organizationName>AT&T Intellectual Property. All rights reserved.</organizationName> + <projectName>org.openecomp.aai</projectName> + <canUpdateCopyright>true</canUpdateCopyright> + <canUpdateDescription>true</canUpdateDescription> + <canUpdateLicense>true</canUpdateLicense> + <emptyLineAfterHeader>true</emptyLineAfterHeader> + <processStartTag>============LICENSE_START=======================================================</processStartTag> + <processEndTag>============LICENSE_END=========================================================</processEndTag> + <sectionDelimiter>================================================================================</sectionDelimiter> + <includes> + <include>**/*.java</include> + <include>**/*.ksh</include> + <include>**/*.sh</include> + <include>**/*.ftl</include> + <include>**/*.xsd</include> + <include>**/*.xjb</include> + <include>**/aai*.xml</include> + <include>**/*logback*.xml</include> + <include>**/*aaiconfig*.properties</include> + <include>**/*titan*.properties</include> + </includes> + </configuration> + <executions> + <execution> + <id>first</id> + <goals> + <goal>update-file-header</goal> + </goals> + <phase>process-sources</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <distributionManagement> + <repository> + <id>ecomp-releases</id> + <name>ECOMP Release Repository</name> + <url>${nexusproxy}/content/repositories/releases/</url> + </repository> + <snapshotRepository> + <id>ecomp-snapshots</id> + <name>ECOMP Snapshot Repository</name> + <url>${nexusproxy}/content/repositories/snapshots/</url> + </snapshotRepository> + <site> + <id>ecomp-site</id> + <url>dav:${nexusproxy}${sitePath}</url> + </site> + </distributionManagement> + + <!-- Plugins and repositories --> + <pluginRepositories> + <pluginRepository> + <id>central</id> + <url>http://repo1.maven.org/maven2</url> + </pluginRepository> + <pluginRepository> + <id>EvoSuite</id> + <name>EvoSuite Repository</name> + <url>http://www.evosuite.org/m2</url> + </pluginRepository> + </pluginRepositories> + + <repositories> + <repository> + <id>AJSC</id> + <name>AJSC repository</name> + <url>https://mvnrepository.com/artifact/com.att.ajsc</url> + </repository> + <repository> + <id>restlet</id> + <name>maven reslet</name> + <url>https://maven.restlet.com/</url> + </repository> + + <repository> + <id>central</id> + <name>Maven 2 repository 2</name> + <url>http://repo2.maven.org/maven2/</url> + </repository> + <repository> + <id>ecomp-releases</id> + <name>ECOMP Release Repository</name> + <url>${nexusproxy}/content/repositories/releases/</url> + </repository> + <repository> + <id>ecomp-staging</id> + <name>ECOMP Staging Repository</name> + <url>${nexusproxy}/content/repositories/staging/</url> + </repository> + <repository> + <id>ecomp-snapshots</id> + <name>ECOMP Snapshot Repository</name> + <url>${nexusproxy}/content/repositories/snapshots/</url> + </repository> + </repositories> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.10.4</version> + <configuration> + <failOnError>false</failOnError> + <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> + <docletArtifact> + <groupId>org.umlgraph</groupId> + <artifactId>umlgraph</artifactId> + <version>5.6</version> + </docletArtifact> + <additionalparam>-views</additionalparam> + <useStandardDocletOptions>true</useStandardDocletOptions> + </configuration> + </plugin> + </plugins> + </reporting> +</project> diff --git a/aai-core/src/main/java/org/openecomp/aai/audit/ListEndpoints.java b/aai-core/src/main/java/org/openecomp/aai/audit/ListEndpoints.java new file mode 100644 index 00000000..acf2be1a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/audit/ListEndpoints.java @@ -0,0 +1,302 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.audit; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.lang.StringUtils; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; + +/** + * The Class ListEndpoints. + */ +public class ListEndpoints { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ListEndpoints.class); + + private final String start = "inventory"; + private final String[] blacklist = { "search", "aai-internal" }; + + private List<String> endpoints = new ArrayList<>(); + private Map<String, String> endpointToLogicalName = new HashMap<String, String>(); + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args) { + ListEndpoints endPoints = new ListEndpoints(AAIProperties.LATEST); + + System.out.println(endPoints.toString("relationship-list")); + + } + + /** + * Instantiates a new list endpoints. + * + * @param version the version + */ + public ListEndpoints(Version version) { + + Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, version); + + try { + final Introspector start = loader.introspectorFromName(this.start); + Set<String> startMap = new HashSet<>(); + beginAudit(start, "/aai/" + version, startMap); + } catch (AAIUnknownObjectException e) { + throw new RuntimeException("Failed to find object " + this.start + ", cannot run ListEndpoints audit"); + } + } + + /** + * Begin audit. + * + * @param obj the obj + * @param uri the uri + */ + private void beginAudit(Introspector obj, String uri, Set<String> visited) { + + String currentUri = ""; + + if (!obj.getDbName().equals("inventory")) { + currentUri = uri + obj.getGenericURI(); + } else { + currentUri = uri; + } + if (obj.getName().equals("relationship-data") || obj.getName().equals("related-to-property")) { + return; + } + if (!obj.isContainer()) { + endpoints.add(currentUri); + } + + String dbName = obj.getDbName(); + + populateLogicalName(obj, uri, currentUri); + + Set<String> properties = obj.getProperties(); + Set<String> props = new LinkedHashSet<>(properties); + if (obj.isContainer()) { + for (String key : visited) { + if (props.remove(key)) { + try { + endpoints.add(currentUri + obj.getLoader().introspectorFromName(key).getGenericURI()); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping endpoint for " + key + " (Unknown object)", e); + } + } + } + } + + outer: for (String propName : props) { + + for (String item : blacklist) { + if (propName.equals(item)) { + continue outer; + } + } + if (obj.isListType(propName)) { + if (obj.isComplexGenericType(propName)) { + try { + final Introspector nestedObj = obj.newIntrospectorInstanceOfNestedProperty(propName); + Set<String> newVisited = new HashSet<>(); + newVisited.addAll(visited); + newVisited.add(nestedObj.getDbName()); + beginAudit( + nestedObj, + currentUri, + newVisited + ); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping nested endpoint for " + propName + " (Unknown Object)", e); + } + } + } else if (obj.isComplexType(propName)) { + try { + final Introspector nestedObj = obj.newIntrospectorInstanceOfProperty(propName); + Set<String> newVisited = new HashSet<>(); + newVisited.addAll(visited); + newVisited.add(nestedObj.getDbName()); + beginAudit(nestedObj, + currentUri, + visited + ); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping nested enpoint for " + propName + " (Unknown Object)", e); + } + } + } + + } + + /** + * Populate logical name. + * + * @param obj the obj + * @param uri the uri + * @param currentUri the current uri + */ + private void populateLogicalName(Introspector obj, String uri, String currentUri) { + + if (obj.getDbName().equals("inventory") || currentUri.split("/").length <= 4 || currentUri.endsWith("relationship-list")) { + return; + } + + if (uri.endsWith("/relationship-list")) { + uri = uri.substring(0, uri.lastIndexOf("/")); + } + + String logicalName = ""; + String keys = ""; + + + if (!obj.getAllKeys().isEmpty()) { + + Pattern p = Pattern.compile("/\\{[\\w\\d\\-]+\\}/\\{[\\w\\d\\-]+\\}+$"); + Matcher m = p.matcher(currentUri); + + if (m.find()) { + keys = StringUtils.join(obj.getAllKeys(), "-and-"); + } else { + keys = StringUtils.join(obj.getAllKeys(), "-or-"); + } + keys = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, keys); + if (!keys.isEmpty()) { + keys = "With" + keys; + } + } + + logicalName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, obj.getDbName()) + keys; + + if (endpointToLogicalName.containsKey(uri) && uri.endsWith("}")) { + logicalName = logicalName + "From" + endpointToLogicalName.get(uri); + } else if (endpointToLogicalName.containsKey(uri.substring(0, uri.lastIndexOf("/")))) { + logicalName = logicalName + "From" + endpointToLogicalName.get(uri.substring(0, uri.lastIndexOf("/"))); + } + + endpointToLogicalName.put(currentUri, logicalName); + + } + + /** + * Gets the logical names. + * + * @return the logical names + */ + public Map<String, String> getLogicalNames() { + + return endpointToLogicalName; + + } + + /** + * Gets the endpoints. + * + * @return the endpoints + */ + public List<String> getEndpoints() { + + return this.getEndpoints(""); + + } + + /** + * Gets the endpoints. + * + * @param filterOut the filter out + * @return the endpoints + */ + public List<String> getEndpoints(String filterOut) { + List<String> result = new ArrayList<>(); + Pattern p = null; + Matcher m = null; + if (!filterOut.equals("")) { + p = Pattern.compile(filterOut); + m = null; + } + for (String s : endpoints) { + if (p != null) { + m = p.matcher(s); + if (m.find()) { + continue; + } + } + + result.add(s); + } + + return result; + + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + for (String s : endpoints) { + sb.append(s + "\n"); + } + return sb.toString(); + + } + + /** + * To string. + * + * @param filterOut the filter out + * @return the string + */ + public String toString(String filterOut) { + StringBuilder sb = new StringBuilder(); + Pattern p = Pattern.compile(filterOut); + Matcher m = null; + for (String s : endpoints) { + m = p.matcher(s); + if (!m.find()) { + sb.append(s + "\n"); + } + } + return sb.toString(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/props/AAIProperties.java b/aai-core/src/main/java/org/openecomp/aai/db/props/AAIProperties.java new file mode 100644 index 00000000..17f1fef0 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/props/AAIProperties.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.props; + +import org.openecomp.aai.introspection.Version; + +public class AAIProperties { + public static final String NODE_TYPE = "aai-node-type"; + public static final String LAST_MOD_SOURCE_OF_TRUTH = "last-mod-source-of-truth"; + public static final String SOURCE_OF_TRUTH = "source-of-truth"; + public static final String LAST_MOD_TS = "aai-last-mod-ts"; + public static final String UNIQUE_KEY = "aai-unique-key"; + public static final String CREATED_TS = "aai-created-ts"; + public static final String RESOURCE_VERSION = "resource-version"; + public static final String AAI_URI = "aai-uri"; + public static final Version LATEST = Version.v10; + public static final Integer MAXIMUM_DEPTH = 10000; + public static final String LINKED = "linked"; + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditDoc.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditDoc.java new file mode 100644 index 00000000..02606334 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditDoc.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.util.List; + +import org.codehaus.jackson.annotate.JsonProperty; + +public class AuditDoc { + + private List<DBProperty> properties; + private List<DBIndex> indexes; + private List<EdgeProperty> edgeLabels; + + /** + * Gets the properties. + * + * @return the properties + */ + public List<DBProperty> getProperties() { + return properties; + } + + /** + * Sets the properties. + * + * @param properties the new properties + */ + public void setProperties(List<DBProperty> properties) { + this.properties = properties; + } + + /** + * Gets the indexes. + * + * @return the indexes + */ + public List<DBIndex> getIndexes() { + return indexes; + } + + /** + * Sets the indexes. + * + * @param indexes the new indexes + */ + public void setIndexes(List<DBIndex> indexes) { + this.indexes = indexes; + } + + /** + * Gets the edge labels. + * + * @return the edge labels + */ + @JsonProperty("edge-labels") + public List<EdgeProperty> getEdgeLabels() { + return edgeLabels; + } + + /** + * Sets the edge labels. + * + * @param edgeLabels the new edge labels + */ + public void setEdgeLabels(List<EdgeProperty> edgeLabels) { + this.edgeLabels = edgeLabels; + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditOXM.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditOXM.java new file mode 100644 index 00000000..2da74d86 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditOXM.java @@ -0,0 +1,248 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.dbmodel.DbEdgeRules; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.util.AAIConstants; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.collect.Multimap; +import com.thinkaurelius.titan.core.Cardinality; +import com.thinkaurelius.titan.core.Multiplicity; +import com.thinkaurelius.titan.core.schema.SchemaStatus; + +public class AuditOXM extends Auditor { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AuditOXM.class); + + private Set<Introspector> allObjects; + + /** + * Instantiates a new audit OXM. + * + * @param version the version + */ + public AuditOXM(Version version) { + Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, version); + Set<String> objectNames = getAllObjects(version); + allObjects = new HashSet<>(); + for (String key : objectNames) { + try { + final Introspector temp = loader.introspectorFromName(key); + allObjects.add(temp); + this.createDBProperties(temp); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping audit for object " + key + " (Unknown Object)", e); + } + } + for (Introspector temp : allObjects) { + this.createDBIndexes(temp); + } + createEdgeLabels(); + + } + + /** + * Gets the all objects. + * + * @param version the version + * @return the all objects + */ + private Set<String> getAllObjects(Version version) { + String fileName = AAIConstants.AAI_HOME_ETC_OXM + "aai_oxm_" + version.toString() + ".xml"; + Set<String> result = new HashSet<>(); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + try { + docFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + Document doc = docBuilder.parse(fileName); + NodeList list = doc.getElementsByTagName("java-type"); + for (int i = 0; i < list.getLength(); i++) { + result.add(list.item(i).getAttributes().getNamedItem("name").getNodeValue()); + } + } catch (ParserConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + result.remove("EdgePropNames"); + return result; + + } + + /** + * Creates the DB properties. + * + * @param temp the temp + */ + private void createDBProperties(Introspector temp) { + Set<String> objectProperties = temp.getProperties(); + + for (String prop : objectProperties) { + if (!properties.containsKey(prop)) { + DBProperty dbProperty = new DBProperty(); + dbProperty.setName(prop); + if (temp.isListType(prop)) { + dbProperty.setCardinality(Cardinality.SET); + if (temp.isSimpleGenericType(prop)) { + Class<?> clazz = null; + try { + clazz = Class.forName(temp.getGenericType(prop)); + } catch (ClassNotFoundException e) { + clazz = Object.class; + } + dbProperty.setTypeClass(clazz); + properties.put(prop, dbProperty); + } + } else { + dbProperty.setCardinality(Cardinality.SINGLE); + if (temp.isSimpleType(prop)) { + Class<?> clazz = null; + try { + clazz = Class.forName(temp.getType(prop)); + } catch (ClassNotFoundException e) { + clazz = Object.class; + } + dbProperty.setTypeClass(clazz); + properties.put(prop, dbProperty); + } + } + } + } + + } + + /** + * Creates the DB indexes. + * + * @param temp the temp + */ + private void createDBIndexes(Introspector temp) { + String uniqueProps = temp.getMetadata(ObjectMetadata.UNIQUE_PROPS); + String namespace = temp.getMetadata(ObjectMetadata.NAMESPACE); + if (uniqueProps == null) { + uniqueProps = ""; + } + if (namespace == null) { + namespace = ""; + } + boolean isTopLevel = namespace != ""; + List<String> unique = Arrays.asList(uniqueProps.split(",")); + Set<String> indexed = temp.getIndexedProperties(); + Set<String> keys = temp.getKeys(); + + for (String prop : indexed) { + DBIndex dbIndex = new DBIndex(); + LinkedHashSet<DBProperty> properties = new LinkedHashSet<>(); + if (!this.indexes.containsKey(prop)) { + dbIndex.setName(prop); + dbIndex.setUnique(unique.contains(prop)); + properties.add(this.properties.get(prop)); + dbIndex.setProperties(properties); + dbIndex.setStatus(SchemaStatus.ENABLED); + this.indexes.put(prop, dbIndex); + } + } + if (keys.size() > 1 || isTopLevel) { + DBIndex dbIndex = new DBIndex(); + LinkedHashSet<DBProperty> properties = new LinkedHashSet<>(); + dbIndex.setName("key-for-" + temp.getDbName()); + if (!this.indexes.containsKey(dbIndex.getName())) { + boolean isUnique = false; + if (isTopLevel) { + properties.add(this.properties.get(AAIProperties.NODE_TYPE)); + } + for (String key : keys) { + properties.add(this.properties.get(key)); + + if (unique.contains(key) && !isUnique) { + isUnique = true; + } + } + dbIndex.setUnique(isUnique); + dbIndex.setProperties(properties); + dbIndex.setStatus(SchemaStatus.ENABLED); + this.indexes.put(dbIndex.getName(), dbIndex); + } + } + + } + + /** + * Creates the edge labels. + */ + private void createEdgeLabels() { + Multimap<String, String> edgeRules = DbEdgeRules.EdgeRules; + for (String key : edgeRules.keySet()) { + Collection<String> collection = edgeRules.get(key); + EdgeProperty prop = new EdgeProperty(); + //there is only ever one, they used the wrong type for EdgeRules + String label = ""; + for (String item : collection) { + label = item.split(",")[0]; + } + prop.setName(label); + prop.setMultiplicity(Multiplicity.MULTI); + this.edgeLabels.put(label, prop); + } + } + + /** + * Gets the all introspectors. + * + * @return the all introspectors + */ + public Set<Introspector> getAllIntrospectors() { + return this.allObjects; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditTitan.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditTitan.java new file mode 100644 index 00000000..743e683e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditTitan.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import com.thinkaurelius.titan.core.EdgeLabel; +import com.thinkaurelius.titan.core.PropertyKey; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.schema.TitanGraphIndex; +import com.thinkaurelius.titan.core.schema.TitanManagement; + +public class AuditTitan extends Auditor { + + private final TitanGraph graph; + + /** + * Instantiates a new audit titan. + * + * @param g the g + */ + public AuditTitan (TitanGraph g) { + this.graph = g; + buildSchema(); + } + + /** + * Builds the schema. + */ + private void buildSchema() { + populateProperties(); + populateIndexes(); + populateEdgeLabels(); + } + + /** + * Populate properties. + */ + private void populateProperties() { + TitanManagement mgmt = graph.openManagement(); + Iterable<PropertyKey> iterable = mgmt.getRelationTypes(PropertyKey.class); + Iterator<PropertyKey> titanProperties = iterable.iterator(); + PropertyKey propKey = null; + while (titanProperties.hasNext()) { + propKey = titanProperties.next(); + DBProperty prop = new DBProperty(); + + prop.setName(propKey.name()); + prop.setCardinality(propKey.cardinality()); + prop.setTypeClass(propKey.dataType()); + + this.properties.put(prop.getName(), prop); + } + } + + /** + * Populate indexes. + */ + private void populateIndexes() { + TitanManagement mgmt = graph.openManagement(); + Iterable<TitanGraphIndex> iterable = mgmt.getGraphIndexes(Vertex.class); + Iterator<TitanGraphIndex> titanIndexes = iterable.iterator(); + TitanGraphIndex titanIndex = null; + while (titanIndexes.hasNext()) { + titanIndex = titanIndexes.next(); + if (titanIndex.isCompositeIndex()) { + DBIndex index = new DBIndex(); + LinkedHashSet<DBProperty> dbProperties = new LinkedHashSet<>(); + index.setName(titanIndex.name()); + index.setUnique(titanIndex.isUnique()); + PropertyKey[] keys = titanIndex.getFieldKeys(); + for (PropertyKey key : keys) { + dbProperties.add(this.properties.get(key.name())); + } + index.setProperties(dbProperties); + index.setStatus(titanIndex.getIndexStatus(keys[0])); + this.indexes.put(index.getName(), index); + } + } + } + + /** + * Populate edge labels. + */ + private void populateEdgeLabels() { + TitanManagement mgmt = graph.openManagement(); + Iterable<EdgeLabel> iterable = mgmt.getRelationTypes(EdgeLabel.class); + Iterator<EdgeLabel> titanEdgeLabels = iterable.iterator(); + EdgeLabel edgeLabel = null; + while (titanEdgeLabels.hasNext()) { + edgeLabel = titanEdgeLabels.next(); + EdgeProperty edgeProperty = new EdgeProperty(); + + edgeProperty.setName(edgeLabel.name()); + edgeProperty.setMultiplicity(edgeLabel.multiplicity()); + + this.edgeLabels.put(edgeProperty.getName(), edgeProperty); + } + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/Auditor.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/Auditor.java new file mode 100644 index 00000000..91897f43 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/Auditor.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.util.*; + +public abstract class Auditor { + + protected Map<String, DBProperty> properties = new HashMap<>(); + protected Map<String, DBIndex> indexes = new HashMap<>(); + protected Map<String, EdgeProperty> edgeLabels = new HashMap<>(); + + /** + * Gets the audit doc. + * + * @return the audit doc + */ + public AuditDoc getAuditDoc() { + AuditDoc doc = new AuditDoc(); + List<DBProperty> propertyList = new ArrayList<>(); + List<DBIndex> indexList = new ArrayList<>(); + List<EdgeProperty> edgeLabelList = new ArrayList<>(); + propertyList.addAll(this.properties.values()); + indexList.addAll(this.indexes.values()); + edgeLabelList.addAll(this.edgeLabels.values()); + Collections.sort(propertyList, new CompareByName()); + Collections.sort(indexList, new CompareByName()); + Collections.sort(edgeLabelList, new CompareByName()); + + doc.setProperties(propertyList); + doc.setIndexes(indexList); + doc.setEdgeLabels(edgeLabelList); + + return doc; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditorFactory.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditorFactory.java new file mode 100644 index 00000000..7adc587c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/AuditorFactory.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import org.openecomp.aai.introspection.Version; +import com.thinkaurelius.titan.core.TitanGraph; + +public class AuditorFactory { + + /** + * Gets the OXM auditor. + * + * @param v the v + * @return the OXM auditor + */ + public static Auditor getOXMAuditor (Version v) { + return new AuditOXM(v); + } + + /** + * Gets the graph auditor. + * + * @param g the g + * @return the graph auditor + */ + public static Auditor getGraphAuditor (TitanGraph g) { + return new AuditTitan(g); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/CompareByName.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/CompareByName.java new file mode 100644 index 00000000..3a979b35 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/CompareByName.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.util.Comparator; + +public class CompareByName implements Comparator<Named>{ + + /** + * {@inheritDoc} + */ + @Override + public int compare(Named o1, Named o2) { + return o1.getName().compareTo(o2.getName()); + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/DBIndex.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/DBIndex.java new file mode 100644 index 00000000..98aab19a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/DBIndex.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.util.LinkedHashSet; +import java.util.Set; + +import com.thinkaurelius.titan.core.schema.SchemaStatus; + +public class DBIndex implements Named { + + private String name = null; + private boolean unique = false; + private LinkedHashSet<DBProperty> properties = new LinkedHashSet<>(); + private SchemaStatus status = null; + + /** + * Gets the name + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * + * @param name the new name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Checks if is unique. + * + * @return true, if is unique + */ + public boolean isUnique() { + return unique; + } + + /** + * Sets the unique. + * + * @param unique the new unique + */ + public void setUnique(boolean unique) { + this.unique = unique; + } + + /** + * Gets the properties. + * + * @return the properties + */ + public Set<DBProperty> getProperties() { + return properties; + } + + /** + * Sets the properties. + * + * @param properties the new properties + */ + public void setProperties(LinkedHashSet<DBProperty> properties) { + this.properties = properties; + } + + /** + * Gets the status. + * + * @return the status + */ + public SchemaStatus getStatus() { + return status; + } + + /** + * Sets the status. + * + * @param status the new status + */ + public void setStatus(SchemaStatus status) { + this.status = status; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/DBProperty.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/DBProperty.java new file mode 100644 index 00000000..2c314d1f --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/DBProperty.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import org.openecomp.aai.introspection.Introspector; +import com.thinkaurelius.titan.core.Cardinality; + +public class DBProperty implements Named { + + + private String name = null; + private Cardinality cardinality = null; + private Class<?> typeClass = null; + + /** + * Gets the name + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * + * @param name the new name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Gets the cardinality. + * + * @return the cardinality + */ + public Cardinality getCardinality() { + return cardinality; + } + + /** + * Sets the cardinality. + * + * @param cardinality the new cardinality + */ + public void setCardinality(Cardinality cardinality) { + this.cardinality = cardinality; + } + + /** + * Gets the type class. + * + * @return the type class + */ + public Class<?> getTypeClass() { + return typeClass; + } + + /** + * Sets the type class. + * + * @param type the new type class + */ + public void setTypeClass(Class<?> type) { + this.typeClass = type; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/EdgeProperty.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/EdgeProperty.java new file mode 100644 index 00000000..0a63dad9 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/EdgeProperty.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import com.thinkaurelius.titan.core.Multiplicity; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.annotate.JsonPropertyOrder; + +@JsonPropertyOrder({ "label", "multiplicity" }) +public class EdgeProperty implements Named { + + private String name = null; + private Multiplicity multiplicity = null; + + /** + * Gets the name + */ + @JsonProperty("label") + public String getName() { + return name; + } + + /** + * Sets the name. + * + * @param name the new name + */ + @JsonProperty("label") + public void setName(String name) { + this.name = name; + } + + /** + * Gets the multiplicity. + * + * @return the multiplicity + */ + public Multiplicity getMultiplicity() { + return multiplicity; + } + + /** + * Sets the multiplicity. + * + * @param multiplicity the new multiplicity + */ + public void setMultiplicity(Multiplicity multiplicity) { + this.multiplicity = multiplicity; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/ManageTitanSchema.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/ManageTitanSchema.java new file mode 100644 index 00000000..940bee38 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/ManageTitanSchema.java @@ -0,0 +1,329 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.introspection.Version; +import com.thinkaurelius.titan.core.PropertyKey; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.schema.SchemaStatus; +import com.thinkaurelius.titan.core.schema.TitanGraphIndex; +import com.thinkaurelius.titan.core.schema.TitanManagement; +import com.thinkaurelius.titan.core.schema.TitanManagement.IndexBuilder; + +public class ManageTitanSchema { + + + private TitanManagement graphMgmt; + private TitanGraph graph; + private List<DBProperty> aaiProperties; + private List<DBIndex> aaiIndexes; + private List<EdgeProperty> aaiEdgeProperties; + private Auditor oxmInfo = null; + private Auditor graphInfo = null; + + /** + * Instantiates a new manage titan schema. + * + * @param graph the graph + */ + public ManageTitanSchema(final TitanGraph graph) { + this.graph = graph; + oxmInfo = AuditorFactory.getOXMAuditor(Version.v8); + graphInfo = AuditorFactory.getGraphAuditor(graph); + } + + + /** + * Builds the schema. + */ + public void buildSchema() { + + this.graphMgmt = graph.openManagement(); + aaiProperties = new ArrayList<>(); + aaiEdgeProperties = new ArrayList<>(); + aaiIndexes = new ArrayList<>(); + aaiProperties.addAll(oxmInfo.getAuditDoc().getProperties()); + aaiIndexes.addAll(oxmInfo.getAuditDoc().getIndexes()); + aaiEdgeProperties.addAll(oxmInfo.getAuditDoc().getEdgeLabels()); + try { + createPropertyKeys(); + createIndexes(); + createEdgeLabels(); + } catch (Exception e) { + e.printStackTrace(); + graphMgmt.rollback(); + } + graphMgmt.commit(); + } + + /** + * Creates the property keys. + */ + private void createPropertyKeys() { + + + for (DBProperty prop : aaiProperties) { + + if (graphMgmt.containsPropertyKey(prop.getName())) { + PropertyKey key = graphMgmt.getPropertyKey(prop.getName()); + boolean isChanged = false; + if (!prop.getCardinality().equals(key.cardinality())) { + isChanged = true; + } + if (!prop.getTypeClass().equals(key.dataType())) { + isChanged = true; + } + if (isChanged) { + //must modify! + this.replaceProperty(prop); + } + } else { + //create a new property key + System.out.println("Key: " + prop.getName() + " not found - adding"); + graphMgmt.makePropertyKey(prop.getName()).dataType(prop.getTypeClass()).cardinality(prop.getCardinality()).make(); + } + } + + } + + /** + * Creates the indexes. + */ + private void createIndexes() { + + for (DBIndex index : aaiIndexes) { + Set<DBProperty> props = index.getProperties(); + boolean isChanged = false; + boolean isNew = false; + List<PropertyKey> keyList = new ArrayList<>(); + for (DBProperty prop : props) { + keyList.add(graphMgmt.getPropertyKey(prop.getName())); + } + if (graphMgmt.containsGraphIndex(index.getName())) { + TitanGraphIndex titanIndex = graphMgmt.getGraphIndex(index.getName()); + PropertyKey[] dbKeys = titanIndex.getFieldKeys(); + if (dbKeys.length != keyList.size()) { + isChanged = true; + } else { + int i = 0; + for (PropertyKey key : keyList) { + if (!dbKeys[i].equals(key)) { + isChanged = true; + break; + } + i++; + } + } + } else { + isNew = true; + } + if (keyList.size() > 0) { + this.createIndex(graphMgmt, index.getName(), keyList, index.isUnique(), isNew, isChanged); + } + } + } + + // Use EdgeRules to make sure edgeLabels are defined in the db. NOTE: the multiplicty used here is + // always "MULTI". This is not the same as our internal "Many2Many", "One2One", "One2Many" or "Many2One" + // We use the same edge-label for edges between many different types of nodes and our internal + // multiplicty definitions depends on which two types of nodes are being connected. + /** + * Creates the edge labels. + */ + private void createEdgeLabels() { + + + for (EdgeProperty prop : aaiEdgeProperties) { + + if (graphMgmt.containsEdgeLabel(prop.getName())) { + // see what changed + } else { + graphMgmt.makeEdgeLabel(prop.getName()).multiplicity(prop.getMultiplicity()).make(); + } + + } + + + } + + /** + * Creates the property. + * + * @param mgmt the mgmt + * @param prop the prop + */ + private void createProperty(TitanManagement mgmt, DBProperty prop) { + if (mgmt.containsPropertyKey(prop.getName())) { + PropertyKey key = mgmt.getPropertyKey(prop.getName()); + boolean isChanged = false; + if (!prop.getCardinality().equals(key.cardinality())) { + isChanged = true; + } + if (!prop.getTypeClass().equals(key.dataType())) { + isChanged = true; + } + if (isChanged) { + //must modify! + this.replaceProperty(prop); + } + } else { + //create a new property key + System.out.println("Key: " + prop.getName() + " not found - adding"); + mgmt.makePropertyKey(prop.getName()).dataType(prop.getTypeClass()).cardinality(prop.getCardinality()).make(); + } + } + + /** + * Creates the index. + * + * @param mgmt the mgmt + * @param indexName the index name + * @param keys the keys + * @param isUnique the is unique + * @param isNew the is new + * @param isChanged the is changed + */ + private void createIndex(TitanManagement mgmt, String indexName, List<PropertyKey> keys, boolean isUnique, boolean isNew, boolean isChanged) { + + /*if (isChanged) { + System.out.println("Changing index: " + indexName); + TitanGraphIndex oldIndex = mgmt.getGraphIndex(indexName); + mgmt.updateIndex(oldIndex, SchemaAction.DISABLE_INDEX); + mgmt.commit(); + //cannot remove indexes + //graphMgmt.updateIndex(oldIndex, SchemaAction.REMOVE_INDEX); + }*/ + if (isNew || isChanged) { + + if (isNew) { + IndexBuilder builder = mgmt.buildIndex(indexName,Vertex.class); + for (PropertyKey k : keys) { + builder.addKey(k); + } + if (isUnique) { + builder.unique(); + } + builder.buildCompositeIndex(); + System.out.println("Built index for " + indexName + " with keys: " + keys); + + //mgmt.commit(); + } + + //mgmt = graph.asAdmin().getManagementSystem(); + //mgmt.updateIndex(mgmt.getGraphIndex(indexName), SchemaAction.REGISTER_INDEX); + //mgmt.commit(); + + try { + //waitForCompletion(indexName); + //TitanIndexRepair.hbaseRepair(AAIConstants.AAI_CONFIG_FILENAME, indexName, ""); + } catch (Exception e) { + // TODO Auto-generated catch block + graph.tx().rollback(); + graph.close(); + e.printStackTrace(); + } + + //mgmt = graph.asAdmin().getManagementSystem(); + //mgmt.updateIndex(mgmt.getGraphIndex(indexName), SchemaAction.REINDEX); + + //mgmt.updateIndex(mgmt.getGraphIndex(indexName), SchemaAction.ENABLE_INDEX); + + //mgmt.commit(); + + } + } + + /** + * Wait for completion. + * + * @param name the name + * @throws InterruptedException the interrupted exception + */ + private void waitForCompletion(String name) throws InterruptedException { + + boolean registered = false; + long before = System.currentTimeMillis(); + while (!registered) { + Thread.sleep(500L); + TitanManagement mgmt = graph.openManagement(); + TitanGraphIndex idx = mgmt.getGraphIndex(name); + registered = true; + for (PropertyKey k : idx.getFieldKeys()) { + SchemaStatus s = idx.getIndexStatus(k); + registered &= s.equals(SchemaStatus.REGISTERED); + } + mgmt.rollback(); + } + System.out.println("Index REGISTERED in " + (System.currentTimeMillis() - before) + " ms"); + } + + /** + * Replace property. + * + * @param key the key + */ + private void replaceProperty(DBProperty key) { + + + + + } + + /** + * Update index. + * + * @param index the index + */ + public void updateIndex(DBIndex index) { + + TitanManagement mgmt = graph.openManagement(); + List<PropertyKey> keys = new ArrayList<>(); + boolean isNew = false; + boolean isChanged = false; + for (DBProperty prop : index.getProperties()) { + createProperty(mgmt, prop); + keys.add(mgmt.getPropertyKey(prop.getName())); + } + if (mgmt.containsGraphIndex(index.getName())) { + System.out.println("index already exists"); + isNew = false; + isChanged = true; + } else { + isNew = true; + isChanged = false; + } + this.createIndex(mgmt, index.getName(), keys, index.isUnique(), isNew, isChanged); + + mgmt.commit(); + + } + + + + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/Named.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/Named.java new file mode 100644 index 00000000..9b0bbe37 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/Named.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +public interface Named { + + /** + * Gets the name. + * + * @return the name + */ + public String getName(); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java b/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java new file mode 100644 index 00000000..fe55af68 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/db/schema/ScriptDriver.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.db.schema; + +import java.io.IOException; + +import org.codehaus.jackson.JsonGenerationException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.util.AAIConfig; +import com.beust.jcommander.JCommander; +import com.beust.jcommander.Parameter; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; + +public class ScriptDriver { + + + /** + * The main method. + * + * @param args the arguments + * @throws AAIException the AAI exception + * @throws JsonGenerationException the json generation exception + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. + */ + public static void main (String[] args) throws AAIException, JsonGenerationException, JsonMappingException, IOException { + CommandLineArgs cArgs = new CommandLineArgs(); + + new JCommander(cArgs, args); + + if (cArgs.help) { + System.out.println("-c [path to graph configuration] -type [what you want to audit - oxm or graph]"); + } + String config = cArgs.config; + AAIConfig.init(); + TitanGraph graph = TitanFactory.open(config); + if (!(cArgs.type.equals("oxm") || cArgs.type.equals("graph"))) { + System.out.println("type: " + cArgs.type + " not recognized."); + System.exit(1); + } + + Auditor a = null; + if (cArgs.type.equals("oxm")) { + a = AuditorFactory.getOXMAuditor(Version.v8); + } else if (cArgs.type.equals("graph")) { + a = AuditorFactory.getGraphAuditor(graph); + } + + AuditDoc doc = a.getAuditDoc(); + + ObjectMapper mapper = new ObjectMapper(); + + String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(doc); + System.out.println(json); + + } + +} + +class CommandLineArgs { + + @Parameter(names = "--help", description = "Help") + public boolean help = false; + + @Parameter(names = "-c", description = "Configuration", required=true) + public String config; + + @Parameter(names = "-type", description = "Type", required=true) + public String type = "graph"; + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java new file mode 100644 index 00000000..aa5084b9 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/DataGrooming.java @@ -0,0 +1,2223 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbgen; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TimeZone; +import java.util.UUID; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; + +import org.openecomp.aai.dbmap.AAIGraph; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.ingestModel.DbMaps; +import org.openecomp.aai.ingestModel.IngestModelMoxyOxm; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import com.att.eelf.configuration.Configuration; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.thinkaurelius.titan.core.TitanEdge; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; +import com.thinkaurelius.titan.core.TitanVertex; + + +public class DataGrooming { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DataGrooming.class); + private static final String FROMAPPID = "AAI-DB"; + private static final String TRANSID = UUID.randomUUID().toString(); + private static int dupeGrpsDeleted = 0; + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args) { + + // Set the logging file properties to be used by EELFManager + Properties props = System.getProperties(); + props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_DATA_GROOMING_LOGBACK_PROPS); + props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); + + String ver = "version"; // Placeholder + Boolean doAutoFix = false; + Boolean edgesOnlyFlag = false; + Boolean dontFixOrphansFlag = false; + Boolean singleCommits = false; + Boolean dupeCheckOff = false; + Boolean dupeFixOn = false; + Boolean ghost2CheckOff = false; + Boolean ghost2FixOn = false; + Boolean neverUseCache = false; + + int maxRecordsToFix = AAIConstants.AAI_GROOMING_DEFAULT_MAX_FIX; + int sleepMinutes = AAIConstants.AAI_GROOMING_DEFAULT_SLEEP_MINUTES; + try { + String maxFixStr = AAIConfig.get("aai.grooming.default.max.fix"); + if( maxFixStr != null && !maxFixStr.equals("") ){ + maxRecordsToFix = Integer.parseInt(maxFixStr); + } + String sleepStr = AAIConfig.get("aai.grooming.default.sleep.minutes"); + if( sleepStr != null && !sleepStr.equals("") ){ + sleepMinutes = Integer.parseInt(sleepStr); + } + } + catch ( Exception e ){ + // Don't worry, we'll just use the defaults that we got from AAIConstants + LOGGER.warn("WARNING - could not pick up aai.grooming values from aaiconfig.properties file. "); + } + + String prevFileName = ""; + dupeGrpsDeleted = 0; + SimpleDateFormat d = new SimpleDateFormat("yyyyMMddHHmm"); + d.setTimeZone(TimeZone.getTimeZone("GMT")); + String dteStr = d.format(new Date()).toString(); + String groomOutFileName = "dataGrooming." + dteStr + ".out"; + + if (args.length > 0) { + // They passed some arguments in that will affect processing + for (int i = 0; i < args.length; i++) { + String thisArg = args[i]; + if (thisArg.equals("-edgesOnly")) { + edgesOnlyFlag = true; + } else if (thisArg.equals("-autoFix")) { + doAutoFix = true; + } else if (thisArg.equals("-dontFixOrphans")) { + dontFixOrphansFlag = true; + } else if (thisArg.equals("-singleCommits")) { + singleCommits = true; + } else if (thisArg.equals("-dupeCheckOff")) { + dupeCheckOff = true; + } else if (thisArg.equals("-dupeFixOn")) { + dupeFixOn = true; + } else if (thisArg.equals("-ghost2CheckOff")) { + ghost2CheckOff = true; + } else if (thisArg.equals("-neverUseCache")) { + neverUseCache = true; + } else if (thisArg.equals("-ghost2FixOn")) { + ghost2FixOn = true; + } else if (thisArg.equals("-maxFix")) { + i++; + if (i >= args.length) { + LOGGER.error(" No value passed with -maxFix option. "); + System.exit(0); + } + String nextArg = args[i]; + try { + maxRecordsToFix = Integer.parseInt(nextArg); + } catch (Exception e) { + LOGGER.error("Bad value passed with -maxFix option: [" + + nextArg + "]"); + System.exit(0); + } + } else if (thisArg.equals("-sleepMinutes")) { + i++; + if (i >= args.length) { + LOGGER.error("No value passed with -sleepMinutes option."); + System.exit(0); + } + String nextArg = args[i]; + try { + sleepMinutes = Integer.parseInt(nextArg); + } catch (Exception e) { + LOGGER.error("Bad value passed with -sleepMinutes option: [" + + nextArg + "]"); + System.exit(0); + } + } else if (thisArg.equals("-f")) { + i++; + if (i >= args.length) { + LOGGER.error(" No value passed with -f option. "); + System.exit(0); + } + prevFileName = args[i]; + } else { + LOGGER.error(" Unrecognized argument passed to DataGrooming: [" + + thisArg + "]. "); + LOGGER.error(" Valid values are: -f -autoFix -maxFix -edgesOnly -dupeFixOn -donFixOrphans -sleepMinutes -neverUseCache"); + System.exit(0); + } + } + } + + + IngestModelMoxyOxm moxyMod = new IngestModelMoxyOxm(); + try { + ArrayList <String> defaultVerLst = new ArrayList <> (); + defaultVerLst.add( AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP) ); + moxyMod.init( defaultVerLst, false); + } + catch (Exception ex){ + LOGGER.error("ERROR - Could not do the moxyMod.init()", ex); + System.exit(1); + } + + try { + if (!prevFileName.equals("")) { + // They are trying to fix some data based on a data in a + // previous file. + LOGGER.info(" Call doTheGrooming() with a previous fileName [" + + prevFileName + "] for cleanup. "); + Boolean finalShutdownFlag = true; + Boolean cacheDbOkFlag = false; + doTheGrooming(prevFileName, edgesOnlyFlag, dontFixOrphansFlag, + maxRecordsToFix, groomOutFileName, ver, singleCommits, + dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, + finalShutdownFlag, cacheDbOkFlag); + } else if (doAutoFix) { + // They want us to run the processing twice -- first to look for + // delete candidates, then after + // napping for a while, run it again and delete any candidates + // that were found by the first run. + // Note: we will produce a separate output file for each of the + // two runs. + LOGGER.info(" Doing an auto-fix call to Grooming. "); + LOGGER.info(" First, Call doTheGrooming() to look at what's out there. "); + Boolean finalShutdownFlag = false; + Boolean cacheDbOkFlag = true; + int fixCandCount = doTheGrooming("", edgesOnlyFlag, + dontFixOrphansFlag, maxRecordsToFix, groomOutFileName, + ver, singleCommits, dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, + finalShutdownFlag, cacheDbOkFlag); + if (fixCandCount == 0) { + LOGGER.info(" No fix-Candidates were found by the first pass, so no second/fix-pass is needed. "); + } else { + // We'll sleep a little and then run a fix-pass based on the + // first-run's output file. + try { + LOGGER.info("About to sleep for " + sleepMinutes + + " minutes."); + int sleepMsec = sleepMinutes * 60 * 1000; + Thread.sleep(sleepMsec); + } catch (InterruptedException ie) { + LOGGER.info("\n >>> Sleep Thread has been Interrupted <<< "); + System.exit(0); + } + + d = new SimpleDateFormat("yyyyMMddHHmm"); + d.setTimeZone(TimeZone.getTimeZone("GMT")); + dteStr = d.format(new Date()).toString(); + String secondGroomOutFileName = "dataGrooming." + dteStr + + ".out"; + LOGGER.info(" Now, call doTheGrooming() a second time and pass in the name of the file " + + "generated by the first pass for fixing: [" + + groomOutFileName + "]"); + finalShutdownFlag = true; + cacheDbOkFlag = false; + doTheGrooming(groomOutFileName, edgesOnlyFlag, + dontFixOrphansFlag, maxRecordsToFix, + secondGroomOutFileName, ver, singleCommits, + dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, + finalShutdownFlag, cacheDbOkFlag); + } + } else { + // Do the grooming - plain vanilla (no fix-it-file, no + // auto-fixing) + Boolean finalShutdownFlag = true; + LOGGER.info(" Call doTheGrooming() "); + Boolean cacheDbOkFlag = true; + if( neverUseCache ){ + // They have forbidden us from using a cached db connection. + cacheDbOkFlag = false; + } + doTheGrooming("", edgesOnlyFlag, dontFixOrphansFlag, + maxRecordsToFix, groomOutFileName, ver, singleCommits, + dupeCheckOff, dupeFixOn, ghost2CheckOff, ghost2FixOn, + finalShutdownFlag, cacheDbOkFlag); + } + } catch (Exception ex) { + LOGGER.error("Exception while grooming data", ex); + } + + LOGGER.info(" Done! "); + System.exit(0); + + }// End of main() + + /** + * Do the grooming. + * + * @param fileNameForFixing the file name for fixing + * @param edgesOnlyFlag the edges only flag + * @param dontFixOrphansFlag the dont fix orphans flag + * @param maxRecordsToFix the max records to fix + * @param groomOutFileName the groom out file name + * @param version the version + * @param singleCommits the single commits + * @param dupeCheckOff the dupe check off + * @param dupeFixOn the dupe fix on + * @param ghost2CheckOff the ghost 2 check off + * @param ghost2FixOn the ghost 2 fix on + * @param finalShutdownFlag the final shutdown flag + * @param cacheDbOkFlag the cacheDbOk flag + * @return the int + */ + private static int doTheGrooming(String fileNameForFixing, + Boolean edgesOnlyFlag, Boolean dontFixOrphansFlag, + int maxRecordsToFix, String groomOutFileName, String version, + Boolean singleCommits, + Boolean dupeCheckOff, Boolean dupeFixOn, + Boolean ghost2CheckOff, Boolean ghost2FixOn, + Boolean finalShutdownFlag, Boolean cacheDbOkFlag) { + + LOGGER.debug(" Entering doTheGrooming \n"); + + int cleanupCandidateCount = 0; + BufferedWriter bw = null; + TitanGraph graph = null; + TitanGraph graph2 = null; + int deleteCount = 0; + boolean executeFinalCommit = false; + Set<String> deleteCandidateList = new LinkedHashSet<>(); + Set<String> processedVertices = new LinkedHashSet<>(); + TitanTransaction g = null; + TitanTransaction g2 = null; + try { + AAIConfig.init(); + String targetDir = AAIConstants.AAI_HOME + AAIConstants.AAI_FILESEP + + "logs" + AAIConstants.AAI_FILESEP + "data" + + AAIConstants.AAI_FILESEP + "dataGrooming"; + + // Make sure the target directory exists + new File(targetDir).mkdirs(); + + if (!fileNameForFixing.equals("")) { + deleteCandidateList = getDeleteList(targetDir, + fileNameForFixing, edgesOnlyFlag, dontFixOrphansFlag, + dupeFixOn); + } + + if (deleteCandidateList.size() > maxRecordsToFix) { + LOGGER.warn(" >> WARNING >> Delete candidate list size (" + + deleteCandidateList.size() + + ") is too big. The maxFix we are using is: " + + maxRecordsToFix + + ". No candidates will be deleted. "); + // Clear out the list so it won't be processed below. + deleteCandidateList = new LinkedHashSet<>(); + } + + SimpleDateFormat d = new SimpleDateFormat("yyyyMMddHHmm"); + d.setTimeZone(TimeZone.getTimeZone("GMT")); + + String fullOutputFileName = targetDir + AAIConstants.AAI_FILESEP + + groomOutFileName; + File groomOutFile = new File(fullOutputFileName); + try { + groomOutFile.createNewFile(); + } catch (IOException e) { + String emsg = " Problem creating output file [" + + fullOutputFileName + "], exception=" + e.getMessage(); + throw new AAIException("AAI_6124", emsg); + } + + LOGGER.info(" Will write to " + fullOutputFileName ); + FileWriter fw = new FileWriter(groomOutFile.getAbsoluteFile()); + bw = new BufferedWriter(fw); + ErrorLogHelper.loadProperties(); + + LOGGER.info(" ---- NOTE --- about to open graph (takes a little while)--------\n"); + + if( cacheDbOkFlag ){ + // Since we're just reading (not deleting/fixing anything), we can use + // a cached connection to the DB + graph = TitanFactory.open(AAIConstants.CACHED_DB_CONFIG); + } + else { + graph = TitanFactory.open(AAIConstants.REALTIME_DB_CONFIG); + } + if (graph == null) { + String emsg = "null graph object in DataGrooming\n"; + throw new AAIException("AAI_6101", emsg); + } + + LOGGER.debug(" Got the graph object. "); + + g = graph.newTransaction(); + if (g == null) { + String emsg = "null graphTransaction object in DataGrooming\n"; + throw new AAIException("AAI_6101", emsg); + } + + + ArrayList<String> errArr = new ArrayList<>(); + int totalNodeCount = 0; + HashMap<String, String> misMatchedHash = new HashMap<String, String>(); + HashMap<String, TitanVertex> orphanNodeHash = new HashMap<String, TitanVertex>(); + HashMap<String, TitanVertex> missingDepNodeHash = new HashMap<String, TitanVertex>(); + HashMap<String, Edge> oneArmedEdgeHash = new HashMap<String, Edge>(); + HashMap<String, String> emptyVertexHash = new HashMap<String, String>(); + HashMap<String, TitanVertex> ghostNodeHash = new HashMap<String, TitanVertex>(); + ArrayList<String> dupeGroups = new ArrayList<>(); + + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + Iterator<String> nodeMapKPropsIterator = dbMaps.NodeKeyProps.keySet().iterator(); + String ntList = ""; + + LOGGER.info(" Starting DataGrooming Processing "); + + if (edgesOnlyFlag) { + LOGGER.info(" NOTE >> Skipping Node processing as requested. Will only process Edges. << "); + } + else { + while (nodeMapKPropsIterator.hasNext()) { + String nType = nodeMapKPropsIterator.next(); + int thisNtCount = 0; + int thisNtDeleteCount = 0; + LOGGER.debug(" > Look at : [" + nType + "] ..."); + ntList = ntList + "," + nType; + + // Get a collection of the names of the key properties for this nodeType to use later + // Determine what the key fields are for this nodeType + Collection <String> keyProps = new ArrayList <>(); + if( dbMaps.NodeKeyProps.containsKey(nType) ){ + keyProps = dbMaps.NodeKeyProps.get(nType); + } + else { + throw new AAIException("AAI_6105", "Required Property name(s) not found for nodeType = " + nType + ")"); + } + + // Get the types of nodes that this nodetype depends on for uniqueness (if any) + Collection <String> depNodeTypes = new ArrayList <>(); + if( dbMaps.NodeDependencies.containsKey(nType) ){ + depNodeTypes = dbMaps.NodeDependencies.get(nType); + } + + // Loop through all the nodes of this Node type + int lastShownForNt = 0; + ArrayList <TitanVertex> tmpList = new ArrayList <> (); + Iterable <?> verts = g.query().has("aai-node-type",nType).vertices(); + Iterator<?> iterv = verts.iterator(); + while (iterv.hasNext()) { + // We put the nodes into an ArrayList because the graph.query iterator can time out + tmpList.add((TitanVertex)iterv.next()); + } + + Iterator <?> iter = tmpList.iterator(); + while (iter.hasNext()) { + try { + thisNtCount++; + if( thisNtCount == lastShownForNt + 250 ){ + lastShownForNt = thisNtCount; + LOGGER.debug("count for " + nType + " so far = " + thisNtCount ); + } + TitanVertex thisVtx = (TitanVertex) iter.next(); + String thisVid = thisVtx.id().toString(); + if (processedVertices.contains(thisVid)) { + LOGGER.debug("skipping already processed vertex: " + thisVid); + continue; + } + totalNodeCount++; + List <TitanVertex> secondGetList = new ArrayList <> (); + // ----------------------------------------------------------------------- + // For each vertex of this nodeType, we want to: + // a) make sure that it can be retrieved using it's AAI defined key + // b) make sure that it is not a duplicate + // ----------------------------------------------------------------------- + + // For this instance of this nodeType, get the key properties + HashMap<String, Object> propHashWithKeys = new HashMap<>(); + Iterator<String> keyPropI = keyProps.iterator(); + while (keyPropI.hasNext()) { + String propName = keyPropI.next(); + String propVal = ""; + //delete an already deleted vertex + Object obj = thisVtx.<Object>property(propName).orElse(null); + if (obj != null) { + propVal = obj.toString(); + } + propHashWithKeys.put(propName, propVal); + } + try { + // If this node is dependent on another for uniqueness, then do the query from that parent node + // Note - all of our nodes that are dependent on others for uniqueness are + // "children" of that node. + boolean depNodeOk = true; + if( depNodeTypes.isEmpty() ){ + // This kind of node is not dependent on any other. + // Make sure we can get it back using it's key properties and that we only get one. + secondGetList = getNodeJustUsingKeyParams( TRANSID, FROMAPPID, g, nType, + propHashWithKeys, version ); + } + else { + // This kind of node is dependent on another for uniqueness. + // Start at it's parent (the dependent vertex) and make sure we can get it + // back using it's key properties and that we only get one. + Iterable <?> verts2 = thisVtx.query().direction(Direction.IN).has("isParent",true).vertices(); + Iterator <?> vertI2 = verts2.iterator(); + TitanVertex parentVtx = null; + int pCount = 0; + while( vertI2 != null && vertI2.hasNext() ){ + parentVtx = (TitanVertex) vertI2.next(); + pCount++; + } + if( pCount <= 0 ){ + + + //List<Vertex> vertI2 = g.traversal().V(thisVtx).union(__.outE().has("isParent-REV",true).outV(),__.inE().has("isParent",true).inV()).toList(); + //if( vertI2.isEmpty()){ + + // It's Missing it's dependent/parent node + depNodeOk = false; + boolean zeroEdges = false; + try { + Iterator<Edge> tmpEdgeIter = thisVtx.edges(Direction.BOTH); + int edgeCount = 0; + while( tmpEdgeIter.hasNext() ){ + edgeCount++; + tmpEdgeIter.next(); + } + if( edgeCount == 0 ){ + zeroEdges = true; + } + } catch (Exception ex) { + LOGGER.warn("WARNING from inside the for-each-vid-loop orphan-edges-check ", ex); + } + + if (deleteCandidateList.contains(thisVid)) { + boolean okFlag = true; + try { + processedVertices.add(thisVtx.id().toString()); + thisVtx.remove(); + deleteCount++; + thisNtDeleteCount++; + } catch (Exception e) { + okFlag = false; + LOGGER.error("ERROR trying to delete missing-dep-node VID = " + thisVid, e); + } + if (okFlag) { + LOGGER.info(" DELETED missing-dep-node VID = " + thisVid); + } + } else { + // We count nodes missing their depNodes two ways - the first if it has + // at least some edges, and the second if it has zero edges. Either + // way, they are effectively orphaned. + // NOTE - Only nodes that have dependent nodes are ever considered "orphaned". + if( zeroEdges ){ + missingDepNodeHash.put(thisVid, thisVtx); + } + else { + orphanNodeHash.put(thisVid, thisVtx); + } + } + } + else if ( pCount > 1 ){ + // Not sure how this could happen? Should we do something here? + depNodeOk = false; + } + else { + // We found the parent - so use it to do the second-look. + // NOTE --- We're just going to do the same check from the other direction - because + // there could be duplicates or the pointer going the other way could be broken + ArrayList <TitanVertex> tmpListSec = new ArrayList <> (); + tmpListSec = getConnectedChildren( g, parentVtx ) ; + Iterator<TitanVertex> vIter = tmpListSec.iterator(); + while (vIter.hasNext()) { + TitanVertex tmpV = vIter.next(); + if( vertexHasTheseKeys(tmpV, propHashWithKeys) ){ + secondGetList.add(tmpV); + } + } + } + } + + if( depNodeOk && (secondGetList == null || secondGetList.size() == 0) ){ + // We could not get the node back using it's own key info. + // So, it's a PHANTOM + if (deleteCandidateList.contains(thisVid)) { + boolean okFlag = true; + try { + thisVtx.remove(); + deleteCount++; + thisNtDeleteCount++; + } catch (Exception e) { + okFlag = false; + LOGGER.error("ERROR trying to delete phantom VID = " + thisVid, e); + } + if (okFlag) { + LOGGER.info(" DELETED VID = " + thisVid); + } + } else { + ghostNodeHash.put(thisVid, thisVtx); + } + } + else if( (secondGetList.size() > 1) && depNodeOk && !dupeCheckOff ){ + // Found some DUPLICATES - need to process them + LOGGER.info(" - now check Dupes for this guy - "); + List<String> tmpDupeGroups = checkAndProcessDupes( + TRANSID, FROMAPPID, g, version, + nType, secondGetList, dupeFixOn, + deleteCandidateList, singleCommits, dupeGroups, dbMaps); + Iterator<String> dIter = tmpDupeGroups.iterator(); + while (dIter.hasNext()) { + // Add in any newly found dupes to our running list + String tmpGrp = dIter.next(); + LOGGER.info("Found set of dupes: [" + tmpGrp + "]"); + dupeGroups.add(tmpGrp); + } + } + } + catch (AAIException e1) { + LOGGER.warn(" For nodeType = " + nType + " Caught exception", e1); + errArr.add(e1.getErrorObject().toString()); + } + catch (Exception e2) { + LOGGER.warn(" For nodeType = " + nType + + " Caught exception", e2); + errArr.add(e2.getMessage()); + } + }// try block to enclose looping of a single vertex + catch (Exception exx) { + LOGGER.warn("WARNING from inside the while-verts-loop ", exx); + } + + } // while loop for each record of a nodeType + + if ( (thisNtDeleteCount > 0) && singleCommits ) { + // NOTE - the singleCommits option is not used in normal processing + g.commit(); + g = AAIGraph.getInstance().getGraph().newTransaction(); + + } + thisNtDeleteCount = 0; + LOGGER.info( " Processed " + thisNtCount + " records for [" + nType + "], " + totalNodeCount + " total overall. " ); + + }// While-loop for each node type + }// end of check to make sure we weren't only supposed to do edges + + + // -------------------------------------------------------------------------------------- + // Now, we're going to look for one-armed-edges. Ie. an edge that + // should have + // been deleted (because a vertex on one side was deleted) but + // somehow was not deleted. + // So the one end of it points to a vertexId -- but that vertex is + // empty. + // -------------------------------------------------------------------------------------- + + // To do some strange checking - we need a second graph object + LOGGER.debug(" ---- DEBUG --- about to open a SECOND graph (takes a little while)--------\n"); + // Note - graph2 just reads - but we want it to use a fresh connection to + // the database, so we are NOT using the CACHED DB CONFIG here. + graph2 = TitanFactory.open(AAIConstants.REALTIME_DB_CONFIG); + if (graph2 == null) { + String emsg = "null graph2 object in DataGrooming\n"; + throw new AAIException("AAI_6101", emsg); + } else { + LOGGER.debug("Got the graph2 object... \n"); + } + g2 = graph2.newTransaction(); + if (g2 == null) { + String emsg = "null graphTransaction2 object in DataGrooming\n"; + throw new AAIException("AAI_6101", emsg); + } + + ArrayList<Vertex> vertList = new ArrayList<>(); + Iterable<? extends Vertex> vIt3 = g.query().vertices(); + Iterator<? extends Vertex> vItor3 = vIt3.iterator(); + // Gotta hold these in a List - or else HBase times out as you cycle + // through these + while (vItor3.hasNext()) { + Vertex v = vItor3.next(); + vertList.add(v); + } + int counter = 0; + int lastShown = 0; + Iterator<Vertex> vItor2 = vertList.iterator(); + LOGGER.info(" Checking for bad edges --- "); + + while (vItor2.hasNext()) { + Vertex v = null; + try { + try { + v = vItor2.next(); + } catch (Exception vex) { + LOGGER.warn(">>> WARNING trying to get next vertex on the vItor2 "); + continue; + } + + counter++; + String thisVertId = ""; + try { + thisVertId = v.id().toString(); + } catch (Exception ev) { + LOGGER.warn("WARNING when doing getId() on a vertex from our vertex list. "); + continue; + } + if (ghostNodeHash.containsKey(thisVertId)) { + // This is a phantom node, so don't try to use it + LOGGER.info(" >> Skipping edge check for edges from vertexId = " + + thisVertId + + ", since that guy is a Phantom Node"); + continue; + } + if (counter == lastShown + 250) { + lastShown = counter; + LOGGER.info("... Checking edges for vertex # " + + counter); + } + Iterator<Edge> eItor = v.edges(Direction.BOTH); + while (eItor.hasNext()) { + Edge e = null; + Vertex vIn = null; + Vertex vOut = null; + try { + e = eItor.next(); + } catch (Exception iex) { + LOGGER.warn(">>> WARNING trying to get next edge on the eItor ", iex); + continue; + } + + try { + vIn = e.inVertex(); + } catch (Exception err) { + LOGGER.warn(">>> WARNING trying to get edge's In-vertex ", err); + } + String vNtI = ""; + String vIdI = ""; + TitanVertex ghost2 = null; + + Boolean keysMissing = true; + Boolean cantGetUsingVid = false; + if (vIn != null) { + try { + Object ob = vIn.<Object>property("aai-node-type").orElse(null); + if (ob != null) { + vNtI = ob.toString(); + keysMissing = anyKeyFieldsMissing(vNtI, vIn, dbMaps); + } + ob = vIn.id(); + long vIdLong = 0L; + if (ob != null) { + vIdI = ob.toString(); + vIdLong = Long.parseLong(vIdI); + } + + if( ! ghost2CheckOff ){ + TitanVertex connectedVert = g2.getVertex(vIdLong); + if( connectedVert == null ) { + LOGGER.warn( "GHOST2 -- got NULL when doing getVertex for vid = " + vIdLong); + cantGetUsingVid = true; + + // If we can NOT get this ghost with the SECOND graph-object, + // it is still a ghost since even though we can get data about it using the FIRST graph + // object. + try { + ghost2 = g.getVertex(vIdLong); + } + catch( Exception ex){ + LOGGER.warn( "GHOST2 -- Could not get the ghost info for a bad edge for vtxId = " + vIdLong, ex); + } + if( ghost2 != null ){ + ghostNodeHash.put(vIdI, ghost2); + } + } + }// end of the ghost2 checking + } + catch (Exception err) { + LOGGER.warn(">>> WARNING trying to get edge's In-vertex props ", err); + } + } + if (keysMissing || vIn == null || vNtI.equals("") + || cantGetUsingVid) { + // this is a bad edge because it points to a vertex + // that isn't there anymore or is corrupted + String thisEid = e.id().toString(); + if (deleteCandidateList.contains(thisEid) || deleteCandidateList.contains(vIdI)) { + boolean okFlag = true; + if (!vIdI.equals("")) { + // try to get rid of the corrupted vertex + try { + if( (ghost2 != null) && ghost2FixOn ){ + ghost2.remove(); + } + else { + vIn.remove(); + } + if (singleCommits) { + // NOTE - the singleCommits option is not used in normal processing + g.commit(); + g = AAIGraph.getInstance().getGraph().newTransaction(); + } + deleteCount++; + } catch (Exception e1) { + okFlag = false; + LOGGER.warn("WARNING when trying to delete bad-edge-connected VERTEX VID = " + + vIdI, e1); + } + if (okFlag) { + LOGGER.info(" DELETED vertex from bad edge = " + + vIdI); + } + } else { + // remove the edge if we couldn't get the + // vertex + try { + e.remove(); + if (singleCommits) { + // NOTE - the singleCommits option is not used in normal processing + g.commit(); + g = AAIGraph.getInstance().getGraph().newTransaction(); + } + deleteCount++; + } catch (Exception ex) { + // NOTE - often, the exception is just + // that this edge has already been + // removed + okFlag = false; + LOGGER.warn("WARNING when trying to delete edge = " + + thisEid); + } + if (okFlag) { + LOGGER.info(" DELETED edge = " + thisEid); + } + } + } else { + oneArmedEdgeHash.put(thisEid, e); + if ((vIn != null) && (vIn.id() != null)) { + emptyVertexHash.put(thisEid, vIn.id() + .toString()); + } + } + } + + try { + vOut = e.outVertex(); + } catch (Exception err) { + LOGGER.warn(">>> WARNING trying to get edge's Out-vertex "); + } + String vNtO = ""; + String vIdO = ""; + ghost2 = null; + keysMissing = true; + cantGetUsingVid = false; + if (vOut != null) { + try { + Object ob = vOut.<Object>property("aai-node-type").orElse(null); + if (ob != null) { + vNtO = ob.toString(); + keysMissing = anyKeyFieldsMissing(vNtO, + vOut, dbMaps); + } + ob = vOut.id(); + long vIdLong = 0L; + if (ob != null) { + vIdO = ob.toString(); + vIdLong = Long.parseLong(vIdO); + } + + if( ! ghost2CheckOff ){ + TitanVertex connectedVert = g2.getVertex(vIdLong); + if( connectedVert == null ) { + cantGetUsingVid = true; + LOGGER.info( "GHOST2 -- got NULL when doing getVertex for vid = " + vIdLong); + // If we can get this ghost with the other graph-object, then get it -- it's still a ghost + try { + ghost2 = g.getVertex(vIdLong); + } + catch( Exception ex){ + LOGGER.warn( "GHOST2 -- Could not get the ghost info for a bad edge for vtxId = " + vIdLong, ex); + } + if( ghost2 != null ){ + ghostNodeHash.put(vIdO, ghost2); + } + } + } + } catch (Exception err) { + LOGGER.warn(">>> WARNING trying to get edge's Out-vertex props ", err); + } + } + if (keysMissing || vOut == null || vNtO.equals("") + || cantGetUsingVid) { + // this is a bad edge because it points to a vertex + // that isn't there anymore + String thisEid = e.id().toString(); + if (deleteCandidateList.contains(thisEid) || deleteCandidateList.contains(vIdO)) { + boolean okFlag = true; + if (!vIdO.equals("")) { + // try to get rid of the corrupted vertex + try { + if( (ghost2 != null) && ghost2FixOn ){ + ghost2.remove(); + } + else { + vOut.remove(); + } + if (singleCommits) { + // NOTE - the singleCommits option is not used in normal processing + g.commit(); + g = AAIGraph.getInstance().getGraph().newTransaction(); + } + deleteCount++; + } catch (Exception e1) { + okFlag = false; + LOGGER.warn("WARNING when trying to delete bad-edge-connected VID = " + + vIdO, e1); + } + if (okFlag) { + LOGGER.info(" DELETED vertex from bad edge = " + + vIdO); + } + } else { + // remove the edge if we couldn't get the + // vertex + try { + e.remove(); + if (singleCommits) { + // NOTE - the singleCommits option is not used in normal processing + g.commit(); + g = AAIGraph.getInstance().getGraph().newTransaction(); + } + deleteCount++; + } catch (Exception ex) { + // NOTE - often, the exception is just + // that this edge has already been + // removed + okFlag = false; + LOGGER.warn("WARNING when trying to delete edge = " + + thisEid, ex); + } + if (okFlag) { + LOGGER.info(" DELETED edge = " + thisEid); + } + } + } else { + oneArmedEdgeHash.put(thisEid, e); + if ((vOut != null) && (vOut.id() != null)) { + emptyVertexHash.put(thisEid, vOut.id() + .toString()); + } + } + } + }// End of while-edges-loop + } catch (Exception exx) { + LOGGER.warn("WARNING from in the while-verts-loop ", exx); + } + }// End of while-vertices-loop + + deleteCount = deleteCount + dupeGrpsDeleted; + if (!singleCommits && deleteCount > 0) { + try { + LOGGER.info("About to do the commit for " + + deleteCount + " removes. "); + executeFinalCommit = true; + LOGGER.info("Commit was successful "); + } catch (Exception excom) { + LOGGER.error(" >>>> ERROR <<<< Could not commit changes. ", excom); + deleteCount = 0; + } + } + + int ghostNodeCount = ghostNodeHash.size(); + int orphanNodeCount = orphanNodeHash.size(); + int missingDepNodeCount = missingDepNodeHash.size(); + int oneArmedEdgeCount = oneArmedEdgeHash.size(); + int dupeCount = dupeGroups.size(); + + deleteCount = deleteCount + dupeGrpsDeleted; + + bw.write("\n\n ============ Summary ==============\n"); + bw.write("Ran these nodeTypes: " + ntList + "\n\n"); + bw.write("There were this many delete candidates from previous run = " + + deleteCandidateList.size() + "\n"); + if (dontFixOrphansFlag) { + bw.write(" Note - we are not counting orphan nodes since the -dontFixOrphans parameter was used. \n"); + } + bw.write("Deleted this many delete candidates = " + deleteCount + + "\n"); + bw.write("Total number of nodes looked at = " + totalNodeCount + + "\n"); + bw.write("Ghost Nodes identified = " + ghostNodeCount + "\n"); + bw.write("Orphan Nodes identified = " + orphanNodeCount + "\n"); + bw.write("Bad Edges identified = " + oneArmedEdgeCount + "\n"); + bw.write("Missing Dependent Edge (but not orphaned) node count = " + + missingDepNodeCount + "\n"); + bw.write("Duplicate Groups count = " + dupeCount + "\n"); + bw.write("MisMatching Label/aai-node-type count = " + + misMatchedHash.size() + "\n"); + + bw.write("\n ------------- Delete Candidates ---------\n"); + for (Map.Entry<String, TitanVertex> entry : ghostNodeHash + .entrySet()) { + String vid = entry.getKey(); + bw.write("DeleteCandidate: Phantom Vid = [" + vid + "]\n"); + cleanupCandidateCount++; + } + for (Map.Entry<String, TitanVertex> entry : orphanNodeHash + .entrySet()) { + String vid = entry.getKey(); + bw.write("DeleteCandidate: OrphanDepNode Vid = [" + vid + "]\n"); + if (!dontFixOrphansFlag) { + cleanupCandidateCount++; + } + } + for (Map.Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) { + String eid = entry.getKey(); + bw.write("DeleteCandidate: Bad EDGE Edge-id = [" + eid + "]\n"); + cleanupCandidateCount++; + } + for (Map.Entry<String, TitanVertex> entry : missingDepNodeHash + .entrySet()) { + String vid = entry.getKey(); + bw.write("DeleteCandidate: (maybe) missingDepNode Vid = [" + + vid + "]\n"); + cleanupCandidateCount++; + } + bw.write("\n-- NOTE - To see DeleteCandidates for Duplicates, you need to look in the Duplicates Detail section below.\n"); + + bw.write("\n ------------- GHOST NODES - detail "); + for (Map.Entry<String, TitanVertex> entry : ghostNodeHash + .entrySet()) { + try { + String vid = entry.getKey(); + bw.write("\n ==> Phantom Vid = " + vid + "\n"); + ArrayList<String> retArr = showPropertiesForNode( + TRANSID, FROMAPPID, entry.getValue()); + for (String info : retArr) { + bw.write(info + "\n"); + } + + retArr = showAllEdgesForNode(TRANSID, FROMAPPID, + entry.getValue()); + for (String info : retArr) { + bw.write(info + "\n"); + } + } catch (Exception dex) { + LOGGER.error("error trying to print detail info for a ghost-node: ", dex); + } + } + + bw.write("\n ------------- Missing Dependent Edge ORPHAN NODES - detail: "); + for (Map.Entry<String, TitanVertex> entry : orphanNodeHash + .entrySet()) { + try { + String vid = entry.getKey(); + bw.write("\n> Orphan Node Vid = " + vid + "\n"); + ArrayList<String> retArr = showPropertiesForNode( + TRANSID, FROMAPPID, entry.getValue()); + for (String info : retArr) { + bw.write(info + "\n"); + } + + retArr = showAllEdgesForNode(TRANSID, FROMAPPID, + entry.getValue()); + for (String info : retArr) { + bw.write(info + "\n"); + } + } catch (Exception dex) { + LOGGER.error("error trying to print detail info for a Orphan Node /missing dependent edge", dex); + } + } + + bw.write("\n ------------- Missing Dependent Edge (but not orphan) NODES: "); + for (Map.Entry<String, TitanVertex> entry : missingDepNodeHash + .entrySet()) { + try { + String vid = entry.getKey(); + bw.write("\n> Missing edge to Dependent Node (but has edges) Vid = " + + vid + "\n"); + ArrayList<String> retArr = showPropertiesForNode( + TRANSID, FROMAPPID, entry.getValue()); + for (String info : retArr) { + bw.write(info + "\n"); + } + + retArr = showAllEdgesForNode(TRANSID, FROMAPPID, + entry.getValue()); + for (String info : retArr) { + bw.write(info + "\n"); + } + } catch (Exception dex) { + LOGGER.error("error trying to print detail info for a node missing its dependent edge but not an orphan", dex); + } + } + + bw.write("\n ------------- EDGES pointing to empty/bad vertices: "); + for (Map.Entry<String, Edge> entry : oneArmedEdgeHash.entrySet()) { + try { + String eid = entry.getKey(); + Edge thisE = entry.getValue(); + String badVid = emptyVertexHash.get(eid); + bw.write("\n> Edge pointing to bad vertex (Vid = " + + badVid + ") EdgeId = " + eid + "\n"); + bw.write("Label: [" + thisE.label() + "]\n"); + Iterator<Property<Object>> pI = thisE.properties(); + while (pI.hasNext()) { + Property<Object> propKey = pI.next(); + bw.write("Prop: [" + propKey + "], val = [" + + propKey.value() + "]\n"); + } + } catch (Exception pex) { + LOGGER.error("error trying to print empty/bad vertex data: ", pex); + } + } + + bw.write("\n ------------- Duplicates: "); + Iterator<String> dupeIter = dupeGroups.iterator(); + int dupeSetCounter = 0; + while (dupeIter.hasNext()) { + dupeSetCounter++; + String dset = (String) dupeIter.next(); + + bw.write("\n --- Duplicate Group # " + dupeSetCounter + + " Detail -----------\n"); + try { + // We expect each line to have at least two vid's, followed + // by the preferred one to KEEP + String[] dupeArr = dset.split("\\|"); + ArrayList<String> idArr = new ArrayList<>(); + int lastIndex = dupeArr.length - 1; + for (int i = 0; i <= lastIndex; i++) { + if (i < lastIndex) { + // This is not the last entry, it is one of the + // dupes, so we want to show all its info + bw.write(" >> Duplicate Group # " + + dupeSetCounter + " Node # " + i + + " ----\n"); + String vidString = dupeArr[i]; + idArr.add(vidString); + long longVertId = Long.parseLong(vidString); + Iterator<Vertex> vtxIterator = g.vertices(longVertId); + TitanVertex vtx = null; + if (vtxIterator.hasNext()) { + vtx = (TitanVertex)vtxIterator.next(); + } + ArrayList<String> retArr = showPropertiesForNode(TRANSID, FROMAPPID, vtx); + for (String info : retArr) { + bw.write(info + "\n"); + } + + retArr = showAllEdgesForNode(TRANSID, + FROMAPPID, vtx); + for (String info : retArr) { + bw.write(info + "\n"); + } + } else { + // This is the last entry which should tell us if we + // have a preferred keeper + String prefString = dupeArr[i]; + if (prefString.equals("KeepVid=UNDETERMINED")) { + bw.write("\n For this group of duplicates, could not tell which one to keep.\n"); + bw.write(" >>> This group needs to be taken care of with a manual/forced-delete.\n"); + } else { + // If we know which to keep, then the prefString + // should look like, "KeepVid=12345" + String[] prefArr = prefString.split("="); + if (prefArr.length != 2 + || (!prefArr[0].equals("KeepVid"))) { + throw new Exception("Bad format. Expecting KeepVid=999999"); + } else { + String keepVidStr = prefArr[1]; + if (idArr.contains(keepVidStr)) { + bw.write("\n The vertex we want to KEEP has vertexId = " + + keepVidStr); + bw.write("\n The others become delete candidates: \n"); + idArr.remove(keepVidStr); + for (int x = 0; x < idArr.size(); x++) { + cleanupCandidateCount++; + bw.write("DeleteCandidate: Duplicate Vid = [" + + idArr.get(x) + "]\n"); + } + } else { + throw new Exception("ERROR - Vertex Id to keep not found in list of dupes. dset = [" + + dset + "]"); + } + } + }// else we know which one to keep + }// else last entry + }// for each vertex in a group + } catch (Exception dex) { + LOGGER.error("error trying to print duplicate vertex data", dex); + } + + }// while - work on each group of dupes + + bw.write("\n ------------- Mis-matched Label/aai-node-type Nodes: \n "); + for (Map.Entry<String, String> entry : misMatchedHash.entrySet()) { + String msg = entry.getValue(); + bw.write("MixedMsg = " + msg + "\n"); + } + + bw.write("\n ------------- Got these errors while processing: \n"); + Iterator<String> errIter = errArr.iterator(); + while (errIter.hasNext()) { + String line = (String) errIter.next(); + bw.write(line + "\n"); + } + + bw.close(); + + LOGGER.info("\n ------------- Done doing all the checks ------------ "); + LOGGER.info("Output will be written to " + fullOutputFileName); + + if (cleanupCandidateCount > 0) { + // Technically, this is not an error -- but we're throwing this + // error so that hopefully a + // monitoring system will pick it up and do something with it. + throw new AAIException("AAI_6123", "See file: [" + fullOutputFileName + + "] and investigate delete candidates. "); + } + } catch (AAIException e) { + LOGGER.error("Caught AAIException while grooming data", e); + ErrorLogHelper.logException(e); + } catch (Exception ex) { + LOGGER.error("Caught exception while grooming data", ex); + ErrorLogHelper.logError("AAI_6128", ex.getMessage() + ", resolve and rerun dataGrooming"); + } finally { + + if (bw != null) { + try { + bw.close(); + } catch (IOException iox) { + LOGGER.warn("Got an IOException trying to close bufferedWriter() \n", iox); + } + } + + if (g != null && !g.isClosed()) { + // Any changes that worked correctly should have already done + // their commits. + try { + if (executeFinalCommit) { + g.commit(); + } + g.rollback(); + } catch (Exception ex) { + // Don't throw anything because Titan sometimes is just saying that the graph is already closed + LOGGER.warn("WARNING from final graphTransaction.rollback()", ex); + } + } + + if (g2 != null && !g2.isClosed()) { + // Any changes that worked correctly should have already done + // their commits. + try { + g2.rollback(); + } catch (Exception ex) { + // Don't throw anything because Titan sometimes is just saying that the graph is already closed + LOGGER.warn("WARNING from final graphTransaction2.rollback()", ex); + } + } + + if( finalShutdownFlag ){ + try { + if( graph != null && graph.isOpen() ){ + graph.tx().close(); + graph.close(); + } + } catch (Exception ex) { + // Don't throw anything because Titan sometimes is just saying that the graph is already closed{ + LOGGER.warn("WARNING from final graph.shutdown()", ex); + } + + try { + if( graph2 != null && graph2.isOpen() ){ + graph2.tx().close(); + graph2.close(); + } + } catch (Exception ex) { + // Don't throw anything because Titan sometimes is just saying that the graph is already closed{ + LOGGER.warn("WARNING from final graph2.shutdown()", ex); + } + } + + } + + return cleanupCandidateCount; + + }// end of doTheGrooming() + + + /** + * Vertex has these keys. + * + * @param tmpV the tmp V + * @param propHashWithKeys the prop hash with keys + * @return the boolean + */ + private static Boolean vertexHasTheseKeys( TitanVertex tmpV, HashMap <String, Object> propHashWithKeys) { + Iterator <?> it = propHashWithKeys.entrySet().iterator(); + while( it.hasNext() ){ + String propName = ""; + String propVal = ""; + Map.Entry <?,?>propEntry = (Map.Entry<?,?>)it.next(); + Object propNameObj = propEntry.getKey(); + if( propNameObj != null ){ + propName = propNameObj.toString(); + } + Object propValObj = propEntry.getValue(); + if( propValObj != null ){ + propVal = propValObj.toString(); + } + Object checkValObj = tmpV.<Object>property(propName).orElse(null); + if( checkValObj == null ) { + return false; + } + else if( !propVal.equals(checkValObj.toString()) ){ + return false; + } + } + return true; + } + + + /** + * Any key fields missing. + * + * @param nType the n type + * @param v the v + * @return the boolean + */ + private static Boolean anyKeyFieldsMissing(String nType, Vertex v, DbMaps dbMaps) { + + try { + // Determine what the key fields are for this nodeType + Collection <String> keyPropNamesColl = new ArrayList <>(); + if( dbMaps.NodeKeyProps.containsKey(nType) ){ + keyPropNamesColl = dbMaps.NodeKeyProps.get(nType); + } + else { + throw new AAIException("AAI_6105", "Required Property name(s) not found for nodeType = " + nType + ")"); + } + + Iterator<String> keyPropI = keyPropNamesColl.iterator(); + while (keyPropI.hasNext()) { + String propName = keyPropI.next(); + Object ob = v.<Object>property(propName).orElse(null); + if (ob == null || ob.toString().equals("")) { + // It is missing a key property + return true; + } + } + } catch (AAIException e) { + // Something was wrong + return true; + } + return false; + } + + + /** + * Gets the delete list. + * + * @param targetDir the target dir + * @param fileName the file name + * @param edgesOnlyFlag the edges only flag + * @param dontFixOrphans the dont fix orphans + * @param dupeFixOn the dupe fix on + * @return the delete list + * @throws AAIException the AAI exception + */ + private static Set<String> getDeleteList(String targetDir, + String fileName, Boolean edgesOnlyFlag, Boolean dontFixOrphans, + Boolean dupeFixOn) throws AAIException { + + // Look in the file for lines formated like we expect - pull out any + // Vertex Id's to delete on this run + Set<String> delList = new LinkedHashSet<>(); + String fullFileName = targetDir + AAIConstants.AAI_FILESEP + fileName; + BufferedReader br = null; + + try { + br = new BufferedReader(new FileReader(fullFileName)); + String line = br.readLine(); + while (line != null) { + if (!line.equals("") && line.startsWith("DeleteCandidate")) { + if (edgesOnlyFlag && (!line.contains("Bad Edge"))) { + // We're not going to process edge guys + } else if (dontFixOrphans && line.contains("Orphan")) { + // We're not going to process orphans + } else if (!dupeFixOn && line.contains("Duplicate")) { + // We're not going to process Duplicates + } else { + int begIndex = line.indexOf("id = "); + int endIndex = line.indexOf("]"); + String vidVal = line.substring(begIndex + 6, endIndex); + delList.add(vidVal); + } + } + line = br.readLine(); + } + br.close(); + } catch (IOException e) { + throw new AAIException("AAI_6124", e, "Could not open input-file [" + fullFileName + + "], exception= " + e.getMessage()); + } + + return delList; + + }// end of getDeleteList + + /** + * Gets the preferred dupe. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param g the g + * @param dupeVertexList the dupe vertex list + * @param ver the ver + * @return TitanVertex + * @throws AAIException the AAI exception + */ + public static TitanVertex getPreferredDupe(String transId, + String fromAppId, TitanTransaction g, + ArrayList<TitanVertex> dupeVertexList, String ver, DbMaps dbMaps) + throws AAIException { + + // This method assumes that it is being passed a List of vertex objects + // which + // violate our uniqueness constraints. + + TitanVertex nullVtx = null; + + if (dupeVertexList == null) { + return nullVtx; + } + int listSize = dupeVertexList.size(); + if (listSize == 0) { + return nullVtx; + } + if (listSize == 1) { + return ((TitanVertex) dupeVertexList.get(0)); + } + + TitanVertex vtxPreferred = null; + TitanVertex currentFaveVtx = (TitanVertex) dupeVertexList.get(0); + for (int i = 1; i < listSize; i++) { + TitanVertex vtxB = (TitanVertex) dupeVertexList.get(i); + vtxPreferred = pickOneOfTwoDupes(transId, fromAppId, g, + currentFaveVtx, vtxB, ver, dbMaps); + if (vtxPreferred == null) { + // We couldn't choose one + return nullVtx; + } else { + currentFaveVtx = vtxPreferred; + } + } + + return (currentFaveVtx); + + } // end of getPreferredDupe() + + /** + * Pick one of two dupes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param g the g + * @param vtxA the vtx A + * @param vtxB the vtx B + * @param ver the ver + * @return TitanVertex + * @throws AAIException the AAI exception + */ + public static TitanVertex pickOneOfTwoDupes(String transId, + String fromAppId, TitanTransaction g, TitanVertex vtxA, + TitanVertex vtxB, String ver, DbMaps dbMaps) throws AAIException { + + TitanVertex nullVtx = null; + TitanVertex preferredVtx = null; + + Long vidA = new Long(vtxA.id().toString()); + Long vidB = new Long(vtxB.id().toString()); + + String vtxANodeType = ""; + String vtxBNodeType = ""; + Object obj = vtxA.<Object>property("aai-node-type").orElse(null); + if (obj != null) { + vtxANodeType = obj.toString(); + } + obj = vtxB.<Object>property("aai-node-type").orElse(null); + if (obj != null) { + vtxBNodeType = obj.toString(); + } + + if (vtxANodeType.equals("") || (!vtxANodeType.equals(vtxBNodeType))) { + // Either they're not really dupes or there's some bad data - so + // don't pick one + return nullVtx; + } + + // Check that node A and B both have the same key values (or else they + // are not dupes) + // (We'll check dep-node later) + // Determine what the key fields are for this nodeType + Collection <String> keyProps = new ArrayList <>(); + if( dbMaps.NodeKeyProps.containsKey(vtxANodeType) ){ + keyProps = dbMaps.NodeKeyProps.get(vtxANodeType); + } + else { + throw new AAIException("AAI_6105", "Required Property name(s) not found for nodeType = " + vtxANodeType + ")"); + } + + Iterator<String> keyPropI = keyProps.iterator(); + while (keyPropI.hasNext()) { + String propName = keyPropI.next(); + String vtxAKeyPropVal = ""; + obj = vtxA.<Object>property(propName).orElse(null); + if (obj != null) { + vtxAKeyPropVal = obj.toString(); + } + String vtxBKeyPropVal = ""; + obj = vtxB.<Object>property(propName).orElse(null); + if (obj != null) { + vtxBKeyPropVal = obj.toString(); + } + + if (vtxAKeyPropVal.equals("") + || (!vtxAKeyPropVal.equals(vtxBKeyPropVal))) { + // Either they're not really dupes or they are missing some key + // data - so don't pick one + return nullVtx; + } + } + + // Collect the vid's and aai-node-types of the vertices that each vertex + // (A and B) is connected to. + ArrayList<String> vtxIdsConn2A = new ArrayList<>(); + ArrayList<String> vtxIdsConn2B = new ArrayList<>(); + HashMap<String, String> nodeTypesConn2A = new HashMap<>(); + HashMap<String, String> nodeTypesConn2B = new HashMap<>(); + + ArrayList<TitanVertex> vertListA = getConnectedNodes( g, vtxA ); + if (vertListA != null) { + Iterator<TitanVertex> iter = vertListA.iterator(); + while (iter.hasNext()) { + TitanVertex tvCon = iter.next(); + String conVid = tvCon.id().toString(); + String nt = ""; + obj = tvCon.<Object>property("aai-node-type").orElse(null); + if (obj != null) { + nt = obj.toString(); + } + nodeTypesConn2A.put(nt, conVid); + vtxIdsConn2A.add(conVid); + } + } + + ArrayList<TitanVertex> vertListB = getConnectedNodes( g, vtxB ); + if (vertListB != null) { + Iterator<TitanVertex> iter = vertListB.iterator(); + while (iter.hasNext()) { + TitanVertex tvCon = iter.next(); + String conVid = tvCon.id().toString(); + String nt = ""; + obj = tvCon.<Object>property("aai-node-type").orElse(null); + if (obj != null) { + nt = obj.toString(); + } + nodeTypesConn2B.put(nt, conVid); + vtxIdsConn2B.add(conVid); + } + } + + // 1 - If this kind of node needs a dependent node for uniqueness, then + // verify that they both nodes + // point to the same dependent node (otherwise they're not really + // duplicates) + // Note - there are sometimes more than one dependent node type since + // one nodeType can be used in + // different ways. But for a particular node, it will only have one + // dependent node that it's + // connected to. + Collection <String> depNodeTypes = new ArrayList <>(); + if( dbMaps.NodeDependencies.containsKey(vtxANodeType) ){ + depNodeTypes = dbMaps.NodeDependencies.get(vtxANodeType); + } + + if (depNodeTypes.isEmpty()) { + // This kind of node is not dependent on any other. That is ok. + } else { + String depNodeVtxId4A = ""; + String depNodeVtxId4B = ""; + Iterator<String> iter = depNodeTypes.iterator(); + while (iter.hasNext()) { + String depNodeType = iter.next(); + if (nodeTypesConn2A.containsKey(depNodeType)) { + // This is the dependent node type that vertex A is using + depNodeVtxId4A = nodeTypesConn2A.get(depNodeType); + } + if (nodeTypesConn2B.containsKey(depNodeType)) { + // This is the dependent node type that vertex B is using + depNodeVtxId4B = nodeTypesConn2B.get(depNodeType); + } + } + if (depNodeVtxId4A.equals("") + || (!depNodeVtxId4A.equals(depNodeVtxId4B))) { + // Either they're not really dupes or there's some bad data - so + // don't pick either one + return nullVtx; + } + } + + if (vtxIdsConn2A.size() == vtxIdsConn2B.size()) { + // 2 - If they both have edges to all the same vertices, then return + // the one with the lower vertexId. + boolean allTheSame = true; + Iterator<String> iter = vtxIdsConn2A.iterator(); + while (iter.hasNext()) { + String vtxIdConn2A = iter.next(); + if (!vtxIdsConn2B.contains(vtxIdConn2A)) { + allTheSame = false; + break; + } + } + + if (allTheSame) { + if (vidA < vidB) { + preferredVtx = vtxA; + } else { + preferredVtx = vtxB; + } + } + } else if (vtxIdsConn2A.size() > vtxIdsConn2B.size()) { + // 3 - VertexA is connected to more things than vtxB. + // We'll pick VtxA if its edges are a superset of vtxB's edges. + boolean missingOne = false; + Iterator<String> iter = vtxIdsConn2B.iterator(); + while (iter.hasNext()) { + String vtxIdConn2B = iter.next(); + if (!vtxIdsConn2A.contains(vtxIdConn2B)) { + missingOne = true; + break; + } + } + if (!missingOne) { + preferredVtx = vtxA; + } + } else if (vtxIdsConn2B.size() > vtxIdsConn2A.size()) { + // 4 - VertexB is connected to more things than vtxA. + // We'll pick VtxB if its edges are a superset of vtxA's edges. + boolean missingOne = false; + Iterator<String> iter = vtxIdsConn2A.iterator(); + while (iter.hasNext()) { + String vtxIdConn2A = iter.next(); + if (!vtxIdsConn2B.contains(vtxIdConn2A)) { + missingOne = true; + break; + } + } + if (!missingOne) { + preferredVtx = vtxB; + } + } else { + preferredVtx = nullVtx; + } + + return (preferredVtx); + + } // end of pickOneOfTwoDupes() + + /** + * Check and process dupes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param g the g + * @param version the version + * @param nType the n type + * @param passedVertList the passed vert list + * @param dupeFixOn the dupe fix on + * @param deleteCandidateList the delete candidate list + * @param singleCommits the single commits + * @param alreadyFoundDupeGroups the already found dupe groups + * @param dbMaps the db maps + * @return the array list + */ + private static List<String> checkAndProcessDupes(String transId, + String fromAppId, TitanTransaction g, String version, String nType, + List<TitanVertex> passedVertList, Boolean dupeFixOn, + Set<String> deleteCandidateList, Boolean singleCommits, + ArrayList<String> alreadyFoundDupeGroups, DbMaps dbMaps ) { + + ArrayList<String> returnList = new ArrayList<>(); + ArrayList<TitanVertex> checkVertList = new ArrayList<>(); + ArrayList<String> alreadyFoundDupeVidArr = new ArrayList<>(); + Boolean noFilterList = true; + Iterator<String> afItr = alreadyFoundDupeGroups.iterator(); + while (afItr.hasNext()) { + String dupeGrpStr = afItr.next(); + String[] dupeArr = dupeGrpStr.split("\\|"); + int lastIndex = dupeArr.length - 1; + for (int i = 0; i < lastIndex; i++) { + // Note: we don't want the last one... + String vidString = dupeArr[i]; + alreadyFoundDupeVidArr.add(vidString); + noFilterList = false; + } + } + + // For a given set of Nodes that were found with a set of KEY + // Parameters, (nodeType + key data) we will + // see if we find any duplicate nodes that need to be cleaned up. Note - + // it's legit to have more than one + // node with the same key data if the nodes depend on a parent for + // uniqueness -- as long as the two nodes + // don't hang off the same Parent. + // If we find duplicates, and we can figure out which of each set of + // duplicates is the one that we + // think should be preserved, we will record that. Whether we can tell + // which one should be + // preserved or not, we will return info about any sets of duplicates + // found. + // + // Each element in the returned arrayList might look like this: + // "1234|5678|keepVid=UNDETERMINED" (if there were 2 dupes, and we + // couldn't figure out which one to keep) + // or, "100017|200027|30037|keepVid=30037" (if there were 3 dupes and we + // thought the third one was the one that should survive) + + // Because of the way the calling code loops over stuff, we can get the + // same data multiple times - so we should + // not process any vertices that we've already seen. + + try { + Iterator<TitanVertex> pItr = passedVertList.iterator(); + while (pItr.hasNext()) { + TitanVertex tvx = (TitanVertex) pItr.next(); + String passedId = tvx.id().toString(); + if (noFilterList || !alreadyFoundDupeVidArr.contains(passedId)) { + // We haven't seen this one before - so we should check it. + checkVertList.add(tvx); + } + } + + if (checkVertList.size() < 2) { + // Nothing new to check. + return returnList; + } + + if (!dbMaps.NodeDependencies.containsKey(nType)) { + // If this was a node that does NOT depend on other nodes for + // uniqueness, and we + // found more than one node using its key -- record the found + // vertices as duplicates. + String dupesStr = ""; + for (int i = 0; i < checkVertList.size(); i++) { + dupesStr = dupesStr + + ((TitanVertex) (checkVertList.get(i))).id() + .toString() + "|"; + } + if (dupesStr != "") { + TitanVertex prefV = getPreferredDupe(transId, fromAppId, + g, checkVertList, version, dbMaps); + if (prefV == null) { + // We could not determine which duplicate to keep + dupesStr = dupesStr + "KeepVid=UNDETERMINED"; + returnList.add(dupesStr); + } else { + dupesStr = dupesStr + "KeepVid=" + prefV.id(); + Boolean didRemove = false; + if (dupeFixOn) { + didRemove = deleteNonKeepersIfAppropriate(g, + dupesStr, prefV.id().toString(), + deleteCandidateList, singleCommits); + } + if (didRemove) { + dupeGrpsDeleted++; + } else { + // keep them on our list + returnList.add(dupesStr); + } + } + } + } else { + // More than one node have the same key fields since they may + // depend on a parent node for + // uniqueness. Since we're finding more than one, we want to + // check to see if any of the + // vertices that have this set of keys are also pointing at the + // same 'parent' node. + // Note: for a given set of key data, it is possible that there + // could be more than one set of + // duplicates. + HashMap<String, ArrayList<TitanVertex>> vertsGroupedByParentHash = groupVertsByDepNodes( + transId, fromAppId, g, version, nType, + checkVertList, dbMaps); + for (Map.Entry<String, ArrayList<TitanVertex>> entry : vertsGroupedByParentHash + .entrySet()) { + ArrayList<TitanVertex> thisParentsVertList = entry + .getValue(); + if (thisParentsVertList.size() > 1) { + // More than one vertex found with the same key info + // hanging off the same parent/dependent node + String dupesStr = ""; + for (int i = 0; i < thisParentsVertList.size(); i++) { + dupesStr = dupesStr + + ((TitanVertex) (thisParentsVertList + .get(i))).id() + "|"; + } + if (dupesStr != "") { + TitanVertex prefV = getPreferredDupe(transId, + fromAppId, g, thisParentsVertList, + version, dbMaps); + + if (prefV == null) { + // We could not determine which duplicate to + // keep + dupesStr = dupesStr + "KeepVid=UNDETERMINED"; + returnList.add(dupesStr); + } else { + Boolean didRemove = false; + dupesStr = dupesStr + "KeepVid=" + + prefV.id().toString(); + if (dupeFixOn) { + didRemove = deleteNonKeepersIfAppropriate( + g, dupesStr, prefV.id() + .toString(), + deleteCandidateList, singleCommits); + } + if (didRemove) { + dupeGrpsDeleted++; + } else { + // keep them on our list + returnList.add(dupesStr); + } + } + } + } + } + } + } catch (Exception e) { + LOGGER.warn(" >>> Threw an error in checkAndProcessDupes - just absorb this error and move on. ", e); + } + + return returnList; + + }// End of checkAndProcessDupes() + + /** + * Group verts by dep nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param g the g + * @param version the version + * @param nType the n type + * @param passedVertList the passed vert list + * @param dbMaps the db maps + * @return the hash map + * @throws AAIException the AAI exception + */ + private static HashMap<String, ArrayList<TitanVertex>> groupVertsByDepNodes( + String transId, String fromAppId, TitanTransaction g, String version, + String nType, ArrayList<TitanVertex> passedVertList, DbMaps dbMaps) + throws AAIException { + // Given a list of Titan Vertices, group them together by dependent + // nodes. Ie. if given a list of + // ip address nodes (assumed to all have the same key info) they might + // sit under several different parent vertices. + // Under Normal conditions, there would only be one per parent -- but + // we're trying to find duplicates - so we + // allow for the case where more than one is under the same parent node. + + HashMap<String, ArrayList<TitanVertex>> retHash = new HashMap<String, ArrayList<TitanVertex>>(); + if (!dbMaps.NodeDependencies.containsKey(nType)) { + // This method really should not have been called if this is not the + // kind of node + // that depends on a parent for uniqueness, so just return the empty + // hash. + return retHash; + } + + // Find out what types of nodes the passed in nodes can depend on + ArrayList<String> depNodeTypeL = new ArrayList<>(); + Collection<String> depNTColl = dbMaps.NodeDependencies.get(nType); + Iterator<String> ntItr = depNTColl.iterator(); + while (ntItr.hasNext()) { + depNodeTypeL.add(ntItr.next()); + } + // For each vertex, we want find its dependent vertex and add it to + // other vertexes that are dependent on that same guy. + if (passedVertList != null) { + Iterator<TitanVertex> iter = passedVertList.iterator(); + while (iter.hasNext()) { + TitanVertex thisVert = iter.next(); + ArrayList<TitanVertex> connectedVList = getConnectedNodes( g, thisVert ); + Iterator<TitanVertex> connIter = connectedVList.iterator(); + while (connIter.hasNext()) { + TitanVertex tvCon = connIter.next(); + String conNt = ""; + Object obj = tvCon.<Object>property("aai-node-type").orElse(null); + if (obj != null) { + conNt = obj.toString(); + } + if (depNTColl.contains(conNt)) { + // This must be the parent/dependent node + String parentVid = tvCon.id().toString(); + if (retHash.containsKey(parentVid)) { + // add this vert to the list for this parent key + retHash.get(parentVid).add(thisVert); + } else { + // This is the first one we found on this parent + ArrayList<TitanVertex> vList = new ArrayList<>(); + vList.add(thisVert); + retHash.put(parentVid, vList); + } + } + } + } + } + + return retHash; + + }// end of groupVertsByDepNodes() + + /** + * Delete non keepers if appropriate. + * + * @param g the g + * @param dupeInfoString the dupe info string + * @param vidToKeep the vid to keep + * @param deleteCandidateList the delete candidate list + * @param singleCommits the single commits + * @return the boolean + */ + private static Boolean deleteNonKeepersIfAppropriate(TitanTransaction g, + String dupeInfoString, String vidToKeep, + Set<String> deleteCandidateList, Boolean singleCommits) { + + Boolean deletedSomething = false; + // This assumes that the dupeInfoString is in the format of + // pipe-delimited vid's followed by + // ie. "3456|9880|keepVid=3456" + if (deleteCandidateList == null || deleteCandidateList.size() == 0) { + // No vid's on the candidate list -- so no deleting will happen on + // this run + return false; + } + + String[] dupeArr = dupeInfoString.split("\\|"); + ArrayList<String> idArr = new ArrayList<>(); + int lastIndex = dupeArr.length - 1; + for (int i = 0; i <= lastIndex; i++) { + if (i < lastIndex) { + // This is not the last entry, it is one of the dupes, + String vidString = dupeArr[i]; + idArr.add(vidString); + } else { + // This is the last entry which should tell us if we have a + // preferred keeper + String prefString = dupeArr[i]; + if (prefString.equals("KeepVid=UNDETERMINED")) { + // They sent us a bad string -- nothing should be deleted if + // no dupe could be tagged as preferred + return false; + } else { + // If we know which to keep, then the prefString should look + // like, "KeepVid=12345" + String[] prefArr = prefString.split("="); + if (prefArr.length != 2 || (!prefArr[0].equals("KeepVid"))) { + LOGGER.error("Bad format. Expecting KeepVid=999999"); + return false; + } else { + String keepVidStr = prefArr[1]; + if (idArr.contains(keepVidStr)) { + idArr.remove(keepVidStr); + + // So now, the idArr should just contain the vid's + // that we want to remove. + for (int x = 0; x < idArr.size(); x++) { + boolean okFlag = true; + String thisVid = idArr.get(x); + if (deleteCandidateList.contains(thisVid)) { + // This vid is a valid delete candidate from + // a prev. run, so we can remove it. + try { + long longVertId = Long + .parseLong(thisVid); + TitanVertex vtx = g + .getVertex(longVertId); + vtx.remove(); + if (singleCommits) { + // NOTE - the singleCommits option is not used in normal processing + g.commit(); + g = AAIGraph.getInstance().getGraph().newTransaction(); + } + } catch (Exception e) { + okFlag = false; + LOGGER.error("ERROR trying to delete VID = " + thisVid, e); + } + if (okFlag) { + LOGGER.info(" DELETED VID = " + thisVid); + deletedSomething = true; + } + } + } + } else { + LOGGER.error("ERROR - Vertex Id to keep not found in list of dupes. dupeInfoString = [" + + dupeInfoString + "]"); + return false; + } + } + }// else we know which one to keep + }// else last entry + }// for each vertex in a group + + return deletedSomething; + + }// end of deleteNonKeepersIfAppropriate() + + + /** + * Gets the node just using key params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param keyPropsHash the key props hash + * @param apiVersion the api version + * @return the node just using key params + * @throws AAIException the AAI exception + */ + public static List <TitanVertex> getNodeJustUsingKeyParams( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> keyPropsHash, String apiVersion ) throws AAIException{ + + List <TitanVertex> retVertList = new ArrayList <> (); + + // We assume that all NodeTypes have at least one key-property defined. + // Note - instead of key-properties (the primary key properties), a user could pass + // alternate-key values if they are defined for the nodeType. + List<String> kName = new ArrayList<>(); + List<Object> kVal = new ArrayList<>(); + if( keyPropsHash == null || keyPropsHash.isEmpty() ) { + throw new AAIException("AAI_6120", " NO key properties passed for this getNodeJustUsingKeyParams() request. NodeType = [" + nodeType + "]. "); + } + + int i = -1; + for( Map.Entry<String, Object> entry : keyPropsHash.entrySet() ){ + i++; + kName.add(i, entry.getKey()); + kVal.add(i, entry.getValue()); + } + int topPropIndex = i; + TitanVertex tiV = null; + String propsAndValuesForMsg = ""; + Iterable <?> verts = null; + + try { + if( topPropIndex == 0 ){ + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ") "; + verts= graph.query().has(kName.get(0),kVal.get(0)).has("aai-node-type",nodeType).vertices(); + } + else if( topPropIndex == 1 ){ + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ") "; + verts = graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has("aai-node-type",nodeType).vertices(); + } + else if( topPropIndex == 2 ){ + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ", " + + kName.get(2) + " = " + kVal.get(2) + ") "; + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has("aai-node-type",nodeType).vertices(); + } + else if( topPropIndex == 3 ){ + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ", " + + kName.get(2) + " = " + kVal.get(2) + ", " + + kName.get(3) + " = " + kVal.get(3) + ") "; + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has(kName.get(3),kVal.get(3)).has("aai-node-type",nodeType).vertices(); + } + else { + throw new AAIException("AAI_6114", " We only support 4 keys per nodeType for now \n"); + } + } + catch( Exception ex ){ + LOGGER.error( " ERROR trying to get node for: [" + propsAndValuesForMsg + "]", ex); + } + + if( verts != null ){ + Iterator <?> vertI = verts.iterator(); + while( vertI.hasNext() ){ + tiV = (TitanVertex) vertI.next(); + retVertList.add(tiV); + } + } + + if( retVertList.size() == 0 ){ + LOGGER.debug("DEBUG No node found for nodeType = [" + nodeType + + "], propsAndVal = " + propsAndValuesForMsg ); + } + + return retVertList; + + }// End of getNodeJustUsingKeyParams() + + /** + * Show all edges for node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param tVert the t vert + * @return the array list + */ + private static ArrayList <String> showAllEdgesForNode( String transId, String fromAppId, TitanVertex tVert ){ + + ArrayList <String> retArr = new ArrayList <> (); + Iterator <Edge> eI = tVert.edges(Direction.IN); + if( ! eI.hasNext() ){ + retArr.add("No IN edges were found for this vertex. "); + } + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + String lab = ed.label(); + TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert); + if( vtx == null ){ + retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< "); + } + else { + String nType = vtx.<String>property("aai-node-type").orElse(null); + String vid = vtx.id().toString(); + retArr.add("Found an IN edge (" + lab + ") to this vertex from a [" + nType + "] node with VtxId = " + vid ); + + } + } + + eI = tVert.edges(Direction.OUT); + if( ! eI.hasNext() ){ + retArr.add("No OUT edges were found for this vertex. "); + } + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + String lab = ed.label(); + TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert); + if( vtx == null ){ + retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< "); + } + else { + String nType = vtx.<String>property("aai-node-type").orElse(null); + String vid = vtx.id().toString(); + retArr.add("Found an OUT edge (" + lab + ") from this vertex to a [" + nType + "] node with VtxId = " + vid ); + } + } + return retArr; + } + + + /** + * Show properties for node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param tVert the t vert + * @return the array list + */ + private static ArrayList <String> showPropertiesForNode( String transId, String fromAppId, TitanVertex tVert ){ + + ArrayList <String> retArr = new ArrayList <> (); + if( tVert == null ){ + retArr.add("null Node object passed to showPropertiesForNode()\n"); + } + else { + String nodeType = ""; + Object ob = tVert.<Object>property("aai-node-type").orElse(null); + if( ob == null ){ + nodeType = "null"; + } + else{ + nodeType = ob.toString(); + } + + retArr.add(" AAINodeType/VtxID for this Node = [" + nodeType + "/" + tVert.id() + "]"); + retArr.add(" Property Detail: "); + Iterator<VertexProperty<Object>> pI = tVert.properties(); + while( pI.hasNext() ){ + VertexProperty<Object> tp = pI.next(); + Object val = tp.value(); + retArr.add("Prop: [" + tp.key() + "], val = [" + val + "] "); + } + } + return retArr; + } + + + private static ArrayList <TitanVertex> getConnectedNodes(TitanTransaction g, TitanVertex startVtx ) + throws AAIException { + + ArrayList <TitanVertex> retArr = new ArrayList <> (); + if( startVtx == null ){ + return retArr; + } + else { + GraphTraversal<Vertex, Vertex> modPipe = null; + modPipe = g.traversal().V(startVtx).both(); + if( modPipe != null && modPipe.hasNext() ){ + while( modPipe.hasNext() ){ + TitanVertex conVert = (TitanVertex) modPipe.next(); + retArr.add(conVert); + } + } + } + return retArr; + + }// End of getConnectedNodes() + + + private static ArrayList <TitanVertex> getConnectedChildren( TitanTransaction graph, + TitanVertex startVtx ) throws AAIException{ + + ArrayList <TitanVertex> childList = new ArrayList <> (); + + Iterable <?> verts = startVtx.query().direction(Direction.OUT).has("isParent",true).vertices(); + Iterator <?> vertI = verts.iterator(); + TitanVertex tmpVtx = null; + while( vertI != null && vertI.hasNext() ){ + tmpVtx = (TitanVertex) vertI.next(); + childList.add(tmpVtx); + } + + return childList; + + }// End of getConnectedChildren() + + + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/DbMeth.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/DbMeth.java new file mode 100644 index 00000000..db33e4dc --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/DbMeth.java @@ -0,0 +1,3643 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbgen; + +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; + +import org.openecomp.aai.dbmodel.DbEdgeRules; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.ingestModel.DbMaps; +import org.openecomp.aai.ingestModel.IngestModelMoxyOxm; +import org.openecomp.aai.serialization.db.EdgeRule; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.net.InetAddresses; +import com.thinkaurelius.titan.core.TitanEdge; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; +import com.thinkaurelius.titan.core.TitanVertex; + + +/** + * General Database-level Utility class. These methods deal with the database one dataNode / Edge at a time. + * Transactions are managed at a higher level by the calling classes by passing in a TitanTransaction object. + */ +public class DbMeth{ + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DbMeth.class); + + /** + * Patch aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param depNodeVal the dep node val + * @param apiVersion the api version + * @return TitanVertex + * @throws AAIException the AAI exception + */ + public static TitanVertex patchAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, TitanVertex depNodeVal, String apiVersion ) throws AAIException{ + // If they're calling patchAaiNode, then we only want to add/update the properties that they + // pass us in the propHash. If there are others already in the DB, we leave them alone. + + // Note: to be really official, we'd throw an error if the node wasn't already in the db. + boolean[] objectExists = new boolean[1]; + objectExists[0] = true; + Boolean patchOnly = true; + TitanVertex tv = persistAaiNodeBASE(transId, fromAppId, graph, nodeType, propHash, depNodeVal, patchOnly, apiVersion, objectExists); + return( tv ); + + } // end of patchAaiNode() + + /** + * Patch aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param depNodeVal the dep node val + * @return the titan vertex + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex patchAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, TitanVertex depNodeVal) throws AAIException{ + return patchAaiNode( transId, fromAppId, graph, nodeType, + propHash, depNodeVal, null ); + } + + /** + * Persist aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param depNodeVal the dep node val + * @param patchOnly the patch only + * @param apiVersion the api version + * @return the titan vertex + * @throws AAIException the AAI exception + */ + public static TitanVertex persistAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, TitanVertex depNodeVal, Boolean patchOnly, String apiVersion) throws AAIException{ + boolean[] objectExists = new boolean[1]; + objectExists[0] = false; + return persistAaiNodeBASE( transId, fromAppId, graph, nodeType, + propHash, depNodeVal, patchOnly, apiVersion, objectExists); + } + + /** + * Persist aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param addIfNotFound the add if not found + * @param depNodeVal the dep node val + * @param apiVersion the api version + * @return the titan vertex + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex persistAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, Boolean addIfNotFound, TitanVertex depNodeVal, String apiVersion) throws AAIException{ + // If they're calling persistAaiNode, then we want to make the Db look like whatever they pass us. That is, if + // there is already a record in the DB, but they do not pass some of the existing properties, they should + // be cleared from the DB. Since we want to take care of all properties, we pass patchOnly = false + Boolean patchOnly = false; + boolean[] objectExists = new boolean[1]; + objectExists[0] = false; + TitanVertex tv = persistAaiNodeBASE(transId, fromAppId, graph, nodeType, propHash, depNodeVal, patchOnly, apiVersion, objectExists); + return( tv ); + } + + /** + * Persist aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param addIfNotFound the add if not found + * @param depNodeVal the dep node val + * @return the titan vertex + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex persistAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, Boolean addIfNotFound, TitanVertex depNodeVal) throws AAIException{ + // If they're calling persistAaiNode, then we want to make the Db look like whatever they pass us. That is, if + // there is already a record in the DB, but they do not pass some of the existing properties, they should + // be cleared from the DB. Since we want to take care of all properties, we pass patchOnly = false + Boolean patchOnly = false; + boolean[] objectExists = new boolean[1]; + objectExists[0] = false; + TitanVertex tv = persistAaiNodeBASE(transId, fromAppId, graph, nodeType, propHash, depNodeVal, patchOnly, null, objectExists); + return( tv ); + } // end of persistAaiNode() + + /** + * Persist aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param addIfNotFound the add if not found + * @param depNodeVal the dep node val + * @param apiVersion the api version + * @param objectExists the object exists + * @return TitanVertex + * @throws AAIException the AAI exception + */ + public static TitanVertex persistAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, Boolean addIfNotFound, TitanVertex depNodeVal, String apiVersion, boolean[] objectExists) throws AAIException{ + Boolean patchOnly = false; + // If they're calling persistAaiNode, then we want to make the Db look like whatever they pass us. That is, if + // there is already a record in the DB, but they do not pass some of the existing properties, they should + // be cleared from the DB. Since we want to take care of all properties, we pass patchOnly = false + TitanVertex tv = persistAaiNodeBASE(transId, fromAppId, graph, nodeType, propHash, depNodeVal, patchOnly, apiVersion, objectExists, null); + return( tv ); + } + + /** + * Persist aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param addIfNotFound the add if not found + * @param depNodeVal the dep node val + * @param apiVersion the api version + * @param objectExists the object exists + * @param thisNodeVertex the this node vertex + * @return the titan vertex + * @throws AAIException the AAI exception + */ + public static TitanVertex persistAaiNode(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, Boolean addIfNotFound, TitanVertex depNodeVal, String apiVersion, boolean[] objectExists, TitanVertex thisNodeVertex) throws AAIException{ + Boolean patchOnly = false; + // If they're calling persistAaiNode, then we want to make the Db look like whatever they pass us. That is, if + // there is already a record in the DB, but they do not pass some of the existing properties, they should + // be cleared from the DB. Since we want to take care of all properties, we pass patchOnly = false + TitanVertex tv = persistAaiNodeBASE(transId, fromAppId, graph, nodeType, propHash, depNodeVal, patchOnly, apiVersion, objectExists, thisNodeVertex); + return( tv ); + } + + /** + * Persist aai node BASE. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param depNodeVal the dep node val + * @param patchOnly the patch only + * @param apiVersion the api version + * @param objectExists the object exists + * @return the titan vertex + * @throws AAIException the AAI exception + */ + public static TitanVertex persistAaiNodeBASE(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, TitanVertex depNodeVal, Boolean patchOnly, + String apiVersion, boolean[] objectExists) throws AAIException{ + return persistAaiNodeBASE(transId, fromAppId, graph, nodeType, propHash, depNodeVal, patchOnly, apiVersion, objectExists, null); + } + + /** + * Persist aai node BASE. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propHash the prop hash + * @param depNodeVal the dep node val + * @param patchOnly the patch only + * @param apiVersion the api version + * @param objectExists the object exists + * @param thisNodeVertex the this node vertex + * @return the titan vertex + * @throws AAIException the AAI exception + */ + public static TitanVertex persistAaiNodeBASE(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap <String,Object> propHash, TitanVertex depNodeVal, Boolean patchOnly, + String apiVersion, boolean[] objectExists, TitanVertex thisNodeVertex) throws AAIException{ + + if( graph == null ){ + throw new AAIException("AAI_6101", "null graph object passed to persistAaiNodeBASE()"); + } + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + boolean useDepNode = false; + String resourceVersion = null; + if( propHash.containsKey("resource-version") ){ + resourceVersion = (String)(propHash.get("resource-version")); + } + String aaiUniqueKeyVal = null; + if( propHash.containsKey("aai-unique-key") ){ + // Note -- we are assuming that nobody is monkeying with this. The 16-07 first-pass theory + // is that the REST layer is always gonna generate this or pass it through. + aaiUniqueKeyVal = (String)(propHash.get("aai-unique-key")); + propHash.remove("aai-unique-key"); + } + + if( needsADepNode4Uniqueness(transId, fromAppId, nodeType, apiVersion) ){ + // This kind of node needs a dependent node (for uniqueness) + if( depNodeVal == null ){ + // They should have passed in the node that this one depends on + throw new AAIException("AAI_6109", "null dependentNode object passed to persistAaiNodeBASE() but " + nodeType + " requires one."); + } + else if( ! nodeTypeACanDependOnB(transId, fromAppId, nodeType, depNodeVal.<String>property("aai-node-type").orElse(null), apiVersion) ){ + // They should have passed in the right type of node as the dependent node + throw new AAIException("AAI_6109", "dependentNode of type " + depNodeVal.<String>property("aai-node-type").orElse(null) + " passed to persistAaiNodeBASE() for nodeType" + nodeType + "."); + } + useDepNode = true; + } + else { + depNodeVal = null; + } + + // Note: as of 1607, we no longer validate property names since that's covered by the REST layer. + // Same goes for required fields (as of 1602) + + // Special ip-address validation for ipAddr nodes only... This will go away when we go to YANG and + // do validations like this up at that layer. + if( nodeType.equals("ipaddress") ){ + // Note - this will throw an exception if the ipAddress is using a bad format + ipAddressFormatOK( transId, fromAppId, (String)propHash.get("addr"), (String)propHash.get("version") ); + } + + // Use the key-fields/dependentNode to check if this is an add or an update + // We assume that all NodeTypes at least one key-property defined. A dependentNode is optional. + if( ! dbMaps.NodeKeyProps.containsKey(nodeType) ){ + // Problem if no key Properties defined for this nodeType + String defVer = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + throw new AAIException("AAI_6105", "No node-key-properties defined in dbMaps for nodeType = " + nodeType + " (ver=" + defVer + ")"); + } + + Boolean hasAltKey1 = false; + HashMap <String,Object>nodeAltKey1PropsHash = new HashMap<String,Object>(); + Collection <String> altKey1Props = getNodeAltKey1PropNames(transId, fromAppId, nodeType, apiVersion); + if( altKey1Props != null ){ + Iterator <String> altKey1PropI = altKey1Props.iterator(); + while( altKey1PropI.hasNext() ){ + String propName = altKey1PropI.next(); + // NOTE: alt-keys are not always required fields. If it is null or blank, we won't + // do alt-key checks on it. + Object value = propHash.get(propName); + if( value != null && !value.toString().equals("") ){ + hasAltKey1 = true; + nodeAltKey1PropsHash.put(propName, value); + } + } + } + HashMap <String,Object>nodeKeyPropsHash = new HashMap<String,Object>(); + Collection <String> keyProps = getNodeKeyPropNames(transId, fromAppId, nodeType, apiVersion); + Iterator <String> keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + String propName = keyPropI.next(); + + Object value = propHash.get(propName); + nodeKeyPropsHash.put(propName, value); + } + + // Check if this node is already in the database based on the Primary Key Info + TitanVertex existingVert = thisNodeVertex; + boolean foundTheNodeInDb = true; + + if (existingVert == null) { + try { + existingVert = getUniqueNode( transId, fromAppId, graph, nodeType, nodeKeyPropsHash, depNodeVal, apiVersion ); + } + catch (AAIException e) { + if (e.getErrorObject().getErrorCode().equals("6114")) { + foundTheNodeInDb = false; + } + else { + throw e; + } + } + } + + // this is so the notification knows whether or not the operation was an UPDATE or a CREATe + objectExists[0] = foundTheNodeInDb; + if( foundTheNodeInDb ){ + // A record was found in the DB using the PK. + if( needToDoResourceVerCheck(apiVersion, patchOnly) ){ + // Need to check that they knew what they were updating + String existingResVer = existingVert.<String>property("resource-version").orElse(null); + if( resourceVersion == null || resourceVersion.equals("") ){ + throw new AAIException("AAI_6130", "Resource-version not passed for update of = " + nodeType + ", " + nodeKeyPropsHash.toString()); + } + else if( (existingResVer != null) && !resourceVersion.equals(existingResVer) ){ + throw new AAIException("AAI_6131", "Resource-version " + resourceVersion + " MISMATCH WITH EXISTING " + existingResVer + " for update of = " + nodeType + ", " + nodeKeyPropsHash.toString()); + } + } + + // Need to ensure that the Alternate key isn't changing to a value that points to a different existing node. + // It is ok if it points to nothing -- that would just be an update for this node. It's also ok if + // it points to this (existing) node - that just means that it wasn't being updated. + if( hasAltKey1 ){ + try { + TitanVertex chkVert = getUniqueNode( transId, fromAppId, graph, nodeType, nodeAltKey1PropsHash, depNodeVal, apiVersion ); + if( ! chkVert.id().toString().equals(existingVert.id().toString()) ){ + throw new AAIException("AAI_6117", "In-Use AlternateKey value passed for update of nodeType = " + nodeType); + } + } + catch (AAIException e) { + if(! e.getErrorObject().getErrorCode().equals("6114") ){ + throw e; + } + } + } + } + else { + // Note not in the DB -- This will be an ADD of a new node + // a) make sure they didn't say they were just doing "patchOnly" which cannot be an ADD. + // b) if there is an alternate key, we need to make sure the AK isn't already in use by somebody else. + if( patchOnly ){ + String depMsg = ""; + if( useDepNode ){ + depMsg = " plus dependent node. "; + } + throw new AAIException("AAI_6114", "Patch Request, but no Node of type " + nodeType + " found for properties: [" + propHash + "] " + depMsg); + } + + if( needToDoResourceVerCheck(apiVersion, patchOnly) && (resourceVersion != null) && !resourceVersion.equals("") ){ + throw new AAIException("AAI_6131", "Resource-version was passed in, but this is an ADD of a " + nodeType + ", with these params: " + nodeKeyPropsHash.toString()); + } + if( hasAltKey1 ){ + try { + getUniqueNode( transId, fromAppId, graph, nodeType, nodeAltKey1PropsHash, depNodeVal, apiVersion ); + // Since the Primary Key for this nodeType wasn't found in the DB yet, the fact that + // we are able to find a record (no "6114" exception thrown) using the Alternate-Key is an error. + // We can't create a new node that uses an AK that's already in use. + throw new AAIException("AAI_6117", "Conflicting Key and Alternate-Key values passed for add of nodeType = " + nodeType); + } + catch (AAIException e) { + if(! e.getErrorObject().getErrorCode().equals("6114") ){ + throw e; + } + } + } + } + + // ------------- Done with checking. Do the add or update to the dB ----------------------- + + if( foundTheNodeInDb ){ + long unixTimeNow = System.currentTimeMillis() / 1000L; + // ----- This is an UPDATE ------ + + + String existingSourceOfTruth = fromAppId; // default value if we can't get the old one + Object tmpOb = existingVert.<Object>property("source-of-truth").orElse(null); + if( tmpOb != null ){ + existingSourceOfTruth = tmpOb.toString(); + } + long existingCreateTs = unixTimeNow; // default value if we can't get the old one + tmpOb = existingVert.<Object>property("aai-created-ts").orElse(null); + if( tmpOb != null ){ + existingCreateTs = (long) tmpOb; + } + + String msg = "UPDATE vertex of type = [" + nodeType + "] "; + if( useDepNode ){ + String depNType = depNodeVal.<String>property("aai-node-type").orElse(null); + HashMap <String, Object> depNodePropKeysHash = getNodeKeyPropHash(transId, fromAppId, graph, depNodeVal); + LOGGER.info("UPDATE existing node: type = " + nodeType + ", key(s) = [" + nodeKeyPropsHash + + "] which rides on dependent node: type = " + depNType + ", with key(s) = [" + depNodePropKeysHash + "]."); + } + else { + LOGGER.info("UPDATE existing node: type = " + nodeType + ", key(s) = [" + nodeKeyPropsHash + "] (no dep. node)."); + } + String removeList = ""; + if( ! patchOnly ){ + // They are updating an existing record, and they want us to "process all defined properties" (not just patch) + // So we will see if the node has any properties that were not passed-in. Those need to be removed. + Collection <String> propCol = dbMaps.NodeProps.get(nodeType); + Iterator <String> propIter = propCol.iterator(); + while( propIter.hasNext() ){ + String propName = propIter.next(); + if( ! propHash.containsKey(propName) && !DbEdgeRules.ReservedPropNames.containsKey(propName)){ + if( thisPropertyWasPutByNewerVersionOfCode(apiVersion, nodeType, propName) ){ + // we must be using an older version of code here - but the property that + // has not been passed in this persist call is one that this older version of + // the database did not know about. So leave it alone. + } + else { + removeList = removeList + "," + propName; + existingVert.property(propName).remove(); + } + } + } + } + if( !removeList.equals("") ){ + LOGGER.info("Removed these props on update: [" + removeList + "]"); + } + for( Map.Entry<String, Object> entry : propHash.entrySet() ){ + // update the parameters that have been passed in (except the key-properties) + // taking away the key-property check. We will now allow this since + // the keys were used to identify this node, so they should be good and + // there are times when Titan resolves conflicts by only using the + // data set in an update - and was losing our key info... + // Similar to the change noted below. + //if( ! nodeKeyPropsHash.containsKey(entry.getKey()) ){ + // existingVert.setProperty( entry.getKey(), entry.getValue() ); + //} + if( ! entry.getKey().equals("resource-version") ){ + boolean nonSingleCardinality = false; + boolean setSoNoDupes = false; + if( checkPropCardinality(entry.getKey(), "Set") ){ + nonSingleCardinality = true; + setSoNoDupes = true; + } + else if( checkPropCardinality(entry.getKey(), "List") ){ + nonSingleCardinality = true; + } + + Iterator <Object> valIter = null; + if( nonSingleCardinality ){ + String className = entry.getValue().getClass().getSimpleName(); + if( className.equals("ArrayList") ){ + valIter = ((ArrayList)(entry.getValue())).iterator(); + } + else if( className.equals("List") ){ + valIter = ((List)(entry.getValue())).iterator(); + } + else if( className.equals("Set") ){ + valIter = ((Set)(entry.getValue())).iterator(); + } + } + + if( nonSingleCardinality ){ + // This property has Cardinality of List or Set - which need to be handled carefully + // Note -- for Lists or Sets, we assume they are of dataType String - that is all + // the Rest layer supports at the moment (16-02) + ArrayList <String> currentData = new ArrayList <String> (); + if( patchOnly ){ + // When patching - gotta know what's already in the db + Iterator<VertexProperty<Object>> existingPropsIter = (existingVert.properties(entry.getKey())); + if( existingPropsIter != null ){ + while( existingPropsIter.hasNext() ){ + String existingVal = existingPropsIter.next().value().toString(); + currentData.add( existingVal ); + } + } + } + else { + // Since this is not a patch-update, we first have to clear out what is currently in the db. + existingVert.property(entry.getKey()).remove(); + } + + if( valIter != null ){ + while( valIter.hasNext() ){ + Object thisVal = valIter.next(); + if( setSoNoDupes ){ + // For Sets, we need to check that the data isn't already in the db or wasn't passed + // in to us twice in the propHash. Otherwise Titan throws an exception (instead of just ignoring it...) + if( !currentData.contains(thisVal) ){ + // We don't have this data yet, so add it to the Set + existingVert.property( entry.getKey(), thisVal ); + currentData.add( thisVal.toString() ); + } + } + else { + // For List data types, it's ok to have duplicate values in the db (why would we want this?) + existingVert.property( entry.getKey(), thisVal ); + } + } + } + } + else { + // This is a normal, "Cardinality = SINGLE" kind of property + // ResourceVersion is not populated based on passed-in data, it is set along with other internal properties below. + //Object cleanVal = convertTypeIfNeeded( entry.getKey(), entry.getValue() ); + //existingVert.setProperty( entry.getKey(), cleanVal ); + // ******************************** + existingVert.property( entry.getKey(), entry.getValue() ); + } + } + } + + // DEBUG - trying to deal with the case where simultaneous PUTs + // cause our db to wind up with a vertex that does not have these three properties filled in. + existingVert.property( "aai-node-type", nodeType ); + existingVert.property( "aai-created-ts", existingCreateTs ); + existingVert.property( "source-of-truth", existingSourceOfTruth ); + + if( aaiUniqueKeyVal != null ){ + existingVert.property( "aai-unique-key", aaiUniqueKeyVal ); + } + + existingVert.property( "aai-last-mod-ts", unixTimeNow ); + String resVers = "" + unixTimeNow; + existingVert.property( "resource-version", resVers ); + existingVert.property( "last-mod-source-of-truth", fromAppId ); + + LOGGER.info(msg + ", [aai-last-mod-ts]/[" + unixTimeNow + "]"); + + return( existingVert ); + } + else{ + // ----- Not found in the DB, This must be an ADD ------ + if( DbEdgeRules.NodeTypeCategory.containsKey(nodeType) ){ + throw new AAIException("AAI_6120", "nodeTypeCategory " + nodeType + " cannot be used to ADD a node. Need to pass a valid nodeType"); + } + + TitanVertex tiVnew = graph.addVertex( nodeType ); + + String msg = "ADD vertex of type = [" + nodeType + "] "; + if( depNodeVal != null ){ + String depNType = depNodeVal.<String>property("aai-node-type").orElse(null); + HashMap <String, Object> depNodePropKeysHash = getNodeKeyPropHash(transId, fromAppId, graph, depNodeVal); + msg = msg + " onto dependent node: type = " + depNType + ", which has key(s) = [" + depNodePropKeysHash + + "]. New Node Prop/values = "; + } + else { + msg = msg + " Note: no dependent node. New Node Prop/values = "; + } + boolean first = true; + for( Map.Entry<String, Object> entry : propHash.entrySet() ){ + if( ! entry.getKey().equals("resource-version") ){ + if( first ){ + msg = msg + " [" + entry.getKey() + "]/[" + entry.getValue() + "]"; + first = false; + } + else { + msg = msg + ", [" + entry.getKey() + "]/[" + entry.getValue() + "]"; + } + + boolean nonSingleCardinality = false; + boolean setSoNoDupes = false; + if( checkPropCardinality(entry.getKey(), "Set") ){ + nonSingleCardinality = true; + setSoNoDupes = true; + } + else if( checkPropCardinality(entry.getKey(), "List") ){ + nonSingleCardinality = true; + } + + Iterator <Object> valIter = null; + if( nonSingleCardinality ){ + String className = entry.getValue().getClass().getSimpleName(); + if( className.equals("ArrayList") ){ + valIter = ((ArrayList)(entry.getValue())).iterator(); + } + else if( className.equals("List") ){ + valIter = ((List)(entry.getValue())).iterator(); + } + else if( className.equals("Set") ){ + valIter = ((Set)(entry.getValue())).iterator(); + } + } + + if( nonSingleCardinality ){ + // This property has Cardinality of List or Set - which need to be handled carefully + ArrayList <String> currentData = new ArrayList <String> (); + if( valIter != null ){ + while( valIter.hasNext() ){ + Object thisVal = valIter.next(); + if( setSoNoDupes ){ + // For Sets, we need to check that they're not passing us duplicate data in propHash. + // Otherwise Titan throws an exception (instead of just ignoring it...) + if( !currentData.contains(thisVal) ){ + // We don't have this data yet, so add it to the Set + tiVnew.property( entry.getKey(), thisVal ); + currentData.add( thisVal.toString() ); + } + } + else { + // For List data types, it's ok to have duplicate values in the db (why would we want this?) + tiVnew.property( entry.getKey(), thisVal ); + } + } + } + } + else { + // This is a normal, "Cardinality = SINGLE" kind of property + // ResourceVersion is not populated based on passed-in data, it is set along with other internal properties below. + tiVnew.property( entry.getKey(), entry.getValue() ); + } + } + } + + tiVnew.property( "aai-node-type", nodeType ); + //long unixTime = System.currentTimeMillis() / 1000L; + long unixTime = System.currentTimeMillis(); + tiVnew.property( "aai-created-ts", unixTime ); + tiVnew.property( "aai-last-mod-ts", unixTime ); + String resVers = "" + unixTime; + tiVnew.property( "resource-version", resVers ); + tiVnew.property( "source-of-truth", fromAppId ); + tiVnew.property( "last-mod-source-of-truth", fromAppId ); + if( aaiUniqueKeyVal != null ){ + tiVnew.property( "aai-unique-key", aaiUniqueKeyVal ); + } + + LOGGER.info(msg + ", [aai-created-ts]/[" + unixTime + "]"); + return( tiVnew ); + } + + } // end of persistAaiNodeBASE() + + + /** + * Need to do resource ver check. + * + * @param apiVersion the api version + * @param patchOnlyFlag the patch only flag + * @return the boolean + * @throws AAIException the AAI exception + */ + public static Boolean needToDoResourceVerCheck(String apiVersion, Boolean patchOnlyFlag) + throws AAIException{ + + if( patchOnlyFlag ){ + // we do not do resource checking for patch requests. + return false; + } + + String resourceCheckOnFlag = AAIConfig.get(AAIConstants.AAI_RESVERSION_ENABLEFLAG); + + int apiVerInt = cleanUpApiVersion(apiVersion); + + if( (resourceCheckOnFlag != null) && resourceCheckOnFlag.equals("true") ){ + // Only do the check if the resource enable flag is set to "true" + if( apiVerInt > 4 ){ + // We're only doing the resource version checks for v5 and later + return true; + } + } + + return false; + }// End needToDoResourceVerCheck() + + + /** + * Clean up api version. + * + * @param apiVersionString the api version string + * @return the int + * @throws AAIException the AAI exception + */ + private static int cleanUpApiVersion( String apiVersionString ) throws AAIException { + // Note: we expect an apiVersion to start with the letter "v", followed by an integer. + + int versionInt = 0; + String verStr = apiVersionString; + if( (apiVersionString == null) || (apiVersionString.length() < 2) ){ + // Passed in version doesn't look right + verStr = org.openecomp.aai.util.AAIApiVersion.get(); + } + versionInt = getVerNumFromVerString( verStr ); + + return versionInt; + } + + /** + * Gets the ver num from ver string. + * + * @param versionString the version string + * @return the ver num from ver string + * @throws AAIException the AAI exception + */ + private static int getVerNumFromVerString( String versionString )throws AAIException { + int versionInt = 0; + if( versionString == null || versionString.length() < 2 ){ + throw new AAIException("AAI_6121", " Bad Version (format) passed to getVerNumFromVerString: [" + versionString + "]."); + } + + int strLen = versionString.length(); + // We assume that a version looks like "v" followed by an integer + if( ! versionString.substring(0,1).equals("v") ){ + String detail = " Bad Version (format) passed to getVerNumFromVerString: [" + versionString + "]."; + throw new AAIException("AAI_6121", detail); + } + else { + String intPart = versionString.substring(1,strLen); + try { + versionInt = Integer.parseInt( intPart ); + } + catch( Exception e ){ + String detail = " Bad Version passed to getVerNumFromVerString: [" + versionString + "]."; + throw new AAIException("AAI_6121", detail); + } + } + return versionInt; + } + + + /** + * Gets the node key prop names. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param apiVersion the api version + * @return HashMap of keyProperties + * @throws AAIException the AAI exception + */ + public static Collection <String> getNodeKeyPropNames( String transId, String fromAppId, String nodeType, String apiVersion ) throws AAIException{ + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + Collection <String> keyProps = new ArrayList <String>(); + if( dbMaps.NodeKeyProps.containsKey(nodeType) ){ + keyProps = dbMaps.NodeKeyProps.get(nodeType); + } + else if( DbEdgeRules.NodeTypeCategory.containsKey(nodeType) ){ + // The passed-in nodeType was really a nodeCategory, so we need to look up the key params + Collection <String> nTypeCatCol = DbEdgeRules.NodeTypeCategory.get(nodeType); + Iterator <String> catItr = nTypeCatCol.iterator(); + String catInfo = ""; + if( catItr.hasNext() ){ + // For now, we only look for one. + catInfo = catItr.next(); + } + else { + String defVer = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + throw new AAIException("AAI_6105", "Required Property name(s) not found for nodeType = " + nodeType+ " (ver=" + defVer + ")"); + } + + String [] flds = catInfo.split(","); + if( flds.length != 4 ){ + throw new AAIException("AAI_6121", "Bad EdgeRule.NodeTypeCategory data for nodeType = [" + nodeType + "]."); + } + + String keyPropsString = flds[0]; + String [] propNames = keyPropsString.split("\\|"); + for( int i = 0; i < propNames.length; i++ ){ + keyProps.add(propNames[i]); + } + } + else { + String defVer = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + throw new AAIException("AAI_6105", "Required Property name(s) not found for nodeType = " + nodeType+ " (ver=" + defVer + ")"); + } + + return keyProps; + + }// end of getNodeKeyPropNames + + /** + * Gets the node key prop names. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @return the node key prop names + * @throws AAIException the AAI exception + */ + @Deprecated + public static Collection <String> getNodeKeyPropNames( String transId, String fromAppId, String nodeType ) throws AAIException{ + return getNodeKeyPropNames( transId, fromAppId, nodeType, null); + } + + /** + * Gets the node alt key 1 prop names. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param apiVersion the api version + * @return HashMap of keyProperties + * @throws AAIException the AAI exception + */ + public static Collection <String> getNodeAltKey1PropNames( String transId, String fromAppId, String nodeType, String apiVersion ) throws AAIException{ + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + Collection <String> altKey1Props = new ArrayList <String>(); + if( dbMaps.NodeAltKey1Props.containsKey(nodeType) ){ + altKey1Props = dbMaps.NodeAltKey1Props.get(nodeType); + } + else if( DbEdgeRules.NodeTypeCategory.containsKey(nodeType) ){ + // The passed-in nodeType was really a nodeCategory, so we need to look up the key params + Collection <String> nTypeCatCol = DbEdgeRules.NodeTypeCategory.get(nodeType); + Iterator <String> catItr = nTypeCatCol.iterator(); + String catInfo = ""; + if( catItr.hasNext() ){ + catInfo = catItr.next(); + String [] flds = catInfo.split(","); + if( flds.length != 4 ){ + throw new AAIException("AAI_6121", "Bad EdgeRule.NodeTypeCategory data (itemCount=" + flds.length + ") for nodeType = [" + nodeType + "]."); + } + + String altKeyPropsString = flds[1]; + String [] propNames = altKeyPropsString.split("\\|"); + for( int i = 0; i < propNames.length; i++ ){ + altKey1Props.add(propNames[i]); + } + } + } + + return altKey1Props; + + }// end of getNodeAltKey1PropNames + + /** + * Gets the node alt key 1 prop names. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @return the node alt key 1 prop names + * @throws AAIException the AAI exception + */ + @Deprecated + public static Collection <String> getNodeAltKey1PropNames( String transId, String fromAppId, String nodeType ) throws AAIException{ + return getNodeAltKey1PropNames( transId, fromAppId, nodeType, null); + } + + + /** + * Gets the unique node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param keyPropsHash the key props hash + * @param depNodeVal the dep node val + * @param apiVersion the api version + * @return TitanVertex + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex getUniqueNode( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> keyPropsHash, TitanVertex depNodeVal, String apiVersion ) throws AAIException{ + + // NOTE - this is really for use by the PersistNode method -- it is looking to see if + // a node exists in the database given either Primary or Alternate Key data and dependent + // node data (if required for uniqueness). + + // Note - the passed in nodeType could really be a nodeTypeCategory --- + Boolean nodeTypeIsCategory = DbEdgeRules.NodeTypeCategory.containsKey(nodeType); + + Boolean useDepNode = false; + if( needsADepNode4Uniqueness(transId, fromAppId, nodeType, apiVersion) ){ + // This kind of node depends on another node for uniqueness + if( depNodeVal == null ){ + // They should have passed in the node that this one depends on + throw new AAIException("AAI_6109", "null dependentNode object passed to getUniqueNode() but " + nodeType + " requires one."); + } + else if( ! nodeTypeACanDependOnB(transId, fromAppId, nodeType, depNodeVal.<String>property("aai-node-type").orElse(null), apiVersion) ){ + // They should have passed in the right type of node as the dependent node + throw new AAIException("AAI_6109", "dependentNode of type " + depNodeVal.<String>property("aai-node-type").orElse(null) + " passed to getUniqueNode() for nodeType" + nodeType + ".\n"); + } + useDepNode = true; + } + else { + depNodeVal = null; + } + + // We assume that all NodeTypes have at least one key-property defined. A dependentNode is optional. + // Note - instead of key-properties (the primary key properties), a user could pass + // alternate-key values if they are defined for the nodeType. + ArrayList<String> kName = new ArrayList<String>(); + ArrayList<Object> kVal = new ArrayList<Object>(); + + Collection <String> keyProps = getNodeKeyPropNames(transId, fromAppId, nodeType, apiVersion); + Iterator <String> keyPropI = keyProps.iterator(); + Boolean haveSomePrimKeyProps = false; + Boolean primaryKeyComplete = true; + while( keyPropI.hasNext() ){ + haveSomePrimKeyProps = true; + + String propName = keyPropI.next(); + if( ! keyPropsHash.containsKey(propName) ){ + primaryKeyComplete = false; + } + else { + Object valObj = keyPropsHash.get(propName); + if( valObj == null ){ + primaryKeyComplete = false; + } + else { + String value = valObj.toString(); + if( value == null || value.equals("") ){ + // They passed the property name, but no value + primaryKeyComplete = false; + } + } + } + } + + int i = -1; + if( haveSomePrimKeyProps && primaryKeyComplete ){ + keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + String propName = keyPropI.next(); + String value = (keyPropsHash.get(propName)).toString(); + i++; + kName.add(i, propName); + kVal.add(i, (Object)value); + } + } + else { + // See if they're using the alternate key + Collection <String> altKey1Props = getNodeAltKey1PropNames(transId, fromAppId, nodeType, apiVersion); + Iterator <String> altKey1PropI = altKey1Props.iterator(); + Boolean haveSomeAltKey1Props = false; + Boolean altKey1Complete = true; + while( altKey1PropI.hasNext() ){ + haveSomeAltKey1Props = true; + String propName = altKey1PropI.next(); + if( ! keyPropsHash.containsKey(propName) ){ + altKey1Complete = false; + } + else { + Object valObj = keyPropsHash.get(propName); + if( valObj == null ){ + altKey1Complete = false; + } + else { + String value = valObj.toString(); + if( value == null || value.equals("") ){ + // They passed the property name, but no value + altKey1Complete = false; + } + } + } + } + if( haveSomeAltKey1Props && altKey1Complete ){ + altKey1PropI = altKey1Props.iterator(); + while( altKey1PropI.hasNext() ){ + String propName = altKey1PropI.next(); + String value = (keyPropsHash.get(propName)).toString(); + i++; + kName.add(i, propName); + kVal.add(i, (Object)value); + } + } + } + + int topPropIndex = i; + TitanVertex tiV = null; + String propsAndValuesForMsg = ""; + if( !useDepNode ){ + // There is no node that this type of node depends on, so we can look for it based + // solely on the Aai-defined key fields. + Iterable <?> verts = null; + + if( topPropIndex == -1 ){ + // Problem if no key Properties defined for this nodeType + String defVer = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + throw new AAIException("AAI_6105", "Bad or Incomplete Key Property params: (" + keyPropsHash.toString() + + ") for nodeType: " + nodeType + " (ver=" + defVer + ")"); + } + else if( topPropIndex == 0 ){ + if (nodeTypeIsCategory) // dont know real type + verts= graph.query().has(kName.get(0),kVal.get(0)).vertices(); + else // need this to find dvs switch: dvs.switch-name and port-group.switch-name issue + verts= graph.query().has(kName.get(0),kVal.get(0)).has("aai-node-type",nodeType).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ") "; + } + else if( topPropIndex == 1 ){ + verts = graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ") "; + } + else if( topPropIndex == 2 ){ + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ", " + + kName.get(2) + " = " + kVal.get(2) + ") "; + } + else if( topPropIndex == 3 ){ + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has(kName.get(3),kVal.get(3)).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ", " + + kName.get(2) + " = " + kVal.get(2) + ", " + + kName.get(3) + " = " + kVal.get(3) + ") "; + } + else { + String emsg = " We only support 4 keys per nodeType for now \n"; + throw new AAIException("AAI_6114", emsg); + } + + Iterator <?> vertI = verts.iterator(); + if( vertI != null && vertI.hasNext()) { + // We found a vertex that meets the input criteria. + tiV = (TitanVertex) vertI.next(); + + if( vertI.hasNext() ){ + // Since this routine is looking for a unique node for the given input values, if + // more than one is found - it's a problem. + throw new AAIException("AAI_6112", "More than one Node found by getUniqueNode for params: " + propsAndValuesForMsg); + } + } + else { + // No Vertex was found for this key - throw a not-found exception + throw new AAIException("AAI_6114", "No Node of type " + nodeType + " found for properties: " + propsAndValuesForMsg); + } + } + else { + // Need to use the dependent vertex to look for this one. + // filter this to the actual keys because + HashMap<String,Object> onlyKeysHash = new HashMap<String,Object>(); + + Collection <String> onlyKeyProps = getNodeKeyPropNames(transId, fromAppId, nodeType, apiVersion); + + Iterator <String> onlyKeyPropsI = onlyKeyProps.iterator(); + + while( onlyKeyPropsI.hasNext() ){ + String keyName = onlyKeyPropsI.next(); + onlyKeysHash.put(keyName, keyPropsHash.get(keyName)); + } + + propsAndValuesForMsg = onlyKeysHash.toString() + " combined with a Dependent [" + depNodeVal.<String>property("aai-node-type").orElse(null) + "] node."; + ArrayList<TitanVertex> resultList = DbMeth.getConnectedNodes(transId, fromAppId, graph, nodeType, onlyKeysHash, + depNodeVal, apiVersion, false); + if( resultList.size() > 1 ){ + // More than one vertex found when we thought there should only be one. + throw new AAIException("AAI_6112", "More than one Node found by getUniqueNode for params: " + propsAndValuesForMsg); + } + else if( resultList.size() == 1 ){ + tiV = resultList.get(0); + } + } + + if( tiV == null ){ + // No Vertex was found for this key - throw a not-found exception + throw new AAIException("AAI_6114", "No Node of type " + nodeType + " found for properties: " + propsAndValuesForMsg); + } + else { + if( !DbEdgeRules.NodeTypeCategory.containsKey(nodeType) ){ + // The nodeType passed in was a real one, not a nodeTypeCategory, so we will + // use it as part of the query to make sure we find the right type of node. + // This can be an issue if they're using nodeTypes covered by a nodeTypeCategory but + // pass in the wrong nodeType. We don't want them to ask for one thing and get the other. + String foundNodeType = tiV.<String>property("aai-node-type").orElse(null); + if( foundNodeType != null && !foundNodeType.equals(nodeType) ){ + throw new AAIException("AAI_6114", "No Node of type " + nodeType + " found for properties: " + propsAndValuesForMsg + " (did find a " + foundNodeType + " though.)"); + } + } + + return tiV; + } + + }// End of getUniqueNode() + + /** + * Gets the unique node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param keyPropsHash the key props hash + * @param depNodeVal the dep node val + * @return the unique node + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex getUniqueNode( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> keyPropsHash, TitanVertex depNodeVal) throws AAIException { + return getUniqueNode( transId, fromAppId, graph, nodeType, + keyPropsHash, depNodeVal, null ); + } + // End getUniqueNode() + + + /** + * Gets the unique node with dep params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param nodePropsHash the node props hash + * @param apiVersion the api version + * @return TitanVertex + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex getUniqueNodeWithDepParams( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> nodePropsHash, String apiVersion ) + throws AAIException{ + /* + * This method uses the nodePropsHash to walk back over dependent nodes until it finds one that + * does not depend on any other for uniqueness. It uses the getUniqueNode() method as it finds + * dependent nodes. NOTE -- it is passed a hash of all the nodeProperties -- for itself and + * for any dependent nodes that it will need to find. There are some types of nodes that can + * depend on more than one node, we assume that there wouldn't be a case where BOTH types of + * dependent nodes are in the trail that we need to traverse. Ie. an ipaddress can depend on + * either a vserver or pserver. NOTE this case can now happen -- nodePropsHash + * should now be sent as a LinkedHashMap in this case so we can search in order. + */ + + // NOTE ALSO -- We're currently supporting 6 layers of dependency. We never thought there would be this + // many layers before hitting a node-type that would be uniquely identifiable on it's own. So the + // code is a little ugly with all these nested if-then-else's. Since we're supporting so many + // layers, it should be re-written so we can support "n" layers instead of having to go in hear + // and adding code... But as of 15-07, we really don't NEED more than 5. + + // NOTE: The passed in nodeType could really be a nodeTypeCategory -- + // The calls to figureDepNodeTypeForRequest() below will deal with it for the dep nodes, the + // call to getUniqueNode() takes care of it for the node itself. + + TitanVertex nullVert = null; + String depNodeType = figureDepNodeTypeForRequest( transId, fromAppId, nodeType, nodePropsHash, apiVersion ); + if( depNodeType.equals("")){ + // This kind of node does not depend on another node for uniqueness, so + // we can just use the "getUniqueNode()" method to get it. + HashMap <String,Object> thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, nodeType, nodePropsHash, apiVersion); + return( getUniqueNode(transId, fromAppId, graph, nodeType, thisNodeTypeParamHash, nullVert, apiVersion) ); + } + else { + // Will need to find the second-layer dependent node + String secondLayerDepNodeType = figureDepNodeTypeForRequest( transId, fromAppId, depNodeType, nodePropsHash, apiVersion ); + if( secondLayerDepNodeType.equals("")){ + // This second-layer kind of node does not depend on another node for uniqueness. + // So once we find the second-layer node, we can use it to get the top-layer guy. + HashMap <String,Object> thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, depNodeType, nodePropsHash, apiVersion); + TitanVertex secLayerDepVert = getUniqueNode(transId, fromAppId, graph, depNodeType, thisNodeTypeParamHash, nullVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, nodeType, nodePropsHash, apiVersion); + return( getUniqueNode(transId, fromAppId, graph, nodeType, thisNodeTypeParamHash, secLayerDepVert, apiVersion) ); + } + else { + // Will need to find the third-layer dependent node + /// String thirdLayerDepNodeType = dbMaps.NodeDependencies.get(secondLayerDepNodeType); + String thirdLayerDepNodeType = figureDepNodeTypeForRequest( transId, fromAppId, secondLayerDepNodeType, nodePropsHash, apiVersion ); + + if( thirdLayerDepNodeType.equals("")){ + // This third-layer kind of node does not depend on another node for uniqueness. + // So we can find it, and then use it to find the second-layer and then use that to find the top guy. + HashMap <String,Object> thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, secondLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex thirdLayerDepVert = getUniqueNode(transId, fromAppId, graph, secondLayerDepNodeType, thisNodeTypeParamHash, nullVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, depNodeType, nodePropsHash, apiVersion); + TitanVertex secLayerDepVert = getUniqueNode(transId, fromAppId, graph, depNodeType, thisNodeTypeParamHash, thirdLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, nodeType, nodePropsHash, apiVersion); + + return( getUniqueNode(transId, fromAppId, graph, nodeType, thisNodeTypeParamHash, secLayerDepVert, apiVersion) ); + } + else { + // Will need to find the third-layer dependent node + String forthLayerDepNodeType = figureDepNodeTypeForRequest( transId, fromAppId, thirdLayerDepNodeType, nodePropsHash, apiVersion ); + if( forthLayerDepNodeType == null || forthLayerDepNodeType.equals("")){ + // This forth-layer kind of node does not depend on another node for uniqueness. + // So we can find it, and then use it to find the third, then second-layer and then use that to find the top guy. + HashMap <String,Object> thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, thirdLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex forthLayerDepVert = getUniqueNode(transId, fromAppId, graph, thirdLayerDepNodeType, thisNodeTypeParamHash, nullVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, secondLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex thirdLayerDepVert = getUniqueNode(transId, fromAppId, graph, secondLayerDepNodeType, thisNodeTypeParamHash, forthLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, depNodeType, nodePropsHash, apiVersion); + TitanVertex secLayerDepVert = getUniqueNode(transId, fromAppId, graph, depNodeType, thisNodeTypeParamHash, thirdLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, nodeType, nodePropsHash, apiVersion); + return( getUniqueNode(transId, fromAppId, graph, nodeType, thisNodeTypeParamHash, secLayerDepVert, apiVersion) ); + } + else { + // Will need to find the forth-layer dependent node + String fifthLayerDepNodeType = figureDepNodeTypeForRequest( transId, fromAppId, forthLayerDepNodeType, nodePropsHash, apiVersion ); + if( fifthLayerDepNodeType == null || fifthLayerDepNodeType.equals("")){ + // This fifth-layer kind of node does not depend on another node for uniqueness. + // So we can find it, and then use it to find the forth, third, then second-layer and then use that to find the top guy. + HashMap <String,Object> thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, forthLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex fifthLayerDepVert = getUniqueNode(transId, fromAppId, graph, forthLayerDepNodeType, thisNodeTypeParamHash, nullVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, thirdLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex forthLayerDepVert = getUniqueNode(transId, fromAppId, graph, thirdLayerDepNodeType, thisNodeTypeParamHash, fifthLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, secondLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex thirdLayerDepVert = getUniqueNode(transId, fromAppId, graph, secondLayerDepNodeType, thisNodeTypeParamHash, forthLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, depNodeType, nodePropsHash, apiVersion); + TitanVertex secLayerDepVert = getUniqueNode(transId, fromAppId, graph, depNodeType, thisNodeTypeParamHash, thirdLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, nodeType, nodePropsHash, apiVersion); + return( getUniqueNode(transId, fromAppId, graph, nodeType, thisNodeTypeParamHash, secLayerDepVert, apiVersion) ); + } + else { + // Will need to find the fifth-layer dependent node + String sixthLayerDepNodeType = figureDepNodeTypeForRequest( transId, fromAppId, fifthLayerDepNodeType, nodePropsHash, apiVersion ); + if( sixthLayerDepNodeType == null || sixthLayerDepNodeType.equals("")){ + // This six-layer kind of node does not depend on another node for uniqueness. + // So we can find it, and then use it to find the fifth, forth, third, then second-layer and then use that to find the top guy. + HashMap <String,Object> thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, fifthLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex sixthLayerDepVert = getUniqueNode(transId, fromAppId, graph, fifthLayerDepNodeType, thisNodeTypeParamHash, nullVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, forthLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex fifthLayerDepVert = getUniqueNode(transId, fromAppId, graph, forthLayerDepNodeType, thisNodeTypeParamHash, sixthLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, thirdLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex forthLayerDepVert = getUniqueNode(transId, fromAppId, graph, thirdLayerDepNodeType, thisNodeTypeParamHash, fifthLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, secondLayerDepNodeType, nodePropsHash, apiVersion); + TitanVertex thirdLayerDepVert = getUniqueNode(transId, fromAppId, graph, secondLayerDepNodeType, thisNodeTypeParamHash, forthLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, depNodeType, nodePropsHash, apiVersion); + TitanVertex secLayerDepVert = getUniqueNode(transId, fromAppId, graph, depNodeType, thisNodeTypeParamHash, thirdLayerDepVert, apiVersion); + + thisNodeTypeParamHash = getThisNodeTypeParams(transId, fromAppId, nodeType, nodePropsHash, apiVersion); + return( getUniqueNode(transId, fromAppId, graph, nodeType, thisNodeTypeParamHash, secLayerDepVert, apiVersion) ); + } + else { + // We don't currently support more layers. We can later if we need to. + // Hopefully, we'll never need to go this deep -- there should be unique keys in there somewhere! + throw new AAIException("AAI_6114", "CODE-LIMITATION - Can't resolve dependant node layers for nodeType = " + nodeType); + } + } + } + } + } + } + } // End getUniqueNodeWithDepParams() + + /** + * Gets the unique node with dep params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param nodePropsHash the node props hash + * @return the unique node with dep params + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanVertex getUniqueNodeWithDepParams( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> nodePropsHash ) throws AAIException { + return getUniqueNodeWithDepParams(transId, fromAppId, graph, nodeType, nodePropsHash, null); + } + + + /** + * Gets the this node type params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param targetNodeType the target node type + * @param passedHash the passed hash + * @param apiVersion the api version + * @return the this node type params + * @throws AAIException the AAI exception + */ + private static HashMap <String, Object> getThisNodeTypeParams(String transId, String fromAppId, String targetNodeType, + HashMap<String,Object> passedHash, String apiVersion )throws AAIException{ + /* + * For the passed-in hash, each key is assumed to look like, "nodeType.paramName". We want to + * pick out the entries that match the targetNodeType and return those with the values they go with. The + * returned keys will have the "nodeType." stripped off. + * + * NOTE - the nodeType passed to this method could actually be a nodeTypeCategory. Just keepin it ugly. + */ + + if( passedHash == null ){ + throw new AAIException("AAI_6120", "Bad param: null passedHash "); + } + + String targetNodeTypeCat = ""; + if( DbEdgeRules.NodeTypeCatMap.containsKey(targetNodeType) ){ + targetNodeTypeCat = DbEdgeRules.NodeTypeCatMap.get(targetNodeType); + } + + HashMap <String,Object> returnHash = new HashMap <String,Object> (); + Iterator <Map.Entry<String,Object>>it = passedHash.entrySet().iterator(); + while( it.hasNext() ){ + Map.Entry <String,Object>pairs = (Map.Entry<String,Object>)it.next(); + String k = (pairs.getKey()).toString(); + int periodLoc = k.indexOf("."); + if( periodLoc <= 0 ){ + throw new AAIException("AAI_6120", "Bad filter param key passed in: [" + k + "]. Expected format = [nodeName.paramName]\n"); + } + else { + String nty = k.substring(0,periodLoc); + String paramName = k.substring(periodLoc + 1); + if( nty.equals(targetNodeType) || (!targetNodeTypeCat.equals("") && nty.equals(targetNodeTypeCat)) ){ + String newK = paramName; + returnHash.put( newK,pairs.getValue() ); + } + } + } + + //aaiLogger.debug(logline, " - end "); + return returnHash; + + }// End of getThisNodeTypeParams() + + /** + * Gets the this node type params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param targetNodeType the target node type + * @param passedHash the passed hash + * @return the this node type params + * @throws AAIException the AAI exception + */ + @Deprecated + private static HashMap <String, Object> getThisNodeTypeParams(String transId, String fromAppId, String targetNodeType, + HashMap<String,Object> passedHash )throws AAIException{ + return getThisNodeTypeParams( transId, fromAppId, targetNodeType, + passedHash, null); + + } + + /** + * Gets the dep node types. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param apiVersion the api version + * @return the dep node types + * @throws AAIException the AAI exception + */ + public static ArrayList <String> getDepNodeTypes(String transId, String fromAppId, String nodeType, String apiVersion)throws AAIException{ + /* + * This returns any nodeTypes that this nodeType can be dependent on. A particular instance of a node will only + * depend on one other node - we don't currently support dependence on multiple nodes. + */ + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + ArrayList <String> depNodeTypeL = new ArrayList <String> (); + if( !DbEdgeRules.NodeTypeCategory.containsKey(nodeType) ){ + // This is a good-ole nodeType + Collection <String> depNTColl = dbMaps.NodeDependencies.get(nodeType); + Iterator <String> ntItr = depNTColl.iterator(); + while( ntItr.hasNext() ){ + depNodeTypeL.add(ntItr.next()); + } + } + else { + // The passed-in nodeType must really be a nodeTypeCategory + Collection <String> nTypeCatCol = DbEdgeRules.NodeTypeCategory.get(nodeType); + Iterator <String> catItr = nTypeCatCol.iterator(); + String catInfo = ""; + if( catItr.hasNext() ){ + // For now, we only look for one. + catInfo = catItr.next(); + } + else { + throw new AAIException("AAI_6121", "Error getting DbEdgeRules.NodeTypeCategory info for nodeTypeCat = " + nodeType); + } + + String [] flds = catInfo.split(","); + if( flds.length != 4 ){ + throw new AAIException("AAI_6121", "Bad EdgeRule.NodeTypeCategory data (itemCount=" + flds.length + ") for nodeType = [" + nodeType + "]."); + } + + String nodeTypesString = flds[0]; + String hasDepNodes = flds[3]; + if( hasDepNodes.equals("true") ){ + String [] ntNames = nodeTypesString.split("\\|"); + for( int i = 0; i < ntNames.length; i++ ){ + Collection <String> depNTColl = dbMaps.NodeDependencies.get(nodeType); + Iterator <String> ntItr = depNTColl.iterator(); + while( ntItr.hasNext() ){ + String depNode = ntItr.next(); + if( !depNodeTypeL.contains(depNode) ){ + depNodeTypeL.add(depNode); + } + } + } + } + } + + + return depNodeTypeL; + + }// End getDepNodeTypes() + + /** + * Gets the dep node types. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @return the dep node types + * @throws AAIException the AAI exception + */ + @Deprecated + public static ArrayList <String> getDepNodeTypes(String transId, String fromAppId, String nodeType)throws AAIException{ + return getDepNodeTypes( transId, fromAppId, nodeType, null); + } + + /** + * Gets the default delete scope. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param apiVersion the api version + * @return the default delete scope + * @throws AAIException the AAI exception + */ + private static String getDefaultDeleteScope(String transId, String fromAppId, String nodeType, String apiVersion)throws AAIException{ + + // At some point we may have different delete rules for different services, so this is + // a list for now even thought there's only one scope per nodeType. + Collection <String> scopeList = DbEdgeRules.DefaultDeleteScope.get(nodeType); + if( scopeList.isEmpty() ){ + throw new AAIException("AAI_6121", "No default deleteScope found for nodeType = [" + nodeType + "] "); + } + else { + Iterator <String> ito = scopeList.iterator(); + return ito.next(); + } + + }// End getDefaultDeleteScope() + + /** + * Gets the default delete scope. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @return the default delete scope + * @throws AAIException the AAI exception + */ + @Deprecated + private static String getDefaultDeleteScope(String transId, String fromAppId, String nodeType)throws AAIException{ + return getDefaultDeleteScope( transId, fromAppId, nodeType, null); + } + + /** + * Needs A dep node 4 uniqueness. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param apiVersion the api version + * @return the boolean + * @throws AAIException the AAI exception + */ + public static Boolean needsADepNode4Uniqueness(String transId, String fromAppId, String nodeType, String apiVersion)throws AAIException{ + // Note: the passed in nodeType could really be a nodeTypeCategory. That is handled by getDepNodeTypes() + + ArrayList <String> depList = getDepNodeTypes(transId, fromAppId, nodeType, apiVersion); + if( depList.isEmpty() ){ + return false; + } + else { + return true; + } + + }// End needsADepNode4Uniqueness() + + /** + * Needs A dep node 4 uniqueness. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @return the boolean + * @throws AAIException the AAI exception + */ + @Deprecated + private static Boolean needsADepNode4Uniqueness(String transId, String fromAppId, String nodeType)throws AAIException{ + return needsADepNode4Uniqueness( transId, fromAppId, nodeType, null); + } + + /** + * Node type A can depend on B. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeTypeA the node type A + * @param nodeTypeB the node type B + * @param apiVersion the api version + * @return the boolean + * @throws AAIException the AAI exception + */ + public static Boolean nodeTypeACanDependOnB(String transId, String fromAppId, String nodeTypeA, String nodeTypeB, String apiVersion) + throws AAIException{ + // Note: the passed in nodeType could really be a nodeTypeCategory. That is handled by getDepNodeTypes() + + ArrayList <String> depList = getDepNodeTypes(transId, fromAppId, nodeTypeA, apiVersion); + if( depList.isEmpty() ){ + return false; + } + else if( depList.contains(nodeTypeB) ){ + return true; + } + else { + return false; + } + + }// End nodeTypeACanDependOnB() + + /** + * Node type A can depend on B. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeTypeA the node type A + * @param nodeTypeB the node type B + * @return the boolean + * @throws AAIException the AAI exception + */ + @Deprecated + private static Boolean nodeTypeACanDependOnB(String transId, String fromAppId, String nodeTypeA, String nodeTypeB) + throws AAIException{ + return nodeTypeACanDependOnB( transId, fromAppId, nodeTypeA, nodeTypeB, null); + } + + /** + * Figure dep node type for request. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param requestParamHash the request param hash + * @param apiVersion the api version + * @return the string + * @throws AAIException the AAI exception + */ + public static String figureDepNodeTypeForRequest(String transId, String fromAppId, String nodeType, + HashMap<String,Object> requestParamHash, String apiVersion )throws AAIException{ + /* + * This is ugly. But if the passed-in nodeType is dependent on another nodeType for + * uniqueness, we need to return what that dependent node-type is. The ugly comes in + * because a node can be dependent on more than one type of node. So, to tell which one + * is going to apply, we root through the passed request parameters to see which of + * the possible dependent node types is being used. + * Note -- if there comes a day when there are so many dependencies that the request could + * have more than one that match -- Then we need to think up something new. But for now, + * we have to assume that if there are more than one legal dep-node-types, only one will + * be represented in the requestHash data. >>> NOTE >>> That day has come. For + * the upstreamers will send in a LinkedHashMap instead of just an unordered + * HashMap so we can look in order for the dependent node. + * + */ + + if( requestParamHash == null ){ + throw new AAIException("AAI_6120", "Bad param: null requestParamHash "); + } + + ArrayList <String> depNodeTypes = getDepNodeTypes(transId, fromAppId, nodeType, apiVersion); + if( depNodeTypes.isEmpty() ){ + // This kind of node is not dependent on any other + //aaiLogger.debug(logline, " (not dependent) - end "); + return ""; + } + else if( depNodeTypes.size() == 1 ){ + // This kind of node can only depend on one other nodeType - so return that. + //aaiLogger.debug(logline, " (depends on " + depNodeTypes.get(0) + " - end "); + return depNodeTypes.get(0); + } + else { + // We need to look to find the first of the dep-node types that is represented in the passed-in + // request data. That will be the one we need to use. + + // first find out what node-types are represented in the requestHash + + Iterator <Map.Entry<String,Object>>it = requestParamHash.entrySet().iterator(); + while( it.hasNext() ){ + Map.Entry <String,Object>pairs = (Map.Entry<String,Object>)it.next(); + String k = (pairs.getKey()).toString(); + int periodLoc = k.indexOf("."); + if( periodLoc <= 0 ){ + throw new AAIException("AAI_6120", "Bad filter param key passed in: [" + k + "]. Expected format = [nodeName.paramName]\n"); + } + else { + String nty = k.substring(0,periodLoc); + if( depNodeTypes.contains(nty) ){ + // This is the first possible dep. node type we've found for the passed in data set + return nty; + } + } + } + + } + + // It's not an error if none is found - the caller needs to deal with cases where there + // should be a dep. node identified but isn't. + //aaiLogger.debug(logline, " no dep NT found - end "); + return ""; + + }// End of figureDepNodeTypeForRequest() + + /** + * Figure dep node type for request. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param requestParamHash the request param hash + * @return the string + * @throws AAIException the AAI exception + */ + @Deprecated + public static String figureDepNodeTypeForRequest(String transId, String fromAppId, String nodeType, + HashMap<String,Object> requestParamHash )throws AAIException{ + return figureDepNodeTypeForRequest( transId, fromAppId, nodeType, requestParamHash, null); + } + + /** + * Detach connected nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param startNodeVal the start node val + * @param autoDeleteOrphans the auto delete orphans + * @param apiVersion the api version + * @return deletedNodeCount + * @throws AAIException the AAI exception + */ + public static int detachConnectedNodes( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, TitanVertex startNodeVal, boolean autoDeleteOrphans, String apiVersion ) throws AAIException{ + + /* Find nodes that are attached to this node which meet the nodeType/filterParams criteria. + * Remove the edges that go to those nodes. + * If that turns any of the nodes into an orphan, then delete it if the autoDeleteOrphans flag is set. + * Return a count of how many nodes were actually deleted (not just detached). + */ + + int deletedCount = 0; + + if( startNodeVal == null ){ + // They should have passed in the node that this query starts from + throw new AAIException("AAI_6109", "null startNode object passed to detachConnectedNodes()."); + } + + // We want to loop through the connected Nodes that we found. + // For each connected Node, we'll get the all edges that start from that node and look for the one + // that connects back to our startNode. + // Only delete the edge that connects back to our startNode. + // then autoDeleteOrphans flag is set, then delete the connectedNode if it's now orphaned. + // + + String startNodeVId = startNodeVal.id().toString(); + ArrayList<TitanVertex> conNodeList = getConnectedNodes( transId, fromAppId, graph, nodeType, propFilterHash, startNodeVal, apiVersion, false ); + Iterator<TitanVertex> conVIter = conNodeList.iterator(); + while( conVIter.hasNext() ){ + TitanVertex connectedVert = conVIter.next(); + boolean isFirstOne = true; + Iterator<Edge> eI = connectedVert.edges(Direction.BOTH); + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + TitanVertex otherVtx = (TitanVertex) ed.otherVertex(connectedVert); + String otherSideLookingBackVId = otherVtx.id().toString(); + if( startNodeVId.equals(otherSideLookingBackVId) ){ + // This is an edge from the connected node back to our starting node + if( isFirstOne && !eI.hasNext() && autoDeleteOrphans ){ + // This was the one and only edge for this connectedNode, so + // delete the node and edge since flag was set + String resVers = connectedVert.<String>property("resource-version").orElse(null); + removeAaiNode( transId, fromAppId, graph, connectedVert, "USE_DEFAULT", apiVersion, resVers); + deletedCount = deletedCount + 1; + } + else { + removeAaiEdge( transId, fromAppId, graph, ed ); + } + } + isFirstOne = false; + } + } + return deletedCount; + + } // end of detachConnectedNodes() + + + + /** + * Detach connected nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param startNodeVal the start node val + * @param autoDeleteOrphans the auto delete orphans + * @return the int + * @throws AAIException the AAI exception + */ + @Deprecated + public static int detachConnectedNodes( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, TitanVertex startNodeVal, boolean autoDeleteOrphans ) throws AAIException{ + return detachConnectedNodes( transId, fromAppId, graph, nodeType, + propFilterHash, startNodeVal, autoDeleteOrphans, null); + } + + /** + * Gets the nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param noFilterOnPurpose the no filter on purpose + * @param apiVersion the api version + * @return ArrayList<TitanVertex> + * @throws AAIException the AAI exception + */ + @Deprecated + public static ArrayList<TitanVertex> getNodes( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, Boolean noFilterOnPurpose, String apiVersion ) throws AAIException{ + boolean skipGroomingFlag = true; + // we will only do real-time grooming if a system variable is set, telling us not to skip it. + String skipGroomingStr = AAIConstants.AAI_SKIPREALTIME_GROOMING; + if( skipGroomingStr.equals("false") ){ + skipGroomingFlag = false; + } + return( getNodes(transId, fromAppId, graph, nodeType, propFilterHash, noFilterOnPurpose, apiVersion, skipGroomingFlag) ); + } + + /** + * Gets the nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param noFilterOnPurpose the no filter on purpose + * @param apiVersion the api version + * @param skipGroomCheck the skip groom check + * @return ArrayList<TitanVertex> + * @throws AAIException the AAI exception + */ + @Deprecated + public static ArrayList<TitanVertex> getNodes( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, Boolean noFilterOnPurpose, String apiVersion, boolean skipGroomCheck ) + throws AAIException{ + // Note - the skipGroomCheck flag is set to true when the DataGrooming tool is using this method to collect + // node data. When the grooming tool is collecting data, we don't want any nodes skipped, because we + // want details about what nodes/edges are bad - more detail than the check in this method does + // as it checks if a node is ok to return to a caller. + + /* Use the nodeType + filterParams to find nodes. + */ + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + ArrayList<TitanVertex> returnVertList = new ArrayList<TitanVertex>(); + if( nodeType == null || nodeType.equals("") ){ + // They should have passed in a nodeType + throw new AAIException("AAI_6118", "Required field: nodeType not passed to getNodes()."); + } + + if( !noFilterOnPurpose && (propFilterHash == null || propFilterHash.isEmpty()) ){ + // They should have passed at least one property to filter on + throw new AAIException("AAI_6118", "Required field: propFilterHash not passed to getNodes()."); + } + + ArrayList<String> kName = new ArrayList<String>(); + ArrayList<Object> kVal = new ArrayList<Object>(); + int i = -1; + Collection <String> indexedProps = dbMaps.NodeMapIndexedProps.get(nodeType); + // First loop through to pick up the indexed-properties if there are any being used + + if( propFilterHash != null ){ + Iterator <?> it = propFilterHash.entrySet().iterator(); + while( it.hasNext() ){ + Map.Entry<?,?> propEntry = (Map.Entry<?,?>) it.next(); + String propName = (propEntry.getKey()).toString(); + // Don't allow search on properties that do not have SINGLE cardinality + if( !checkPropCardinality(propName, "Set") && !checkPropCardinality(propName, "List") ){ + if( indexedProps.contains(propName) ){ + i++; + kName.add(i, propName); + kVal.add(i, (Object)propEntry.getValue()); + } + } + } + + // Now go through again and pick up the non-indexed properties + it = propFilterHash.entrySet().iterator(); + while( it.hasNext() ){ + Map.Entry <?,?> propEntry = (Map.Entry<?,?>)it.next(); + String propName = (propEntry.getKey()).toString(); + // Don't allow search on properties that do not have SINGLE cardinality + if( !checkPropCardinality(propName, "Set") && !checkPropCardinality(propName, "List") ){ + if( ! indexedProps.contains(propName) ){ + i++; + kName.add(i, propName); + kVal.add(i, (Object)propEntry.getValue()); + } + } + } + } + + Iterable <?> verts = null; + String propsAndValuesForMsg = ""; + int topPropIndex = i; + if( topPropIndex == -1 ){ + // No Filtering -- just go get them all + verts= graph.query().has("aai-node-type",nodeType).vertices(); + propsAndValuesForMsg = " ( no filter props ) "; + } + else if( topPropIndex == 0 ){ + verts= graph.query().has(kName.get(0),kVal.get(0)).has("aai-node-type",nodeType).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ") "; + } + else if( topPropIndex == 1 ){ + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has("aai-node-type",nodeType).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ") "; + } + else if( topPropIndex == 2 ){ + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has("aai-node-type",nodeType).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ", " + + kName.get(2) + " = " + kVal.get(2) + ") "; + } + else if( topPropIndex == 3 ){ + verts= graph.query().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has(kName.get(3),kVal.get(3)).has("aai-node-type",nodeType).vertices(); + propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", " + + kName.get(1) + " = " + kVal.get(1) + ", " + + kName.get(2) + " = " + kVal.get(2) + ", " + + kName.get(3) + " = " + kVal.get(3) + ") "; + } + else { + String emsg = " -- Sorry -- we only support 4 filter properties in getNodes() for now... \n"; + throw new AAIException("AAI_6114", emsg); + } + if( verts != null ){ + // We did find some matching vertices + Iterator <?> it = verts.iterator(); + while( it.hasNext() ){ + TitanVertex v = (TitanVertex)it.next(); + + if( skipGroomCheck ){ + // Good or bad, just return everything we find + returnVertList.add( v ); + } + else { + // Weed out any bad vertices we find + if( thisVertexNotReachable(transId, fromAppId, graph, v, apiVersion) ){ + LOGGER.info("IN-LINE GROOMING - Unreachable Node DETECTED > skipping it. "); + } + else if( thisVertexHasBadEdges(transId, fromAppId, graph, v, apiVersion) ){ + LOGGER.info("IN-LINE GROOMING - BAD EDGE DETECTED > skipping vtxId = [" + v.id() + "] "); + } + else if( thisVertexIsAPhantom(transId, fromAppId, graph, v, apiVersion) ){ + LOGGER.info("IN-LINE GROOMING - BAD NODE DETECTED > skipping vtxId = [" + v.id() + "] "); + } + else { + returnVertList.add( v ); + } + } + } + } + + return returnVertList; + } + + /** + * Gets the nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param noFilterOnPurpose the no filter on purpose + * @return the nodes + * @throws AAIException the AAI exception + */ + @Deprecated + public static ArrayList<TitanVertex> getNodes( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, Boolean noFilterOnPurpose ) throws AAIException{ + return getNodes(transId, fromAppId, graph, nodeType, + propFilterHash, noFilterOnPurpose, null ); + } + // End of getNodes() + + + /** + * Gets the connected children. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVtx the start vtx + * @param limitToThisNodeType the limit to this node type + * @return ArrayList <TitanVertex> + * @throws AAIException the AAI exception + */ + public static ArrayList<TitanVertex> getConnectedChildren( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVtx, String limitToThisNodeType ) throws AAIException{ + + // Just get child nodes (ie. other end of an OUT edge that is tagged as a parent/Child edge) + + ArrayList <TitanVertex> childList = new ArrayList <TitanVertex> (); + Boolean doNodeTypeCheck = false; + if( limitToThisNodeType != null && ! limitToThisNodeType.equals("") ){ + doNodeTypeCheck = true; + } + + + List<Vertex> verts = graph.traversal().V(startVtx).union(__.inE().has("isParent-REV", true).outV(), __.outE().has("isParent", true).inV()).toList(); + TitanVertex tmpVtx = null; + int vertsSize = verts.size(); + for (int i = 0; i < vertsSize; i++){ + tmpVtx = (TitanVertex) verts.get(i); + if( ! doNodeTypeCheck ){ + childList.add(tmpVtx); + } + else { + String tmpNT = tmpVtx.<String>property("aai-node-type").orElse(null); + if( tmpNT != null && tmpNT.equals(limitToThisNodeType) ){ + childList.add(tmpVtx); + } + } + } + + return childList; + + }// End of getConnectedChildren() + + + + /** + * Gets the connected nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param startNodeVal the start node val + * @param apiVersion the api version + * @param excludeRecurComingIn the exclude recur coming in + * @return ArrayList <TitanVertex> + * @throws AAIException the AAI exception + */ + public static ArrayList<TitanVertex> getConnectedNodes( String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, TitanVertex startNodeVal, String apiVersion, Boolean excludeRecurComingIn ) throws AAIException{ + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + /* Get (almost) all the nodes that are connected to this vertex. + * Narrow down what is returned using optional filter parameters nodeType and propFilterHash + * NOTE - the default behavior has changed slightly. For start-Nodes that + * can be recursivly connected, this method will only bring back the same kind of + * connected node by following an OUT edge. Ie. if the start node is an "model-element", + * then this method will only follow OUT edges to get to other "model-element" type nodes. + */ + + String startNodeNT = ""; + if( startNodeVal == null ){ + // They should have passed in the node that this query starts from + throw new AAIException("AAI_6109", "null startNode object passed to getConnectedNodes()."); + } + else { + startNodeNT = startNodeVal.<String>property("aai-node-type").orElse(null); + } + + boolean nodeTypeFilter = false; + if( nodeType != null && !nodeType.equals("") ){ + // They want to filter using nodeType + if( ! dbMaps.NodeProps.containsKey(nodeType) ){ + throw new AAIException("AAI_6115", "Unrecognized nodeType [" + nodeType + "] passed to getConnectedNodes()."); + } + nodeTypeFilter = true; + } + + ArrayList <String> excludeVidList = new <String> ArrayList (); + if( DbEdgeRules.CanBeRecursiveNT.containsKey(startNodeNT) && excludeRecurComingIn ){ + // If we're starting on a nodeType that supports recursion, then find any connected + // nodes that are coming from IN edges so we can exclude them later. + + Iterable <?> vertsR = startNodeVal.query().direction(Direction.IN).vertices(); + Iterator <?> vertIR = vertsR.iterator(); + while( vertIR != null && vertIR.hasNext() ){ + TitanVertex tmpVertIN = (TitanVertex) vertIR.next(); + String tmpNT = tmpVertIN.<String>property("aai-node-type").orElse(null); + if( tmpNT != null && tmpNT.equals(startNodeNT) ){ + // We're on a nodetype that supports recursion (like model-element) and we've + // found an connected Node of this same type on an IN edge - put this + // on our excludeList. + excludeVidList.add( tmpVertIN.id().toString() ); + } + } + } + + boolean propertyFilter = false; + if( propFilterHash != null && !propFilterHash.isEmpty() ){ + // They want to filter using some properties + Iterator <?> it = propFilterHash.entrySet().iterator(); + while( it.hasNext() ){ + Map.Entry<?,?> propEntry = (Map.Entry<?,?>)it.next(); + String propName = (propEntry.getKey()).toString(); + if( ! dbMaps.NodeProps.containsValue(propName) ){ + throw new AAIException("AAI_6116", "Unrecognized property name [" + propName + "] passed to getConnectedNodes()."); + } + // Don't allow search on properties that do not have SINGLE cardinality + if( !checkPropCardinality(propName, "Set") && !checkPropCardinality(propName, "List") ){ + propertyFilter = true; + } + } + } + // If filter-properties were passed in, then look for nodes that have those values. + ArrayList<TitanVertex> returnVertList = new ArrayList<TitanVertex>(); + Iterable<TitanVertex> qResult = null; + Iterator<TitanVertex> resultI = null; + try { + qResult = startNodeVal.query().vertices(); + resultI = qResult.iterator(); + } + catch( NullPointerException npe ){ + throw new AAIException("AAI_6125", "Titan null pointer exception trying to get nodes connected to vertexId = " + + startNodeVal.id() + ", aai-node-type = [" + startNodeVal.property("aai-node-type") + "]."); + } + + while( resultI != null && resultI.hasNext() ){ + boolean addThisOne = true; + TitanVertex tmpV = (TitanVertex)resultI.next(); + if( tmpV == null ){ + LOGGER.info("Titan gave a null vertex when looking for nodes connected to vertexId = " + + startNodeVal.id() + ", aai-node-type = [" + startNodeVal.property("aai-node-type") + "]."); + // Note - we will skip this one, but try to return any others that we find. + addThisOne = false; + } + + else { + String tmpVid = tmpV.id().toString(); + if( nodeTypeFilter ){ + Object nto = tmpV.<Object>property("aai-node-type").orElse(null); + if( nto == null || !nto.toString().equals(nodeType) ){ + //LOGGER.info("Found a connected vertex (vertexId = " + + // tmpVid + "), but we will not collect it. It had aai-node-type [" + + // nto + "], we are looking for [" + nodeType + "]. "); + // Note - we will skip this one, but try to return any others that we find. + addThisOne = false; + } + } + + if( excludeVidList.contains(tmpVid) ){ + LOGGER.info("Found a connected vertex (vertexId = " + + tmpVid + "), but will exclude it since it is on an IN edge and this nodeType " + + startNodeNT + " can be recursively attached."); + // Note - we will skip this one, but try to return any others that we find. + addThisOne = false; + } + + if( propertyFilter ){ + Iterator <?> it = propFilterHash.entrySet().iterator(); + while( it.hasNext() ){ + Map.Entry <?,?>propEntry = (Map.Entry<?,?>)it.next(); + String propName = (propEntry.getKey()).toString(); + if( checkPropCardinality(propName, "Set") || checkPropCardinality(propName, "List") ){ + // Don't allow search on properties that do not have SINGLE cardinality + continue; + } + Object propVal = propEntry.getValue(); + Object foundVal = tmpV.<Object>property(propName).orElse(null); + if( foundVal != null && propVal != null && !foundVal.toString().equals(propVal.toString()) ){ + addThisOne = false; + break; + } + else if( (foundVal == null && propVal != null) || (foundVal != null && propVal == null) ){ + addThisOne = false; + break; + } + } + } + } + if( addThisOne ){ + // This node passed the tests -- put it on the return List + returnVertList.add( (TitanVertex)tmpV ); + } + } + //aaiLogger.debug(logline, " end "); + return returnVertList; + + }// End of getConnectedNodes() + + + /** + * Gets the connected nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param startNodeVal the start node val + * @param apiVersion the api version + * @return the connected nodes + * @throws AAIException the AAI exception + */ + @Deprecated + public static ArrayList<TitanVertex> getConnectedNodes(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, TitanVertex startNodeVal, String apiVersion ) throws AAIException { + return getConnectedNodes( transId, fromAppId, graph, nodeType, + propFilterHash, startNodeVal, apiVersion, true ); + } + + /** + * Gets the connected nodes. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param nodeType the node type + * @param propFilterHash the prop filter hash + * @param startNodeVal the start node val + * @return the connected nodes + * @throws AAIException the AAI exception + */ + @Deprecated + public static ArrayList<TitanVertex> getConnectedNodes(String transId, String fromAppId, TitanTransaction graph, String nodeType, + HashMap<String,Object> propFilterHash, TitanVertex startNodeVal ) throws AAIException { + return getConnectedNodes( transId, fromAppId, graph, nodeType, + propFilterHash, startNodeVal, null, true ); + + } + + /** + * Ip address format OK. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param addrVal the addr val + * @param addrVer the addr ver + * @param apiVersion the api version + * @return Boolean + * @throws AAIException the AAI exception + */ + public static Boolean ipAddressFormatOK(String transId, String fromAppId, String addrVal, String addrVer, String apiVersion) throws AAIException{ + + /* NOTE -- the google methods we use do not allow leading zeros in ipV4 addresses. + * So it will reject, "22.33.44.001" + */ + + if( addrVal == null ){ + throw new AAIException("AAI_6120", "Bad data (addrVal = null) passed to ipAddressFormatOK()"); + } + else if( addrVer == null ){ + throw new AAIException("AAI_6120", "Bad data (addrType = null) passed to ipAddressFormatOK()"); + } + + Boolean retVal = false; + Boolean lookingForV4 = false; + Boolean lookingForV6 = false; + InetAddress inetAddr = null; + + if( addrVer.equalsIgnoreCase("v4") || addrVer.equals("ipv4") || addrVer.equals("4")){ + lookingForV4 = true; + } + else if( addrVer.equalsIgnoreCase("v6") || addrVer.equals("ipv6") || addrVer.equals("6")){ + lookingForV6 = true; + } + else { + throw new AAIException("AAI_6120", " Bad data for addressVersion [" + addrVer + "] passed to ipAddressFormatOK()"); + } + + try { + inetAddr = InetAddresses.forString(addrVal); + if( inetAddr instanceof Inet4Address ){ + if( lookingForV4 ){ + retVal = true; + } + else { + throw new AAIException("AAI_6120", "Bad data. Address is a V4, but addressType said it should be V6. [" + + addrVal + "], [" + addrVer + "] passed to ipAddressFormatOK()"); + } + } + else if( inetAddr instanceof Inet6Address ){ + if( lookingForV6 ){ + retVal = true; + } + else { + throw new AAIException("AAI_6120", "Bad data. Address is a V6, but addressType said it should be V4. [" + + addrVal + "], [" + addrVer + "] passed to ipAddressFormatOK()."); + } + } + } + catch (IllegalArgumentException e) { + throw new AAIException("AAI_6120", "Badly formed ip-address: [" + addrVal + "] passed to ipAddressFormatOK()"); + } + + return retVal; + + }//end of ipAddressFormatOk() + + /** + * Ip address format OK. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param addrVal the addr val + * @param addrVer the addr ver + * @return the boolean + * @throws AAIException the AAI exception + */ + public static Boolean ipAddressFormatOK(String transId, String fromAppId, String addrVal, String addrVer) throws AAIException{ + return ipAddressFormatOK( transId, fromAppId, addrVal, addrVer, null); + } + + /** + * Save aai edge to db. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param edgeLabel the edge label + * @param outV the out V + * @param inV the in V + * @param propHash the prop hash + * @param apiVersion the api version + * @return TitanEdge + * @throws AAIException the AAI exception + */ + private static TitanEdge saveAaiEdgeToDb(String transId, String fromAppId, TitanTransaction graph, String edgeLabel, + TitanVertex outV, TitanVertex inV, HashMap <String,Object> propHash, String apiVersion) throws AAIException{ + + // If this edge doesn't exist yet, then create it. + + // NOTE - the Titan javaDoc says that there might not always be an id for a node. + // This is the internal-titan-unique-id, not any of our data. + // Not sure how to know when it might be there and when it might not?! + // So far, it has worked for all my testing, but this might warrant some + // further investigation. + + TitanEdge existingEdge = null; + String inVId = inV.id().toString(); + Iterator <Edge> eI = outV.edges(Direction.BOTH, edgeLabel); + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + TitanVertex otherVtx = (TitanVertex) ed.otherVertex(outV); + if( (otherVtx.id().toString()).equals(inVId) ){ + // NOTE -?- Not sure -- at some point we might want to check the edgeLabels also since we might + // want to allow two different-type edges between the same two vertexes? (or maybe not.) + existingEdge = ed; + break; + } + } + + if( existingEdge != null ){ + // This is just an UPDATE + for( Map.Entry<String, Object> entry : propHash.entrySet() ){ + LOGGER.debug("update edge property/val = [" + entry.getKey() + "]/[" + entry.getValue() + "]"); + existingEdge.property( entry.getKey(), entry.getValue() ); + } + + return( existingEdge ); + } + else { + // This is an ADD + + // Uniqueness double-check. This is just to catch the possibility that at the transaction layer, + // if data came in for two identical nodes that point to the same dependant node (for uniqueness), + // we would only be able to catch the problem at the time the edge to the second node is added. + // For example - if they had a VM and then got a request to add two ipAddress nodes, but some + // bad data was passed and those two ipAddress nodes were identical -- we'd want to catch it. + String outV_NType = outV.<String>property("aai-node-type").orElse(null); + String inV_NType = inV.<String>property("aai-node-type").orElse(null); + if( needsADepNode4Uniqueness(transId, fromAppId, outV_NType, apiVersion) + && nodeTypeACanDependOnB(transId, fromAppId, outV_NType, inV_NType, apiVersion) ){ + // The out-Vertex has a uniqueness dependency on the in-vertex + // Make sure we haven't already added an node/edge like this in this transaction + HashMap <String, Object> nodeKeyPropsHash = getNodeKeyPropHash(transId, fromAppId, graph, outV); + ArrayList<TitanVertex> resultList = new ArrayList<TitanVertex>(); + resultList = DbMeth.getConnectedNodes("transId", "fromAppId", graph, outV_NType, nodeKeyPropsHash, inV, apiVersion, false); + if( resultList.size() > 0 ){ + String propInfo = ""; + if( nodeKeyPropsHash != null ){ + propInfo = nodeKeyPropsHash.toString(); + } + throw new AAIException("AAI_6117", "Failed to add edge. This node (" + inV_NType + ") already has an edge to a " + outV_NType + + " node with kepProps [" + propInfo + "]"); + } + } + else if( needsADepNode4Uniqueness(transId, fromAppId, inV_NType, apiVersion) + && nodeTypeACanDependOnB(transId, fromAppId, inV_NType, outV_NType, apiVersion) ){ + // The in-Vertex has a uniqueness dependency on the out-vertex + // Make sure we haven't already added an node/edge like this in this transaction + HashMap <String, Object> nodeKeyPropsHash = getNodeKeyPropHash(transId, fromAppId, graph, inV); + ArrayList<TitanVertex> resultList = new ArrayList<TitanVertex>(); + resultList = DbMeth.getConnectedNodes("transId", "fromAppId", graph, inV_NType, nodeKeyPropsHash, outV, apiVersion, false); + if( resultList.size() > 0 ){ + String propInfo = ""; + if( nodeKeyPropsHash != null ){ + propInfo = nodeKeyPropsHash.toString(); + } + throw new AAIException("AAI_6117", "Failed to add edge. This node (" + outV_NType + ") already has an edge to a " + inV_NType + + " node with kepProps [" + propInfo + "]"); + } + } + + + // We're good to go to add this edge + + TitanEdge tEdge = outV.addEdge( edgeLabel, inV ); + // Add the properties to the new Edge + for( Map.Entry<String, Object> entry : propHash.entrySet() ){ + tEdge.property( entry.getKey(), entry.getValue() ); + } + + // For (resource-id updates) we need to "touch" the vertices on each side of the edge so + // anybody working on one of those vertices will know that something (ADDing this edge) has happened. + touchVertex( transId, fromAppId, inV ); + touchVertex( transId, fromAppId, outV ); + + return tEdge; + } + + }// End saveAaiEdgeToDb() + + + + /** + * Derive edge rule key for this edge. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param tEdge the t edge + * @return String - key to look up edgeRule (fromNodeType|toNodeType) + * @throws AAIException the AAI exception + */ + public static String deriveEdgeRuleKeyForThisEdge( String transId, String fromAppId, TitanTransaction graph, + TitanEdge tEdge ) throws AAIException{ + + TitanVertex fromVtx = tEdge.outVertex(); + TitanVertex toVtx = tEdge.inVertex(); + String startNodeType = fromVtx.<String>property("aai-node-type").orElse(null); + String targetNodeType = toVtx.<String>property("aai-node-type").orElse(null); + String key = startNodeType + "|" + targetNodeType; + if( EdgeRules.getInstance().hasEdgeRule(startNodeType, targetNodeType) ){ + // We can use the node info in the order they were given + return( key ); + } + else { + key = targetNodeType + "|" + startNodeType; + if( EdgeRules.getInstance().hasEdgeRule(targetNodeType, startNodeType) ){ + return( key ); + } + else { + // Couldn't find a rule for this edge + throw new AAIException("AAI_6120", "No EdgeRule found for passed nodeTypes: " + startNodeType + ", " + + targetNodeType); + } + } + }// end of deriveEdgeRuleKeyForThisEdge() + + + + /** + * Save aai edge to db. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param edgeLabel the edge label + * @param outV the out V + * @param inV the in V + * @param propHash the prop hash + * @return the titan edge + * @throws AAIException the AAI exception + */ + @Deprecated + private static TitanEdge saveAaiEdgeToDb(String transId, String fromAppId, TitanTransaction graph, String edgeLabel, + TitanVertex outV, TitanVertex inV, HashMap <String,Object> propHash) throws AAIException{ + return saveAaiEdgeToDb( transId, fromAppId, graph, edgeLabel, + outV, inV, propHash, null); + } + + /** + * Persist aai edge. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVert the start vert + * @param targetVert the target vert + * @param apiVersion the api version + * @return the titan edge + * @throws AAIException the AAI exception + */ + public static TitanEdge persistAaiEdge( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVert, TitanVertex targetVert, String apiVersion ) throws AAIException{ + TitanEdge returnEdge = persistAaiEdge(transId, fromAppId, graph, startVert, targetVert, apiVersion, ""); + return returnEdge; + } + + /** + * Persist aai edge. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVert the start vert + * @param targetVert the target vert + * @param apiVersion the api version + * @param edgeType the edge type + * @return TitanEdge + * @throws AAIException the AAI exception + */ + public static TitanEdge persistAaiEdge( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVert, TitanVertex targetVert, String apiVersion, String edgeType ) throws AAIException{ + + TitanVertex fromVtx = null; + TitanVertex toVtx = null; + String startNodeType = startVert.<String>property("aai-node-type").orElse(null); + String targetNodeType = targetVert.<String>property("aai-node-type").orElse(null); + String fwdRuleKey = startNodeType + "|" + targetNodeType; + int fwdRuleCount = 0; + String fwdRule = ""; + String fwdLabel = ""; + String revRuleKey = targetNodeType + "|" + startNodeType; + int revRuleCount = 0; + String revRule = ""; + String revLabel = ""; + String edRule = ""; + String edLabel = ""; + + Boolean checkType = false; + if( (edgeType != null) && edgeType != "" ){ + checkType = true; + } + + // As of 16-07, it is possible to have more than one kind of edge defined between a given + // pair of nodeTypes. So we need to check to see if there is only one possibility, or if + // we need to look at the edgeType to determine which to use. + // NOTE -- we're only supporting having 2 edges between a given pair of nodeTypes and + // one and only one of them would have to be a parent-child edge. + + if( DbEdgeRules.EdgeRules.containsKey(fwdRuleKey) ){ + Collection <String> edRuleColl = DbEdgeRules.EdgeRules.get(fwdRuleKey); + Iterator <String> ruleItr = edRuleColl.iterator(); + while( ruleItr.hasNext() ){ + String tmpRule = ruleItr.next(); + String [] rules = tmpRule.split(","); + String tmpLabel = rules[0]; + String tmpParChild = rules[3]; + if( !checkType + || (checkType && tmpParChild.equals("true") && edgeType.equals("parentChild")) + || (checkType && tmpParChild.equals("false") && edgeType.equals("cousin")) ){ + // Either they didn't want us to check the edgeType or it is a match + fwdRuleCount++; + if( fwdRuleCount > 1 ){ + // We found more than one with the given info + throw new AAIException("AAI_6120", "Multiple EdgeRules found for nodeTypes: [" + startNodeType + "], [" + + targetNodeType + "], edgeType = [" + edgeType + "]."); + } + else { + fwdRule = tmpRule; + fwdLabel = tmpLabel; + } + } + } + } + + // Try it the other way also (unless this is the case of a nodeType recursively pointing to itself + // Ie. the edge rule: "model-element|model-element" + if( !revRuleKey.equals(fwdRuleKey) && DbEdgeRules.EdgeRules.containsKey(revRuleKey) ){ + Collection <String> edRuleColl = DbEdgeRules.EdgeRules.get(revRuleKey); + Iterator <String> ruleItr = edRuleColl.iterator(); + while( ruleItr.hasNext() ){ + String tmpRule = ruleItr.next(); + String [] rules = tmpRule.split(","); + String tmpLabel = rules[0]; + String tmpParChild = rules[3]; + if( !checkType + || (checkType && tmpParChild.equals("true") && edgeType.equals("parentChild")) + || (checkType && tmpParChild.equals("false") && edgeType.equals("cousin")) ){ + // Either they didn't want us to check the edgeType or it is a match + revRuleCount++; + if( revRuleCount > 1 ){ + // We found more than one with the given info + throw new AAIException("AAI_6120", "Multiple EdgeRules found for nodeTypes: [" + targetNodeType + "], [" + + startNodeType + "], edgeType = [" + edgeType + "]."); + } + else { + revRule = tmpRule; + revLabel = tmpLabel; + } + } + } + } + + if( (fwdRuleCount == 1) && (revRuleCount == 0) ){ + // We can use the node info in the order they were given + fromVtx = startVert; + toVtx = targetVert; + edRule = fwdRule; + edLabel = fwdLabel; + } + else if( (fwdRuleCount == 0) && (revRuleCount == 1) ){ + // We need to switch the vertex order so the edge-direction is correct + toVtx = startVert; + fromVtx = targetVert; + edRule = revRule; + edLabel = revLabel; + } + else if( (fwdRuleCount == 0) && (revRuleCount == 0) ){ + // No edge rule found for this + throw new AAIException("AAI_6120", "No EdgeRule found for passed nodeTypes: " + startNodeType + ", " + targetNodeType + + "], checkLabelType = [" + edgeType + "]."); + } + else if( (fwdRuleCount > 0) && (revRuleCount > 0) ){ + // We found more than one with the given info + throw new AAIException("AAI_6120", "Multiple EdgeRules (fwd and rev) found for nodeTypes: [" + startNodeType + "], [" + + targetNodeType + "], checkLabelType = [" + edgeType + "]."); + } + + // If we got to this point, we now have a single edge label and we know to and from Vtx. + + HashMap <String,Object> edgeParamHash = getEdgeTagPropPutHash4Rule(transId, fromAppId, edRule); + // We do "source-of-truth" for all edges + edgeParamHash.put("source-of-truth", fromAppId ); + + TitanEdge returnEdge = saveAaiEdgeToDb(transId, fromAppId, graph, edLabel, fromVtx, toVtx, edgeParamHash, apiVersion); + + return returnEdge; + + } + + /** + * Persist aai edge. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVert the start vert + * @param targetVert the target vert + * @return the titan edge + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanEdge persistAaiEdge( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVert, TitanVertex targetVert ) throws AAIException{ + return persistAaiEdge( transId, fromAppId, graph, + startVert, targetVert, null); + } + // End persistAaiEdge() + + + /** + * Persist aai edge. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param edgeLabel the edge label + * @param startVert the start vert + * @param targetVert the target vert + * @param propHash the prop hash + * @param addIfNotFound the add if not found + * @return the titan edge + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanEdge persistAaiEdge( String transId, String fromAppId, TitanTransaction graph, + String edgeLabel, TitanVertex startVert, TitanVertex targetVert, + HashMap <String,Object> propHash, Boolean addIfNotFound ) throws AAIException{ + + /*----- This method is depricated ------ + * We will ignore the parameters: edgeLabel, propHash and addIfNotFound + * We will use the remaining params to call the newer version of this method + */ + TitanEdge returnEdge = persistAaiEdge(transId, fromAppId, graph, startVert, targetVert, null); + + return returnEdge; + + }// End depricated version of persistAaiEdge() + + + /** + * Persist aai edge with dep params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVert the start vert + * @param targetNodeType the target node type + * @param targetNodeParamHash the target node param hash + * @param apiVersion the api version + * @return TitanEdge + * @throws AAIException the AAI exception + */ + public static TitanEdge persistAaiEdgeWithDepParams( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVert, String targetNodeType, HashMap <String,Object> targetNodeParamHash, String apiVersion) throws AAIException{ + + TitanVertex targetVert = getUniqueNodeWithDepParams( transId, fromAppId, graph, targetNodeType, targetNodeParamHash, apiVersion ); + TitanEdge returnEdge = persistAaiEdge(transId, fromAppId, graph, startVert, targetVert, apiVersion); + + return returnEdge; + + }// End persistAaiEdgeWithDepParams() + + // Version that lets you pass in an edgeType ("parentChild" or "cousin" since it sometimes cannot be determined + /** + * Persist aai edge with dep params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVert the start vert + * @param targetNodeType the target node type + * @param targetNodeParamHash the target node param hash + * @param apiVersion the api version + * @param edgeType the edge type + * @return the titan edge + * @throws AAIException the AAI exception + */ + // from the two nodeTypes anymore (16-07) + public static TitanEdge persistAaiEdgeWithDepParams( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVert, String targetNodeType, HashMap <String,Object> targetNodeParamHash, + String apiVersion, String edgeType) throws AAIException{ + TitanVertex targetVert = getUniqueNodeWithDepParams( transId, fromAppId, graph, targetNodeType, targetNodeParamHash, apiVersion ); + TitanEdge returnEdge = persistAaiEdge(transId, fromAppId, graph, startVert, targetVert, apiVersion, edgeType); + + return returnEdge; + + }// End persistAaiEdgeWithDepParams() + + /** + * Persist aai edge with dep params. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param startVert the start vert + * @param targetNodeType the target node type + * @param targetNodeParamHash the target node param hash + * @return the titan edge + * @throws AAIException the AAI exception + */ + @Deprecated + public static TitanEdge persistAaiEdgeWithDepParams( String transId, String fromAppId, TitanTransaction graph, + TitanVertex startVert, String targetNodeType, HashMap <String,Object> targetNodeParamHash) throws AAIException{ + return persistAaiEdgeWithDepParams( transId, fromAppId, graph, + startVert, targetNodeType, targetNodeParamHash, null); + } + + /** + * Gets the node key prop hash. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param vtx the vtx + * @return nodeKeyPropHash + * @throws AAIException the AAI exception + */ + public static HashMap <String, Object> getNodeKeyPropHash( String transId, String fromAppId, TitanTransaction graph, TitanVertex vtx) throws AAIException{ + + if( vtx == null ){ + throw new AAIException("AAI_6109", "null node object passed to getNodeKeyPropHash()."); + } + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + String nType = vtx.<String>property("aai-node-type").orElse(null); + if( ! dbMaps.NodeKeyProps.containsKey(nType) ){ + // Problem if no key Properties defined for this nodeType + String defVer = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + throw new AAIException("AAI_6105", "No node-key-properties defined in dbMaps for nodeType = " + nType + " (ver=" + defVer + ")"); + } + + HashMap <String,Object>nodeKeyPropsHash = new HashMap<String,Object>(); + Collection <String> keyProps = dbMaps.NodeKeyProps.get(nType); + Iterator <String> keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + String propName = keyPropI.next(); + Object value = (Object) vtx.<Object>property(propName).orElse(null); + nodeKeyPropsHash.put(propName, value); + } + + return nodeKeyPropsHash; + + }// End of getNodeKeyPropHash() + + /** + * Gets the node name prop hash. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param vtx the vtx + * @param apiVersion the api version + * @return nodeKeyPropHash + * @throws AAIException the AAI exception + */ + public static HashMap <String, Object> getNodeNamePropHash( String transId, String fromAppId, TitanTransaction graph, TitanVertex vtx, String apiVersion) throws AAIException{ + + if( vtx == null ){ + throw new AAIException("AAI_6109", "null node object passed to getNodeNamePropHash()." ); + } + + String nType = vtx.<String>property("aai-node-type").orElse(null); + HashMap <String,Object>nodeNamePropsHash = new HashMap<String,Object>(); + Collection <String> keyProps = DbMeth.getNodeNameProps(transId, fromAppId, nType, apiVersion); + Iterator <String> keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + String propName = keyPropI.next(); + Object value = (Object) vtx.<Object>property(propName).orElse(null); + nodeNamePropsHash.put(propName, value); + } + + return nodeNamePropsHash; + + }// End of getNodeNamePropHash() + + + /** + * Removes the aai edge. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param tEdge the t edge + * @return void + */ + public static void removeAaiEdge( String transId, String fromAppId, TitanTransaction graph, TitanEdge tEdge){ + // Before removing the edge, touch the vertices on each side so their resource-versions will get updated + TitanVertex tmpVIn = tEdge.inVertex(); + touchVertex( transId, fromAppId, tmpVIn ); + + TitanVertex tmpVOut = tEdge.outVertex(); + touchVertex( transId, fromAppId, tmpVOut ); + + // Remove the passed in edge. + tEdge.remove(); + + }// end of removeAaiEdge() + + + /** + * Removes the aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param thisVtx the this vtx + * @param scopeParam the scope param + * @param apiVersion the api version + * @param resourceVersion the resource version + * @throws AAIException the AAI exception + */ + public static void removeAaiNode( String transId, String fromAppId, TitanTransaction graph, TitanVertex thisVtx, String scopeParam, + String apiVersion, String resourceVersion ) throws AAIException{ + // Note: the resource Version Override flag is only set to true when called by the Model Delete code which + // has no way to know the resource-versions of nodes at lower-levels of it's model topology. + Boolean resVersionOverrideFlag = false; + removeAaiNode( transId, fromAppId, graph, thisVtx, scopeParam, apiVersion, resourceVersion, resVersionOverrideFlag ); + } + + + /** + * <pre> + * Possible values for deleteScope can be: + * USE_DEFAULT - Get the scope from ref data for this node + * THIS_NODE_ONLY (but should fail if it there are nodes that depend on it for uniqueness) + * CASCADE_TO_CHILDREN - will look for OUT-Edges that have parentOf/hasDelTarget = true and follow those down + * ERROR_4_IN_EDGES_OR_CASCADE - combo of error-if-any-IN-edges + CascadeToChildren + * ERROR_IF_ANY_IN_EDGES - Fail if this node has any existing IN edges + * ERROR_IF_ANY_EDGES - Fail if this node has any existing edges at all! + * </pre>. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param thisVtx the this vtx + * @param scopeParam the scope param + * @param apiVersion the api version + * @param resourceVersion the resource version + * @param resVerOverride the res ver override + * @return void + * @throws AAIException the AAI exception + */ + public static void removeAaiNode( String transId, String fromAppId, TitanTransaction graph, TitanVertex thisVtx, String scopeParam, + String apiVersion, String resourceVersion, Boolean resVerOverride ) throws AAIException{ + String nodeType2Del = thisVtx.<String>property("aai-node-type").orElse(null); + String deleteScope = scopeParam; + if( scopeParam.equals("USE_DEFAULT") ){ + deleteScope = getDefaultDeleteScope(transId, fromAppId, nodeType2Del, apiVersion); + } + + if( !resVerOverride && needToDoResourceVerCheck(apiVersion, false) ){ + // Need to check that they knew what they were deleting + String existingResVer = thisVtx.<String>property("resource-version").orElse(null); + if( resourceVersion == null || resourceVersion.equals("") ){ + throw new AAIException("AAI_6130", "Resource-version not passed for delete of = " + nodeType2Del); + } + else if( (existingResVer != null) && !resourceVersion.equals(existingResVer) ){ + throw new AAIException("AAI_6131", "Resource-version MISMATCH for delete of = " + nodeType2Del); + } + } + + if( !deleteScope.equals("THIS_NODE_ONLY") + && !deleteScope.equals("CASCADE_TO_CHILDREN") + && !deleteScope.equals("ERROR_4_IN_EDGES_OR_CASCADE") + && !deleteScope.equals("ERROR_IF_ANY_EDGES") + && !deleteScope.equals("ERROR_IF_ANY_IN_EDGES") ){ + throw new AAIException("AAI_6120", "Unrecognized value in deleteScope: [" + deleteScope + "]."); + } + + if( deleteScope.equals("ERROR_IF_ANY_EDGES") ){ + if ( thisVtx.edges(Direction.BOTH).hasNext() ) { + throw new AAIException("AAI_6110", "Node cannot be deleted because it still has Edges and the ERROR_IF_ANY_EDGES scope was used."); + } + } + else if( deleteScope.equals("ERROR_IF_ANY_IN_EDGES") || deleteScope.equals("ERROR_4_IN_EDGES_OR_CASCADE") ){ + Iterator <Edge> eI = thisVtx.edges(Direction.IN); + boolean onlyHasParent = false; + Edge temp = null; + if( eI != null && eI.hasNext() ){ + temp = eI.next(); + Boolean isParent = temp.<Boolean>property("isParent").orElse(null); + if (isParent != null && isParent && !eI.hasNext()) { + onlyHasParent = true; + } + + if (!onlyHasParent) { + throw new AAIException("AAI_6110", "Node cannot be deleted because it still has Edges and the " + deleteScope + " scope was used."); + } + } + } + else if( deleteScope.equals("THIS_NODE_ONLY")){ + // Make sure nobody depends on this node. + Iterator<Edge> eI = thisVtx.edges(Direction.BOTH); + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + TitanVertex otherVtx = (TitanVertex) ed.otherVertex(thisVtx); + String nodeTypeA = otherVtx.<String>property("aai-node-type").orElse(null); + if( nodeTypeACanDependOnB(transId, fromAppId, nodeTypeA, nodeType2Del, apiVersion)){ + // We're only supposed to delete this node - but another node is dependant on it, + // so we shouldn't delete this one. + throw new AAIException("AAI_6110", "Node cannot be deleted using scope = " + deleteScope + + " another node (type = " + nodeTypeA + ") depends on it for uniqueness."); + } + } + } + + // We've passed our checks - so do some deleting of edges and maybe pass + // the delete request down to children or delete-targets. + + // First we deal with the "IN"-Edges which can't have children/delete-targets which + // by definition (of "IN") on the other end + Iterator <Edge> eI_In = thisVtx.edges(Direction.IN); + while( eI_In.hasNext() ){ + TitanEdge ed = (TitanEdge) eI_In.next(); + + //- "touch" vertex on other side of this edge so it gets a fresh resource-version + TitanVertex tmpVOther = ed.otherVertex(thisVtx); + touchVertex( transId, fromAppId, tmpVOther ); + + ed.remove(); + } + + // Now look at the "OUT"-edges which might include children or delete-targets + String cascadeMsg = "This nt = " + nodeType2Del + ", Cascading del to: "; + Iterator <Edge> eI_Out = thisVtx.edges(Direction.OUT); + if( !eI_Out.hasNext() ){ + cascadeMsg = cascadeMsg + "[no children for this node]"; + } + while( eI_Out.hasNext() ){ + TitanEdge ed = (TitanEdge) eI_Out.next(); + + // "touch" vertex on other side of this edge so it gets a fresh resource-version + TitanVertex tmpVOther = ed.otherVertex(thisVtx); + touchVertex( transId, fromAppId, tmpVOther ); + + Boolean otherVtxAChild = ed.<Boolean>property("isParent").orElse(null); + if( otherVtxAChild == null ){ + otherVtxAChild = false; + } + + Boolean otherVtxADeleteTarget = ed.<Boolean>property("hasDelTarget").orElse(null); + if( otherVtxADeleteTarget == null ){ + otherVtxADeleteTarget = false; + } + + if( (otherVtxAChild || otherVtxADeleteTarget) && + (deleteScope.equals("CASCADE_TO_CHILDREN") || deleteScope.equals("ERROR_4_IN_EDGES_OR_CASCADE")) ){ + // Delete the edge to the child and Pass the delete down to it. + ed.remove(); + TitanVertex otherVtx = (TitanVertex) ed.otherVertex(thisVtx); + String vid = otherVtx.id().toString(); + String nty = otherVtx.<String>property("aai-node-type").orElse(null); + String resVers = otherVtx.<String>property("resource-version").orElse(null); + cascadeMsg = cascadeMsg + "[" + nty + ":" + vid + "]"; + removeAaiNode(transId, fromAppId, graph, otherVtx, "CASCADE_TO_CHILDREN", apiVersion, resVers); + } + else { + // The other node is not a child or deleteTarget. Delete the edge to it if it is not + // dependent (Should never be dependent since it's not a child/delTarget... but + // someone could create a node that was dependent for Uniqueness without + // being a child/target. + + // DEBUG -- eventually add the check for dependancy that isn't on a parent-type or delTarget-type edge + ed.remove(); + } + } + + LOGGER.info(cascadeMsg); + + Iterator<Edge> eI = thisVtx.edges(Direction.BOTH); + if( ! eI.hasNext() ){ + // By this point, either there were no edges to deal with, or we have dealt with them. + thisVtx.remove(); + } + else { + // Something went wrong and we couldn't delete all the edges for this guy. + throw new AAIException("AAI_6110", "Node could be deleted because it unexpectedly still has Edges.\n"); + } + } + + + /** + * Removes the aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param thisVtx the this vtx + * @param scopeParam the scope param + * @return void + * @throws AAIException the AAI exception + */ + @Deprecated + public static void removeAaiNode( String transId, String fromAppId, TitanTransaction graph, TitanVertex thisVtx, String scopeParam) throws AAIException{ + removeAaiNode(transId, fromAppId, graph, thisVtx, scopeParam, null, null); + } + + /** + * Removes the aai node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param thisVtx the this vtx + * @param scopeParam the scope param + * @param apiVersion the api version + * @throws AAIException the AAI exception + */ + @Deprecated + public static void removeAaiNode( String transId, String fromAppId, TitanTransaction graph, TitanVertex thisVtx, String scopeParam, + String apiVersion ) throws AAIException{ + removeAaiNode(transId, fromAppId, graph, thisVtx, scopeParam, apiVersion, null); + } + // end of removeAaiNode() + + + /** + * Delete all graph data. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @return void + */ + public static void deleteAllGraphData( String transId, String fromAppId, TitanGraph graph ){ + /** ====================================================================== + * WARNING -- this removes ALL the data that is currently in the graph. + * ====================================================================== + **/ + LOGGER.warn("deleteAllGraphData called! Run for the hills!"); + Iterator<Edge> edges = graph.edges(Direction.BOTH); + graph.tx().commit(); + Edge edge = null; + while (edges.hasNext()) { + edge = edges.next(); + edges.remove(); + } + graph.tx().commit(); + Iterator<Vertex> vertices = graph.vertices(); + graph.tx().commit(); + Vertex vertex = null; + while (vertices.hasNext()) { + vertex = vertices.next(); + vertex.remove(); + } + graph.tx().commit(); + } + + + /** + * Show all edges for node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param tVert the t vert + * @return the array list + */ + public static ArrayList <String> showAllEdgesForNode( String transId, String fromAppId, TitanVertex tVert ){ + + ArrayList <String> retArr = new ArrayList <String> (); + Iterator <Edge> eI = tVert.edges(Direction.IN); + if( ! eI.hasNext() ){ + retArr.add("No IN edges were found for this vertex. "); + } + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + String lab = ed.label(); + TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert); + if( vtx == null ){ + retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< "); + } + else { + String nType = vtx.<String>property("aai-node-type").orElse(null); + String vid = vtx.id().toString(); + retArr.add("Found an IN edge (" + lab + ") to this vertex from a [" + nType + "] node with VtxId = " + vid ); + //DEBUG --- + //showPropertiesForEdge( transId, fromAppId, ed ); + } + } + + eI = tVert.edges(Direction.OUT); + if( ! eI.hasNext() ){ + retArr.add("No OUT edges were found for this vertex. "); + } + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + String lab = ed.label(); + TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert); + if( vtx == null ){ + retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< "); + } + else { + String nType = vtx.<String>property("aai-node-type").orElse(null); + String vid = vtx.id().toString(); + retArr.add("Found an OUT edge (" + lab + ") from this vertex to a [" + nType + "] node with VtxId = " + vid ); + //DEBUG --- + //showPropertiesForEdge( transId, fromAppId, ed ); + } + } + return retArr; + } + + + /** + * Show properties for node. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param tVert the t vert + * @return the array list + */ + public static ArrayList <String> showPropertiesForNode( String transId, String fromAppId, TitanVertex tVert ){ + + ArrayList <String> retArr = new ArrayList <String> (); + if( tVert == null ){ + retArr.add("null Node object passed to showPropertiesForNode()\n"); + } + else { + String nodeType = ""; + //String datType = ""; + Object ob = tVert.<Object>property("aai-node-type").orElse(null); + if( ob == null ){ + nodeType = "null"; + } + else{ + nodeType = ob.toString(); + //datType = ob.getClass().getSimpleName(); + } + + retArr.add(" AAINodeType/VtxID for this Node = [" + nodeType + "/" + tVert.id() + "]"); + retArr.add(" Property Detail: "); + Iterator<VertexProperty<Object>> pI = tVert.properties(); + while( pI.hasNext() ){ + VertexProperty<Object> tp = pI.next(); + Object val = tp.value(); + //retArr.add("Prop: [" + tp.getPropertyKey() + "], val = [" + val + "], dataType = " + val.getClass() ); + retArr.add("Prop: [" + tp.key() + "], val = [" + val + "] "); + } + } + return retArr; + } + + + /** + * Gets the node name props. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param nodeType the node type + * @param apiVersion the api version + * @return HashMap of keyProperties + * @throws AAIException the AAI exception + */ + public static Collection <String> getNodeNameProps( String transId, String fromAppId, String nodeType, String apiVersion ) throws AAIException{ + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + Collection <String> nameProps = new ArrayList <String>(); + if( dbMaps.NodeNameProps.containsKey(nodeType) ){ + nameProps = dbMaps.NodeNameProps.get(nodeType); + } + else if( DbEdgeRules.NodeTypeCategory.containsKey(nodeType) ){ + // The passed-in nodeType was really a nodeCategory, theoretically, all the guys in the same + // category should have the same name property -- so if they just give us the category, we will + // just give the name info from the first nodeType we encounter of that category. + Collection <String> nTypeCatCol = DbEdgeRules.NodeTypeCategory.get(nodeType); + Iterator <String> catItr = nTypeCatCol.iterator(); + String catInfo = ""; + if( catItr.hasNext() ){ + // For now, we only look for one. + catInfo = catItr.next(); + } + else { + throw new AAIException("AAI_6105", "Required Property name(s) not found for nodeType = " + nodeType); + } + + String [] flds = catInfo.split(","); + if( flds.length != 4 ){ + throw new AAIException("AAI_6121", "Bad EdgeRule.NodeTypeCategory data (itemCount=" + flds.length + ") for nodeType = [" + nodeType + "]."); + } + + String nodeTypesString = flds[0]; + String [] nodeTypeNames = nodeTypesString.split("\\|"); + if( nodeTypeNames != null && nodeTypeNames.length > 0 ){ + // We'll just use the first one + String nt = nodeTypeNames[0]; + nameProps = dbMaps.NodeNameProps.get(nt); + } + } + + + // Note - it's ok if there was no defined name property for this nodeType. + + return nameProps; + + }// end of getNodeKeyPropNames + + + /** + * Gets the edge tag prop put hash 4 rule. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param edRule the ed rule + * @return the edge tag prop put hash 4 rule + * @throws AAIException the AAI exception + */ + public static HashMap <String,Object> getEdgeTagPropPutHash4Rule( String transId, String fromAppId, String edRule ) + throws AAIException{ + // For a given edgeRule - already pulled out of DbEdgeRules.EdgeRules -- parse out the "tags" that + // need to be set for this kind of edge. + // These are the Boolean properties like, "isParent", "usesResource" etc. + HashMap <String,Object> retEdgePropPutMap = new HashMap <String,Object>(); + + if( (edRule == null) || edRule.equals("") ){ + // No edge rule found for this + throw new AAIException("AAI_6120", "blank edRule passed to getEdgeTagPropPutHash4Rule()"); + } + + int tagCount = DbEdgeRules.EdgeInfoMap.size(); + String [] rules = edRule.split(","); + if( rules.length != tagCount ){ + throw new AAIException("AAI_6121", "Bad EdgeRule data (itemCount =" + rules.length + ") for rule = [" + edRule + "]."); + } + + // In DbEdgeRules.EdgeRules -- What we have as "edRule" is a comma-delimited set of strings. + // The first item is the edgeLabel. + // The second in the list is always "direction" which is always OUT for the way we've implemented it. + // Items starting at "firstTagIndex" and up are all assumed to be booleans that map according to + // tags as defined in EdgeInfoMap. + // Note - if they are tagged as 'reverse', that means they get the tag name with "-REV" on it + for( int i = DbEdgeRules.firstTagIndex; i < tagCount; i++ ){ + String booleanStr = rules[i]; + Integer mapKey = new Integer(i); + String propName = DbEdgeRules.EdgeInfoMap.get(mapKey); + String revPropName = propName + "-REV"; + + if( booleanStr.equals("true") ){ + retEdgePropPutMap.put(propName, true); + retEdgePropPutMap.put(revPropName,false); + } + else if( booleanStr.equals("false") ){ + retEdgePropPutMap.put(propName, false); + retEdgePropPutMap.put(revPropName,false); + } + else if( booleanStr.equals("reverse") ){ + retEdgePropPutMap.put(propName, false); + retEdgePropPutMap.put(revPropName,true); + } + else { + throw new AAIException("AAI_6121", "Bad EdgeRule data for rule = [" + edRule + "], val = [" + booleanStr + "]."); + } + + } + + return retEdgePropPutMap; + + } // End of getEdgeTagPropPutHash() + + + + /** + * Gets the edge tag prop put hash. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param edgeRuleKey the edge rule key + * @return the edge tag prop put hash + * @throws AAIException the AAI exception + */ + public static Map<String, EdgeRule> getEdgeTagPropPutHash( String transId, String fromAppId, String edgeRuleKey ) + throws AAIException{ + // For a given edgeRuleKey (nodeTypeA|nodeTypeB), look up the rule that goes with it in + // DbEdgeRules.EdgeRules and parse out the "tags" that need to be set on each edge. + // These are the Boolean properties like, "isParent", "usesResource" etc. + // Note - this code is also used by the updateEdgeTags.java code + + String[] edgeRuleKeys = edgeRuleKey.split("\\|"); + + if (edgeRuleKeys.length < 2 || ! EdgeRules.getInstance().hasEdgeRule(edgeRuleKeys[0], edgeRuleKeys[1])) { + throw new AAIException("AAI_6120", "Could not find an DbEdgeRule entry for passed edgeRuleKey (nodeTypeA|nodeTypeB): " + edgeRuleKey + "."); + } + + Map<String, EdgeRule> edgeRules = EdgeRules.getInstance().getEdgeRules(edgeRuleKeys[0], edgeRuleKeys[1]); + + return edgeRules; + + } // End of getEdgeTagPropPutHash() + + + /** + * This property was put by newer version of code. + * + * @param apiVersionStr the api version str + * @param nodeType the node type + * @param propName the prop name + * @return true, if successful + * @throws AAIException the AAI exception + */ + private static boolean thisPropertyWasPutByNewerVersionOfCode( String apiVersionStr, + String nodeType, String propName) throws AAIException{ + // We want to return True if the nodeType + property-name combo was introduced AFTER the apiVersion passed. + + int apiVerInt = 0; + int propIntroVerInt = 0; + + if( apiVersionStr == null || apiVersionStr.equals("") ){ + apiVersionStr = org.openecomp.aai.util.AAIApiVersion.get(); + } + apiVerInt = getVerNumFromVerString(apiVersionStr); + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + String propIntroKey = nodeType + "|" + propName; + if( propName.equals("prov-status") ){ + // This is a special case -- The dbMaps from v2 has it in there, but it was introduced half way through. So + // it needs to be catogorized as v3. + propIntroVerInt = 3; + } + else if( ! dbMaps.PropertyVersionInfoMap.containsKey(propIntroKey) ){ + String detail = propIntroKey + " [" + propIntroKey + "] not found in dbMaps.PropertyVersionInfoMap."; + throw new AAIException("AAI_6121", detail); + } + else { + String propIntroVerString = dbMaps.PropertyVersionInfoMap.get(propIntroKey); + propIntroVerInt = getVerNumFromVerString( propIntroVerString ); + } + + if( propIntroVerInt > apiVerInt ){ + return true; + } + else { + return false; + } + + } // End of thisPropertyWasPutByNewerVersionOfCode() + + + /** + * Touch vertex. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param v the v + * @return void + */ + public static void touchVertex( String transId, String fromAppId, TitanVertex v ){ + // We want to "touch" the vertex -- Ie. update it's last-mod-date, last-mod- resource-version to the current date/time + if( v != null ){ + long unixTimeNow = System.currentTimeMillis() / 1000L; + String timeNowInSec = "" + unixTimeNow; + v.property( "aai-last-mod-ts", timeNowInSec ); + v.property( "resource-version", timeNowInSec ); + v.property( "last-mod-source-of-truth", fromAppId ); + } + } // End of touchVertex() + + + /** + * Check prop cardinality. + * + * @param propName the prop name + * @param cardinalityType the cardinality type + * @return boolean + * @throws AAIException the AAI exception + */ + public static boolean checkPropCardinality( String propName, String cardinalityType ) throws AAIException { + + // Return true if the named property is tagged in our dbMaps PropetyDataTypeMap as + // having the passed in cardinality type. + // NOTE: supported cardinality types in dbMaps = "Set" or "List" + // In Titan (and ex5.json), those go in as "SET" and "LIST" + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + if( dbMaps.PropertyDataTypeMap.containsKey(propName) ){ + String propDataType = dbMaps.PropertyDataTypeMap.get(propName); + if( propDataType != null && propDataType.startsWith(cardinalityType) ){ + return true; + } + } + return false; + + } // End of checkPropCardinality() + + /** + * Convert type if needed. + * + * @param propName the prop name + * @param val the val + * @return convertedValue (if it was a String but needed to be a Boolean) + * @throws AAIException the AAI exception + */ + public static Object convertTypeIfNeeded( String propName, Object val ) + throws AAIException { + // Make sure the dataType of the passed-in Object matches what the DB expects + + // NOTE: since this is a fix very late in our dev cycle, we'll just fix the scenarios that + // we're having trouble with which is Strings getting into the db which should be going in as + // Booleans or Integers. + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + if( dbMaps.PropertyDataTypeMap.containsKey(propName) ){ + String dbExpectedDataType = dbMaps.PropertyDataTypeMap.get(propName); + if( dbExpectedDataType != null + && dbExpectedDataType.equals("Boolean") + && val != null + && !(val instanceof Boolean) ){ + String valStr = val.toString().trim(); + if( valStr.equals("true") || valStr.equals("True") || valStr.equals("TRUE") ){ + return Boolean.valueOf("true"); + } + else if( valStr.equals("false") || valStr.equals("False") || valStr.equals("FALSE") ){ + return Boolean.valueOf("false"); + } + else { + String emsg = "Error trying to convert value: [" + valStr + "] to a Boolean for property + " + propName + "\n"; + throw new AAIException("AAI_6120", emsg); + } + } + else if( dbExpectedDataType != null + && dbExpectedDataType.equals("Integer") + && val != null + && !(val.toString().trim().equals("")) + && !(val instanceof Integer) ){ + String valStr = val.toString().trim(); + Integer newInt; + try { + newInt = Integer.valueOf(valStr); + return newInt; + } + catch( Exception e ){ + String emsg = "Error trying to convert value: [" + valStr + "] to an Integer for property + " + propName + "\n"; + throw new AAIException("AAI_6120", emsg); + } + } + } + + // If it didn't need to be converted, just return it. + return val; + + } // End of convertTypeIfNeeded() + + + + /** + * This vertex not reachable. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param v the v + * @param version the version + * @return boolean + */ + public static boolean thisVertexNotReachable( String transId, String fromAppId, TitanTransaction graph, TitanVertex v, String version){ + if( v == null ){ + return true; + } + else { + try { + v.id().toString(); + } + catch( Exception ex ){ + // Could not get this -- sometimes we're holding a vertex object that has gotten deleted, so + // when we try to get stuff from it, we get an "Element Has Been Removed" error from Titan + return true; + } + } + + return false; + + } // End of thisVertexNotReachable() + + /** + * This vertex has bad edges. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param v the v + * @param version the version + * @return boolean + */ + public static boolean thisVertexHasBadEdges( String transId, String fromAppId, TitanTransaction graph, TitanVertex v, String version){ + + Iterator <Edge> eItor = v.edges(Direction.BOTH); + while( eItor.hasNext() ){ + Edge e = null; + e = eItor.next(); + if( e == null ){ + return true; + } + Vertex vIn = e.inVertex(); + if( (vIn == null) || (vIn.<String>property("aai-node-type").orElse(null) == null) ){ + // this is a bad edge because it points to a vertex that isn't there anymore + return true; + } + + Vertex vOut = e.outVertex(); + if( (vOut == null) || (vOut.<String>property("aai-node-type").orElse(null) == null) ){ + // this is a bad edge because it points to a vertex that isn't there anymore + return true; + } + } + + // If we made it to here, the vertex's edges must be ok. + return false; + + } // End of thisVertexHasBadEdges() + + + /** + * This vertex is A phantom. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param v the v + * @param version the version + * @return boolean + * @throws AAIException the AAI exception + */ + public static boolean thisVertexIsAPhantom( String transId, String fromAppId, TitanTransaction graph, TitanVertex v, String version ) + throws AAIException { + + + // The kind of Phantom we're looking for is the kind that we sometimes get when we do a select without + // using key properties. They can be in the database as a vertex, but the indexes that should point to + // them are not working -- so they cannot be used by normal interfaces (like the REST API) which means + // that if we return it, it can mess up a caller who tries to use it. + if( v == null ){ + return true; + } + String thisVid = v.id().toString(); + + DbMaps dbMaps = IngestModelMoxyOxm.dbMapsContainer.get(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP)); + + Object propOb = v.<Object>property("aai-node-type").orElse(null); + if( propOb == null ){ + // This vertex does not have an aai-node-type ---> it is messed up + return true; + } + String nType = propOb.toString(); + if( ! dbMaps.NodeKeyProps.containsKey(nType) ){ + // This node Type does not have keys defined + // This could just be bad reference data, so we will not flag this guy, but we + // can't really do our test... + return false; + } + + HashMap <String,Object> propHashWithKeys = new HashMap<String, Object>(); + Collection <String> keyProps = null; + try { + keyProps = getNodeKeyPropNames(transId, fromAppId, nType, version); + } + catch (AAIException ex) { + // something wrong with getting this guy's key property names - we'll abandon this test... + return false; + } + + Iterator <String> keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + String propName = keyPropI.next(); + String propVal = ""; + Object ob = v.<Object>property(propName).orElse(null); + if( ob != null ){ + propVal = ob.toString(); + } + propHashWithKeys.put(propName, propVal); + } + try { + // Note - We can get more than one back since some nodes need a dep. node for uniqueness. + // We don't care about that -- we just want to make sure we can get this vertex back when + // we're searching with it's indexed fields. + // NOTE - we're passing the skipGroomCheck to getNodes so we don't wind up in an infinite loop + ArrayList <TitanVertex> vertList2 = getNodes( transId, fromAppId, graph, nType, propHashWithKeys, false, version, true ); + Iterator<TitanVertex> iter2 = vertList2.iterator(); + while( iter2.hasNext() ){ + TitanVertex tvx2 = iter2.next(); + String foundId = tvx2.id().toString(); + if( foundId.equals( thisVid ) ){ + // We could get back the vertex by looking it up using key properties... That's good. + return false; + } + } + } + catch (Exception e2) { + //String msg = " Error encountered for this vertex id: [" + thisVid + + // "]. Caught this exception: " + e2.toString(); + // Something messed up - but that doesn't prove that this is a phantom. + return false; + } + + // If we dropped down to here, we have looked but could not pull the vertex out of the + // db using it's key fields, so it gets flagged as a Phantom. + return true; + + } // End of thisVertexIsAPhantom() + + + /** + * Gets the node by unique key. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param aaiUniquekey the aai uniquekey + * @return the node by unique key + */ + public TitanVertex getNodeByUniqueKey(String transId, String fromAppId, TitanTransaction graph, String aaiUniquekey) { + + TitanVertex vert = null; + + Iterator<?> vertI = graph.query().has("aai-unique-key", aaiUniquekey).vertices().iterator(); + + if( vertI != null && vertI.hasNext()) { + // We found a vertex that meets the input criteria. + vert = (TitanVertex) vertI.next(); + } + + return vert; + } + + + +} + diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java new file mode 100644 index 00000000..43f8f76b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/GenTester.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbgen; + +import com.att.eelf.configuration.Configuration; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.openecomp.aai.dbmap.AAIGraph; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; + +import java.util.Properties; + + +public class GenTester { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(GenTester.class); + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args) { + + TitanGraph graph = null; + + // Set the logging file properties to be used by EELFManager + Properties props = System.getProperties(); + props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_CREATE_DB_SCHEMA_LOGBACK_PROPS); + props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); + boolean addDefaultCR = true; + + try { + AAIConfig.init(); + if (args != null && args.length > 0 ){ + if( "genDbRulesOnly".equals(args[0]) ){ + ErrorLogHelper.logError("AAI_3100", + " This option is no longer supported. What was in DbRules is now derived from the OXM files. "); + return; + } + else if ( "GEN_DB_WITH_NO_SCHEMA".equals(args[0]) ){ + // Note this is done to create an empty DB with no Schema so that + // an HBase copyTable can be used to set up a copy of the db. + LOGGER.info(" ---- NOTE --- about to load a graph without doing any schema processing (takes a little while) -------- "); + graph = AAIGraph.getInstance().getGraph(); + + if( graph == null ){ + ErrorLogHelper.logError("AAI_5102", "Error creating Titan graph."); + return; + } + else { + LOGGER.auditEvent("Successfully loaded a Titan graph without doing any schema work. "); + return; + } + } else if ("GEN_DB_WITH_NO_DEFAULT_CR".equals(args[0])) { + addDefaultCR = false; + } + else { + ErrorLogHelper.logError("AAI_3000", "Unrecognized argument passed to GenTester.java: [" + args[0] + "]. "); + LOGGER.error("Unrecognized argument passed to GenTester.java: [" + args[0] + "]. "); + LOGGER.error("Either pass no argument for normal processing, or use 'GEN_DB_WITH_NO_SCHEMA'."); + return; + } + } + + //AAIConfig.init(); + ErrorLogHelper.loadProperties(); + LOGGER.info(" ---- NOTE --- about to open graph (takes a little while)--------;"); + graph = AAIGraph.getInstance().getGraph(); + + if( graph == null ){ + ErrorLogHelper.logError("AAI_5102", "Error creating Titan graph. "); + return; + } + + // Load the propertyKeys, indexes and edge-Labels into the DB + TitanManagement graphMgt = graph.openManagement(); + + LOGGER.info("-- Loading new schema elements into Titan --"); + SchemaGenerator.loadSchemaIntoTitan( graph, graphMgt, addDefaultCR ); + + } catch(Exception ex) { + ErrorLogHelper.logError("AAI_4000", ex.getMessage()); + } + + + if( graph != null ){ + LOGGER.info("-- graph commit"); + graph.tx().commit(); + + LOGGER.info("-- graph shutdown "); + graph.close(); + } + + LOGGER.auditEvent("-- all done, if program does not exit, please kill."); + System.exit(0); + } + +} + + diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/PropertyLimitDesc.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/PropertyLimitDesc.java new file mode 100644 index 00000000..aad519e4 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/PropertyLimitDesc.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbgen; + +public enum PropertyLimitDesc { + SHOW_NONE, + SHOW_ALL, + SHOW_NAME_AND_KEYS_ONLY +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java new file mode 100644 index 00000000..fb8e8977 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbgen/SchemaGenerator.java @@ -0,0 +1,168 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbgen; + + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.collect.Multimap; +import com.thinkaurelius.titan.core.*; +import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.EdgeRule; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.util.AAIConfig; + +import java.util.*; + + +public class SchemaGenerator { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(SchemaGenerator.class); + private static boolean addDefaultCR = true; + + + /** + * Load schema into titan. + * + * @param graph the graph + * @param graphMgmt the graph mgmt + * @param addDefaultCloudRegion the add default cloud region + */ + public static void loadSchemaIntoTitan(final TitanGraph graph, final TitanManagement graphMgmt, boolean addDefaultCloudRegion) { + addDefaultCR = addDefaultCloudRegion; + loadSchemaIntoTitan(graph, graphMgmt); + } + + /** + * Load schema into titan. + * + * @param graph the graph + * @param graphMgmt the graph mgmt + */ + public static void loadSchemaIntoTitan(final TitanGraph graph, final TitanManagement graphMgmt) { + + try { + AAIConfig.init(); + } + catch (Exception ex){ + LOGGER.error(" ERROR - Could not run AAIConfig.init(). ", ex); + System.exit(1); + } + + // NOTE - Titan 0.5.3 doesn't keep a list of legal node Labels. + // They are only used when a vertex is actually being created. Titan 1.1 will keep track (we think). + + + // Use EdgeRules to make sure edgeLabels are defined in the db. NOTE: the multiplicty used here is + // always "MULTI". This is not the same as our internal "Many2Many", "One2One", "One2Many" or "Many2One" + // We use the same edge-label for edges between many different types of nodes and our internal + // multiplicty definitions depends on which two types of nodes are being connected. + + Multimap<String, EdgeRule> edges = null; + Set<String> labels = new HashSet<>(); + try { + edges = EdgeRules.getInstance().getAllRules(); + for (EdgeRule rule : edges.values()) { + labels.add(rule.getLabel()); + } + } catch (AAIException e) { + LOGGER.error("could not get edge rules", e); + System.exit(1); + } + for( String label: labels){ + if( graphMgmt.containsRelationType(label) ) { + LOGGER.debug(" EdgeLabel [" + label + "] already existed. "); + } else { + LOGGER.debug("Making EdgeLabel: [" + label + "]"); + graphMgmt.makeEdgeLabel(label).multiplicity(Multiplicity.valueOf("MULTI")).make(); + } + } + + Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST); + Map<String, Introspector> objs = loader.getAllObjects(); + Map<String, PropertyKey> seenProps = new HashMap<>(); + + for (Introspector obj : objs.values()) { + for (String propName : obj.getProperties()) { + String dbPropName = propName; + Optional<String> alias = obj.getPropertyMetadata(propName, PropertyMetadata.DB_ALIAS); + if (alias.isPresent()) { + dbPropName = alias.get(); + } + if( graphMgmt.containsRelationType(propName) ){ + LOGGER.debug(" PropertyKey [" + propName + "] already existed in the DB. "); + } else { + Class<?> type = obj.getClass(propName); + Cardinality cardinality = Cardinality.SINGLE; + boolean process = false; + if (obj.isListType(propName) && obj.isSimpleGenericType(propName)) { + cardinality = Cardinality.SET; + type = obj.getGenericTypeClass(propName); + process = true; + } else if (obj.isSimpleType(propName)) { + process = true; + } + + if (process) { + + LOGGER.info("Creating PropertyKey: [" + dbPropName + "], ["+ type.getSimpleName() + "], [" + cardinality + "]"); + PropertyKey propK; + if (!seenProps.containsKey(dbPropName)) { + propK = graphMgmt.makePropertyKey(dbPropName).dataType(type).cardinality(cardinality).make(); + seenProps.put(dbPropName, propK); + } else { + propK = seenProps.get(dbPropName); + } + if (graphMgmt.containsGraphIndex(dbPropName)) { + LOGGER.debug(" Index [" + dbPropName + "] already existed in the DB. "); + } else { + if( obj.getIndexedProperties().contains(propName) ){ + if( obj.getUniqueProperties().contains(propName) ){ + LOGGER.info("Add Unique index for PropertyKey: [" + dbPropName + "]"); + graphMgmt.buildIndex(dbPropName,Vertex.class).addKey(propK).unique().buildCompositeIndex(); + } else { + LOGGER.info("Add index for PropertyKey: [" + dbPropName + "]"); + graphMgmt.buildIndex(dbPropName,Vertex.class).addKey(propK).buildCompositeIndex(); + } + } else { + LOGGER.info("No index added for PropertyKey: [" + dbPropName + "]"); + } + } + } + } + } + } + + LOGGER.info("-- About to call graphMgmt commit"); + graphMgmt.commit(); + }// End of loadSchemaIntoTitan() + +} + + diff --git a/aai-core/src/main/java/org/openecomp/aai/dbgraphgen/DbSearchWithTags.java b/aai-core/src/main/java/org/openecomp/aai/dbgraphgen/DbSearchWithTags.java new file mode 100644 index 00000000..cceb950b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbgraphgen/DbSearchWithTags.java @@ -0,0 +1,366 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbgraphgen; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import org.openecomp.aai.util.AAIConfig; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + + +/** + * Database-level Search-Utility class that uses edge-tags to help it navigate the graph. + */ +public class DbSearchWithTags{ + + private EELFLogger LOGGER = EELFManager.getInstance().getLogger(DbSearchWithTags.class); + + private TransactionalGraphEngine engine; + + protected DbSearchWithTags() { + + } + public DbSearchWithTags(Loader loader, TransactionalGraphEngine engine, DBSerializer serializer) { + this.engine = engine; + } + + /** + * Run edge tag query. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param edgeTag the edge tag + * @param searchRootType - root collection point when doing the search + * @param displayRootType - if they want more data than would be included using the searchRootType, this + * lets them specify it. + * @param searchDirectionStr the search direction str + * @param initialFilterHash the initial filter hash + * @param secondaryFilterHash the secondary filter hash + * @param pruneLevel either "none", "searchLevel" or "displayLevel". + * @param retNodeType could be either "all" for the full map, or a single nodeType + * @param trimList list of nodes to "stop" at when collecting data + * @return List<resultSet> + * @throws AAIException the AAI exception + */ + public Tree<Vertex> runEdgeTagQuery( String transId, String fromAppId, + String edgeTag, + String searchRootType, + Map<String,Object> initialFilterHash, + Map<String,Object> secondaryFilterHash) + throws AAIException{ + + final String tag = edgeTag; + final String reverseTag = edgeTag + "-REV"; + //max levels is not used at this time, but may be used again + int maxLevels = 50; // default value + String maxString = AAIConfig.get("aai.edgeTag.proc.max.levels"); + if( maxString != null && !maxString.equals("") ){ + try { + int maxVal = Integer.parseInt(maxString); + maxLevels = maxVal; + } + catch ( Exception nfe ){ + // Don't worry, we will leave "maxLevels" set to the default value it was initialized with + } + } + + // First, we need to use the intialFilter plus the edgeTag to identify a set of search-root-nodes + HashMap <String, Vertex> searchRootHash = identifyTopNodeSet( transId, fromAppId, + edgeTag, searchRootType, initialFilterHash, maxLevels ); + + + Set<String> keySet = searchRootHash.keySet(); + Iterator<String> itr = keySet.iterator(); + String[] arrayOfVertices = new String[keySet.size()]; + int i = 0; + while (itr.hasNext()) { + arrayOfVertices[i] = itr.next(); + i++; + } + //start from all vertices provided + //repeat checking the out edge for the tag and the in edge for reverse tag + //emit all vertices not already seen and start again + //return a tree structure of the vertices and edges touched by this traversal + Tree<Element> resultTree = this.engine.asAdmin().getReadOnlyTraversalSource().V(arrayOfVertices) + .emit().repeat(__.union(__.outE().has(tag, true), __.inE().has(reverseTag, true)).otherV()).tree().next(); + + //the resulting tree includes the edges because of our query, we'll need to remove them + Tree<Vertex> sanitizedTree = removeUnwantedItems(resultTree); + + //if we have secondary filters then check each tree returned for matches + if (!secondaryFilterHash.isEmpty()) { + filterOutResultTrees(sanitizedTree, secondaryFilterHash); + } + return sanitizedTree; + + }// End of runEdgeTagQuery() + + /** + * Identify top node set. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param edgeTag the edge tag + * @param topNodeType the top node type + * @param initialFilterHash the initial filter hash + * @param maxLevels the max levels + * @return List<titanVertex> + * @throws AAIException the AAI exception + */ + public HashMap<String, Vertex> identifyTopNodeSet( String transId, String fromAppId, + String edgeTag, String topNodeType, Map<String,Object> initialFilterHash, int maxLevels ) + throws AAIException { + + final String tag = edgeTag; + final String reverseTag = edgeTag + "-REV"; + HashMap <String, Vertex> topVertHash = new HashMap <>(); + + // Given the filter, we want to select all the nodes of the type the filter tells us that have the + // property they gave us. + // Then looping through those start points, we will look "up" and then "down" to find the set of target/top nodes. + + if( initialFilterHash == null || initialFilterHash.isEmpty() ){ + throw new AAIException("AAI_6118", " initialFilterHash is required for identifyInitialNodeSet() call. \n"); + } + + // NOTE: we're expecting the filter to have a format like this: "nodeType.parameterName:parameterValue" + Iterator <?> it = initialFilterHash.entrySet().iterator(); + // -- DEBUG -- for now we only deal with ONE initial filter parameter + // it would be easy enough to deal with multiple parameters if they all + // applied to the same nodeType. + String propNodeTypeDotName = ""; + String initNodeType = ""; + String initPropName = ""; + + String extraChecks = ""; + + String propVal = ""; + if( it.hasNext() ){ + Map.Entry<?,?> propEntry = (Map.Entry<?,?>) it.next(); + propNodeTypeDotName = (propEntry.getKey()).toString(); + propVal = (propEntry.getValue()).toString(); + } + + GraphTraversalSource source = this.engine.asAdmin().getReadOnlyTraversalSource(); + GraphTraversal<Vertex, Vertex> g; + + int periodLoc = propNodeTypeDotName.indexOf("."); + if( periodLoc <= 0 ){ + throw new AAIException("AAI_6120", "Bad filter param key passed in: [" + propNodeTypeDotName + "]. Expected format = [nodeName.paramName]\n"); + } + else { + initNodeType = propNodeTypeDotName.substring(0,periodLoc); + initPropName = propNodeTypeDotName.substring(periodLoc + 1); + + //there used to be logic here that would do something special for generic-vnf.vnf-name and vserver.vserver-name + //it would attempt a search as they sent it, if nothing came back, try as all upper, try as all lower, then fail + //here it checks whether something comes back or not, if not change the case and try again + if( (initNodeType.equals("generic-vnf") && initPropName.equals("vnf-name")) + || (initNodeType.equals("vserver") && initPropName.equals("vserver-name")) ){ + if (!this.checkKludgeCase(initNodeType, initPropName, propVal)) { + if (this.checkKludgeCase(initNodeType, initPropName, propVal.toUpperCase())) { + propVal = propVal.toUpperCase(); + } else { + if (this.checkKludgeCase(initNodeType, initPropName, propVal)) { + propVal = propVal.toLowerCase(); + } + } + } + } + g = source.V().has(AAIProperties.NODE_TYPE, initNodeType).has(initPropName, propVal); + + //search all around bounded by our edge tag for start nodes that match our topNodeType + if (!topNodeType.equals(initNodeType)) { + + g.union(__.<Vertex>start().until(__.has(AAIProperties.NODE_TYPE, topNodeType)) + .repeat(__.union(__.inE().has(reverseTag, true), __.outE().has(tag, true)).otherV()), + __.<Vertex>start().until(__.has(AAIProperties.NODE_TYPE, topNodeType)) + .repeat(__.union(__.inE().has(tag, true), __.outE().has(reverseTag, true)).otherV())).dedup(); + } + + List<Vertex> results = g.toList(); + + results.forEach(v -> { + topVertHash.put(v.id().toString(), v); + }); + } + if( topVertHash.isEmpty() ){ + // No Vertex was found - throw a not-found exception + throw new AAIException("AAI_6114", "No Node of type " + topNodeType + " found for properties: " + initialFilterHash.toString() + extraChecks); + } + else { + return topVertHash; + } + + }// End identifyInitialNodeSet() + + /** + * This is a carryover from the previous version. + * We may be able to remove this. + * + * @param nodeType + * @param propName + * @param propValue + * @return + */ + private boolean checkKludgeCase(String nodeType, String propName, String propValue) { + return this.engine.getQueryBuilder().getVerticesByIndexedProperty(AAIProperties.NODE_TYPE, nodeType).getVerticesByProperty(propName, propValue).hasNext(); + } + + /** + * This method starts from the top of the tree object and checks each nested tree. + * If that tree does not contain a node (or nodes) that match the filterHash, remove it + * + * @param tree + * @param filterHash + * @throws AAIException + */ + private void filterOutResultTrees(Tree<Vertex> tree, Map<String,Object> filterHash) throws AAIException { + Set<Vertex> topLevelKeys = new LinkedHashSet<>(tree.keySet()); + for (Vertex topLevel : topLevelKeys) { + if (!this.checkVertexWithFilters(topLevel, filterHash)) { + if (!filterOutResultTreesHelper(tree.get(topLevel), filterHash)) { + //if we never found anything to satisfy our filter, remove the entire result tree + tree.remove(topLevel); + } + } + } + } + + /** + * Checks all vertices of a tree with the provided filterHash + * + * @param tree + * @param filterHash + * @return + * @throws AAIException + */ + private boolean filterOutResultTreesHelper(Tree<Vertex> tree, Map<String,Object> filterHash) throws AAIException { + + Set<Vertex> keys = tree.keySet(); + + for (Vertex v : keys) { + if (checkVertexWithFilters(v, filterHash)) { + return true; + } else { + if (filterOutResultTreesHelper(tree.get(v), filterHash)) { + return true; + } + } + } + + return false; + } + /** + * Checks whether a vertex matches the filterHash provided + * + * @param v + * @param filterHash + * @return + * @throws AAIException + */ + private boolean checkVertexWithFilters(Vertex v, Map<String,Object> filterHash) throws AAIException { + Iterator <?> it = filterHash.entrySet().iterator(); + + while( it.hasNext() ){ + Map.Entry<?,?> filtEntry = (Map.Entry<?,?>) it.next(); + String propNodeTypeDotName = (filtEntry.getKey()).toString(); + String value = (filtEntry.getValue()).toString(); + + int periodLoc = propNodeTypeDotName.indexOf("."); + if( periodLoc <= 0 ){ + throw new AAIException("AAI_6120", "Bad filter param key passed in: [" + propNodeTypeDotName + "]. Expected format = [nodeName.paramName]\n"); + } + else { + String nodeType = propNodeTypeDotName.substring(0,periodLoc); + String propertyName = propNodeTypeDotName.substring(periodLoc + 1); + String nt = v.<String>property("aai-node-type").orElse(null); + if( nt.equals( nodeType ) ){ + if( propertyName.equals("vertex-id") ){ + // vertex-id can't be gotten the same way as other properties + String thisVtxId = v.id().toString(); + if( thisVtxId.equals(value) ){ + return true; + } + } + else { + Object thisValObj = v.property(propertyName).orElse(null); + if( thisValObj != null ){ + String thisVal = thisValObj.toString(); + if( thisVal.equals(value) ){ + return true; + } + } + } + } + } + } + + return false; + } + + /** + * Removes every other tree from the originalTree provided. + * It is designed to specifically handle removing unwanted edges from the originalTree + * @param originalTree + * @return + */ + private Tree<Vertex> removeUnwantedItems(Tree<Element> originalTree) { + + Tree<Vertex> newTree = new Tree<>(); + Set<Element> keys = originalTree.keySet(); + for (Element element : keys) { + newTree.put((Vertex)element, removeUnwantedItemsHelper(originalTree.get(element).getTreesAtDepth(2))); + } + + return newTree; + + + } + + private Tree<Vertex> removeUnwantedItemsHelper(List<Tree<Element>> originalTrees) { + Tree<Vertex> newTree = new Tree<>(); + for (Tree<Element> tree : originalTrees) { + newTree.addTree(removeUnwantedItems(tree)); + } + + return newTree; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmap/AAIGraph.java b/aai-core/src/main/java/org/openecomp/aai/dbmap/AAIGraph.java new file mode 100644 index 00000000..b4be1a37 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbmap/AAIGraph.java @@ -0,0 +1,187 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbmap; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.lang.exception.ExceptionUtils; +import org.apache.tinkerpop.gremlin.structure.io.IoCore; + +import org.openecomp.aai.dbgen.SchemaGenerator; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.util.AAIConstants; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; +import com.thinkaurelius.titan.core.schema.TitanManagement; + +/** + * Database Mapping class which acts as the middle man between the REST + * interface objects and Titan DB objects. This class provides methods to commit + * the objects received on the REST interface into the Titan graph database as + * vertices and edges. Transactions are also managed here by using a TitanGraph + * object to load, commit/rollback and shutdown for each request. The data model + * rules such as keys/required properties are handled by calling DBMeth methods + * which are driven by a specification file in json. + * + + */ +public class AAIGraph { + + protected Map<String, TitanGraph> graphs = new HashMap<>(); + protected static final String COMPONENT = "aaidbmap"; + private final String REALTIME_DB = "realtime"; + private final String CACHED_DB = "cached"; + private final EELFLogger logger = EELFManager.getInstance().getLogger(this.getClass().getSimpleName()); + + + /** + * Instantiates a new AAI graph. + */ + private AAIGraph() { + try { + String rtConfig = System.getProperty("realtime.db.config"); + String cachedConfig = System.getProperty("cached.db.config"); + if (rtConfig == null) { + rtConfig = AAIConstants.REALTIME_DB_CONFIG; + } + if (cachedConfig == null) { + cachedConfig = AAIConstants.CACHED_DB_CONFIG; + } + this.loadGraph(REALTIME_DB, rtConfig); + this.loadGraph(CACHED_DB, cachedConfig); + } catch (Exception e) { + throw new RuntimeException("Failed to instantiate graphs", e); + } + } + + private static class Helper { + private static final AAIGraph INSTANCE = new AAIGraph(); + } + + /** + * Gets the single instance of AAIGraph. + * + * @return single instance of AAIGraph + */ + public static AAIGraph getInstance() { + return Helper.INSTANCE; + } + + private void loadGraph(String name, String configPath) throws AAIException { + try { + final TitanGraph graph = TitanFactory.open(configPath); + InputStream is = new FileInputStream(configPath); + Properties graphProps = new Properties(); + graphProps.load(is); + + if (graphProps.get("storage.backend").equals("inmemory")) { + // Load the propertyKeys, indexes and edge-Labels into the DB + loadSchema(graph); + if (graphProps.containsKey("load.snapshot.file")) { + String value = graphProps.getProperty("load.snapshot.file"); + if ("true".equals(value)) { + try { + String location = System.getProperty("snapshot.location"); + logAndPrint(logger, "Loading snapshot to inmemory graph."); + TitanTransaction transaction = graph.newTransaction(); + transaction.io(IoCore.graphson()).readGraph(location); + transaction.commit(); + logAndPrint(logger, "Snapshot loaded to inmemory graph."); + } catch (IOException e) { + graph.close(); + logAndPrint(logger, "ERROR: Could not load datasnapshot to in memory graph. \n" + ExceptionUtils.getFullStackTrace(e)); + System.exit(0); + } + } + } + } + + if (graph == null) { + throw new AAIException("AAI_5102"); + } + + graphs.put(name, graph); + } catch (FileNotFoundException fnfe) { + throw new AAIException("AAI_4001"); + } catch (IOException e) { + throw new AAIException("AAI_4002"); + + } + } + + private void loadSchema(TitanGraph graph) { + // Load the propertyKeys, indexes and edge-Labels into the DB + TitanManagement graphMgt = graph.openManagement(); + + System.out.println("-- loading schema into Titan"); + SchemaGenerator.loadSchemaIntoTitan( graph, graphMgt ); + } + + /** + * Graph shutdown. + */ + public void graphShutdown() { + graphs.get(REALTIME_DB).close(); + } + + /** + * Gets the graph. + * + * @return the graph + */ + public TitanGraph getGraph() { + return graphs.get(REALTIME_DB); + } + + public void graphShutdown(DBConnectionType connectionType) { + + graphs.get(this.getGraphName(connectionType)).close(); + } + + public TitanGraph getGraph(DBConnectionType connectionType) { + return graphs.get(this.getGraphName(connectionType)); + } + + private String getGraphName(DBConnectionType connectionType) { + String graphName = ""; + if (DBConnectionType.CACHED.equals(connectionType)) { + graphName = this.CACHED_DB; + } else if (DBConnectionType.REALTIME.equals(connectionType)) { + graphName = this.REALTIME_DB; + } + + return graphName; + } + + private void logAndPrint(EELFLogger logger, String msg) { + System.out.println(msg); + logger.info(msg); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmap/DBConnectionType.java b/aai-core/src/main/java/org/openecomp/aai/dbmap/DBConnectionType.java new file mode 100644 index 00000000..a2c01e21 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbmap/DBConnectionType.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbmap; + +public enum DBConnectionType { + REALTIME, + CACHED +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRules.java new file mode 100644 index 00000000..9a56fc69 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRules.java @@ -0,0 +1,472 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbmodel; + +import java.util.HashMap; +import java.util.Map; + +import com.google.common.collect.ImmutableSetMultimap; +import com.google.common.collect.Multimap; + +public class DbEdgeRules { + + /* + * The EdgeRules data is set up as a key (fromNodeTypeA|toNodeTypeB) mapped + * to a string which holds the info we need to build an edge from nodeTypeA + * to nodeTypeB. Note -- the MultiMap will let us define more than one type + * of edge between a given pair of nodeTypes, but for now we never define + * more than one. + * + * The edgeInfo part is comma separated and looks like this: + * "edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA" This + * format is encoded into the EdgeInfoMap below. + * MultiplicityRule can be either "Many2Many", "Many2One", "One2Many" or "One2One" + * The values for the things after multiplicityRule can be either "true", "false" or "reverse". "reverse" is + * really saying that this tag does apply, but the edge will be traversed + * the opposite way from the same tag that just has "true". + */ + public static final Map<Integer, String> EdgeInfoMap; + static { + EdgeInfoMap = new HashMap<Integer, String>(); + EdgeInfoMap.put(0, "edgeLabel"); + EdgeInfoMap.put(1, "direction"); + EdgeInfoMap.put(2, "multiplicityRule"); + EdgeInfoMap.put(3, "isParent"); + EdgeInfoMap.put(4, "usesResource"); + EdgeInfoMap.put(5, "hasDelTarget"); + EdgeInfoMap.put(6, "SVC-INFRA"); + } + + public static Integer firstTagIndex = 3; + + public static final Multimap<String, String> EdgeRules = new ImmutableSetMultimap.Builder<String, String>() + .putAll("availability-zone|complex", + "groupsResourcesIn,OUT,Many2Many,false,false,false,false") + .putAll("availability-zone|service-capability", + "supportsServiceCapability,OUT,Many2Many,false,false,false,false") + .putAll("cloud-region|complex", + "locatedIn,OUT,Many2One,false,false,false,false") + .putAll("cloud-region|l3-network", + "uses,OUT,Many2Many,false,false,false,false") + .putAll("cloud-region|tenant", + "has,OUT,One2Many,true,false,false,reverse") + .putAll("cloud-region|image", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|flavor", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|availability-zone", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|oam-network", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|dvs-switch", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|volume-group", + "has,OUT,One2Many,true,true,false,false") + .putAll("cloud-region|group-assignment", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|snapshot", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|zone", + "isMemberOf,OUT,Many2One,false,false,false,false") + .putAll("complex|ctag-pool", + "hasCtagPool,OUT,Many2Many,true,false,false,false") + .putAll("complex|l3-network", + "usesL3Network,OUT,Many2Many,false,false,false,true") + .putAll("ctag-pool|availability-zone", + "supportsAvailabilityZone,OUT,Many2Many,false,false,false,false") + .putAll("customer|service-subscription", + "subscribesTo,OUT,Many2Many,true,false,false,reverse") + .putAll("dvs-switch|availability-zone", + "existsIn,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("generic-vnf|availability-zone", + "hasAvailabilityZone,OUT,Many2Many,false,false,false,true") + .putAll("generic-vnf|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,true") + .putAll("generic-vnf|l3-network", + "usesL3Network,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|pserver", + "runsOnPserver,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|vnf-image", + "usesVnfImage,OUT,Many2One,false,false,false,true") + .putAll("generic-vnf|vserver", + "runsOnVserver,OUT,One2Many,false,true,false,true") + .putAll("generic-vnf|service-instance", + "hasInstance,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|site-pair-set", + "hasSitePairSet,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|network-profile", + "hasNetworkProfile,OUT,Many2Many,false,false,false,false") + .putAll("group-assignment|tenant", + "has,OUT,Many2Many,false,false,false,false") + .putAll("group-assignment|pserver", + "has,OUT,One2Many,false,false,false,false") + .putAll("image|metadata", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("image|metadatum", + "hasMetaDatum,OUT,Many2Many,true,false,false,false") + .putAll("l-interface|instance-group", + "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("l-interface|l3-interface-ipv4-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("l-interface|l3-interface-ipv6-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("l-interface|l-interface", + "has,OUT,One2Many,true,false,false,true") + .putAll("l-interface|logical-link", + "usesLogicalLink,OUT,Many2Many,false,false,true,true") + .putAll("lag-interface|logical-link", + "uses,OUT,Many2Many,false,false,true,true") + .putAll("l-interface|vlan","hasVlan,OUT,Many2Many,true,false,false,false") + .putAll("l-interface|sriov-vf","has,OUT,One2One,true,false,false,false") + .putAll("l3-interface-ipv4-address-list|instance-group", + "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("l3-interface-ipv6-address-list|instance-group", + "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("l3-interface-ipv4-address-list|l3-network", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv6-address-list|l3-network", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv4-address-list|subnet", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv6-address-list|subnet", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-network|vpn-binding", + "usesVpnBinding,OUT,Many2Many,false,false,false,false") + .putAll("l3-network|subnet", + "hasSubnet,OUT,Many2Many,true,false,false,reverse") + .putAll("l3-network|service-instance", + "hasInstance,OUT,Many2Many,false,false,false,reverse") + .putAll("l3-network|ctag-assignment", + "hasCtagAssignment,OUT,Many2Many,true,false,false,true") + .putAll("l3-network|network-policy", + "uses,OUT,Many2Many,false,false,false,true") + .putAll("l3-network|segmentation-assignment", + "has,OUT,One2Many,true,false,false,false") + .putAll("l3-network|route-table-reference", + "uses,OUT,Many2Many,false,false,false,false") + .putAll("lag-interface|lag-link", + "usesLAGLink,OUT,Many2Many,false,true,true,true") + .putAll("lag-interface|p-interface", + "usesPInterface,OUT,Many2Many,false,true,false,true") + .putAll("lag-interface|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("logical-link|lag-link", + "usesLAGLink,OUT,Many2Many,false,true,false,true") + .putAll("logical-link|pnf", + "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|logical-link", + "uses,OUT,One2Many,false,false,false,true") + .putAll("model|model-ver", + "has,OUT,One2Many,true,false,false,false") + .putAll("model-ver|model-element", + "startsWith,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-ver", + "isA,OUT,Many2One,false,false,false,false") + .putAll("model-ver|metadatum", + "hasMetaData,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-element", + "connectsTo,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-constraint", + "uses,OUT,One2Many,true,false,false,false") + .putAll("model-element|constrained-element-set", + "connectsTo,OUT,One2Many,true,false,false,false") + .putAll("model-constraint|constrained-element-set", + "uses,OUT,One2Many,true,false,false,false") + .putAll("constrained-element-set|element-choice-set", + "uses,OUT,One2Many,true,false,false,false") + .putAll("element-choice-set|model-element", + "has,OUT,One2Many,true,false,false,false") + .putAll("named-query|model", + "relatedTo,OUT,One2Many,false,false,false,false") + .putAll("named-query|named-query-element", + "startsWith,OUT,One2One,true,false,false,false") + .putAll("named-query-element|named-query-element", + "connectsTo,OUT,Many2Many,true,false,false,false") + .putAll("named-query-element|model", + "isA,OUT,Many2One,false,false,false,false") + .putAll("named-query-element|property-constraint", + "uses,OUT,One2Many,true,false,false,false") + .putAll("named-query-element|related-lookup", + "uses,OUT,One2Many,true,false,false,false") + .putAll("instance-group|model", + "targets,OUT,Many2Many,false,false,false,false") + .putAll("newvce|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,false") + .putAll("oam-network|complex", + "definedFor,OUT,Many2Many,false,false,false,false") + .putAll("oam-network|service-capability", + "supportsServiceCapability,OUT,Many2Many,false,false,false,false") + .putAll("p-interface|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("p-interface|physical-link", + "usesPhysicalLink,OUT,Many2Many,false,false,true,false") + .putAll("p-interface|logical-link", + "usesLogicalLink,OUT,Many2One,false,false,false,true") + .putAll("port-group|cvlan-tag", "hasCTag,OUT,Many2Many,true,true,false,true") + .putAll("pserver|complex", "locatedIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|cloud-region","locatedIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|availability-zone","existsIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,true") + .putAll("pserver|p-interface", + "hasPinterface,OUT,Many2Many,true,true,false,true") + .putAll("pserver|zone", + "isMemberOf,OUT,Many2One,false,false,false,false") + .putAll("pnf|p-interface", + "hasPinterface,OUT,Many2Many,true,true,false,true") + .putAll("pnf|lag-interface", + "has,OUT,One2Many,true,false,false,true") + .putAll("pnf|complex", + "locatedIn,OUT,Many2One,false,false,false,false") + .putAll("pnf|instance-group", + "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("pnf|zone", + "isMemberOf,OUT,Many2One,false,false,false,false") + .putAll("service-instance|cvlan-tag", + "hasIPAGFacingVLAN,OUT,Many2Many,false,true,false,false") + .putAll("service-instance|pnf", + "uses,OUT,One2Many,false,true,false,false") + .putAll("service-subscription|service-instance", + "hasInstance,OUT,Many2Many,true,false,false,reverse") + .putAll("site-pair-set|routing-instance", + "hasRoutingInstance,OUT,Many2Many,true,false,false,false") + .putAll("routing-instance|site-pair", + "hasSitePair,OUT,Many2Many,true,false,false,false") + .putAll("site-pair|class-of-service", + "hasClassOfService,OUT,Many2Many,true,false,false,false") + .putAll("tenant|l3-network", + "usesL3Network,OUT,Many2Many,false,false,false,false") + .putAll("tenant|service-subscription", + "relatedTo,OUT,Many2Many,false,false,false,false") + .putAll("tenant|vserver", "owns,OUT,One2Many,true,false,false,reverse") + .putAll("vce|availability-zone", + "hasAvailabilityZone,OUT,Many2Many,false,false,false,false") + .putAll("vce|complex", "locatedIn,OUT,Many2Many,false,false,false,true") + .putAll("vce|port-group", "hasPortGroup,OUT,Many2Many,true,true,false,true") + .putAll("vce|vserver", "runsOnVserver,OUT,Many2Many,false,true,false,true") + .putAll("vce|service-instance", + "hasServiceInstance,OUT,Many2Many,false,false,false,reverse") + .putAll("virtual-data-center|generic-vnf", + "hasVNF,OUT,Many2Many,false,false,false,reverse") + .putAll("vlan|l3-interface-ipv4-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("vlan|l3-interface-ipv6-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("vpe|complex", "locatedIn,OUT,Many2Many,false,false,false,false") + .putAll("vpe|ctag-pool", "usesCtagPool,OUT,Many2Many,false,false,false,false") + .putAll("vpe|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,false") + .putAll("vpe|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,false") + .putAll("vpe|vserver", "runsOnVserver,OUT,Many2Many,false,true,false,false") + .putAll("vpls-pe|complex", "locatedIn,OUT,Many2Many,false,false,false,false") + .putAll("vpls-pe|ctag-pool", + "usesCtagPool,OUT,Many2Many,false,false,false,false") + .putAll("vpls-pe|p-interface", + "hasPinterface,OUT,Many2Many,true,false,false,false") + .putAll("vpls-pe|lag-interface", + "hasLAGinterface,OUT,Many2Many,true,false,false,false") + .putAll("vserver|flavor", "hasFlavor,OUT,Many2One,false,false,false,true") + .putAll("vserver|image", "hasImage,OUT,Many2One,false,false,false,true") + .putAll("vserver|ipaddress", + "hasIpAddress,OUT,Many2Many,true,true,false,false") + .putAll("vserver|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("vserver|pserver", + "runsOnPserver,OUT,Many2One,false,true,false,true") + .putAll("vserver|volume", "hasVolume,OUT,Many2Many,true,true,false,true") + .putAll("vserver|vnfc", "hosts,OUT,Many2Many,false,true,false,true") + .putAll("vserver|snapshot", "uses,OUT,One2One,false,false,false,true") + .putAll("service-instance|connector", "uses,OUT,Many2Many,false,true,false,false") + .putAll("service-instance|metadatum", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("service-instance|logical-link", "uses,OUT,Many2Many,false,false,true,false") + .putAll("service-instance|vlan", "dependsOn,OUT,One2Many,false,true,false,false") + .putAll("service-instance|service-instance", "dependsOn,OUT,One2Many,false,true,false,false") + .putAll("connector|virtual-data-center", "contains,OUT,Many2Many,false,false,false,false") + .putAll("connector|metadatum", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("virtual-data-center|logical-link", "contains,OUT,Many2Many,false,true,false,false") + .putAll("logical-link|generic-vnf", "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|pserver", "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("vlan|multicast-configuration", "uses,OUT,Many2Many,false,true,false,false") + .putAll("volume-group|complex", "existsIn,OUT,Many2Many,false,false,false,true") + .putAll("volume-group|tenant", "belongsTo,OUT,Many2Many,false,false,false,true") + .putAll("ipsec-configuration|vig-server", "hasVigServer,OUT,One2Many,true,true,false,false") + .putAll("generic-vnf|ipsec-configuration", "uses,OUT,Many2One,false,true,false,false") + .putAll("vf-module|volume-group", "uses,OUT,One2One,false,false,false,true") + .putAll("vserver|vf-module", "isPartOf,OUT,Many2One,false,false,false,true") + .putAll("vf-module|l3-network", "uses,OUT,Many2Many,false,false,false,true") + .putAll("vf-module|vnfc", "uses,OUT,One2Many,false,false,true,true") + .putAll("generic-vnf|vf-module", "has,OUT,One2Many,true,false,false,true") + .putAll("generic-vnf|volume-group", "uses,OUT,One2Many,false,false,false,true") + .putAll("generic-vnf|vnfc", "uses,OUT,One2Many,false,false,true,true") + .putAll("vlan|logical-link", "usesLogicalLink,OUT,Many2Many,false,false,true,true") + .putAll("vpn-binding|route-target", "has,OUT,One2Many,true,false,false,false") + .putAll("service-instance|ctag-assignment","uses,OUT,One2Many,false,false,false,false") + // The next edge is needed in 1702 but will be worked in user story AAI-6848 + //.putAll("service-instance|allotted-resource", "uses,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|generic-vnf", "isPartOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|l3-network", "isPartOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|instance-group", "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|network-policy", "uses,OUT,One2One,false,false,false,false") + .putAll("allotted-resource|vlan", "isPartOf,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|instance-group", "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("service-instance|instance-group", "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|tunnel-xconnect", "has,OUT,One2One,true,false,false,false") + .putAll("logical-link|cloud-region", "existsIn,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|vpn-binding", "uses,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|entitlement", "has,OUT,One2Many,true,false,false,false") + .putAll("generic-vnf|license", "has,OUT,One2Many,true,false,false,false") + .putAll("vce|entitlement", "has,OUT,One2Many,true,false,false,false") + .putAll("vce|license", "has,OUT,One2Many,true,false,false,false") + .putAll("vpe|entitlement", "has,OUT,One2Many,true,false,false,false") + .putAll("vpe|license", "has,OUT,One2Many,true,false,false,false") + .putAll("zone|complex", "existsIn,OUT,Many2One,false,false,false,false") + .putAll("service-instance|allotted-resource", "has,OUT,Many2Many,true,false,false,false") + .putAll("service-instance|allotted-resource", "uses,OUT,Many2Many,false,false,false,false") + .build(); + + public static final Multimap<String, String> DefaultDeleteScope = new ImmutableSetMultimap.Builder<String, String>() + .putAll("customer", "CASCADE_TO_CHILDREN") + .putAll("cloud-region", "THIS_NODE_ONLY") + .putAll("service-subscription", "CASCADE_TO_CHILDREN") + .putAll("service-instance", "CASCADE_TO_CHILDREN") + .putAll("vce", "CASCADE_TO_CHILDREN") + .putAll("port-group", "CASCADE_TO_CHILDREN") + .putAll("cvlan-tag", "THIS_NODE_ONLY") + .putAll("tenant", "THIS_NODE_ONLY") + .putAll("vserver", "CASCADE_TO_CHILDREN") + .putAll("volume", "THIS_NODE_ONLY") + .putAll("ipaddress", "THIS_NODE_ONLY") + .putAll("image", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("pserver", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("availability-zone", "ERROR_IF_ANY_IN_EDGES") + .putAll("oam-network", "ERROR_IF_ANY_IN_EDGES") + .putAll("dvs-switch", "THIS_NODE_ONLY") + .putAll("service-capability", "ERROR_IF_ANY_IN_EDGES") + .putAll("complex", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("flavor", "ERROR_IF_ANY_IN_EDGES") + .putAll("metadata", "THIS_NODE_ONLY") + .putAll("metadatum", "THIS_NODE_ONLY") + .putAll("model", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("model-ver", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("model-element", "CASCADE_TO_CHILDREN") + .putAll("model-constraint", "CASCADE_TO_CHILDREN") + .putAll("property-constraint", "CASCADE_TO_CHILDREN") + .putAll("related-lookup", "CASCADE_TO_CHILDREN") + .putAll("constrained-element-set", "CASCADE_TO_CHILDREN") + .putAll("element-choice-set", "CASCADE_TO_CHILDREN") + .putAll("named-query", "CASCADE_TO_CHILDREN") + .putAll("named-query-element", "CASCADE_TO_CHILDREN") + .putAll("network-policy", "THIS_NODE_ONLY") + .putAll("collect-lookup", "THIS_NODE_ONLY") + .putAll("service", "ERROR_IF_ANY_IN_EDGES") + .putAll("newvce", "CASCADE_TO_CHILDREN") + .putAll("vpe", "CASCADE_TO_CHILDREN") + .putAll("vpls-pe", "CASCADE_TO_CHILDREN") + .putAll("l-interface", "CASCADE_TO_CHILDREN") + .putAll("vlan", "CASCADE_TO_CHILDREN") + .putAll("p-interface", "CASCADE_TO_CHILDREN") + .putAll("l3-interface-ipv6-address-list", "THIS_NODE_ONLY") + .putAll("l3-interface-ipv4-address-list", "THIS_NODE_ONLY") + .putAll("logical-link", "THIS_NODE_ONLY") + .putAll("physical-link", "THIS_NODE_ONLY") + .putAll("lag-link", "THIS_NODE_ONLY") + .putAll("lag-interface", "CASCADE_TO_CHILDREN") + .putAll("virtual-data-center", "CASCADE_TO_CHILDREN") + .putAll("generic-vnf", "CASCADE_TO_CHILDREN") + .putAll("l3-network", "CASCADE_TO_CHILDREN") + .putAll("ctag-pool", "THIS_NODE_ONLY") + .putAll("subnet", "THIS_NODE_ONLY") + .putAll("sriov-vf", "THIS_NODE_ONLY") + .putAll("vpn-binding", "ERROR_IF_ANY_IN_EDGES") + .putAll("vnf-image", "ERROR_IF_ANY_IN_EDGES") + .putAll("site-pair-set", "CASCADE_TO_CHILDREN") + .putAll("routing-instance", "CASCADE_TO_CHILDREN") + .putAll("site-pair", "CASCADE_TO_CHILDREN") + .putAll("class-of-service", "THIS_NODE_ONLY") + .putAll("connector", "CASCADE_TO_CHILDREN") + .putAll("vnfc", "THIS_NODE_ONLY") + .putAll("multicast-configuration", "THIS_NODE_ONLY") + .putAll("volume-group", "THIS_NODE_ONLY") + .putAll("ctag-assignment", "THIS_NODE_ONLY") + .putAll("pnf", "CASCADE_TO_CHILDREN") + .putAll("ipsec-configuration", "CASCADE_TO_CHILDREN") + .putAll("vig-server", "THIS_NODE_ONLY") + .putAll("vf-module", "THIS_NODE_ONLY") + .putAll("snapshot", "THIS_NODE_ONLY") + .putAll("group-assignment", "THIS_NODE_ONLY") + .putAll("segmentation-assignment", "THIS_NODE_ONLY") + .putAll("route-table-reference", "THIS_NODE_ONLY") + .putAll("network-profile", "THIS_NODE_ONLY") + .putAll("allotted-resource", "CASCADE_TO_CHILDREN") + .putAll("tunnel-xconnect", "THIS_NODE_ONLY") + .putAll("instance-group","THIS_NODE_ONLY") + .putAll("entitlement","THIS_NODE_ONLY") + .putAll("license","THIS_NODE_ONLY") + .putAll("zone", "THIS_NODE_ONLY") + .putAll("route-target", "CASCADE_TO_CHILDREN").build(); + + // NOTE -- Sorry, this is ugly, but we are mapping the nodeTypeCategory two + // ways just to + // make the code a little less bulky. But that means that we need to ensure + // that + // nodeTypeCategory and nodeTypeCatMap are kept in synch. + + // NodeTypeCategory: key is: nodeTypeCategory, value is: + // "nodeTypes,keyProperties,AltKeyProps,depNode4UniquenessFlag" + public static final Multimap<String, String> NodeTypeCategory = new ImmutableSetMultimap.Builder<String, String>() + .putAll("vnf", "vce|vpe|generic-vnf,vnf-id,,true").build(); + + // NodeTypeCatMap: key is nodeType; value is: "nodeTypeCategory" + // So -- we're assuming that a nodeType can only be in one nodeTypeCategory. + public static final Map<String, String> NodeTypeCatMap; + static { + NodeTypeCatMap = new HashMap<String, String>(); + NodeTypeCatMap.put("vpe", "vnf"); + NodeTypeCatMap.put("vce", "vnf"); + NodeTypeCatMap.put("generic-vnf", "vnf"); + } + + // ReservedPropNames: keys are property names of (node) properties that are + // common to all nodes and + // should not be removed if not passed in on an UPDATE request. + public static final Map<String, String> ReservedPropNames; + static { + ReservedPropNames = new HashMap<String, String>(); + ReservedPropNames.put("source-of-truth", ""); + ReservedPropNames.put("last-mod-source-of-truth", ""); + ReservedPropNames.put("aai-created-ts", ""); + ReservedPropNames.put("aai-last-mod-ts", ""); + } + + // This just lists which node types can be connected to themselves recursively. + // It's temporary - since DbEdgeRules is going to be overhauled in 16-10, this will + // get generated automatically. But for 1607, it can work like this. + public static final Map<String, String> CanBeRecursiveNT; + static { + CanBeRecursiveNT = new HashMap<String, String>(); + CanBeRecursiveNT.put("model-element", ""); + CanBeRecursiveNT.put("service-instance", ""); + CanBeRecursiveNT.put("named-query-element", ""); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/v8/gen/DbEdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/v8/gen/DbEdgeRules.java new file mode 100644 index 00000000..fac0ae48 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbmodel/v8/gen/DbEdgeRules.java @@ -0,0 +1,300 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbmodel.v8.gen; + +import java.util.HashMap; +import java.util.Map; + +import com.google.common.collect.ImmutableSetMultimap; +import com.google.common.collect.Multimap; + +public class DbEdgeRules { + + /* + * The EdgeRules data is set up as a key (fromNodeTypeA|toNodeTypeB) mapped + * to a string which holds the info we need to build an edge from nodeTypeA + * to nodeTypeB. Note -- the MultiMap will let us define more than one type + * of edge between a given pair of nodeTypes, but for now we never define + * more than one. + * + * The edgeInfo part is comma separated and looks like this: + * "edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA" This + * format is encoded into the EdgeInfoMap below. + * MultiplicityRule can be either "Many2Many", "Many2One", "One2Many" or "One2One" + * The values for the things after multiplicityRule can be either "true", "false" or "reverse". "reverse" is + * really saying that this tag does apply, but the edge will be traversed + * the opposite way from the same tag that just has "true". + */ + public static final Map<Integer, String> EdgeInfoMap; + static { + EdgeInfoMap = new HashMap<Integer, String>(); + EdgeInfoMap.put(0, "edgeLabel"); + EdgeInfoMap.put(1, "direction"); + EdgeInfoMap.put(2, "multiplicityRule"); + EdgeInfoMap.put(3, "isParent"); + EdgeInfoMap.put(4, "usesResource"); + EdgeInfoMap.put(5, "hasDelTarget"); + EdgeInfoMap.put(6, "SVC-INFRA"); + } + + public static Integer firstTagIndex = 3; + + public static final Multimap<String, String> EdgeRules = new ImmutableSetMultimap.Builder<String, String>() + .putAll("cloud-region|l3-network", + "uses,OUT,Many2Many,false,false,false,false") + .putAll("cloud-region|tenant", + "has,OUT,One2Many,true,false,false,reverse") + .putAll("cloud-region|image", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|flavor", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|availability-zone", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|volume-group", + "has,OUT,One2Many,true,true,false,false") + .putAll("cloud-region|group-assignment", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|snapshot", + "has,OUT,One2Many,true,false,false,false") + .putAll("customer|service-subscription", + "subscribesTo,OUT,Many2Many,true,false,false,reverse") + .putAll("generic-vnf|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("generic-vnf|availability-zone", + "hasAvailabilityZone,OUT,Many2Many,false,false,false,true") + .putAll("generic-vnf|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,true") + .putAll("generic-vnf|l3-network", + "usesL3Network,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|pserver", + "runsOnPserver,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|vserver", + "runsOnVserver,OUT,One2Many,false,true,false,true") + .putAll("generic-vnf|service-instance", + "hasInstance,OUT,Many2Many,false,true,false,true") + .putAll("group-assignment|tenant", + "has,OUT,Many2Many,false,false,false,false") + .putAll("group-assignment|pserver", + "has,OUT,One2Many,false,false,false,false") + .putAll("image|metadata", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("image|metadatum", + "hasMetaDatum,OUT,Many2Many,true,false,false,false") + .putAll("l-interface|l3-interface-ipv4-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("l-interface|l3-interface-ipv6-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("l-interface|logical-link", + "usesLogicalLink,OUT,Many2Many,false,false,true,true") + .putAll("l-interface|vlan","hasVlan,OUT,Many2Many,true,false,false,false") + .putAll("l3-interface-ipv4-address-list|l3-network", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv6-address-list|l3-network", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv4-address-list|subnet", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv6-address-list|subnet", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-network|subnet", + "hasSubnet,OUT,Many2Many,true,false,false,reverse") + .putAll("l3-network|service-instance", + "hasInstance,OUT,Many2Many,false,false,false,reverse") + .putAll("l3-network|ctag-assignment", + "hasCtagAssignment,OUT,Many2Many,true,false,false,true") + .putAll("l3-network|segmentation-assignment", + "has,OUT,One2Many,true,false,false,false") + .putAll("lag-interface|p-interface", + "usesPInterface,OUT,Many2Many,false,true,false,true") + .putAll("lag-interface|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("logical-link|pnf", + "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|logical-link", + "uses,OUT,One2Many,false,false,false,true") + .putAll("model|model-element", + "startsWith,OUT,One2Many,true,false,false,false") + .putAll("model-element|model", + "isA,OUT,Many2One,false,false,false,false") + .putAll("model|metadatum", + "hasMetaData,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-element", + "connectsTo,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-constraint", + "uses,OUT,One2Many,true,false,false,false") + .putAll("model-element|constrained-element-set", + "connectsTo,OUT,One2Many,true,false,false,false") + .putAll("model-constraint|constrained-element-set", + "uses,OUT,One2Many,true,false,false,false") + .putAll("constrained-element-set|element-choice-set", + "uses,OUT,One2Many,true,false,false,false") + .putAll("element-choice-set|model-element", + "has,OUT,One2Many,true,false,false,false") + .putAll("named-query|model", + "relatedTo,OUT,One2Many,false,false,false,false") + .putAll("named-query|named-query-element", + "startsWith,OUT,One2One,true,false,false,false") + .putAll("named-query-element|named-query-element", + "connectsTo,OUT,Many2Many,true,false,false,false") + .putAll("named-query-element|model", + "isA,OUT,Many2One,false,false,false,false") + .putAll("named-query-element|property-constraint", + "uses,OUT,One2Many,true,false,false,false") + .putAll("named-query-element|related-lookup", + "uses,OUT,One2Many,true,false,false,false") + .putAll("p-interface|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("p-interface|physical-link", + "usesPhysicalLink,OUT,Many2Many,false,false,true,false") + .putAll("p-interface|logical-link", + "usesLogicalLink,OUT,Many2One,false,false,false,true") + .putAll("pserver|cloud-region","locatedIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|availability-zone","existsIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,true") + .putAll("pserver|p-interface", + "hasPinterface,OUT,Many2Many,true,true,false,true") + .putAll("pnf|p-interface", + "hasPinterface,OUT,Many2Many,true,true,false,true") + .putAll("pnf|lag-interface", + "has,OUT,One2Many,true,false,false,true") + .putAll("service-instance|pnf", + "uses,OUT,One2Many,false,true,false,false") + .putAll("service-subscription|service-instance", + "hasInstance,OUT,Many2Many,true,false,false,reverse") + .putAll("tenant|l3-network", + "usesL3Network,OUT,Many2Many,false,false,false,false") + .putAll("tenant|service-subscription", + "relatedTo,OUT,Many2Many,false,false,false,false") + .putAll("tenant|vserver", "owns,OUT,One2Many,true,false,false,reverse") + .putAll("vlan|l3-interface-ipv4-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("vlan|l3-interface-ipv6-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("vserver|flavor", "hasFlavor,OUT,Many2One,false,false,false,true") + .putAll("vserver|image", "hasImage,OUT,Many2One,false,false,false,true") + .putAll("vserver|ipaddress", + "hasIpAddress,OUT,Many2Many,true,true,false,false") + .putAll("vserver|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("vserver|pserver", + "runsOnPserver,OUT,Many2One,false,true,false,true") + .putAll("vserver|volume", "hasVolume,OUT,Many2Many,true,true,false,true") + .putAll("vserver|vnfc", "hosts,OUT,Many2Many,false,true,false,true") + .putAll("vserver|snapshot", "uses,OUT,One2One,false,false,false,true") + .putAll("service-instance|metadatum", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("service-instance|logical-link", "uses,OUT,Many2Many,false,false,true,false") + .putAll("service-instance|vlan", "dependsOn,OUT,One2Many,false,true,false,false") + .putAll("service-instance|service-instance", "dependsOn,OUT,One2Many,false,true,false,false") + .putAll("logical-link|generic-vnf", "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|pserver", "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("volume-group|tenant", "belongsTo,OUT,Many2Many,false,false,false,true") + .putAll("vf-module|volume-group", "uses,OUT,One2One,false,false,false,true") + .putAll("vserver|vf-module", "isPartOf,OUT,Many2One,false,false,false,true") + .putAll("vf-module|l3-network", "uses,OUT,Many2Many,false,false,false,true") + .putAll("vf-module|vnfc", "uses,OUT,One2Many,false,false,true,true") + .putAll("generic-vnf|vf-module", "has,OUT,One2Many,true,false,false,true") + .putAll("generic-vnf|volume-group", "uses,OUT,One2Many,false,false,false,true") + .putAll("generic-vnf|vnfc", "uses,OUT,One2Many,false,false,true,true") + .putAll("vlan|logical-link", "usesLogicalLink,OUT,One2One,false,false,true,true") + .build(); + + public static final Multimap<String, String> DefaultDeleteScope = new ImmutableSetMultimap.Builder<String, String>() + .putAll("customer", "CASCADE_TO_CHILDREN") + .putAll("cloud-region", "THIS_NODE_ONLY") + .putAll("service-subscription", "CASCADE_TO_CHILDREN") + .putAll("service-instance", "CASCADE_TO_CHILDREN") + .putAll("tenant", "CASCADE_TO_CHILDREN") + .putAll("vserver", "CASCADE_TO_CHILDREN") + .putAll("volume", "THIS_NODE_ONLY") + .putAll("ipaddress", "THIS_NODE_ONLY") + .putAll("image", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("pserver", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("availability-zone", "ERROR_IF_ANY_IN_EDGES") + .putAll("flavor", "ERROR_IF_ANY_IN_EDGES") + .putAll("metadata", "THIS_NODE_ONLY") + .putAll("metadatum", "THIS_NODE_ONLY") + .putAll("model", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("model-element", "CASCADE_TO_CHILDREN") + .putAll("named-query", "CASCADE_TO_CHILDREN") + .putAll("named-query-element", "CASCADE_TO_CHILDREN") + .putAll("collect-lookup", "THIS_NODE_ONLY") + .putAll("service", "ERROR_IF_ANY_IN_EDGES") + .putAll("l-interface", "CASCADE_TO_CHILDREN") + .putAll("vlan", "CASCADE_TO_CHILDREN") + .putAll("p-interface", "CASCADE_TO_CHILDREN") + .putAll("l3-interface-ipv6-address-list", "THIS_NODE_ONLY") + .putAll("l3-interface-ipv4-address-list", "THIS_NODE_ONLY") + .putAll("logical-link", "THIS_NODE_ONLY") + .putAll("physical-link", "THIS_NODE_ONLY") + .putAll("lag-interface", "CASCADE_TO_CHILDREN") + .putAll("l3-network", "CASCADE_TO_CHILDREN") + .putAll("subnet", "THIS_NODE_ONLY") + .putAll("vnfc", "THIS_NODE_ONLY") + .putAll("volume-group", "THIS_NODE_ONLY") + .putAll("ctag-assignment", "THIS_NODE_ONLY") + .putAll("pnf", "CASCADE_TO_CHILDREN") + .putAll("vf-module", "THIS_NODE_ONLY") + .putAll("snapshot", "THIS_NODE_ONLY") + .putAll("group-assignment", "THIS_NODE_ONLY") + .putAll("segmentation-assignment", "THIS_NODE_ONLY") + .putAll("generic-vnf", "CASCADE_TO_CHILDREN").build(); + + // NOTE -- Sorry, this is ugly, but we are mapping the nodeTypeCategory two + // ways just to + // make the code a little less bulky. But that means that we need to ensure + // that + // nodeTypeCategory and nodeTypeCatMap are kept in synch. + + // NodeTypeCategory: key is: nodeTypeCategory, value is: + // "nodeTypes,keyProperties,AltKeyProps,depNode4UniquenessFlag" + public static final Multimap<String, String> NodeTypeCategory = new ImmutableSetMultimap.Builder<String, String>() + .putAll("vnf", "generic-vnf,vnf-id,,true").build(); + + // NodeTypeCatMap: key is nodeType; value is: "nodeTypeCategory" + // So -- we're assuming that a nodeType can only be in one nodeTypeCategory. + public static final Map<String, String> NodeTypeCatMap; + static { + NodeTypeCatMap = new HashMap<String, String>(); + NodeTypeCatMap.put("generic-vnf", "vnf"); + } + + // ReservedPropNames: keys are property names of (node) properties that are + // common to all nodes and + // should not be removed if not passed in on an UPDATE request. + public static final Map<String, String> ReservedPropNames; + static { + ReservedPropNames = new HashMap<String, String>(); + ReservedPropNames.put("source-of-truth", ""); + ReservedPropNames.put("last-mod-source-of-truth", ""); + ReservedPropNames.put("aai-created-ts", ""); + ReservedPropNames.put("aai-last-mod-ts", ""); + } + + // This just lists which node types can be connected to themselves recursively. + // It's temporary - since DbEdgeRules is going to be overhauled in 16-10, this will + // get generated automatically. But for 1607, it can work like this. + public static final Map<String, String> CanBeRecursiveNT; + static { + CanBeRecursiveNT = new HashMap<String, String>(); + CanBeRecursiveNT.put("model-element", ""); + CanBeRecursiveNT.put("named-query-element", ""); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/v9/gen/DbEdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/v9/gen/DbEdgeRules.java new file mode 100644 index 00000000..3787bc80 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/dbmodel/v9/gen/DbEdgeRules.java @@ -0,0 +1,459 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.dbmodel.v9.gen; + +import java.util.HashMap; +import java.util.Map; + +import com.google.common.collect.ImmutableSetMultimap; +import com.google.common.collect.Multimap; + +public class DbEdgeRules { + + /* + * The EdgeRules data is set up as a key (fromNodeTypeA|toNodeTypeB) mapped + * to a string which holds the info we need to build an edge from nodeTypeA + * to nodeTypeB. Note -- the MultiMap will let us define more than one type + * of edge between a given pair of nodeTypes, but for now we never define + * more than one. + * + * The edgeInfo part is comma separated and looks like this: + * "edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA" This + * format is encoded into the EdgeInfoMap below. + * MultiplicityRule can be either "Many2Many", "Many2One", "One2Many" or "One2One" + * The values for the things after multiplicityRule can be either "true", "false" or "reverse". "reverse" is + * really saying that this tag does apply, but the edge will be traversed + * the opposite way from the same tag that just has "true". + */ + public static final Map<Integer, String> EdgeInfoMap; + static { + EdgeInfoMap = new HashMap<Integer, String>(); + EdgeInfoMap.put(0, "edgeLabel"); + EdgeInfoMap.put(1, "direction"); + EdgeInfoMap.put(2, "multiplicityRule"); + EdgeInfoMap.put(3, "isParent"); + EdgeInfoMap.put(4, "usesResource"); + EdgeInfoMap.put(5, "hasDelTarget"); + EdgeInfoMap.put(6, "SVC-INFRA"); + } + + public static Integer firstTagIndex = 3; + + public static final Multimap<String, String> EdgeRules = new ImmutableSetMultimap.Builder<String, String>() + .putAll("availability-zone|complex", + "groupsResourcesIn,OUT,Many2Many,false,false,false,false") + .putAll("availability-zone|service-capability", + "supportsServiceCapability,OUT,Many2Many,false,false,false,false") + .putAll("cloud-region|complex", + "locatedIn,OUT,Many2One,false,false,false,false") + .putAll("cloud-region|l3-network", + "uses,OUT,Many2Many,false,false,false,false") + .putAll("cloud-region|tenant", + "has,OUT,One2Many,true,false,false,reverse") + .putAll("cloud-region|image", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|flavor", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|availability-zone", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|oam-network", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|dvs-switch", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|volume-group", + "has,OUT,One2Many,true,true,false,false") + .putAll("cloud-region|group-assignment", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|snapshot", + "has,OUT,One2Many,true,false,false,false") + .putAll("cloud-region|zone", + "isMemberOf,OUT,Many2One,false,false,false,false") + .putAll("complex|ctag-pool", + "hasCtagPool,OUT,Many2Many,true,false,false,false") + .putAll("complex|l3-network", + "usesL3Network,OUT,Many2Many,false,false,false,true") + .putAll("ctag-pool|availability-zone", + "supportsAvailabilityZone,OUT,Many2Many,false,false,false,false") + .putAll("customer|service-subscription", + "subscribesTo,OUT,Many2Many,true,false,false,reverse") + .putAll("dvs-switch|availability-zone", + "existsIn,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("generic-vnf|availability-zone", + "hasAvailabilityZone,OUT,Many2Many,false,false,false,true") + .putAll("generic-vnf|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,true") + .putAll("generic-vnf|l3-network", + "usesL3Network,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|pserver", + "runsOnPserver,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|vnf-image", + "usesVnfImage,OUT,Many2One,false,false,false,true") + .putAll("generic-vnf|vserver", + "runsOnVserver,OUT,One2Many,false,true,false,true") + .putAll("generic-vnf|service-instance", + "hasInstance,OUT,Many2Many,false,true,false,true") + .putAll("generic-vnf|site-pair-set", + "hasSitePairSet,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|network-profile", + "hasNetworkProfile,OUT,Many2Many,false,false,false,false") + .putAll("group-assignment|tenant", + "has,OUT,Many2Many,false,false,false,false") + .putAll("group-assignment|pserver", + "has,OUT,One2Many,false,false,false,false") + .putAll("image|metadata", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("image|metadatum", + "hasMetaDatum,OUT,Many2Many,true,false,false,false") + .putAll("l-interface|l3-interface-ipv4-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("l-interface|l3-interface-ipv6-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("l-interface|logical-link", + "usesLogicalLink,OUT,Many2Many,false,false,true,true") + .putAll("l-interface|vlan","hasVlan,OUT,Many2Many,true,false,false,false") + .putAll("l-interface|sriov-vf","has,OUT,One2One,true,false,false,false") + .putAll("l3-interface-ipv4-address-list|l3-network", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv6-address-list|l3-network", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv4-address-list|subnet", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-interface-ipv6-address-list|subnet", + "isMemberOf,OUT,Many2Many,false,false,false,true") + .putAll("l3-network|vpn-binding", + "usesVpnBinding,OUT,Many2Many,false,false,false,false") + .putAll("l3-network|subnet", + "hasSubnet,OUT,Many2Many,true,false,false,reverse") + .putAll("l3-network|service-instance", + "hasInstance,OUT,Many2Many,false,false,false,reverse") + .putAll("l3-network|ctag-assignment", + "hasCtagAssignment,OUT,Many2Many,true,false,false,true") + .putAll("l3-network|network-policy", + "uses,OUT,Many2Many,false,false,false,true") + .putAll("l3-network|segmentation-assignment", + "has,OUT,One2Many,true,false,false,false") + .putAll("l3-network|route-table-reference", + "uses,OUT,Many2Many,false,false,false,false") + .putAll("lag-interface|lag-link", + "usesLAGLink,OUT,Many2Many,false,true,true,true") + .putAll("lag-interface|p-interface", + "usesPInterface,OUT,Many2Many,false,true,false,true") + .putAll("lag-interface|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("logical-link|lag-link", + "usesLAGLink,OUT,Many2Many,false,true,false,true") + .putAll("logical-link|pnf", + "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|logical-link", + "uses,OUT,One2Many,false,false,false,true") + .putAll("model|model-ver", + "has,OUT,One2Many,true,false,false,false") + .putAll("model-ver|model-element", + "startsWith,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-ver", + "isA,OUT,Many2One,false,false,false,false") + .putAll("model-ver|metadatum", + "hasMetaData,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-element", + "connectsTo,OUT,One2Many,true,false,false,false") + .putAll("model-element|model-constraint", + "uses,OUT,One2Many,true,false,false,false") + .putAll("model-element|constrained-element-set", + "connectsTo,OUT,One2Many,true,false,false,false") + .putAll("model-constraint|constrained-element-set", + "uses,OUT,One2Many,true,false,false,false") + .putAll("constrained-element-set|element-choice-set", + "uses,OUT,One2Many,true,false,false,false") + .putAll("element-choice-set|model-element", + "has,OUT,One2Many,true,false,false,false") + .putAll("named-query|model", + "relatedTo,OUT,One2Many,false,false,false,false") + .putAll("named-query|named-query-element", + "startsWith,OUT,One2One,true,false,false,false") + .putAll("named-query-element|named-query-element", + "connectsTo,OUT,Many2Many,true,false,false,false") + .putAll("named-query-element|model", + "isA,OUT,Many2One,false,false,false,false") + .putAll("named-query-element|property-constraint", + "uses,OUT,One2Many,true,false,false,false") + .putAll("named-query-element|related-lookup", + "uses,OUT,One2Many,true,false,false,false") + .putAll("instance-group|model", + "targets,OUT,Many2Many,false,false,false,false") + .putAll("newvce|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,false") + .putAll("oam-network|complex", + "definedFor,OUT,Many2Many,false,false,false,false") + .putAll("oam-network|service-capability", + "supportsServiceCapability,OUT,Many2Many,false,false,false,false") + .putAll("p-interface|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("p-interface|physical-link", + "usesPhysicalLink,OUT,Many2Many,false,false,true,false") + .putAll("p-interface|logical-link", + "usesLogicalLink,OUT,Many2One,false,false,false,true") + .putAll("port-group|cvlan-tag", "hasCTag,OUT,Many2Many,true,true,false,true") + .putAll("pserver|complex", "locatedIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|cloud-region","locatedIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|availability-zone","existsIn,OUT,Many2One,false,false,false,true") + .putAll("pserver|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,true") + .putAll("pserver|p-interface", + "hasPinterface,OUT,Many2Many,true,true,false,true") + .putAll("pserver|zone", + "isMemberOf,OUT,Many2One,false,false,false,false") + .putAll("pnf|p-interface", + "hasPinterface,OUT,Many2Many,true,true,false,true") + .putAll("pnf|lag-interface", + "has,OUT,One2Many,true,false,false,true") + .putAll("pnf|complex", + "locatedIn,OUT,Many2One,false,false,false,false") + .putAll("pnf|instance-group", + "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("pnf|zone", + "isMemberOf,OUT,Many2One,false,false,false,false") + .putAll("service-instance|cvlan-tag", + "hasIPAGFacingVLAN,OUT,Many2Many,false,true,false,false") + .putAll("service-instance|pnf", + "uses,OUT,One2Many,false,true,false,false") + .putAll("service-subscription|service-instance", + "hasInstance,OUT,Many2Many,true,false,false,reverse") + .putAll("site-pair-set|routing-instance", + "hasRoutingInstance,OUT,Many2Many,true,false,false,false") + .putAll("routing-instance|site-pair", + "hasSitePair,OUT,Many2Many,true,false,false,false") + .putAll("site-pair|class-of-service", + "hasClassOfService,OUT,Many2Many,true,false,false,false") + .putAll("tenant|l3-network", + "usesL3Network,OUT,Many2Many,false,false,false,false") + .putAll("tenant|service-subscription", + "relatedTo,OUT,Many2Many,false,false,false,false") + .putAll("tenant|vserver", "owns,OUT,One2Many,true,false,false,reverse") + .putAll("vce|availability-zone", + "hasAvailabilityZone,OUT,Many2Many,false,false,false,false") + .putAll("vce|complex", "locatedIn,OUT,Many2Many,false,false,false,true") + .putAll("vce|port-group", "hasPortGroup,OUT,Many2Many,true,true,false,true") + .putAll("vce|vserver", "runsOnVserver,OUT,Many2Many,false,true,false,true") + .putAll("vce|service-instance", + "hasServiceInstance,OUT,Many2Many,false,false,false,reverse") + .putAll("virtual-data-center|generic-vnf", + "hasVNF,OUT,Many2Many,false,false,false,reverse") + .putAll("vlan|l3-interface-ipv4-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("vlan|l3-interface-ipv6-address-list", + "hasIpAddress,OUT,Many2Many,true,false,false,true") + .putAll("vpe|complex", "locatedIn,OUT,Many2Many,false,false,false,false") + .putAll("vpe|ctag-pool", "usesCtagPool,OUT,Many2Many,false,false,false,false") + .putAll("vpe|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,false") + .putAll("vpe|lag-interface", + "hasLAGInterface,OUT,Many2Many,true,false,false,false") + .putAll("vpe|vserver", "runsOnVserver,OUT,Many2Many,false,true,false,false") + .putAll("vpls-pe|complex", "locatedIn,OUT,Many2Many,false,false,false,false") + .putAll("vpls-pe|ctag-pool", + "usesCtagPool,OUT,Many2Many,false,false,false,false") + .putAll("vpls-pe|p-interface", + "hasPinterface,OUT,Many2Many,true,false,false,false") + .putAll("vpls-pe|lag-interface", + "hasLAGinterface,OUT,Many2Many,true,false,false,false") + .putAll("vserver|flavor", "hasFlavor,OUT,Many2One,false,false,false,true") + .putAll("vserver|image", "hasImage,OUT,Many2One,false,false,false,true") + .putAll("vserver|ipaddress", + "hasIpAddress,OUT,Many2Many,true,true,false,false") + .putAll("vserver|l-interface", + "hasLInterface,OUT,Many2Many,true,false,false,true") + .putAll("vserver|pserver", + "runsOnPserver,OUT,Many2One,false,true,false,true") + .putAll("vserver|volume", "hasVolume,OUT,Many2Many,true,true,false,true") + .putAll("vserver|vnfc", "hosts,OUT,Many2Many,false,true,false,true") + .putAll("vserver|snapshot", "uses,OUT,One2One,false,false,false,true") + .putAll("service-instance|connector", "uses,OUT,Many2Many,false,true,false,false") + .putAll("service-instance|metadatum", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("service-instance|logical-link", "uses,OUT,Many2Many,false,false,true,false") + .putAll("service-instance|vlan", "dependsOn,OUT,One2Many,false,true,false,false") + .putAll("service-instance|service-instance", "dependsOn,OUT,One2Many,false,true,false,false") + .putAll("connector|virtual-data-center", "contains,OUT,Many2Many,false,false,false,false") + .putAll("connector|metadatum", "hasMetaData,OUT,Many2Many,true,false,false,false") + .putAll("virtual-data-center|logical-link", "contains,OUT,Many2Many,false,true,false,false") + .putAll("logical-link|generic-vnf", "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|pserver", "bridgedTo,OUT,Many2Many,false,false,false,false") + .putAll("vlan|multicast-configuration", "uses,OUT,Many2Many,false,true,false,false") + .putAll("volume-group|complex", "existsIn,OUT,Many2Many,false,false,false,true") + .putAll("volume-group|tenant", "belongsTo,OUT,Many2Many,false,false,false,true") + .putAll("ipsec-configuration|vig-server", "hasVigServer,OUT,One2Many,true,true,false,false") + .putAll("generic-vnf|ipsec-configuration", "uses,OUT,Many2One,false,true,false,false") + .putAll("vf-module|volume-group", "uses,OUT,One2One,false,false,false,true") + .putAll("vserver|vf-module", "isPartOf,OUT,Many2One,false,false,false,true") + .putAll("vf-module|l3-network", "uses,OUT,Many2Many,false,false,false,true") + .putAll("vf-module|vnfc", "uses,OUT,One2Many,false,false,true,true") + .putAll("generic-vnf|vf-module", "has,OUT,One2Many,true,false,false,true") + .putAll("generic-vnf|volume-group", "uses,OUT,One2Many,false,false,false,true") + .putAll("generic-vnf|vnfc", "uses,OUT,One2Many,false,false,true,true") + .putAll("vlan|logical-link", "usesLogicalLink,OUT,Many2Many,false,false,true,true") + .putAll("service-instance|ctag-assignment","uses,OUT,One2Many,false,false,false,false") + // The next edge is needed in 1702 but will be worked in user story AAI-6848 + //.putAll("service-instance|allotted-resource", "uses,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|generic-vnf", "isPartOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|l3-network", "isPartOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|instance-group", "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|vlan", "isPartOf,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|instance-group", "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("service-instance|instance-group", "isMemberOf,OUT,Many2Many,false,false,false,false") + .putAll("allotted-resource|tunnel-xconnect", "has,OUT,One2One,true,false,false,false") + .putAll("logical-link|cloud-region", "existsIn,OUT,Many2Many,false,false,false,false") + .putAll("logical-link|vpn-binding", "uses,OUT,Many2Many,false,false,false,false") + .putAll("generic-vnf|entitlement", "has,OUT,One2Many,true,false,false,false") + .putAll("generic-vnf|license", "has,OUT,One2Many,true,false,false,false") + .putAll("vce|entitlement", "has,OUT,One2Many,true,false,false,false") + .putAll("vce|license", "has,OUT,One2Many,true,false,false,false") + .putAll("vpe|entitlement", "has,OUT,One2Many,true,false,false,false") + .putAll("vpe|license", "has,OUT,One2Many,true,false,false,false") + .putAll("zone|complex", "existsIn,OUT,Many2One,false,false,false,false") + .putAll("service-instance|allotted-resource", "has,OUT,Many2Many,true,false,false,false") + .putAll("service-instance|allotted-resource", "uses,OUT,Many2Many,false,false,false,false") + .build(); + + public static final Multimap<String, String> DefaultDeleteScope = new ImmutableSetMultimap.Builder<String, String>() + .putAll("customer", "CASCADE_TO_CHILDREN") + .putAll("cloud-region", "THIS_NODE_ONLY") + .putAll("service-subscription", "CASCADE_TO_CHILDREN") + .putAll("service-instance", "CASCADE_TO_CHILDREN") + .putAll("vce", "CASCADE_TO_CHILDREN") + .putAll("port-group", "CASCADE_TO_CHILDREN") + .putAll("cvlan-tag", "THIS_NODE_ONLY") + .putAll("tenant", "THIS_NODE_ONLY") + .putAll("vserver", "CASCADE_TO_CHILDREN") + .putAll("volume", "THIS_NODE_ONLY") + .putAll("ipaddress", "THIS_NODE_ONLY") + .putAll("image", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("pserver", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("availability-zone", "ERROR_IF_ANY_IN_EDGES") + .putAll("oam-network", "ERROR_IF_ANY_IN_EDGES") + .putAll("dvs-switch", "THIS_NODE_ONLY") + .putAll("service-capability", "ERROR_IF_ANY_IN_EDGES") + .putAll("complex", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("flavor", "ERROR_IF_ANY_IN_EDGES") + .putAll("metadata", "THIS_NODE_ONLY") + .putAll("metadatum", "THIS_NODE_ONLY") + .putAll("model", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("model-ver", "ERROR_4_IN_EDGES_OR_CASCADE") + .putAll("model-element", "CASCADE_TO_CHILDREN") + .putAll("model-constraint", "CASCADE_TO_CHILDREN") + .putAll("property-constraint", "CASCADE_TO_CHILDREN") + .putAll("related-lookup", "CASCADE_TO_CHILDREN") + .putAll("constrained-element-set", "CASCADE_TO_CHILDREN") + .putAll("element-choice-set", "CASCADE_TO_CHILDREN") + .putAll("named-query", "CASCADE_TO_CHILDREN") + .putAll("named-query-element", "CASCADE_TO_CHILDREN") + .putAll("network-policy", "THIS_NODE_ONLY") + .putAll("collect-lookup", "THIS_NODE_ONLY") + .putAll("service", "ERROR_IF_ANY_IN_EDGES") + .putAll("newvce", "CASCADE_TO_CHILDREN") + .putAll("vpe", "CASCADE_TO_CHILDREN") + .putAll("vpls-pe", "CASCADE_TO_CHILDREN") + .putAll("l-interface", "CASCADE_TO_CHILDREN") + .putAll("vlan", "CASCADE_TO_CHILDREN") + .putAll("p-interface", "CASCADE_TO_CHILDREN") + .putAll("l3-interface-ipv6-address-list", "THIS_NODE_ONLY") + .putAll("l3-interface-ipv4-address-list", "THIS_NODE_ONLY") + .putAll("logical-link", "THIS_NODE_ONLY") + .putAll("physical-link", "THIS_NODE_ONLY") + .putAll("lag-link", "THIS_NODE_ONLY") + .putAll("lag-interface", "CASCADE_TO_CHILDREN") + .putAll("virtual-data-center", "CASCADE_TO_CHILDREN") + .putAll("generic-vnf", "CASCADE_TO_CHILDREN") + .putAll("l3-network", "CASCADE_TO_CHILDREN") + .putAll("ctag-pool", "THIS_NODE_ONLY") + .putAll("subnet", "THIS_NODE_ONLY") + .putAll("sriov-vf", "THIS_NODE_ONLY") + .putAll("vpn-binding", "ERROR_IF_ANY_IN_EDGES") + .putAll("vnf-image", "ERROR_IF_ANY_IN_EDGES") + .putAll("site-pair-set", "CASCADE_TO_CHILDREN") + .putAll("routing-instance", "CASCADE_TO_CHILDREN") + .putAll("site-pair", "CASCADE_TO_CHILDREN") + .putAll("class-of-service", "THIS_NODE_ONLY") + .putAll("connector", "CASCADE_TO_CHILDREN") + .putAll("vnfc", "THIS_NODE_ONLY") + .putAll("multicast-configuration", "THIS_NODE_ONLY") + .putAll("volume-group", "THIS_NODE_ONLY") + .putAll("ctag-assignment", "THIS_NODE_ONLY") + .putAll("pnf", "CASCADE_TO_CHILDREN") + .putAll("ipsec-configuration", "CASCADE_TO_CHILDREN") + .putAll("vig-server", "THIS_NODE_ONLY") + .putAll("vf-module", "THIS_NODE_ONLY") + .putAll("snapshot", "THIS_NODE_ONLY") + .putAll("group-assignment", "THIS_NODE_ONLY") + .putAll("segmentation-assignment", "THIS_NODE_ONLY") + .putAll("route-table-reference", "THIS_NODE_ONLY") + .putAll("network-profile", "THIS_NODE_ONLY") + .putAll("allotted-resource", "CASCADE_TO_CHILDREN") + .putAll("tunnel-xconnect", "THIS_NODE_ONLY") + .putAll("instance-group","THIS_NODE_ONLY") + .putAll("entitlement","THIS_NODE_ONLY") + .putAll("license","THIS_NODE_ONLY") + .putAll("zone", "THIS_NODE_ONLY").build(); + + // NOTE -- Sorry, this is ugly, but we are mapping the nodeTypeCategory two + // ways just to + // make the code a little less bulky. But that means that we need to ensure + // that + // nodeTypeCategory and nodeTypeCatMap are kept in synch. + + // NodeTypeCategory: key is: nodeTypeCategory, value is: + // "nodeTypes,keyProperties,AltKeyProps,depNode4UniquenessFlag" + public static final Multimap<String, String> NodeTypeCategory = new ImmutableSetMultimap.Builder<String, String>() + .putAll("vnf", "vce|vpe|generic-vnf,vnf-id,,true").build(); + + // NodeTypeCatMap: key is nodeType; value is: "nodeTypeCategory" + // So -- we're assuming that a nodeType can only be in one nodeTypeCategory. + public static final Map<String, String> NodeTypeCatMap; + static { + NodeTypeCatMap = new HashMap<String, String>(); + NodeTypeCatMap.put("vpe", "vnf"); + NodeTypeCatMap.put("vce", "vnf"); + NodeTypeCatMap.put("generic-vnf", "vnf"); + } + + // ReservedPropNames: keys are property names of (node) properties that are + // common to all nodes and + // should not be removed if not passed in on an UPDATE request. + public static final Map<String, String> ReservedPropNames; + static { + ReservedPropNames = new HashMap<String, String>(); + ReservedPropNames.put("source-of-truth", ""); + ReservedPropNames.put("last-mod-source-of-truth", ""); + ReservedPropNames.put("aai-created-ts", ""); + ReservedPropNames.put("aai-last-mod-ts", ""); + } + + // This just lists which node types can be connected to themselves recursively. + // It's temporary - since DbEdgeRules is going to be overhauled in 16-10, this will + // get generated automatically. But for 1607, it can work like this. + public static final Map<String, String> CanBeRecursiveNT; + static { + CanBeRecursiveNT = new HashMap<String, String>(); + CanBeRecursiveNT.put("model-element", ""); + CanBeRecursiveNT.put("service-instance", ""); + CanBeRecursiveNT.put("named-query-element", ""); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResource.java b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResource.java new file mode 100644 index 00000000..7fc1f7a3 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResource.java @@ -0,0 +1,675 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.model; + +import java.util.ArrayList; +import java.util.Map; + +import com.google.common.collect.Multimap; + + +public class AAIResource { + private AAIResource parent; + private AAIResources children; + + private AAIResourceKeys aaiResourceKeys; + + private String namespace; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag -> "Network" + + private String resourceType; // node or container + private String resourceClassName; + private String simpleName; // Vce + private String fullName; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag + private String uri; // /network/vces/vce/{vnf-id}/port-groups/port-group/{interface-name}/cvlan-tags/cvlan-tag/{cvlan-tag} + private String apiVersion; + private String relationshipListClass; + private String relationshipUtils; + + private Map<String, String> PropertyDataTypeMap; + private Multimap<String, String> NodeMapIndexedProps; + private Multimap<String, String> NodeAltKey1Props; + private Multimap<String, String> NodeDependencies; + private Multimap<String, String> NodeKeyProps; + private Multimap<String, String> NodeReqProps; + private Multimap<String, String> NodeNameProps; + private Multimap<String, String> NodeUniqueProps; + + // if new dataTypes are added - make sure to update getAllFields() method below + private ArrayList<String> stringFields; + private ArrayList<String> stringListFields; + private ArrayList<String> longFields; + private ArrayList<String> intFields; + private ArrayList<String> shortFields; + private ArrayList<String> booleanFields; + + private ArrayList<String> requiredFields; + private ArrayList<String> orderedFields; + private AAIResource recurseToResource; + private boolean allowDirectWrite; + private boolean allowDirectRead; + private ArrayList<String> autoGenUuidFields; + + /** + * Gets the parent. + * + * @return the parent + */ + public AAIResource getParent() { + return parent; + } + + /** + * Sets the parent. + * + * @param parent the new parent + */ + public void setParent(AAIResource parent) { + this.parent = parent; + } + + /** + * Gets the children. + * + * @return the children + */ + public AAIResources getChildren() { + if (this.children == null) { + this.children = new AAIResources(); + } + return this.children; + } + + /** + * Gets the aai resource keys. + * + * @return the aai resource keys + */ + public AAIResourceKeys getAaiResourceKeys() { + if (aaiResourceKeys == null) { + aaiResourceKeys = new AAIResourceKeys(); + } + return aaiResourceKeys; + } + + /** + * Gets the namespace. + * + * @return the namespace + */ + public String getNamespace() { + return namespace; + } + + /** + * Sets the namespace. + * + * @param namespace the new namespace + */ + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + /** + * Gets the resource type. + * + * @return the resource type + */ + public String getResourceType() { + return resourceType; + } + + /** + * Sets the resource type. + * + * @param resourceType the new resource type + */ + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + /** + * Gets the simple name. + * + * @return the simple name + */ + public String getSimpleName() { + return simpleName; + } + + /** + * Sets the simple name. + * + * @param simpleName the new simple name + */ + public void setSimpleName(String simpleName) { + this.simpleName = simpleName; + } + + /** + * Gets the full name. + * + * @return the full name + */ + public String getFullName() { + return fullName; + } + + /** + * Sets the full name. + * + * @param fullName the new full name + */ + public void setFullName(String fullName) { + this.fullName = fullName; + } + + /** + * Gets the uri. + * + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * Sets the uri. + * + * @param uri the new uri + */ + public void setUri(String uri) { + this.uri = uri; + } + + /** + * Gets the resource class name. + * + * @return the resource class name + */ + public String getResourceClassName() { + return resourceClassName; + } + + /** + * Sets the resource class name. + * + * @param resourceClassName the new resource class name + */ + public void setResourceClassName(String resourceClassName) { + this.resourceClassName = resourceClassName; + } + + /** + * Gets the property data type map. + * + * @return the property data type map + */ + public Map<String, String> getPropertyDataTypeMap() { + return PropertyDataTypeMap; + } + + /** + * Sets the property data type map. + * + * @param propertyDataTypeMap the property data type map + */ + public void setPropertyDataTypeMap(Map<String, String> propertyDataTypeMap) { + PropertyDataTypeMap = propertyDataTypeMap; + } + + /** + * Gets the node map indexed props. + * + * @return the node map indexed props + */ + public Multimap<String, String> getNodeMapIndexedProps() { + return NodeMapIndexedProps; + } + + /** + * Sets the node map indexed props. + * + * @param nodeMapIndexedProps the node map indexed props + */ + public void setNodeMapIndexedProps(Multimap<String, String> nodeMapIndexedProps) { + NodeMapIndexedProps = nodeMapIndexedProps; + } + + /** + * Gets the node key props. + * + * @return the node key props + */ + public Multimap<String, String> getNodeKeyProps() { + return NodeKeyProps; + } + + /** + * Sets the node key props. + * + * @param nodeKeyProps the node key props + */ + public void setNodeKeyProps(Multimap<String, String> nodeKeyProps) { + this.NodeKeyProps = nodeKeyProps; + } + + /** + * Gets the node name props. + * + * @return the node name props + */ + public Multimap<String, String> getNodeNameProps() { + return NodeNameProps; + } + + /** + * Sets the node name props. + * + * @param nodeNameProps the node name props + */ + public void setNodeNameProps(Multimap<String, String> nodeNameProps) { + + NodeNameProps = nodeNameProps; + } + + /** + * Gets the node unique props. + * + * @return the node unique props + */ + public Multimap<String, String> getNodeUniqueProps() { + return NodeUniqueProps; + } + + /** + * Sets the node unique props. + * + * @param nodeUniqueProps the node unique props + */ + public void setNodeUniqueProps(Multimap<String, String> nodeUniqueProps) { + NodeUniqueProps = nodeUniqueProps; + } + + /** + * Gets the node req props. + * + * @return the node req props + */ + public Multimap<String, String> getNodeReqProps() { + return NodeReqProps; + } + + /** + * Sets the node req props. + * + * @param nodeReqProps the node req props + */ + public void setNodeReqProps(Multimap<String, String> nodeReqProps) { + NodeReqProps = nodeReqProps; + } + + /** + * Gets the api version. + * + * @return the api version + */ + public String getApiVersion() { + return apiVersion; + } + + /** + * Sets the api version. + * + * @param apiVersion the new api version + */ + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + + /** + * Gets the relationship list class. + * + * @return the relationship list class + */ + public String getRelationshipListClass() { + return relationshipListClass; + } + + /** + * Sets the relationship list class. + * + * @param relationshipListClass the new relationship list class + */ + public void setRelationshipListClass(String relationshipListClass) { + this.relationshipListClass = relationshipListClass; + } + + /** + * Gets the relationship utils. + * + * @return the relationship utils + */ + public String getRelationshipUtils() { + return relationshipUtils; + } + + /** + * Sets the relationship utils. + * + * @param relationshipUtils the new relationship utils + */ + public void setRelationshipUtils(String relationshipUtils) { + this.relationshipUtils = relationshipUtils; + } + + /** + * Gets the string fields. + * + * @return the string fields + */ + public ArrayList<String> getStringFields() { + if (this.stringFields == null) { + this.stringFields = new ArrayList<String>(); + } + return this.stringFields; + } + + /** + * Sets the string fields. + * + * @param stringFields the new string fields + */ + public void setStringFields(ArrayList<String> stringFields) { + this.stringFields = stringFields; + } + + /** + * Gets the string list fields. + * + * @return the string list fields + */ + public ArrayList<String> getStringListFields() { + if (this.stringListFields == null) { + this.stringListFields = new ArrayList<String>(); + } + return this.stringListFields; + } + + /** + * Sets the string list fields. + * + * @param stringListFields the new string list fields + */ + public void setStringListFields(ArrayList<String> stringListFields) { + this.stringListFields = stringListFields; + } + + /** + * Gets the long fields. + * + * @return the long fields + */ + public ArrayList<String> getLongFields() { + if (this.longFields == null) { + this.longFields = new ArrayList<String>(); + } + return longFields; + } + + /** + * Sets the long fields. + * + * @param longFields the new long fields + */ + public void setLongFields(ArrayList<String> longFields) { + this.longFields = longFields; + } + + /** + * Gets the int fields. + * + * @return the int fields + */ + public ArrayList<String> getIntFields() { + if (this.intFields == null) { + this.intFields = new ArrayList<String>(); + } + return intFields; + } + + /** + * Sets the int fields. + * + * @param intFields the new int fields + */ + public void setIntFields(ArrayList<String> intFields) { + this.intFields = intFields; + } + + /** + * Gets the short fields. + * + * @return the short fields + */ + public ArrayList<String> getShortFields() { + if (this.shortFields == null) { + this.shortFields = new ArrayList<String>(); + } + return shortFields; + } + + /** + * Sets the short fields. + * + * @param shortFields the new short fields + */ + public void setShortFields(ArrayList<String> shortFields) { + this.shortFields = shortFields; + } + + /** + * Gets the boolean fields. + * + * @return the boolean fields + */ + public ArrayList<String> getBooleanFields() { + if (this.booleanFields == null) { + this.booleanFields = new ArrayList<String>(); + } + return booleanFields; + } + + /** + * Sets the boolean fields. + * + * @param booleanFields the new boolean fields + */ + public void setBooleanFields(ArrayList<String> booleanFields) { + this.booleanFields = booleanFields; + } + + /** + * Gets the required fields. + * + * @return the required fields + */ + public ArrayList<String> getRequiredFields() { + if (this.requiredFields == null) { + this.requiredFields = new ArrayList<String>(); + } + return requiredFields; + } + + /** + * Sets the required fields. + * + * @param requiredFields the new required fields + */ + public void setRequiredFields(ArrayList<String> requiredFields) { + this.requiredFields = requiredFields; + } + + /** + * Gets the ordered fields. + * + * @return the ordered fields + */ + public ArrayList<String> getOrderedFields() { + if (this.orderedFields == null) { + this.orderedFields = new ArrayList<String>(); + } + return this.orderedFields; + } + + /** + * Gets the all fields. + * + * @return the all fields + */ + public ArrayList<String> getAllFields() { + + ArrayList<String> allFields = new ArrayList<String>(); + allFields.addAll(getBooleanFields()); + allFields.addAll(getStringListFields()); + allFields.addAll(getStringFields()); + allFields.addAll(getIntFields()); + allFields.addAll(getLongFields()); + allFields.addAll(getShortFields()); + + return allFields; + } + + /** + * Gets the plural name. + * + * @return the plural name + */ + public String getPluralName() { + + if (simpleName.contains("List") || simpleName.contains("-list") ) + return ""; + String[] fullNameList = getFullName().split("/"); + return fullNameList[fullNameList.length - 2]; + } + + /** + * Sets the node alt key 1 props. + * + * @param _dbRulesNodeAltKey1Props the db rules node alt key 1 props + */ + public void setNodeAltKey1Props(Multimap<String, String> _dbRulesNodeAltKey1Props) { + this.NodeAltKey1Props = _dbRulesNodeAltKey1Props; + } + + /** + * Gets the node alt key 1 props. + * + * @return the node alt key 1 props + */ + public Multimap<String,String> getNodeAltKey1Props() { + return this.NodeAltKey1Props; + } + + /** + * Sets the node dependencies. + * + * @param _dbRulesNodeDependencies the db rules node dependencies + */ + public void setNodeDependencies(Multimap<String, String> _dbRulesNodeDependencies) { + this.NodeDependencies = _dbRulesNodeDependencies; + } + + /** + * Gets the node dependencies. + * + * @return the node dependencies + */ + public Multimap<String,String> getNodeDependencies() { + return this.NodeDependencies; + } + + /** + * Gets the recurse to resource. + * + * @return the recurse to resource + */ + public AAIResource getRecurseToResource() { + return this.recurseToResource; + } + + /** + * Sets the recurse to resource. + * + * @param ancestor the new recurse to resource + */ + public void setRecurseToResource(AAIResource ancestor) { + this.recurseToResource = ancestor; + + } + + /** + * Sets the allow direct write. + * + * @param allowDirectWrite the new allow direct write + */ + public void setAllowDirectWrite(boolean allowDirectWrite) { + this.allowDirectWrite = allowDirectWrite; + } + + /** + * Checks if is allow direct write. + * + * @return true, if is allow direct write + */ + public boolean isAllowDirectWrite() { + return this.allowDirectWrite; + } + + /** + * Sets the allow direct read. + * + * @param allowDirectRead the new allow direct read + */ + public void setAllowDirectRead(boolean allowDirectRead) { + this.allowDirectRead = allowDirectRead; + } + + /** + * Checks if is allow direct read. + * + * @return true, if is allow direct read + */ + public boolean isAllowDirectRead() { + return this.allowDirectRead; + } + + /** + * Gets the auto gen uuid fields. + * + * @return the auto gen uuid fields + */ + public ArrayList<String> getAutoGenUuidFields() { + if (this.autoGenUuidFields == null) { + this.autoGenUuidFields = new ArrayList<String>(); + } + return this.autoGenUuidFields; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResourceKey.java b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResourceKey.java new file mode 100644 index 00000000..5129992b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResourceKey.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.model; + +import com.google.common.base.CaseFormat; + +public class AAIResourceKey { + private String keyName; + private String keyType; + private String pathParamName; + private String dnCamKeyName; + + /** + * Gets the key name. + * + * @return the key name + */ + public String getKeyName() { + return keyName; + } + + /** + * Sets the key name. + * + * @param keyName the new key name + */ + public void setKeyName(String keyName) { + this.keyName = keyName; + } + + /** + * Gets the key type. + * + * @return the key type + */ + public String getKeyType() { + return keyType; + } + + /** + * Sets the key type. + * + * @param t the new key type + */ + public void setKeyType(String t) { + this.keyType = t; + } + + /** + * Gets the path param name. + * + * @return the path param name + */ + public String getPathParamName() { + return pathParamName; + } + + /** + * Sets the path param name. + * + * @param pathParamName the new path param name + */ + public void setPathParamName(String pathParamName) { + this.pathParamName = pathParamName; + } + + /** + * Gets the dn cam key name. + * + * @return the dn cam key name + */ + public String getDnCamKeyName() { + return dnCamKeyName; + } + + /** + * Sets the dn cam key name. + * + * @param dnCamKeyName the new dn cam key name + */ + public void setDnCamKeyName(String dnCamKeyName) { + this.dnCamKeyName = dnCamKeyName; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResourceKeys.java b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResourceKeys.java new file mode 100644 index 00000000..2aa752c8 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResourceKeys.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.model; + +import java.util.ArrayList; +import java.util.List; + +public class AAIResourceKeys { + private List<AAIResourceKey> aaiResourceKey; + + /** + * Gets the aai resource key. + * + * @return the aai resource key + */ + public List<AAIResourceKey> getAaiResourceKey() { + if (aaiResourceKey == null) { + aaiResourceKey = new ArrayList<AAIResourceKey>(); + } + return aaiResourceKey; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResources.java b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResources.java new file mode 100644 index 00000000..6aff26e8 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/model/AAIResources.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.model; + +import java.util.HashMap; + +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; + +public class AAIResources { + + private DynamicJAXBContext jaxbContext; + + private HashMap<String, AAIResource> aaiResources; + private HashMap<String, AAIResource> resourceLookup; + + + /** + * Gets the aai resources. + * + * @return the aai resources + */ + public HashMap<String, AAIResource> getAaiResources() { + if (aaiResources == null) { + aaiResources = new HashMap<String, AAIResource>(); + } + return aaiResources; + } + + /** + * Gets the jaxb context. + * + * @return the jaxb context + */ + public DynamicJAXBContext getJaxbContext() { + return jaxbContext; + } + + /** + * Sets the jaxb context. + * + * @param jaxbContext the new jaxb context + */ + public void setJaxbContext(DynamicJAXBContext jaxbContext) { + this.jaxbContext = jaxbContext; + } + + /** + * Gets the resource lookup. + * + * @return the resource lookup + */ + public HashMap<String, AAIResource> getResourceLookup() { + if (resourceLookup == null) { + resourceLookup = new HashMap<String, AAIResource>(); + } + return resourceLookup; + } + + /** + * Sets the resource lookup. + * + * @param resourceLookup the resource lookup + */ + public void setResourceLookup(HashMap<String, AAIResource> resourceLookup) { + this.resourceLookup = resourceLookup; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/notificationEvent/NotificationEvent.java b/aai-core/src/main/java/org/openecomp/aai/domain/notificationEvent/NotificationEvent.java new file mode 100644 index 00000000..18585518 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/notificationEvent/NotificationEvent.java @@ -0,0 +1,564 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2016.01.06 at 05:38:00 PM EST +// + + +package org.openecomp.aai.domain.notificationEvent; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.w3c.dom.Element; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="cambria.partition" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="event-header" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="timestamp" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="source-name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="domain" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="sequence-number" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="severity" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="event-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="action" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="entity-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="top-entity-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="entity-link" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <any processContents='lax' namespace='##other' minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "cambriaPartition", + "eventHeader", + "entity" +}) +@XmlRootElement(name = "NotificationEvent") +public class NotificationEvent { + + @XmlElement(name = "cambria.partition") + protected String cambriaPartition; + @XmlElement(name = "event-header") + protected NotificationEvent.EventHeader eventHeader; + @XmlAnyElement(lax = true) + protected Object entity; + + /** + * Gets the value of the eventHeader property. + * + * @return + * possible object is + * {@link NotificationEvent.EventHeader } + * + */ + public NotificationEvent.EventHeader getEventHeader() { + return eventHeader; + } + + /** + * Sets the value of the eventHeader property. + * + * @param value + * allowed object is + * {@link NotificationEvent.EventHeader } + * + */ + public void setEventHeader(NotificationEvent.EventHeader value) { + this.eventHeader = value; + } + + /** + * Gets the value of the any property. + * + * @return + * possible object is + * {@link Object } + * {@link Element } + * + */ + public Object getEntity() { + return entity; + } + + /** + * Sets the value of the any property. + * + * @param value + * allowed object is + * {@link Object } + * {@link Element } + * + */ + public void setEntity(Object value) { + this.entity = value; + } + + /** + * Gets the value of the cambriaPartition property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCambriaPartition() { + return cambriaPartition; + } + + /** + * Sets the value of the cambriaPartition property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCambriaPartition(String value) { + this.cambriaPartition = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="timestamp" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="source-name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="domain" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="sequence-number" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="severity" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="event-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="action" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="entity-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="top-entity-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="entity-link" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="status" type="{http://www.w3.org/2001/XMLSchema}string"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "id", + "timestamp", + "sourceName", + "domain", + "sequenceNumber", + "severity", + "eventType", + "version", + "action", + "entityType", + "topEntityType", + "entityLink", + "status" + }) + public static class EventHeader { + + @XmlElement(required = true) + protected String id; + @XmlElement(required = true) + protected String timestamp; + @XmlElement(name = "source-name", required = true) + protected String sourceName; + @XmlElement(required = true) + protected String domain; + @XmlElement(name = "sequence-number", required = true) + protected String sequenceNumber; + @XmlElement(required = true) + protected String severity; + @XmlElement(name = "event-type", required = true) + protected String eventType; + @XmlElement(required = true) + protected String version; + @XmlElement(required = true) + protected String action; + @XmlElement(name = "entity-type", required = true) + protected String entityType; + @XmlElement(name = "top-entity-type", required = true) + protected String topEntityType; + @XmlElement(name = "entity-link", required = true) + protected String entityLink; + @XmlElement(required = true) + protected String status; + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + /** + * Gets the value of the timestamp property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTimestamp() { + return timestamp; + } + + /** + * Sets the value of the timestamp property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTimestamp(String value) { + this.timestamp = value; + } + + /** + * Gets the value of the sourceName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSourceName() { + return sourceName; + } + + /** + * Sets the value of the sourceName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSourceName(String value) { + this.sourceName = value; + } + + /** + * Gets the value of the domain property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDomain() { + return domain; + } + + /** + * Sets the value of the domain property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDomain(String value) { + this.domain = value; + } + + /** + * Gets the value of the sequenceNumber property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSequenceNumber() { + return sequenceNumber; + } + + /** + * Sets the value of the sequenceNumber property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSequenceNumber(String value) { + this.sequenceNumber = value; + } + + /** + * Gets the value of the severity property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSeverity() { + return severity; + } + + /** + * Sets the value of the severity property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSeverity(String value) { + this.severity = value; + } + + /** + * Gets the value of the eventType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEventType() { + return eventType; + } + + /** + * Sets the value of the eventType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEventType(String value) { + this.eventType = value; + } + + /** + * Gets the value of the version property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersion() { + return version; + } + + /** + * Sets the value of the version property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersion(String value) { + this.version = value; + } + + /** + * Gets the value of the action property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAction() { + return action; + } + + /** + * Sets the value of the action property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAction(String value) { + this.action = value; + } + + /** + * Gets the value of the entityType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEntityType() { + return entityType; + } + + /** + * Sets the value of the entityType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEntityType(String value) { + this.entityType = value; + } + + /** + * Gets the value of the topEntityType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTopEntityType() { + return topEntityType; + } + + /** + * Sets the value of the topEntityType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTopEntityType(String value) { + this.topEntityType = value; + } + + /** + * Gets the value of the entityLink property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEntityLink() { + return entityLink; + } + + /** + * Sets the value of the entityLink property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEntityLink(String value) { + this.entityLink = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/notificationEvent/ObjectFactory.java b/aai-core/src/main/java/org/openecomp/aai/domain/notificationEvent/ObjectFactory.java new file mode 100644 index 00000000..c8bfab89 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/notificationEvent/ObjectFactory.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2016.01.06 at 05:38:00 PM EST +// + + +package org.openecomp.aai.domain.notificationEvent; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.aai.domain.notificationEvent package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.aai.domain.notificationEvent + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link NotificationEvent }. + * + * @return the notification event + */ + public NotificationEvent createNotificationEvent() { + return new NotificationEvent(); + } + + /** + * Create an instance of {@link NotificationEvent.EventHeader } + * + * @return the event header + */ + public NotificationEvent.EventHeader createNotificationEventEventHeader() { + return new NotificationEvent.EventHeader(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessage.java b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessage.java new file mode 100644 index 00000000..5cbe3167 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessage.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.responseMessage; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "aaiResponseMessageCode", + "aaiResponseMessageResourceType", + "aaiResponseMessageDescription", + "aaiResponseMessageData", +}) +@XmlRootElement(name = "aai-response-message", namespace = "http://org.openecomp.aai.inventory") +public class AAIResponseMessage { + + @XmlElement(name = "aai-response-message-code", required = true) + protected String aaiResponseMessageCode; + @XmlElement(name = "aai-response-message-resource-type") + protected String aaiResponseMessageResourceType; + @XmlElement(name = "aai-response-message-description") + protected String aaiResponseMessageDescription; + @XmlElement(name = "aai-response-message-data") + protected AAIResponseMessageData aaiResponseMessageData; + + /** + * Gets the aai response message code. + * + * @return the aai response message code + */ + public String getAaiResponseMessageCode() { + return aaiResponseMessageCode; + } + + /** + * Sets the aai response message code. + * + * @param aaiResponseMessageCode the new aai response message code + */ + public void setAaiResponseMessageCode(String aaiResponseMessageCode) { + this.aaiResponseMessageCode = aaiResponseMessageCode; + } + + /** + * Gets the aai response message resource type. + * + * @return the aai response message resource type + */ + public String getAaiResponseMessageResourceType() { + return aaiResponseMessageResourceType; + } + + /** + * Sets the aai response message resource type. + * + * @param aaiResponseMessageResourceType the new aai response message resource type + */ + public void setAaiResponseMessageResourceType( + String aaiResponseMessageResourceType) { + this.aaiResponseMessageResourceType = aaiResponseMessageResourceType; + } + + /** + * Gets the aai response message description. + * + * @return the aai response message description + */ + public String getAaiResponseMessageDescription() { + return aaiResponseMessageDescription; + } + + /** + * Sets the aai response message description. + * + * @param aaiResponseMessageDescription the new aai response message description + */ + public void setAaiResponseMessageDescription( + String aaiResponseMessageDescription) { + this.aaiResponseMessageDescription = aaiResponseMessageDescription; + } + + /** + * Gets the aai response message data. + * + * @return the aai response message data + */ + public AAIResponseMessageData getAaiResponseMessageData() { + if (aaiResponseMessageData == null) { + aaiResponseMessageData = new AAIResponseMessageData(); + } + return aaiResponseMessageData; + } + + /** + * Sets the AAI response message data. + * + * @param aaiResponseMessageData the new AAI response message data + */ + public void setAAIResponseMessageData( + AAIResponseMessageData aaiResponseMessageData) { + this.aaiResponseMessageData = aaiResponseMessageData; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessageData.java b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessageData.java new file mode 100644 index 00000000..2f16b98a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessageData.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.responseMessage; + + +// +//This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +//See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +//Any modifications to this file will be lost upon recompilation of the source schema. +//Generated on: 2015.09.11 at 11:53:27 AM EDT +// + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "aaiResponseMessageDatum", + "any" +}) +@XmlRootElement(name = "aai-response-message-data", namespace = "http://org.openecomp.aai.inventory") +public class AAIResponseMessageData { + + @XmlElement(name = "aai-response-message-datum") + protected List<AAIResponseMessageDatum> aaiResponseMessageDatum; + @XmlAnyElement(lax = true) + protected List<Object> any; + + /** + * Gets the AAI response message datum. + * + * @return the AAI response message datum + */ + public List<AAIResponseMessageDatum> getAAIResponseMessageDatum() { + if (aaiResponseMessageDatum == null) { + aaiResponseMessageDatum = new ArrayList<AAIResponseMessageDatum>(); + } + return this.aaiResponseMessageDatum; + } + + /** + * Gets the any. + * + * @return the any + */ + public List<Object> getAny() { + if (any == null) { + any = new ArrayList<Object>(); + } + return this.any; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessageDatum.java b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessageDatum.java new file mode 100644 index 00000000..9e56333d --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessageDatum.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.responseMessage; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "aaiResponseMessageDatumKey", + "aaiResponseMessageDatumValue", + +}) + +@XmlRootElement(name = "aai-response-message-datum", namespace = "http://org.openecomp.aai.inventory") +public class AAIResponseMessageDatum { + + @XmlElement(name = "aai-response-message-datum-key", required = true) + protected String aaiResponseMessageDatumKey; + @XmlElement(name = "aai-response-message-datum-value", required = true) + protected String aaiResponseMessageDatumValue; + + /** + * Gets the aai response message datum key. + * + * @return the aai response message datum key + */ + public String getAaiResponseMessageDatumKey() { + return aaiResponseMessageDatumKey; + } + + /** + * Sets the aai response message datum key. + * + * @param aaiResponseMessageDatumKey the new aai response message datum key + */ + public void setAaiResponseMessageDatumKey(String aaiResponseMessageDatumKey) { + this.aaiResponseMessageDatumKey = aaiResponseMessageDatumKey; + } + + /** + * Gets the aai response message datum value. + * + * @return the aai response message datum value + */ + public String getAaiResponseMessageDatumValue() { + return aaiResponseMessageDatumValue; + } + + /** + * Sets the aai response message datum value. + * + * @param aaiResponseMessageDatumValue the new aai response message datum value + */ + public void setAaiResponseMessageDatumValue(String aaiResponseMessageDatumValue) { + this.aaiResponseMessageDatumValue = aaiResponseMessageDatumValue; + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessages.java b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessages.java new file mode 100644 index 00000000..ec6d645d --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/AAIResponseMessages.java @@ -0,0 +1,118 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.responseMessage; + + +// +//This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +//See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +//Any modifications to this file will be lost upon recompilation of the source schema. +//Generated on: 2015.09.11 at 11:53:27 AM EDT +// + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="flavor" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="flavor-id" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="flavor-name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="flavor-vcpus" type="{http://www.w3.org/2001/XMLSchema}short" minOccurs="0"/> + * <element name="flavor-ram" type="{http://www.w3.org/2001/XMLSchema}short" minOccurs="0"/> + * <element name="flavor-disk" type="{http://www.w3.org/2001/XMLSchema}short" minOccurs="0"/> + * <element name="flavor-ephemeral" type="{http://www.w3.org/2001/XMLSchema}short" minOccurs="0"/> + * <element name="flavor-swap" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="flavor-is-public" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="flavor-selflink" type="{urn:ietf:params:xml:ns:yang:ietf-inet-types}uri" minOccurs="0"/> + * <element name="flavor-disabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp.aai.inventory/v3}relationship-list" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "aaiResponseMessage", + "any" +}) +@XmlRootElement(name = "aai-response-messages", namespace = "http://org.openecomp.aai.inventory") +public class AAIResponseMessages { + @XmlElement(name = "aai-response-message") + protected List<AAIResponseMessage> aaiResponseMessage; + @XmlAnyElement(lax = true) + protected List<Object> any; + + /** + * Gets the AAI response message. + * + * @return the AAI response message + */ + public List<AAIResponseMessage> getAAIResponseMessage() { + if (aaiResponseMessage == null) { + aaiResponseMessage = new ArrayList<AAIResponseMessage>(); + } + return this.aaiResponseMessage; + } + + /** + * Gets the any. + * + * @return the any + */ + public List<Object> getAny() { + if (any == null) { + any = new ArrayList<Object>(); + } + return this.any; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/package-info.java b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/package-info.java new file mode 100644 index 00000000..0c024ff2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/responseMessage/package-info.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.06.15 at 03:03:58 PM EDT +// + +@javax.xml.bind.annotation.XmlSchema( + namespace = "http://org.openecomp.aai.inventory", + elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.openecomp.aai.domain.responseMessage; + diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/Fault.java b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/Fault.java new file mode 100644 index 00000000..68281cf6 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/Fault.java @@ -0,0 +1,382 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.02.11 at 04:54:39 PM EST +// + + +package org.openecomp.aai.domain.restPolicyException; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="requestError"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="policyException"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestError" +}) +@XmlRootElement(name = "Fault") +public class Fault { + + @XmlElement(required = true) + protected Fault.RequestError requestError; + + /** + * Gets the value of the requestError property. + * + * @return + * possible object is + * {@link Fault.RequestError } + * + */ + public Fault.RequestError getRequestError() { + return requestError; + } + + /** + * Sets the value of the requestError property. + * + * @param value + * allowed object is + * {@link Fault.RequestError } + * + */ + public void setRequestError(Fault.RequestError value) { + this.requestError = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="policyException"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "policyException" + }) + public static class RequestError { + + @XmlElement(required = true) + protected Fault.RequestError.PolicyException policyException; + + /** + * Gets the value of the policyException property. + * + * @return + * possible object is + * {@link Fault.RequestError.PolicyException } + * + */ + public Fault.RequestError.PolicyException getPolicyException() { + return policyException; + } + + /** + * Sets the value of the policyException property. + * + * @param value + * allowed object is + * {@link Fault.RequestError.PolicyException } + * + */ + public void setPolicyException(Fault.RequestError.PolicyException value) { + this.policyException = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "messageId", + "text", + "variables" + }) + public static class PolicyException { + + @XmlElement(required = true) + protected String messageId; + @XmlElement(required = true) + protected String text; + @XmlElement(required = true) + protected Fault.RequestError.PolicyException.Variables variables; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + + /** + * Gets the value of the variables property. + * + * @return + * possible object is + * {@link Fault.RequestError.PolicyException.Variables } + * + */ + public Fault.RequestError.PolicyException.Variables getVariables() { + return variables; + } + + /** + * Sets the value of the variables property. + * + * @param value + * allowed object is + * {@link Fault.RequestError.PolicyException.Variables } + * + */ + public void setVariables(Fault.RequestError.PolicyException.Variables value) { + this.variables = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "variable" + }) + public static class Variables { + + protected List<String> variable; + + /** + * Gets the value of the variable property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the variable property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVariable().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * @return the variable + */ + public List<String> getVariable() { + if (variable == null) { + variable = new ArrayList<String>(); + } + return this.variable; + } + + } + + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/ObjectFactory.java b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/ObjectFactory.java new file mode 100644 index 00000000..3d3cffe2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/ObjectFactory.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.02.11 at 04:54:39 PM EST +// + + +package org.openecomp.aai.domain.restPolicyException; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.aai.domain.restPolicyException package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.aai.domain.restPolicyException + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Fault }. + * + * @return the fault + */ + public Fault createFault() { + return new Fault(); + } + + /** + * Create an instance of {@link Fault.RequestError } + * + * @return the request error + */ + public Fault.RequestError createFaultRequestError() { + return new Fault.RequestError(); + } + + /** + * Create an instance of {@link Fault.RequestError.PolicyException } + * + * @return the policy exception + */ + public Fault.RequestError.PolicyException createFaultRequestErrorPolicyException() { + return new Fault.RequestError.PolicyException(); + } + + /** + * Create an instance of {@link Fault.RequestError.PolicyException.Variables } + * + * @return the variables + */ + public Fault.RequestError.PolicyException.Variables createFaultRequestErrorPolicyExceptionVariables() { + return new Fault.RequestError.PolicyException.Variables(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/PolicyException.java b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/PolicyException.java new file mode 100644 index 00000000..b0e427bb --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/PolicyException.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.restPolicyException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "messageId", + "text", + "variables" +}) +public class PolicyException { + + @JsonProperty("messageId") + private String messageId; + @JsonProperty("text") + private String text; + @JsonProperty("variables") + private List<String> variables = new ArrayList<String>(); + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * Gets the message id. + * + * @return The messageId + */ + @JsonProperty("messageId") + public String getMessageId() { + return messageId; + } + + /** + * Sets the message id. + * + * @param messageId The messageId + */ + @JsonProperty("messageId") + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + /** + * Gets the text. + * + * @return The text + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * Sets the text. + * + * @param text The text + */ + @JsonProperty("text") + public void setText(String text) { + this.text = text; + } + + /** + * Gets the variables. + * + * @return The variables + */ + @JsonProperty("variables") + public List<String> getVariables() { + return variables; + } + + /** + * Sets the variables. + * + * @param variables The variables + */ + @JsonProperty("variables") + public void setVariables(List<String> variables) { + this.variables = variables; + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/RESTResponse.java b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/RESTResponse.java new file mode 100644 index 00000000..bf929e8c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/RESTResponse.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.restPolicyException; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "requestError" +}) +public class RESTResponse { + + @JsonProperty("requestError") + private RequestError requestError; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * Gets the request error. + * + * @return The requestError + */ + @JsonProperty("requestError") + public RequestError getRequestError() { + return requestError; + } + + /** + * Sets the request error. + * + * @param requestError The requestError + */ + @JsonProperty("requestError") + public void setRequestError(RequestError requestError) { + this.requestError = requestError; + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/RequestError.java b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/RequestError.java new file mode 100644 index 00000000..ebbb8984 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restPolicyException/RequestError.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.restPolicyException; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "policyException" +}) +public class RequestError { + + @JsonProperty("policyException") + private PolicyException policyException; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * Gets the policy exception. + * + * @return The policyException + */ + @JsonProperty("policyException") + public PolicyException getPolicyException() { + return policyException; + } + + /** + * Sets the policy exception. + * + * @param policyException The policyException + */ + @JsonProperty("policyException") + public void setPolicyException(PolicyException policyException) { + this.policyException = policyException; + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} + diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restResponseInfo/Info.java b/aai-core/src/main/java/org/openecomp/aai/domain/restResponseInfo/Info.java new file mode 100644 index 00000000..a91fdb5b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restResponseInfo/Info.java @@ -0,0 +1,385 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.10.28 at 05:53:17 PM EDT +// + + +package org.openecomp.aai.domain.restResponseInfo; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="responseMessages" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="responseMessage" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "responseMessages" +}) +@XmlRootElement(name = "Info") +public class Info { + + protected Info.ResponseMessages responseMessages; + + /** + * Gets the value of the responseMessages property. + * + * @return + * possible object is + * {@link Info.ResponseMessages } + * + */ + public Info.ResponseMessages getResponseMessages() { + return responseMessages; + } + + /** + * Sets the value of the responseMessages property. + * + * @param value + * allowed object is + * {@link Info.ResponseMessages } + * + */ + public void setResponseMessages(Info.ResponseMessages value) { + this.responseMessages = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="responseMessage" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "responseMessage" + }) + public static class ResponseMessages { + + protected List<Info.ResponseMessages.ResponseMessage> responseMessage; + + /** + * Gets the value of the responseMessage property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the responseMessage property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getResponseMessage().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link Info.ResponseMessages.ResponseMessage } + * + * @return the response message + */ + public List<Info.ResponseMessages.ResponseMessage> getResponseMessage() { + if (responseMessage == null) { + responseMessage = new ArrayList<Info.ResponseMessages.ResponseMessage>(); + } + return this.responseMessage; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "messageId", + "text", + "variables" + }) + public static class ResponseMessage { + + @XmlElement(required = true) + protected String messageId; + @XmlElement(required = true) + protected String text; + @XmlElement(required = true) + protected Info.ResponseMessages.ResponseMessage.Variables variables; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + + /** + * Gets the value of the variables property. + * + * @return + * possible object is + * {@link Info.ResponseMessages.ResponseMessage.Variables } + * + */ + public Info.ResponseMessages.ResponseMessage.Variables getVariables() { + return variables; + } + + /** + * Sets the value of the variables property. + * + * @param value + * allowed object is + * {@link Info.ResponseMessages.ResponseMessage.Variables } + * + */ + public void setVariables(Info.ResponseMessages.ResponseMessage.Variables value) { + this.variables = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "variable" + }) + public static class Variables { + + protected List<String> variable; + + /** + * Gets the value of the variable property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the variable property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVariable().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * @return the variable + */ + public List<String> getVariable() { + if (variable == null) { + variable = new ArrayList<String>(); + } + return this.variable; + } + + } + + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restResponseInfo/ObjectFactory.java b/aai-core/src/main/java/org/openecomp/aai/domain/restResponseInfo/ObjectFactory.java new file mode 100644 index 00000000..c964cd59 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restResponseInfo/ObjectFactory.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.10.28 at 05:53:17 PM EDT +// + + +package org.openecomp.aai.domain.restResponseInfo; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.aai.domain.restResponseInfo package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.aai.domain.restResponseInfo + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Info }. + * + * @return the info + */ + public Info createInfo() { + return new Info(); + } + + /** + * Create an instance of {@link Info.ResponseMessages } + * + * @return the response messages + */ + public Info.ResponseMessages createInfoResponseMessages() { + return new Info.ResponseMessages(); + } + + /** + * Create an instance of {@link Info.ResponseMessages.ResponseMessage } + * + * @return the response message + */ + public Info.ResponseMessages.ResponseMessage createInfoResponseMessagesResponseMessage() { + return new Info.ResponseMessages.ResponseMessage(); + } + + /** + * Create an instance of {@link Info.ResponseMessages.ResponseMessage.Variables } + * + * @return the variables + */ + public Info.ResponseMessages.ResponseMessage.Variables createInfoResponseMessagesResponseMessageVariables() { + return new Info.ResponseMessages.ResponseMessage.Variables(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/Fault.java b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/Fault.java new file mode 100644 index 00000000..639a5cff --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/Fault.java @@ -0,0 +1,382 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.02.11 at 04:54:29 PM EST +// + + +package org.openecomp.aai.domain.restServiceException; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="requestError"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="serviceException"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestError" +}) +@XmlRootElement(name = "Fault") +public class Fault { + + @XmlElement(required = true) + protected Fault.RequestError requestError; + + /** + * Gets the value of the requestError property. + * + * @return + * possible object is + * {@link Fault.RequestError } + * + */ + public Fault.RequestError getRequestError() { + return requestError; + } + + /** + * Sets the value of the requestError property. + * + * @param value + * allowed object is + * {@link Fault.RequestError } + * + */ + public void setRequestError(Fault.RequestError value) { + this.requestError = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="serviceException"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "serviceException" + }) + public static class RequestError { + + @XmlElement(required = true) + protected Fault.RequestError.ServiceException serviceException; + + /** + * Gets the value of the serviceException property. + * + * @return + * possible object is + * {@link Fault.RequestError.ServiceException } + * + */ + public Fault.RequestError.ServiceException getServiceException() { + return serviceException; + } + + /** + * Sets the value of the serviceException property. + * + * @param value + * allowed object is + * {@link Fault.RequestError.ServiceException } + * + */ + public void setServiceException(Fault.RequestError.ServiceException value) { + this.serviceException = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="variables"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "messageId", + "text", + "variables" + }) + public static class ServiceException { + + @XmlElement(required = true) + protected String messageId; + @XmlElement(required = true) + protected String text; + @XmlElement(required = true) + protected Fault.RequestError.ServiceException.Variables variables; + + /** + * Gets the value of the messageId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets the value of the messageId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMessageId(String value) { + this.messageId = value; + } + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + + /** + * Gets the value of the variables property. + * + * @return + * possible object is + * {@link Fault.RequestError.ServiceException.Variables } + * + */ + public Fault.RequestError.ServiceException.Variables getVariables() { + return variables; + } + + /** + * Sets the value of the variables property. + * + * @param value + * allowed object is + * {@link Fault.RequestError.ServiceException.Variables } + * + */ + public void setVariables(Fault.RequestError.ServiceException.Variables value) { + this.variables = value; + } + + + /** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="variable" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "variable" + }) + public static class Variables { + + protected List<String> variable; + + /** + * Gets the value of the variable property. + * + * <p> + * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a <CODE>set</CODE> method for the variable property. + * + * <p> + * For example, to add a new item, do as follows: + * <pre> + * getVariable().add(newItem); + * </pre> + * + * + * <p> + * Objects of the following type(s) are allowed in the list + * {@link String } + * + * @return the variable + */ + public List<String> getVariable() { + if (variable == null) { + variable = new ArrayList<String>(); + } + return this.variable; + } + + } + + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/ObjectFactory.java b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/ObjectFactory.java new file mode 100644 index 00000000..c6c06766 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/ObjectFactory.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.02.11 at 04:54:29 PM EST +// + + +package org.openecomp.aai.domain.restServiceException; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.aai.domain.restServiceException package. + * <p>An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.aai.domain.restServiceException + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Fault }. + * + * @return the fault + */ + public Fault createFault() { + return new Fault(); + } + + /** + * Create an instance of {@link Fault.RequestError } + * + * @return the request error + */ + public Fault.RequestError createFaultRequestError() { + return new Fault.RequestError(); + } + + /** + * Create an instance of {@link Fault.RequestError.ServiceException } + * + * @return the service exception + */ + public Fault.RequestError.ServiceException createFaultRequestErrorServiceException() { + return new Fault.RequestError.ServiceException(); + } + + /** + * Create an instance of {@link Fault.RequestError.ServiceException.Variables } + * + * @return the variables + */ + public Fault.RequestError.ServiceException.Variables createFaultRequestErrorServiceExceptionVariables() { + return new Fault.RequestError.ServiceException.Variables(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/RESTResponse.java b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/RESTResponse.java new file mode 100644 index 00000000..bef20f79 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/RESTResponse.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.restServiceException; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "requestError" +}) +public class RESTResponse { + + @JsonProperty("requestError") + private RequestError requestError; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * Gets the request error. + * + * @return The requestError + */ + @JsonProperty("requestError") + public RequestError getRequestError() { + return requestError; + } + + /** + * Sets the request error. + * + * @param requestError The requestError + */ + @JsonProperty("requestError") + public void setRequestError(RequestError requestError) { + this.requestError = requestError; + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/RequestError.java b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/RequestError.java new file mode 100644 index 00000000..9a076908 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/RequestError.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.restServiceException; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "serviceException" +}) +public class RequestError { + + @JsonProperty("serviceException") + private ServiceException serviceException; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * Gets the service exception. + * + * @return The serviceException + */ + @JsonProperty("serviceException") + public ServiceException getServiceException() { + return serviceException; + } + + /** + * Sets the service exception. + * + * @param serviceException The serviceException + */ + @JsonProperty("serviceException") + public void setServiceException(ServiceException serviceException) { + this.serviceException = serviceException; + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/ServiceException.java b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/ServiceException.java new file mode 100644 index 00000000..86b21de3 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/restServiceException/ServiceException.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.restServiceException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "messageId", + "text", + "variables" +}) +public class ServiceException { + + @JsonProperty("messageId") + private String messageId; + @JsonProperty("text") + private String text; + @JsonProperty("variables") + private List<String> variables = new ArrayList<String>(); + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * Gets the message id. + * + * @return The messageId + */ + @JsonProperty("messageId") + public String getMessageId() { + return messageId; + } + + /** + * Sets the message id. + * + * @param messageId The messageId + */ + @JsonProperty("messageId") + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + /** + * Gets the text. + * + * @return The text + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * Sets the text. + * + * @param text The text + */ + @JsonProperty("text") + public void setText(String text) { + this.text = text; + } + + /** + * Gets the variables. + * + * @return The variables + */ + @JsonProperty("variables") + public List<String> getVariables() { + return variables; + } + + /** + * Sets the variables. + * + * @param variables The variables + */ + @JsonProperty("variables") + public void setVariables(List<String> variables) { + this.variables = variables; + } + + /** + * Gets the additional properties. + * + * @return the additional properties + */ + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Sets the additional property. + * + * @param name the name + * @param value the value + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/translog/TransactionLogEntries.java b/aai-core/src/main/java/org/openecomp/aai/domain/translog/TransactionLogEntries.java new file mode 100644 index 00000000..0497da42 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/translog/TransactionLogEntries.java @@ -0,0 +1,131 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.03.20 at 09:46:47 AM CDT +// + + +package org.openecomp.aai.domain.translog; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * <p>Java class for anonymous complex type. + * + * <p>The following schema fragment specifies the expected content contained within this class. + * + * <pre> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="update" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="update-node-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="update-node-key" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="key-name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="key-value" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <element name="action" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="action-type" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="action-data" maxOccurs="unbounded" minOccurs="0"> + * <complexType> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="property-name" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <element name="property-value" type="{http://www.w3.org/2001/XMLSchema}string"/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </element> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + * </pre> + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "transactionLogEntries" +}) +@XmlRootElement(name = "transaction-log-entries", namespace = "http://org.openecomp.aai.inventory") +public class TransactionLogEntries { + + protected List<TransactionLogEntry> transactionLogEntries; + + /** + * Gets the transaction log entries. + * + * @return the transaction log entries + */ + public List<TransactionLogEntry> getTransactionLogEntries() { + if (transactionLogEntries == null) { + transactionLogEntries = new ArrayList<TransactionLogEntry>(); + } + return this.transactionLogEntries; + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/domain/translog/TransactionLogEntry.java b/aai-core/src/main/java/org/openecomp/aai/domain/translog/TransactionLogEntry.java new file mode 100644 index 00000000..6c2f815b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/domain/translog/TransactionLogEntry.java @@ -0,0 +1,438 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.domain.translog; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.sun.xml.txw2.annotation.XmlCDATA; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "transactionLogEntryId", + "status", + "rqstDate", + "respDate", + "sourceId", + "resourceId", + "resourceType", + "rqstBuf", + "respBuf", + "notificationPayload", + "notificationId", + "notificationStatus", + "notificationTopic", + "notificationEntityLink", + "notificationAction" +}) +@XmlRootElement(name = "transaction-log-entry", namespace = "http://org.openecomp.aai.inventory") +public class TransactionLogEntry { + + @XmlElement(name = "transaction-log-entry-id", required = true) + protected String transactionLogEntryId; + @XmlElement(name = "status") + protected String status; + @XmlElement(name = "rqst-date") + protected String rqstDate; + @XmlElement(name = "resp-date") + protected String respDate; + @XmlElement(name = "source-id") + protected String sourceId; + @XmlElement(name = "resource-id") + protected String resourceId; + @XmlElement(name = "resource-type") + protected String resourceType; + @XmlElement(name = "rqst-buf") + protected String rqstBuf; + @XmlElement(name = "resp-buf") + protected String respBuf; + @XmlElement(name = "notification-payload") + protected String notificationPayload; + @XmlElement(name = "notification-id") + protected String notificationId; + @XmlElement(name = "notification-status") + protected String notificationStatus; + @XmlElement(name = "notification-topic") + private String notificationTopic; + @XmlElement(name = "notification-entity-link") + private String notificationEntityLink; + @XmlElement(name = "notification-action") + private String notificationAction; + + /** + * Gets the value of the transcationLogEntryId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTransactionLogEntryId() { + return transactionLogEntryId; + } + + /** + * Sets the value of the transactionLogEntryId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTransactionLogEntryId(String value) { + this.transactionLogEntryId = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + + /** + * Gets the value of the rqstDate property. + * + * @return + * possible object is + * {@link String } + * + */ + + public String getRqstDate() { + return rqstDate; + } + + /** + * Sets the value of the rqstDate property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRqstDate(String value) { + this.rqstDate = value; + } + + + /** + * Gets the value of the respDate property. + * + * @return + * possible object is + * {@link String } + * + */ + + public String getRespDate() { + return respDate; + } + + /** + * Sets the value of the respDate property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRespDate(String value) { + this.respDate = value; + } + /** + * Gets the value of the sourceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSourceId() { + return sourceId; + } + + /** + * Sets the value of the sourceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSourceId(String value) { + this.sourceId = value; + } + + /** + * Gets the value of the resourceId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceId() { + return resourceId; + } + + /** + * Sets the value of the resourceId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceId(String value) { + this.resourceId = value; + } + + /** + * Gets the value of the resourceType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResourceType() { + return resourceType; + } + + /** + * Sets the value of the resourceType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResourceType(String value) { + this.resourceType = value; + } + + /** + * Gets the value of the rqstBuf property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRqstBuf() { + return rqstBuf; + } + + /** + * Sets the value of the rqstBuf property. + * + * @param value + * allowed object is + * {@link String } + * + */ + @XmlCDATA + public void setRqstBuf(String value) { + this.rqstBuf = value; + } + + /** + * Gets the value of the respBuf property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getrespBuf() { + return respBuf; + } + + /** + * Sets the value of the respBuf property. + * + * @param value + * allowed object is + * {@link String } + * + */ + @XmlCDATA + public void setrespBuf(String value) { + this.respBuf = value; + } + + /** + * Gets the value of the notificationPayload property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNotificationPayload() { + return notificationPayload; + } + + /** + * Sets the value of the notificationPayload property. + * + * @param value + * allowed object is + * {@link String } + * + */ + @XmlCDATA + public void setNotificationPayload(String value) { + this.notificationPayload = value; + } + + + /** + * Gets the value of the notificationId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNotificationId() { + return notificationId; + } + + /** + * Sets the value of the notificationId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNotificationId(String value) { + this.notificationId = value; + } + + /** + * Gets the value of the notificationId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNotificationStatus() { + return notificationStatus; + } + + /** + * Sets the value of the notificationId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNotificationStatus(String value) { + this.notificationStatus = value; + } + + /** + * Gets the value of the notificationTopic property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNotificationTopic() { + return notificationTopic; + } + + /** + * Sets the value of the notificationTopic property. + * + * @param topic the new notification topic + */ + public void setNotificationTopic(String topic) { + this.notificationTopic = topic; + } + + /** + * Gets the value of the notificationEntityLink property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNotificationEntityLink() { + return notificationEntityLink; + } + + /** + * Sets the value of the notificationEntityLink property. + * + * @param entityLink the new notification entity link + */ + public void setNotificationEntityLink(String entityLink) { + this.notificationEntityLink = entityLink; + } + + /** + * Sets the value of the notificationAction property. + * + * @return the notification action + */ + public String getNotificationAction() { + return notificationAction; + } + + /** + * Sets the value of the notificationAction property. + * + * @param action the new notification action + */ + public void setNotificationAction(String action) { + this.notificationAction = action; + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/exceptions/AAIException.java b/aai-core/src/main/java/org/openecomp/aai/exceptions/AAIException.java new file mode 100644 index 00000000..75ee12f2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/exceptions/AAIException.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.exceptions; + +import java.util.Collection; +import java.util.LinkedList; + +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.logging.ErrorObject; +import org.openecomp.aai.logging.ErrorObjectNotFoundException; + +public class AAIException extends Exception { + + public static final String DEFAULT_EXCEPTION_CODE = "AAI_4000"; + private static final long serialVersionUID = 1L; + + private final String code; + private final ErrorObject errorObject; + private final Collection<String> templateVars; + + /** + * Instantiates a new AAI exception. + */ + public AAIException() { + super(); + this.code = DEFAULT_EXCEPTION_CODE; + this.templateVars = new LinkedList<String> (); + + try { + this.errorObject = ErrorLogHelper.getErrorObject(getCode()); + } catch (ErrorObjectNotFoundException e) { + throw new RuntimeException("Failed to instantiate AAIException with code=" + getCode() + + " - update error.properties before using this exception code"); + } + } + + /** + * Instantiates a new AAI exception. + * + * @param code the code + */ + public AAIException(String code) { + super(); + + this.code = code; + this.templateVars = new LinkedList<String> (); + + try { + this.errorObject = ErrorLogHelper.getErrorObject(getCode()); + } catch (ErrorObjectNotFoundException e) { + throw new RuntimeException("Failed to instantiate AAIException with code=" + getCode() + + " - update error.properties before using this exception code"); + } + } + + /** + * Instantiates a new AAI exception. + * + * @param code the code + * @param details the details + */ + public AAIException(String code, String details) { + super(details); + + this.code = code; + this.templateVars = new LinkedList<String> (); + + try { + this.errorObject = ErrorLogHelper.getErrorObject(getCode()); + } catch (ErrorObjectNotFoundException e) { + throw new RuntimeException("Failed to instantiate AAIException with code=" + getCode() + + " - update error.properties before using this exception code"); + } + } + + /** + * Instantiates a new AAI exception. + * + * @param code the code + * @param cause the cause + */ + public AAIException(String code, Throwable cause) { + super(cause); + + this.code = code; + this.templateVars = new LinkedList<String> (); + + try { + this.errorObject = ErrorLogHelper.getErrorObject(getCode()); + } catch (ErrorObjectNotFoundException e) { + throw new RuntimeException("Failed to instantiate AAIException with code=" + getCode() + + " - update error.properties before using this exception code"); + } + } + + /** + * Instantiates a new AAI exception. + * + * @param code the code + * @param cause the cause + * @param details the details + */ + public AAIException(String code, Throwable cause, String details) { + super(details, cause); + + this.code = code; + this.templateVars = new LinkedList<String> (); + + try { + this.errorObject = ErrorLogHelper.getErrorObject(getCode()); + } catch (ErrorObjectNotFoundException e) { + throw new RuntimeException("Failed to instantiate AAIException with code=" + getCode() + + " - update error.properties before using this exception code"); + } + } + + public String getCode() { + return code; + } + + public ErrorObject getErrorObject() { + return errorObject; + } + + public Collection<String> getTemplateVars() { + return templateVars; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/exceptions/AAIExceptionWithInfo.java b/aai-core/src/main/java/org/openecomp/aai/exceptions/AAIExceptionWithInfo.java new file mode 100644 index 00000000..5065612e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/exceptions/AAIExceptionWithInfo.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.exceptions; + +import java.util.HashMap; + +public class AAIExceptionWithInfo extends AAIException { + + HashMap<String, Object> infoHash; + String info; + + /** + * Instantiates a new AAI exception with info. + * + * @param infoHash the info hash + * @param info the info + */ + public AAIExceptionWithInfo(HashMap<String, Object> infoHash, String info) { + super(); + setInfoHash(infoHash); + setInfo(info); + } + + /** + * Instantiates a new AAI exception with info. + * + * @param code the code + * @param infoHash the info hash + * @param info the info + */ + public AAIExceptionWithInfo(String code, HashMap<String, Object> infoHash, String info) { + super(code); + setInfoHash(infoHash); + setInfo(info); + } + + /** + * Instantiates a new AAI exception with info. + * + * @param code the code + * @param details the details + * @param infoHash the info hash + * @param info the info + */ + public AAIExceptionWithInfo(String code, String details, HashMap<String, Object> infoHash, String info) { + super(code, details); + setInfoHash(infoHash); + setInfo(info); + } + + /** + * Instantiates a new AAI exception with info. + * + * @param code the code + * @param cause the cause + * @param infoHash the info hash + * @param info the info + */ + public AAIExceptionWithInfo(String code, Throwable cause, HashMap<String, Object> infoHash, String info) { + super(code, cause); + setInfoHash(infoHash); + setInfo(info); + } + + /** + * Instantiates a new AAI exception with info. + * + * @param code the code + * @param cause the cause + * @param details the details + * @param infoHash the info hash + * @param info the info + */ + public AAIExceptionWithInfo(String code, Throwable cause, String details, HashMap<String, Object> infoHash, String info) { + super(code, cause, details); + setInfoHash(infoHash); + setInfo(info); + } + + /** + * Gets the info hash. + * + * @return the info hash + */ + public HashMap<String, Object> getInfoHash() { + return infoHash; + } + + /** + * Sets the info hash. + * + * @param infoHash the info hash + */ + public void setInfoHash(HashMap<String, Object> infoHash) { + this.infoHash = infoHash; + } + + /** + * Gets the info. + * + * @return the info + */ + public String getInfo() { + return info; + } + + /** + * Sets the info. + * + * @param info the new info + */ + public void setInfo(String info) { + this.info = info; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/ingestModel/ConvertXmlToJsonMoxyOxm.java b/aai-core/src/main/java/org/openecomp/aai/ingestModel/ConvertXmlToJsonMoxyOxm.java new file mode 100644 index 00000000..1af2df31 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/ingestModel/ConvertXmlToJsonMoxyOxm.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.ingestModel; + +import java.io.File; +import java.io.StringWriter; +import java.util.ArrayList; + +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.JAXBMarshaller; +import org.eclipse.persistence.jaxb.JAXBUnmarshaller; +import org.eclipse.persistence.jaxb.MarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; + +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; + +/** + * The Class ConvertXmlToJsonMoxyOxm. + */ +public class ConvertXmlToJsonMoxyOxm +{ + /** + * The main method. + * + * @param args the arguments + * @throws Exception the exception + */ + public static void main(String[] args) throws Exception { + + String _apiVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + String fileName = null; + String dynamicType = null; + if (args.length > 0) { + if (args[0] != null) { + _apiVersion = args[0]; + } + if (args[1] != null) { + fileName = args[1]; + } + if (args[2] != null) { + dynamicType = args[2]; + } + } + + if (fileName == null) { + System.err.println("You must specify a fileName"); + System.exit(0); + } + if (dynamicType == null) { + System.err.println("You must specify a dynamic Type"); + System.exit(0); + } + + ArrayList<String> apiVersions = new ArrayList<String>(); + apiVersions.add(_apiVersion); + final IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + m.init(apiVersions, false); + + DynamicJAXBContext jaxbContext = IngestModelMoxyOxm.aaiResourceContainer.get(_apiVersion).getJaxbContext(); + + JAXBUnmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + + Class<? extends DynamicEntity> resultClass = jaxbContext.newDynamicEntity(dynamicType).getClass(); + + DynamicEntity meObject = (DynamicEntity) unmarshaller.unmarshal(new StreamSource(new File(fileName)), resultClass).getValue(); + + // put it out as JSON + + JAXBMarshaller marshaller = jaxbContext.createMarshaller(); + marshaller.setProperty(JAXBMarshaller.JAXB_FORMATTED_OUTPUT, true); + + marshaller.setProperty("eclipselink.media-type", "application/json"); + marshaller.setProperty("eclipselink.json.include-root", false); + marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS, Boolean.FALSE) ; + + StringWriter writer = new StringWriter(); + marshaller.marshal(meObject, writer); + + System.out.println(writer.toString()); + + System.exit(0); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/ingestModel/CreateWidgetModels.java b/aai-core/src/main/java/org/openecomp/aai/ingestModel/CreateWidgetModels.java new file mode 100644 index 00000000..549bff00 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/ingestModel/CreateWidgetModels.java @@ -0,0 +1,168 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.ingestModel; + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Map; +import java.util.UUID; + +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.JAXBMarshaller; +import org.eclipse.persistence.jaxb.JAXBUnmarshaller; +import org.eclipse.persistence.jaxb.MarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; + +import org.openecomp.aai.domain.model.AAIResource; +import org.openecomp.aai.domain.model.AAIResources; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import com.google.common.base.CaseFormat; + +/** + * The Class CreateWidgetModels. + */ +public class CreateWidgetModels +{ + /** + * The main method. + * + * @param args the arguments + * @throws Exception the exception + */ + public static void main(String[] args) throws Exception { + + String _apiVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + String widgetJsonDir = null; + String modelVersion = null; + if (args.length > 0) { + if (args[0] != null) { + _apiVersion = args[0]; + } + if (args[1] != null) { + widgetJsonDir = args[1]; + } + if (args[2] != null) { + modelVersion = args[2]; + } + } + + if (widgetJsonDir == null) { + System.err.println("You must specify a directory for widgetModelJson"); + System.exit(0); + } + if (modelVersion == null) { + System.err.println("You must specify a modelVersion"); + System.exit(0); + } + + ArrayList<String> apiVersions = new ArrayList<String>(); + apiVersions.add(_apiVersion); + final IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + m.init(apiVersions, false); + + AAIResources aaiResources = IngestModelMoxyOxm.aaiResourceContainer.get(_apiVersion); + + DynamicJAXBContext jaxbContext = aaiResources.getJaxbContext(); + + // iterate the collection of resources + + ArrayList<String> processedWidgets = new ArrayList<String>(); + for (Map.Entry<String, AAIResource> aaiResEnt : aaiResources.getAaiResources().entrySet()) { + DynamicEntity meObject = jaxbContext.newDynamicEntity("inventory.aai.openecomp.org." + _apiVersion + ".Model"); + // no need for a ModelVers DynamicEntity + + AAIResource aaiRes = aaiResEnt.getValue(); + + if (aaiRes.getResourceType().equals("node")) { + String resource = aaiRes.getSimpleName(); + + if (processedWidgets.contains(resource)) { + continue; + } + processedWidgets.add(resource); + + String widgetName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, resource); + String filePathString = widgetJsonDir + "/" + widgetName + "-" + modelVersion + ".json"; + File f = new File(filePathString); + + String filePathString2 = widgetJsonDir + "/../widget-model-json-old/" + widgetName + "-" + modelVersion + ".json"; + File f2 = new File(filePathString2); + + if(!f.exists() && !f.isDirectory()) { + + if (f2.exists()) { + System.out.println("Using old file for " + resource + "."); + + JAXBUnmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + unmarshaller.setProperty("eclipselink.media-type", "application/json"); + unmarshaller.setProperty("eclipselink.json.include-root", false); + Class<? extends DynamicEntity> resultClass = meObject.getClass(); + meObject = (DynamicEntity) unmarshaller.unmarshal(new StreamSource(f2), resultClass).getValue(); + // override, some of them are wrong + meObject.set("modelVersion", modelVersion); + } else { + + System.out.println("Making new file for " + resource + "."); + meObject.set("modelInvariantId", UUID.randomUUID().toString()); + meObject.set("modelType", "widget"); + DynamicEntity mevObject = jaxbContext.newDynamicEntity("inventory.aai.openecomp.org." + _apiVersion + ".ModelVer"); + DynamicEntity mevsObject = jaxbContext.newDynamicEntity("inventory.aai.openecomp.org." + _apiVersion + ".ModelVers"); + mevObject.set("modelVersionId", UUID.randomUUID().toString()); + mevObject.set("modelVersion", modelVersion); + mevObject.set("modelName", widgetName); + // make a list of dynamic Entities + ArrayList<DynamicEntity> mevsList = new ArrayList<DynamicEntity>(); + // add this one, it will be the only one in the list in this case + mevsList.add(mevObject); + mevsObject.set("modelVer", mevsList); + // Have to figure out how to add my mev object to the mevsObject, + // the modelVers is a list of dynamic entities so we can just attach the array here + meObject.set("modelVers",mevsObject); + } + + // put it out as JSON + + JAXBMarshaller marshaller = jaxbContext.createMarshaller(); + marshaller.setProperty(JAXBMarshaller.JAXB_FORMATTED_OUTPUT, true); + + marshaller.setProperty("eclipselink.media-type", "application/json"); + marshaller.setProperty("eclipselink.json.include-root", false); + marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS, Boolean.FALSE) ; + + StringWriter writer = new StringWriter(); + marshaller.marshal(meObject, writer); + PrintWriter out = new PrintWriter(f); + out.println(writer.toString()); + out.close(); + + } else { + System.out.println("File already exists for " + resource + ". Skipping."); + } + } + } + System.exit(0); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/ingestModel/DbMaps.java b/aai-core/src/main/java/org/openecomp/aai/ingestModel/DbMaps.java new file mode 100644 index 00000000..9d7fa4dc --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/ingestModel/DbMaps.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.ingestModel; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; + +/** + * The Class DbMaps. + */ +public class DbMaps { + + // from oxm file + public Multimap<String, String> NodeAltKey1Props = ArrayListMultimap.create(); + + public Multimap<String, String> NodeDependencies = ArrayListMultimap.create(); + + public Multimap<String, String> NodeNameProps = ArrayListMultimap.create(); + + public Multimap<String, String> NodeMapIndexedProps = ArrayListMultimap.create(); + + public Multimap<String, String> NodeMapUniqueProps = ArrayListMultimap.create(); + + public Map<Integer, String> EdgeInfoMap = new LinkedHashMap<Integer, String>(); + + public Map<String, String> ReservedPropNames = new HashMap<String, String>(); + + // from AAIResources + public Multimap<String, String> NodeProps = ArrayListMultimap.create(); + + public Multimap<String, String> NodeKeyProps = ArrayListMultimap.create(); + + public Map<String, String> NodePlural = new HashMap<String, String>(); + + public Map<String, String> NodeNamespace = new HashMap<String, String>(); + + public Map<String, String> PropertyVersionInfoMap = new HashMap<String, String>(); + + public Map<String, String> NodeVersionInfoMap = new HashMap<String, String>(); + + public Map<String, String> PropertyDataTypeMap = new HashMap<String, String>(); + + } diff --git a/aai-core/src/main/java/org/openecomp/aai/ingestModel/IngestModelListener.java b/aai-core/src/main/java/org/openecomp/aai/ingestModel/IngestModelListener.java new file mode 100644 index 00000000..914e5a3b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/ingestModel/IngestModelListener.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.ingestModel; + +import java.util.ArrayList; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.logging.ErrorLogHelper; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +/** + * The listener interface for receiving ingestModel events. + * The class that is interested in processing a ingestModel + * event implements this interface, and the object created + * with that class is registered with a component using the + * component's <code>addIngestModelListener<code> method. When + * the ingestModel event occurs, that object's appropriate + * method is invoked. + * + * @see IngestModelEvent + */ +public class IngestModelListener implements ServletContextListener { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(IngestModelListener.class); + +/** + * Destroys context. + * + * @param arg0 the ServletContextEvent + */ +//@Override + public void contextDestroyed(ServletContextEvent arg0) { + IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + m.cleanup(); + LOGGER.info("AAI Auth Listener contextDestroyed() complete."); + } + +//Run this before web application is started + /** + * Initializaes the context. + * + * @param arg0 the ServletContextEvent + */ +//@Override + public void contextInitialized(ServletContextEvent arg0) { + + LOGGER.info("IngestModel starts initialization..."); + try { + ArrayList<String> apiVersions = new ArrayList<String>(); + apiVersions.add("v10"); + apiVersions.add("v9"); + apiVersions.add("v8"); + apiVersions.add("v7"); + apiVersions.add("v2"); + IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + m.init(apiVersions); + } catch (AAIException e) { + ErrorLogHelper.logException(e); + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/ingestModel/IngestModelMoxyOxm.java b/aai-core/src/main/java/org/openecomp/aai/ingestModel/IngestModelMoxyOxm.java new file mode 100644 index 00000000..1fa11c1b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/ingestModel/IngestModelMoxyOxm.java @@ -0,0 +1,862 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.ingestModel; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; +import java.util.Vector; + +import org.eclipse.persistence.descriptors.ClassDescriptor; +import org.eclipse.persistence.dynamic.DynamicType; +import org.eclipse.persistence.internal.dynamic.DynamicTypeImpl; +import org.eclipse.persistence.internal.helper.DatabaseField; +import org.eclipse.persistence.jaxb.JAXBContextProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory; +import org.eclipse.persistence.mappings.DatabaseMapping; +import org.eclipse.persistence.oxm.XMLField; +import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping; +import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping; + +import org.openecomp.aai.domain.model.AAIResource; +import org.openecomp.aai.domain.model.AAIResourceKey; +import org.openecomp.aai.domain.model.AAIResourceKeys; +import org.openecomp.aai.domain.model.AAIResources; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import org.openecomp.aai.util.FileWatcher; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.google.common.base.Splitter; +import com.google.common.collect.Multimap; + +/** + * The Class IngestModelMoxyOxm. + */ +public class IngestModelMoxyOxm +{ + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(IngestModelMoxyOxm.class); + + public static HashMap<String, AAIResources> aaiResourceContainer; + public static HashMap<String, DbMaps> dbMapsContainer; + + private static HashMap<String, Timer> timers = new HashMap<String,Timer>(); + + /** + * The main method. + * + * @param args the arguments + * @throws Exception the exception + */ + public static void main(String[] args) throws Exception { + + String _apiVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP); + + if (args.length > 0) { + if (args[0] != null) { + _apiVersion = args[0]; + } + } + ArrayList<String> apiVersions = new ArrayList<String>(); + apiVersions.add(_apiVersion); + final IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + m.init(apiVersions, false); + + ArrayList<String> endpoints = new ArrayList<String>(); + + for (Map.Entry<String, AAIResources> ent: aaiResourceContainer.entrySet()) { + + AAIResources aaiResources = ent.getValue(); + DynamicJAXBContext jaxbContext = aaiResources.getJaxbContext(); + for (Map.Entry<String, AAIResource> aaiResEnt : aaiResources.getAaiResources().entrySet()) { + AAIResource aaiRes = aaiResEnt.getValue(); + + String uri = aaiRes.getUri(); + if (uri != null) { + endpoints.add(uri); + DynamicType dt = jaxbContext.getDynamicType(aaiRes.getResourceClassName()); + if (dt.containsProperty("relationshipList")) { + endpoints.add(uri + "/relationship-list/relationship"); + } + } + } + Collections.sort(endpoints); + for (String endpoint : endpoints) { + if (!endpoint.contains("/aai-internal/")) { + System.out.println(endpoint); + } + } + } + + System.exit(0); + } + + /** + * Inits the. + * + * @param apiVersions the api versions + * @throws Exception the exception + */ + public synchronized void init(ArrayList<String> apiVersions) throws AAIException { + final IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + m.init(apiVersions, true); + } + + /** + * Inits the. + * + * @param apiVersions the api versions + * @param setTimer the set timer + * @throws AAIException If AAIConfig is missing necessary properties + * @throws Exception the exception + */ + public synchronized void init(ArrayList<String> apiVersions, Boolean setTimer) throws AAIException { + + aaiResourceContainer = new HashMap<String, AAIResources>(); + dbMapsContainer = new HashMap<String, DbMaps>(); + + final IngestModelMoxyOxm m = new IngestModelMoxyOxm(); + + for (String apiVersion : apiVersions) { + + String relationshipUtils = "org.openecomp.aai.dbmap.RelationshipUtils"; + final String thisRelationshipUtils = relationshipUtils; + + final String thisApiVersion = apiVersion; + final String schemaFile = AAIConstants.AAI_HOME_ETC_OXM + "aai_oxm_" + apiVersion + ".xml"; + + m.loadSchema(apiVersion, schemaFile, relationshipUtils); + + if (!setTimer) continue; + + TimerTask task = null; + task = new FileWatcher ( new File(schemaFile)) { + protected void onChange( File file ) { + m.loadSchema(thisApiVersion, schemaFile, thisRelationshipUtils); + } + }; + + if (!timers.containsKey(apiVersion)) { + Timer timer = new Timer(); + timer.schedule( task , new Date(), 10000 ); + timers.put(apiVersion, timer); + + } + } + if (apiVersions.contains(AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP))) { + m.createPropertyAndNodeVersionInfoMapFromDbMaps(); + + for (Map.Entry<String, AAIResources> ent: aaiResourceContainer.entrySet()) { + String apiVersion = ent.getKey(); + AAIResources aaiResources = ent.getValue(); + + DbMaps dbMap = dbMapsContainer.get(apiVersion); + + for (Map.Entry<String, AAIResource> aaiResEnt : aaiResources.getAaiResources().entrySet()) { + AAIResource aaiRes = aaiResEnt.getValue(); + aaiRes.setPropertyDataTypeMap(dbMap.PropertyDataTypeMap); + aaiRes.setNodeKeyProps(dbMap.NodeKeyProps); + aaiRes.setNodeNameProps(dbMap.NodeNameProps); + aaiRes.setNodeMapIndexedProps(dbMap.NodeMapIndexedProps); + } + } + } + } + + /** + * Load schema. + * + * @param apiVersion the api version + * @param schemaFile the schema file + * @param relationshipUtils the relationship utils + * @return the dynamic JAXB context + */ + private DynamicJAXBContext loadSchema(String apiVersion, + String schemaFile, + String relationshipUtils) { + + AAIResources aaiResources = new AAIResources(); + DbMaps dbMaps = new DbMaps(); + DynamicJAXBContext jaxbContext = null; + + try { + + InputStream iStream = new FileInputStream(new File(schemaFile)); + + Map<String, Object> properties = new HashMap<String, Object>(); + properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, iStream); + + jaxbContext = + DynamicJAXBContextFactory.createContextFromOXM(IngestModelMoxyOxm.class.getClassLoader(), properties); + + aaiResources.setJaxbContext(jaxbContext); + String rootClassName = "inventory.aai.openecomp.org." + apiVersion + ".Inventory"; + + if ("v2".equals(apiVersion)) { + rootClassName = "inventory.aai.openecomp.org.Inventory"; + } + + DynamicTypeImpl t = (DynamicTypeImpl)jaxbContext.getDynamicType(rootClassName); + + lookAtDynamicResource("Inventory", + "inventory.aai.openecomp.org." + apiVersion, + jaxbContext, + t, + 1, "", "", apiVersion, "/" + apiVersion, false, aaiResources, dbMaps, relationshipUtils); + + } catch (Exception e) { + ErrorLogHelper.logException(new AAIException("AAI_3000", e)); + } + + LOGGER.info("---> Loading " + apiVersion + " in aaiResourceContainer"); + aaiResourceContainer.put(apiVersion, aaiResources); + + createDbMapsfromAAIResources(aaiResources, dbMaps); + + LOGGER.info("---> Loading " + apiVersion + " in dbMapsContainer"); + dbMapsContainer.put(apiVersion, dbMaps); + + return jaxbContext; + } + + /** + * Cleanup. + */ + public void cleanup() { + aaiResourceContainer.clear(); + dbMapsContainer.clear(); + } + + /** + * Look at dynamic resource. + * + * @param resource the resource + * @param pojoBase the pojo base + * @param jaxbContext the jaxb context + * @param t the t + * @param depth the depth + * @param parent the parent + * @param namespace the namespace + * @param apiVersion the api version + * @param url the url + * @param container the container + * @param aaiResources the aai resources + * @param dbMaps the db maps + * @param relationshipUtils the relationship utils + * @throws ClassNotFoundException the class not found exception + * @throws NoSuchFieldException the no such field exception + * @throws SecurityException the security exception + * @throws IOException Signals that an I/O exception has occurred. + */ + private void lookAtDynamicResource(String resource, + String pojoBase, + DynamicJAXBContext jaxbContext, + DynamicTypeImpl t, + int depth, + String parent, + String namespace, + String apiVersion, + String url, + boolean container, + AAIResources aaiResources, + DbMaps dbMaps, + String relationshipUtils + ) + throws ClassNotFoundException, NoSuchFieldException, SecurityException, IOException { + + String className = pojoBase + "." + CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL, resource); + + AAIResource parentResource = aaiResources.getAaiResources().get(parent); + + AAIResources siblings = null; + + if (parentResource == null) { + String fullName = "/" + resource; + AAIResource aaiRes = new AAIResource(); + aaiRes.setFullName(fullName); + aaiRes.setSimpleName(resource); + aaiRes.setResourceType("container"); + aaiRes.setResourceClassName(className); + aaiRes.setApiVersion(apiVersion); + + aaiResources.getAaiResources().put(fullName, aaiRes); + parentResource = aaiRes; + } + + if (depth >= 50) return; + + siblings = parentResource.getChildren(); + + if (depth == 2) { + namespace = resource; + } + if (depth >= 50) { + return; + } + + /* if ("Actions".equals(namespace) || "Search".equals(namespace)) { + return; + }*/ + + ClassDescriptor cd = t.getDescriptor(); + + createDbMapsfromOXM(cd.getProperties(), resource, dbMaps); + + + + Vector<DatabaseMapping> dm = cd.getMappings(); + + for (DatabaseMapping dmInst : dm) { + String dmName = dmInst.getAttributeName(); + + ClassDescriptor cd2 = dmInst.getReferenceDescriptor(); + if (cd2 != null) { + + String newClassName = cd2.getJavaClassName(); + // + if (newClassName.contains("RelationshipList")) { + continue; + } + + DynamicTypeImpl newDt = (DynamicTypeImpl)jaxbContext.getDynamicType(newClassName); + + if (dmInst instanceof XMLCompositeCollectionMapping) { + String simpleName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, dmName); + // System.out.println(spaces + "+ List of A&AI Object named " + simpleName); + + String hypName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, simpleName); + + String fullName = parent + "/" + simpleName; + + //Class<?> newClazz = Class.forName(newClassName); + AAIResource aaiRes = new AAIResource(); + + if ("cvlan-tag-entry".equals(hypName)) { + } + + ClassDescriptor cd3 = newDt.getDescriptor(); + + boolean allowDirectWrite = true; + if (cd3.getProperties().containsKey("allowDirectWrite")) { + if (cd3.getProperties().get("allowDirectWrite").equals("false")) { + allowDirectWrite = false; + } + } + + + boolean allowDirectRead = true; + if (cd3.getProperties().containsKey("allowDirectRead")) { + if (cd3.getProperties().get("allowDirectRead").equals("false")) { + allowDirectRead = false; + } + } + + List<DatabaseField> dbfList = cd3.getPrimaryKeyFields(); + ArrayList<String> keyFields = new ArrayList<String>(); + + if (dbfList != null) { + for (DatabaseField dbf : dbfList) { + String name = dbf.getName(); + name = name.substring(0, name.indexOf('/')); + keyFields.add(name); + } + } + Vector<DatabaseMapping> dm2 = cd3.getMappings(); + for (DatabaseMapping dmInst2 : dm2) { + String dmName2= CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmInst2.getAttributeName()); + DatabaseField xf2 = dmInst2.getField(); + if (dmInst2.getProperties().containsKey("autoGenerateUuid")) { + if (dmInst2.getProperties().get("autoGenerateUuid").equals("true")) { + aaiRes.getAutoGenUuidFields().add(dmName2); + } + } + if (xf2 instanceof XMLField) { + XMLField x = (XMLField)xf2; + if (x != null) { + if (x.isRequired()) { + aaiRes.getRequiredFields().add(dmName2); + } + } + + } + try { + Class<?> xf2Clazz = xf2.getType(); + if (xf2Clazz.getSimpleName().equals("String")) { + if (dmInst2 instanceof XMLCompositeDirectCollectionMapping) { + aaiRes.getStringListFields().add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmName2)); + } else { + aaiRes.getStringFields().add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmName2)); + } + } else if (xf2Clazz.getSimpleName().toLowerCase().contains("long")) { + aaiRes.getLongFields().add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmName2)); + } else if (xf2Clazz.getSimpleName().toLowerCase().contains("int")) { + aaiRes.getIntFields().add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmName2)); + } else if (xf2Clazz.getSimpleName().toLowerCase().contains("short")) { + aaiRes.getShortFields().add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmName2)); + } else if (xf2Clazz.getSimpleName().toLowerCase().contains("boolean")) { + aaiRes.getBooleanFields().add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmName2)); + } + } catch (Exception e) { // this xf2.getType() throws null pointer when I try to get the type and it doesn't have one + ; + } + } + + // get the key(s) from DbRules + String uriKey = ""; + LinkedHashMap<String, ArrayList<String>> itemKeyList = new LinkedHashMap<String, ArrayList<String>>(); + + aaiRes.setApiVersion(apiVersion); + itemKeyList.put(hypName, new ArrayList<String>()); + for (String thisKey : keyFields) { + String pathParamName = hypName + "-" + thisKey; + + AAIResourceKey aaiResKey = new AAIResourceKey(); + aaiResKey.setKeyName(thisKey); + aaiResKey.setDnCamKeyName(CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, pathParamName)); + aaiResKey.setPathParamName(pathParamName); + + for (DatabaseMapping dmInst2 : dm2) { + String dmName2= CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,dmInst2.getAttributeName()); + if (dmName2.equals(thisKey)){ + DatabaseField xf2 = dmInst2.getField(); + aaiResKey.setKeyType(xf2.getType().getSimpleName()); + break; + } + } + + aaiRes.getAaiResourceKeys().getAaiResourceKey().add(aaiResKey); + + if (siblings != null) { + siblings.getAaiResources().put(fullName, aaiRes); + } + + uriKey += "/{" + pathParamName + "}"; + } + + String newUri = url + "/" + hypName + uriKey; + + + if ("v2".equals(apiVersion)) { + aaiRes.setResourceClassName("inventory.aai.openecomp.org." + simpleName); + } else { + aaiRes.setResourceClassName("inventory.aai.openecomp.org." + apiVersion + "." + simpleName); + } + + aaiRes.setAllowDirectWrite(allowDirectWrite); + aaiRes.setAllowDirectRead(allowDirectRead); + aaiRes.setNamespace(namespace); + aaiRes.setSimpleName(simpleName); + + if (!aaiResources.getResourceLookup().containsKey(simpleName)) { + aaiResources.getResourceLookup().put(simpleName, aaiRes); + } + + aaiRes.setFullName(fullName); + aaiRes.setUri(newUri); + aaiRes.setResourceType("node"); + if ("v2".equals(apiVersion)) { + aaiRes.setRelationshipListClass("inventory.aai.openecomp.org.RelationshipList"); + } else { + aaiRes.setRelationshipListClass("inventory.aai.openecomp.org." + apiVersion + ".RelationshipList"); + } + aaiRes.setRelationshipUtils(relationshipUtils); + + if (parentResource != null) { + aaiRes.setParent(parentResource); + } else { + aaiRes.setParent(aaiRes); + } + + aaiResources.getAaiResources().put(fullName, aaiRes); + + if (siblings != null) { + siblings.getAaiResources().put(fullName, aaiRes); + } +// AAIResource ancestor = parentResource; +// +// boolean recursiveEntity = false; +// while (ancestor != null) { +// +// if (ancestor.getSimpleName().equals(aaiRes.getSimpleName())) { +// recursiveEntity = true; +// // attach it to the container that contains the resource above this one with the same name +// if (ancestor.getParent() != null && ancestor.getParent().getResourceType().equals("container")) { +// AAIResource recurseHere = ancestor.getParent(); +// aaiRes.setRecurseToResource(recurseHere); +// } +// break; +// } +// ancestor = ancestor.getParent(); +// +// } +// if (recursiveEntity == false) { + lookAtDynamicResource(cd2.getJavaClass().getSimpleName(), + pojoBase, + jaxbContext, + newDt, + (depth + 1), fullName, namespace, apiVersion, newUri, false, aaiResources, dbMaps, + relationshipUtils); +// } + } else { + String simpleName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, dmName); + String fullName = parent + "/" + simpleName; + // System.out.println(spaces + "+ Container of A&AI Object named " + simpleName); + + AAIResource aaiRes = new AAIResource(); + if (parentResource != null) { + aaiRes.setParent(parentResource); + } else { + aaiRes.setParent(aaiRes); + } + aaiRes.setAllowDirectWrite(true); + aaiRes.setAllowDirectRead(true); + aaiRes.setFullName(fullName); + aaiRes.setSimpleName(simpleName); + if (!aaiResources.getResourceLookup().containsKey(simpleName)) { + aaiResources.getResourceLookup().put(simpleName, aaiRes); + } + aaiRes.setResourceType("container"); + + if ("v2".equals(apiVersion)) { + aaiRes.setResourceClassName("inventory.aai.openecomp.org." + simpleName); + aaiRes.setRelationshipListClass("inventory.aai.openecomp.org.RelationshipList"); + } else { + aaiRes.setResourceClassName("inventory.aai.openecomp.org." + apiVersion + "." + simpleName); + aaiRes.setRelationshipListClass("inventory.aai.openecomp.org." + apiVersion + ".RelationshipList"); + } + aaiRes.setApiVersion(apiVersion); + + aaiResources.getAaiResources().put(fullName, aaiRes); + aaiRes.setRelationshipUtils(relationshipUtils); + + String hypName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, simpleName); + + if (siblings != null) { + siblings.getAaiResources().put(fullName, aaiRes); + } + + lookAtDynamicResource(cd2.getJavaClass().getSimpleName(), + pojoBase, + jaxbContext, + (DynamicTypeImpl)jaxbContext.getDynamicType(newClassName), + (depth + 1), fullName, namespace, apiVersion, url + "/" + hypName, false, aaiResources, dbMaps, + relationshipUtils); + + + } + } + } + } + + /** + * Creates the db mapsfrom OXM. + * + * @param propMap the prop map + * @param resource the resource + * @param dbMaps the db maps + */ + private void createDbMapsfromOXM(Map<?, ?> propMap, String resource, DbMaps dbMaps) { + String nodeType = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, resource); + if ("cvlan-tag-entry".equals(nodeType)) { + nodeType = "cvlan-tag"; + } + + // if we have nodes dependent on multiple nodes we might revisit the node again - skip then + if (propMap.size() > 1 && !dbMaps.NodeMapIndexedProps.containsKey(nodeType)) { + + if (propMap.containsKey("nameProps")) + dbMaps.NodeNameProps.putAll(nodeType, + (Iterable<String>) fromCommaSeparatedString(propMap.get("nameProps").toString())); + + if (propMap.containsKey("indexedProps")) + dbMaps.NodeMapIndexedProps.putAll(nodeType, + (Iterable<String>) fromCommaSeparatedString(propMap.get("indexedProps").toString())); + + if (propMap.containsKey("dependentOn")) + dbMaps.NodeDependencies.putAll(nodeType, + (Iterable<String>) fromCommaSeparatedString(propMap.get("dependentOn").toString())); + + if (propMap.containsKey("alternateKeys1")) + dbMaps.NodeAltKey1Props.putAll(nodeType, + (Iterable<String>) fromCommaSeparatedString(propMap.get("alternateKeys1").toString())); + + if (propMap.containsKey("uniqueProps")) + dbMaps.NodeMapUniqueProps.putAll(nodeType, + (Iterable<String>) fromCommaSeparatedString(propMap.get("uniqueProps").toString())); + + // build EdgeInfoMap + if (propMap.containsKey("edgeInfo")) { + int i = 0; + Iterable<String> edgeInfoIterable = (Iterable<String>) fromCommaSeparatedString(propMap.get("edgeInfo").toString()); + Iterator<String> edgeInfoIterator = edgeInfoIterable.iterator(); + while(edgeInfoIterator.hasNext()) { + String propName = edgeInfoIterator.next(); + dbMaps.EdgeInfoMap.put(i++, propName); + } + } + } + } + + /** + * Creates the db mapsfrom AAI resources. + * + * @param aaiResources the aai resources + * @param dbMaps the db maps + */ + private void createDbMapsfromAAIResources(AAIResources aaiResources, DbMaps dbMaps) { + + for (String resource: aaiResources.getAaiResources().keySet()) { + + AAIResource aaiResource = aaiResources.getAaiResources().get(resource); + String nodeType = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,aaiResource.getSimpleName()); + + if (nodeType.equals("cvlan-tag-entry")) + nodeType = "cvlan-tag"; + + // Build NodeNamespace + if (aaiResource.getNamespace() != null && !aaiResource.getNamespace().equalsIgnoreCase("search")) + // oamNetworks is also defined under the search namespace - do not want that namespace + dbMaps.NodeNamespace.put(nodeType, CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, aaiResource.getNamespace())); + + // only process one nodetype once + if (dbMaps.NodeProps.containsKey(nodeType)) + continue; + + // Build NodePlural + if (aaiResource.getPluralName() != null && !aaiResource.getPluralName().equals(aaiResource.getNamespace())) + // dont want resources which are namespaces themselves in map + dbMaps.NodePlural.put(nodeType, CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, aaiResource.getPluralName())); + + // Build NodeProps + dbMaps.NodeProps.putAll(nodeType, aaiResource.getAllFields()); + + // build ReservedNames + if (nodeType.equalsIgnoreCase("reserved-prop-names")) { + for (String propName: aaiResource.getAllFields()) { + dbMaps.ReservedPropNames.put(propName, ""); + } + } + + // Build NodekeyProps + AAIResourceKeys aaiResKeys = aaiResource.getAaiResourceKeys(); + List<String> keyList = new ArrayList<String>(); + for (AAIResourceKey rk : aaiResKeys.getAaiResourceKey()) { + String keyProp = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN,rk.getKeyName()); + if (!keyList.contains(keyProp)) + keyList.add(keyProp); + } + dbMaps.NodeKeyProps.putAll(nodeType, (Iterable<String>)keyList); + + // Build PropertyDataTypeMap + for (String propName: aaiResource.getBooleanFields()) { + if (nodeType.equalsIgnoreCase("edge-prop-names")) // these properties are in mixed format in DB + propName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, propName); + if (propName.equals("sVCINFRA")) propName = "SVC-INFRA"; + if (propName.equals("sVCINFRAREV")) propName = "SVC-INFRA-REV"; + if (!dbMaps.PropertyDataTypeMap.containsKey(propName)) + dbMaps.PropertyDataTypeMap.put(propName, "Boolean"); + else if (!dbMaps.PropertyDataTypeMap.get(propName).equals("Boolean")) + System.out.println(propName + "defined with mis-matched types in oxm file"); + } + for (String propName: aaiResource.getShortFields()) { + if (nodeType.equalsIgnoreCase("edge-prop-names")) // these properties are in mixed format in DB + propName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, propName); + if (propName.equals("sVCINFRA")) propName = "SVC-INFRA"; + if (propName.equals("sVCINFRAREV")) propName = "SVC-INFRA-REV"; + if (!dbMaps.PropertyDataTypeMap.containsKey(propName)) + dbMaps.PropertyDataTypeMap.put(propName, "Integer"); + else if (!dbMaps.PropertyDataTypeMap.get(propName).equals("Integer")) + System.out.println(propName + "defined with mis-matched types in oxm file"); + } + for (String propName: aaiResource.getLongFields()) { + if (nodeType.equalsIgnoreCase("edge-prop-names")) // these properties are in mixed format in DB + propName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, propName); + if (propName.equals("sVCINFRA")) propName = "SVC-INFRA"; + if (propName.equals("sVCINFRAREV")) propName = "SVC-INFRA-REV"; + if (!dbMaps.PropertyDataTypeMap.containsKey(propName)) { + if (propName.contains("-ts")) + dbMaps.PropertyDataTypeMap.put(propName, "Long"); + else + dbMaps.PropertyDataTypeMap.put(propName, "Integer"); + } else if (!dbMaps.PropertyDataTypeMap.get(propName).equals("Integer")) + System.out.println(propName + "defined with mis-matched types in oxm file"); + } + for (String propName: aaiResource.getIntFields()) { + if (nodeType.equalsIgnoreCase("edge-prop-names")) // these properties are in mixed format in DB + propName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, propName); + if (propName.equals("sVCINFRA")) propName = "SVC-INFRA"; + if (propName.equals("sVCINFRAREV")) propName = "SVC-INFRA-REV"; + if (!dbMaps.PropertyDataTypeMap.containsKey(propName)) + dbMaps.PropertyDataTypeMap.put(propName, "Integer"); + else if (!dbMaps.PropertyDataTypeMap.get(propName).equals("Integer")) + System.out.println(propName + "defined with mis-matched types in oxm file"); + } + for (String propName: aaiResource.getStringFields()) { + if (nodeType.equalsIgnoreCase("edge-prop-names")) // these properties are in mixed format in DB + propName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, propName); + if (propName.equals("sVCINFRA")) propName = "SVC-INFRA"; + if (propName.equals("sVCINFRAREV")) propName = "SVC-INFRA-REV"; + if (!dbMaps.PropertyDataTypeMap.containsKey(propName)) + dbMaps.PropertyDataTypeMap.put(propName, "String"); + else if (!dbMaps.PropertyDataTypeMap.get(propName).equals("String")) + System.out.println(propName + "defined with mis-matched types in oxm file"); + } + for (String propName: aaiResource.getStringListFields()) { + if (nodeType.equalsIgnoreCase("edge-prop-names")) // these properties are in mixed format in DB + propName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, propName); + if (propName.equals("sVCINFRA")) propName = "SVC-INFRA"; + if (propName.equals("sVCINFRAREV")) propName = "SVC-INFRA-REV"; + if (!dbMaps.PropertyDataTypeMap.containsKey(propName)) + dbMaps.PropertyDataTypeMap.put(propName, "Set<String>"); + else if (!dbMaps.PropertyDataTypeMap.get(propName).equals("Set<String>")) + System.out.println(propName + "defined with mis-matched types in oxm file"); + } + } + + } + + + /** + * Creates the property and node version info map from db maps. + */ + private void createPropertyAndNodeVersionInfoMapFromDbMaps() { + DbMaps dbMaps = null; + String previousApiVersion = null; + List<Integer> apiIntegerKeySet = new ArrayList<Integer>(); + for ( String vers : dbMapsContainer.keySet()) { + apiIntegerKeySet.add(Integer.valueOf(vers.substring(1))); + } + ArrayList<Integer> apiIntegerVersionsList = (ArrayList<Integer>) asSortedList(apiIntegerKeySet); + String apiVersion; + for ( Integer apiIntegerVersion : apiIntegerVersionsList) { + apiVersion = "v" + apiIntegerVersion; + System.out.println("apiVersion=" + apiVersion); + dbMaps = dbMapsContainer.get(apiVersion); + + if (previousApiVersion != null) { // when running more than one version + dbMaps.PropertyVersionInfoMap.putAll(dbMapsContainer.get(previousApiVersion).PropertyVersionInfoMap); + dbMaps.NodeVersionInfoMap.putAll(dbMapsContainer.get(previousApiVersion).NodeVersionInfoMap); + } + + Iterator<String> nodeTypeIterator = dbMaps.NodeProps.keySet().iterator(); + while( nodeTypeIterator.hasNext() ){ + String nType = nodeTypeIterator.next(); + if (!dbMaps.NodeVersionInfoMap.containsKey(nType)) { + dbMaps.NodeVersionInfoMap.put(nType, apiVersion); + } + Collection <String> nodePropsForType = dbMaps.NodeProps.get(nType); + Iterator <String> propIter = nodePropsForType.iterator(); + while( propIter.hasNext() ){ + String propName = propIter.next(); + String infoKey = nType + "|" + propName; + if( ! dbMaps.PropertyVersionInfoMap.containsKey(infoKey) ){ + // We haven't seen this one yet -- add it in. + dbMaps.PropertyVersionInfoMap.put(infoKey, apiVersion); + } + } + } + dbMapsContainer.put(apiVersion, dbMaps); + previousApiVersion = apiVersion; + } + } + + /** + * As sorted list. + * + * @param <T> the generic type + * @param c the c + * @return the list + */ + private <T extends Comparable<? super T>> List<T> asSortedList(Collection<T> c) { + List<T> list = new ArrayList<T>(c); + java.util.Collections.sort(list); + return list; + } + + /** + * From comma separated string. + * + * @param string the string + * @return the iterable + */ + public Iterable<String> fromCommaSeparatedString( String string ) { + Iterable<String> split = Splitter.on( "," ).omitEmptyStrings().trimResults().split( string ); + return split; + } + + /** + * Pretty print map. + * + * @param map the map + * @return the string + */ + public String prettyPrintMap(Multimap<String, String> map) { + StringBuilder sb = new StringBuilder(); + sb.append('\n'); + for (String key:map.keySet()) { + sb.append('\t'); + sb.append(key); + sb.append('=').append('"'); + sb.append(map.get(key)); + sb.append('"'); + sb.append('\n'); + } + return sb.toString(); + } + + /** + * Pretty print map. + * + * @param map the map + * @return the string + */ + public String prettyPrintMap(Map<?, String> map) { + StringBuilder sb = new StringBuilder(); + sb.append('\n'); + for (Object key:map.keySet()) { + sb.append('\t'); + sb.append(key); + sb.append('=').append('"'); + sb.append(map.get(key)); + sb.append('"'); + sb.append('\n'); + } + return sb.toString(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java new file mode 100644 index 00000000..a62d5aee --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Introspector.java @@ -0,0 +1,616 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +import org.apache.commons.lang.ClassUtils; +import org.eclipse.persistence.exceptions.DynamicException; + +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.restcore.MediaType; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.workarounds.NamingExceptions; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; + +public abstract class Introspector implements Cloneable { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(Introspector.class); + + protected String className; + protected String uriChain = ""; + protected Loader loader; + protected final NamingExceptions namingException = NamingExceptions.getInstance(); + private Set<String> uniqueProperties = null; + private Set<String> indexedProperties = null; + private Set<String> allKeys = null; + protected Introspector(Object obj) { + } + + public abstract boolean hasProperty(String name); + + protected String convertPropertyName (String name) { + return CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name); + } + + protected abstract Object get(String name); + protected abstract void set(String name, Object value); + /** + * + * @param name the property name you'd like to retrieve the value for + * @return the value of the property + */ + public <T> T getValue(String name) { + String convertedName = convertPropertyName(name); + Object result = null; + + if (this.hasProperty(name)) { + result = this.get(convertedName); + } else { + /* property not found - slightly ambiguous */ + return null; + } + + Class<?> clazz = this.getClass(name); + if (this.isListType(name) && result == null) { + try { + this.set(convertedName, clazz.newInstance()); + result = this.get(convertedName); + } catch (DynamicException | InstantiationException | IllegalAccessException e) { + + } + } + + return (T)result; + } + + public Introspector getWrappedValue(String name) { + String convertedName = convertPropertyName(name); + Object value = null; + + if (this.hasProperty(name)) { + value = this.get(convertedName); + } else { + /* property not found - slightly ambiguous */ + return null; + } + + Class<?> clazz = this.getClass(name); + if (this.isListType(name) && value == null) { + try { + this.set(convertedName, clazz.newInstance()); + value = this.get(convertedName); + } catch (DynamicException | InstantiationException | IllegalAccessException e) { + + } + } + if (value != null) { + return IntrospectorFactory.newInstance(this.getModelType(), value); + } else { + //no value + return null; + } + + } + + public List<Introspector> getWrappedListValue(String name) { + String convertedName = convertPropertyName(name); + Object value = null; + List<Introspector> resultList = new ArrayList<>(); + if (this.hasProperty(name)) { + value = this.get(convertedName); + } else { + /* property not found - slightly ambiguous */ + return null; + } + boolean isListType = this.isListType(name); + if (!this.isListType(name)) { + return null; + } + Class<?> clazz = this.getClass(name); + if (isListType && value == null) { + try { + this.set(convertedName, clazz.newInstance()); + value = this.get(convertedName); + } catch (DynamicException | InstantiationException | IllegalAccessException e) { + + } + } + + List<Object> valueList = (List<Object>)value; + + for (Object item : valueList) { + resultList.add(IntrospectorFactory.newInstance(this.getModelType(), item)); + } + + return resultList; + + } + + public Object castValueAccordingToSchema(String name, Object obj) { + Object result = obj; + Class<?> nameClass = this.getClass(name); + if (nameClass == null) { + throw new IllegalArgumentException("property: " + name + " does not exist on " + this.getDbName()); + } + if (obj != null) { + + try { + if (!obj.getClass().getName().equals(nameClass.getName())) { + if (nameClass.isPrimitive()) { + nameClass = ClassUtils.primitiveToWrapper(nameClass); + result = nameClass.getConstructor(String.class).newInstance(obj.toString()); + } + if (obj.getClass().getName().equals("java.lang.String")) { + result = nameClass.getConstructor(String.class).newInstance(obj); + } else if (!this.isListType(name) && !this.isComplexType(name)){ + //box = obj.toString(); + result = nameClass.getConstructor(String.class).newInstance(obj.toString()); + } + } + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException | NoSuchMethodException | SecurityException e) { + ErrorLogHelper.logError("AAI_4017", e.getMessage()); + } + } + return result; + } + + public List<Object> castValueAccordingToSchema(String name, List<?> objs) { + List<Object> result = new ArrayList<>(); + + for (Object item : objs) { + result.add(this.castValueAccordingToSchema(name, item)); + } + + return result; + + } + /** + * + * @param name the property name you'd like to set the value of + * @param obj the value to be set + * @return + */ + public void setValue(String name, Object obj) throws IllegalArgumentException { + Object box = this.castValueAccordingToSchema(name, obj); + + name = convertPropertyName(name); + this.set(name, box); + } + /** + * + * @return a list of all the properties available on the object + */ + public abstract Set<String> getProperties(); + + public Set<String> getProperties(PropertyPredicate<Introspector, String> p) { + final Set<String> temp = new LinkedHashSet<>(); + this.getProperties().stream().filter(item -> { + return p.test(this, item); + }).forEach(item -> { + temp.add(item); + }); + final Set<String> result = Collections.unmodifiableSet(temp); + + return result; + + } + /** + * + * @return a list of the required properties on the object + */ + public abstract Set<String> getRequiredProperties(); + /** + * + * @return a list of the properties that can be used to query the object in the db + */ + public abstract Set<String> getKeys(); + /** + * + * @return a list of the all key properties for this object + */ + public Set<String> getAllKeys() { + Set<String> result = null; + if (this.allKeys == null) { + Set<String> keys = this.getKeys(); + result = new LinkedHashSet<>(); + result.addAll(keys); + String altKeys = this.getMetadata(ObjectMetadata.ALTERNATE_KEYS_1); + if (altKeys != null) { + String[] altKeysArray = altKeys.split(","); + for (String altKey : altKeysArray) { + result.add(altKey); + } + } + result = Collections.unmodifiableSet(result); + this.allKeys = result; + } + result = this.allKeys; + return result; + } + + public Set<String> getIndexedProperties() { + Set<String> result = null; + + if (this.indexedProperties == null) { + result = new LinkedHashSet<>(); + Set<String> keys = this.getKeys(); + result.addAll(keys); + String altKeys = this.getMetadata(ObjectMetadata.INDEXED_PROPS); + if (altKeys != null) { + String[] altKeysArray = altKeys.split(","); + for (String altKey : altKeysArray) { + result.add(altKey); + } + } + this.indexedProperties = Collections.unmodifiableSet(result); + } + result = this.indexedProperties; + return result; + } + + public Set<String> getUniqueProperties() { + Set<String> result = null; + if (this.uniqueProperties == null) { + String altKeys = this.getMetadata(ObjectMetadata.UNIQUE_PROPS); + result = new LinkedHashSet<>(); + if (altKeys != null) { + String[] altKeysArray = altKeys.split(","); + for (String altKey : altKeysArray) { + result.add(altKey); + } + } + this.uniqueProperties = Collections.unmodifiableSet(result); + + } + result = this.uniqueProperties; + return result; + } + /** + * + * @param name + * @return the string name of the java class of the named property + */ + public String getType(String name) { + Class<?> resultClass = this.getClass(name); + String result = ""; + + if (resultClass != null) { + result = resultClass.getName(); + if (result.equals("java.util.ArrayList")) { + result = "java.util.List"; + } + } + + return result; + } + /** + * This will returned the generic parameterized type of the underlying + * object if it exists + * @param name + * @return the generic type of the java class of the underlying object + */ + public String getGenericType(String name) { + Class<?> resultClass = this.getGenericTypeClass(name); + String result = ""; + + if (resultClass != null) { + result = resultClass.getName(); + } + + return result; + } + /** + * + * @return the string name of the java class of the underlying object + */ + public abstract String getJavaClassName(); + + /** + * + * @param name the property name + * @return the Class object + */ + public abstract Class<?> getClass(String name); + + public abstract Class<?> getGenericTypeClass(String name); + + /** + * + * @param name the property name + * @return a new instance of the underlying type of this property + * @throws AAIUnknownObjectException + */ + public Object newInstanceOfProperty(String name) throws AAIUnknownObjectException { + String type = this.getType(name); + return loader.objectFromName(type); + } + + public Object newInstanceOfNestedProperty(String name) throws AAIUnknownObjectException { + String type = this.getGenericType(name); + return loader.objectFromName(type); + } + + + public Introspector newIntrospectorInstanceOfProperty(String name) throws AAIUnknownObjectException { + + Introspector result = IntrospectorFactory.newInstance(this.getModelType(), this.newInstanceOfProperty(name)); + + return result; + + } + + public Introspector newIntrospectorInstanceOfNestedProperty(String name) throws AAIUnknownObjectException { + + Introspector result = IntrospectorFactory.newInstance(this.getModelType(), this.newInstanceOfNestedProperty(name)); + + return result; + + } + /** + * Is this type not a Java String or primitive + * @param name + * @return + */ + public boolean isComplexType(String name) { + String result = this.getType(name); + + if (result.contains("aai") || result.equals("java.lang.Object")) { + return true; + } else { + return false; + } + } + + public boolean isComplexGenericType(String name) { + String result = this.getGenericType(name); + + if (result.contains("aai")) { + return true; + } else { + return false; + } + } + + public boolean isSimpleType(String name) { + return !(this.isComplexType(name) || this.isListType(name)); + } + + public boolean isSimpleGenericType(String name) { + return !this.isComplexGenericType(name); + } + + public boolean isListType(String name) { + String result = this.getType(name); + + if (result.contains("java.util.List")) { + return true; + } else { + return false; + } + } + + public boolean isContainer() { + Set<String> props = this.getProperties(); + boolean result = false; + if (props.size() == 1 && this.isListType(props.iterator().next())) { + result = true; + } + + return result; + } + + public abstract String getChildName(); + public String getChildDBName() { + String result = this.getChildName(); + + result = namingException.getDBName(result); + return result; + } + public abstract String getName(); + + public String getDbName() { + String lowerHyphen = this.getName(); + + lowerHyphen = namingException.getDBName(lowerHyphen); + + return lowerHyphen; + } + + public abstract ModelType getModelType(); + + public boolean hasChild(Introspector child) { + boolean result = false; + //check all inheriting types for this child + if ("true".equals(this.getMetadata(ObjectMetadata.ABSTRACT))) { + String[] inheritors = this.getMetadata(ObjectMetadata.INHERITORS).split(","); + for (String inheritor : inheritors) { + try { + Introspector temp = this.loader.introspectorFromName(inheritor); + result = temp.hasProperty(child.getName()); + if (result) { + break; + } + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping inheritor " + inheritor + " (Unknown Object)", e); + } + } + } else { + result = this.hasProperty(child.getName()); + } + return result; + } + + public void setURIChain(String uri) { + this.uriChain = uri; + } + public abstract String getObjectId() throws UnsupportedEncodingException; + + public String getURI() throws UnsupportedEncodingException { + //String result = this.uriChain; + String result = ""; + String namespace = this.getMetadata(ObjectMetadata.NAMESPACE); + String container = this.getMetadata(ObjectMetadata.CONTAINER); + if (this.isContainer()) { + result += "/" + this.getName(); + } else { + + if (container != null) { + result += "/" + container; + } + result += "/" + this.getDbName() + "/" + this.findKey(); + + if (namespace != null && !namespace.equals("")) { + result = "/" + namespace + result; + } + } + + + return result; + } + + public String getGenericURI() { + String result = ""; + if (this.isContainer()) { + result += "/" + this.getName(); + } else { + result += "/" + this.getDbName(); + for (String key : this.getKeys()) { + result += "/{" + this.getDbName() + "-" + key + "}"; + } + } + + return result; + } + + public String getFullGenericURI() { + String result = ""; + String namespace = this.getMetadata(ObjectMetadata.NAMESPACE); + String container = this.getMetadata(ObjectMetadata.CONTAINER); + if (this.isContainer()) { + result += "/" + this.getName(); + } else { + + + if (container != null) { + result += "/" + container; + } + result += "/" + this.getDbName(); + + for (String key : this.getKeys()) { + result += "/{" + this.getDbName() + "-" + key + "}"; + } + if (namespace != null && !namespace.equals("")) { + result = "/" + namespace + result; + } + + } + + return result; + } + + public abstract String preProcessKey(String key); + + protected abstract String findKey() throws UnsupportedEncodingException; + + public abstract String marshal(MarshallerProperties properties); + + public abstract Object clone(); + + public abstract Object getUnderlyingObject(); + + public String marshal(boolean formatted) { + MarshallerProperties properties = + new MarshallerProperties.Builder(MediaType.APPLICATION_JSON_TYPE).formatted(formatted).build(); + + return marshal(properties); + } + public String makeSingular(String word) { + + String result = word; + result = result.replaceAll("(?:([ho])es|s)$", ""); + + if (result.equals("ClassesOfService")) { + result = "ClassOfService"; + } else if (result.equals("CvlanTag")) { + result = "CvlanTagEntry"; + } else if (result.equals("Metadata")) { + result = "Metadatum"; + } + return result; + } + + protected String makePlural(String word) { + String result = word; + + if (result.equals("cvlan-tag-entry")) { + return "cvlan-tags"; + } else if (result.equals("class-of-service")) { + return "classes-of-service"; + } else if (result.equals("metadatum")) { + return "metadata"; + } + result = result.replaceAll("([a-z])$", "$1s"); + result = result.replaceAll("([hox])s$", "$1es"); + /* + if (result.equals("classes-of-services")) { + result = "classes-of-service"; + }*/ + + return result; + } + + public abstract String getMetadata(ObjectMetadata metadataName); + public abstract Map<PropertyMetadata, String> getPropertyMetadata(String propName); + public Optional<String> getPropertyMetadata(String propName, PropertyMetadata metadataName) { + final String resultValue = this.getPropertyMetadata(propName).getOrDefault(metadataName, ""); + Optional<String> result = Optional.empty(); + + if (!resultValue.isEmpty()) { + result = Optional.of(resultValue); + } + return result; + + } + + public abstract Version getVersion(); + public Loader getLoader() { + return this.loader; + } + + public boolean isTopLevel() { + + return this.getMetadata(ObjectMetadata.NAMESPACE) != null; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorFactory.java b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorFactory.java new file mode 100644 index 00000000..016e089f --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorFactory.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +public class IntrospectorFactory { + + /** + * New instance. + * + * @param type the type + * @param o the o + * @param llBuilder the ll builder + * @return the introspector + */ + public static Introspector newInstance(ModelType type, Object o) { + + if (type.equals(ModelType.MOXY)) { + return new MoxyStrategy(o); + } else if (type.equals(ModelType.POJO)) { + return new PojoStrategy(o); + } else if (type.equals(ModelType.JSON)) { + return new JSONStrategy(o); + } else { + throw new IllegalArgumentException("Unknown class type: " + type); + } + + } + + /** + * New instance. + * + * @param type the type + * @param o the o + * @param namedType the named type + * @param llBuilder the ll builder + * @return the introspector + */ + public static Introspector newInstance(ModelType type, Object o, String namedType) { + + if (type.equals(ModelType.JSON)) { + return new JSONStrategy(o, namedType); + } else { + throw new IllegalArgumentException("Unknown class type: " + type); + } + + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java new file mode 100644 index 00000000..12d545d2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/IntrospectorWalker.java @@ -0,0 +1,193 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class IntrospectorWalker { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(IntrospectorWalker.class); + + private Wanderer w = null; + private Set<String> blacklist = null; + private boolean preventCycles = false; + private final PropertyPredicate<Introspector, String> propVisibility; + + /** + * Instantiates a new introspector walker. + * + * @param w the w + * @param llBuilder the ll builder + */ + public IntrospectorWalker(Wanderer w) { + this.w = w; + this.blacklist = new HashSet<>(); + this.propVisibility = null; + } + + public IntrospectorWalker(Wanderer w, PropertyPredicate<Introspector, String> p) { + this.w = w; + this.blacklist = new HashSet<>(); + this.propVisibility = p; + } + + + /** + * Sets the blacklist. + * + * @param list the new blacklist + */ + public void setBlacklist(List<String> list) { + blacklist.addAll(list); + } + + /** + * Prevent cycles. + * + * @param prevent the prevent + */ + public void preventCycles(boolean prevent) { + this.preventCycles = prevent; + } + + /** + * Walk. + * + * @param obj the obj + * @throws AAIException + */ + public void walk(Introspector obj) throws AAIException { + Set<String> visited = new HashSet<>(); + + walk(obj, null, visited); + } + + /** + * Walk. + * + * @param obj the obj + * @param parent the parent + * @throws AAIException + */ + private void walk(Introspector obj, Introspector parent, Set<String> visited) throws AAIException { + boolean stopRecursion = false; + Set<String> localVisited = new HashSet<>(); + localVisited.addAll(visited); + if (preventCycles) { + if (visited.contains(obj.getName())) { + stopRecursion = true; + } + if (!obj.isContainer()) { + localVisited.add(obj.getName()); //so we don't recurse while walking its children + } + } + Set<String> props; + //props must duplicate the result from getProperties because + //it is unmodifiable + if (this.propVisibility == null) { + props = new LinkedHashSet<>(obj.getProperties()); + } else { + props = new LinkedHashSet<>(obj.getProperties(this.propVisibility)); + } + + w.processComplexObj(obj); + props.removeAll(blacklist); + if (!obj.isContainer()) { + parent = obj; + } + for (String prop : props) { + + if (obj.isSimpleType(prop)) { + + w.processPrimitive(prop, obj); + } else if (obj.isListType(prop) && !stopRecursion) { + + List<Object> listReference = obj.getValue(prop); + boolean isComplexType = obj.isComplexGenericType(prop); + if (isComplexType) { + List<Introspector> list = obj.getWrappedListValue(prop); + try { + Introspector child = obj.newIntrospectorInstanceOfNestedProperty(prop); + w.modifyComplexList(list, listReference, parent, child); + for (Object item : listReference) { + child = IntrospectorFactory.newInstance(obj.getModelType(), item); + walk(child, parent, localVisited); + } + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping property " + prop + " (Unknown Object)", e); + } + } else { + w.processPrimitiveList(prop, obj); + } + if (listReference.size() == 0) { + if (isComplexType) { + try { + Introspector child = obj.newIntrospectorInstanceOfNestedProperty(prop); + int size = w.createComplexListSize(parent, child); + for (int i = 0; i < size; i++) { + child = obj.newIntrospectorInstanceOfNestedProperty(prop); + walk(child, parent, localVisited); + listReference.add(child.getUnderlyingObject()); + } + + obj.setValue(prop, listReference); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping property " + prop + " (Unknown Object)", e); + } + } else if (!isComplexType){ + w.processPrimitiveList(prop, obj); + } + } + + } else if (obj.isComplexType(prop) && !stopRecursion) { + Introspector child = null; + if (obj.getValue(prop) != null) { + child = IntrospectorFactory.newInstance(obj.getModelType(), obj.getValue(prop)); + } else { + if (w.createComplexObjIfNull()) { + try { + child = obj.newIntrospectorInstanceOfProperty(prop); + obj.setValue(prop, child.getUnderlyingObject()); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping property " + prop + " (Unknown Object)", e); + } + } + } + if (child != null) { + walk(child, obj, localVisited); + } + } + + } + /* + if (preventCycles && !obj.isContainer()) { + visited.remove(obj.getName()); //so we can see it down another path that isn't in danger of recursing over it + }*/ + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java new file mode 100644 index 00000000..45ffaad6 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/JSONStrategy.java @@ -0,0 +1,360 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.UnsupportedEncodingException; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.json.simple.JSONObject; + +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; + +public class JSONStrategy extends Introspector { + + private JSONObject json = null; + private String namedType = ""; + protected JSONStrategy(Object o) { + super(o); + json = (JSONObject)o; + //Assumes you provide a wrapper + Set<String> keySet = json.keySet(); + if (keySet.size() == 1) { + namedType = keySet.iterator().next(); + json = (JSONObject)json.get(namedType); + } else { + throw new IllegalArgumentException("This object has no named type."); + } + } + + protected JSONStrategy(Object o, String namedType) { + super(o); + json = (JSONObject)o; + this.namedType = namedType; + + } + + @Override + public boolean hasProperty(String name) { + //TODO + return true; + } + @Override + public Object getValue(String name) { + Object result = ""; + result = json.get(name); + + return result; + } + + @Override + public void setValue(String name, Object obj) { + json.put(name, obj); + + } + @Override + public Object getUnderlyingObject() { + return this.json; + } + + @Override + public Set<String> getProperties() { + Set<String> result = json.keySet(); + return result; + } + + @Override + public Set<String> getRequiredProperties() { + //unknowable + + return this.getProperties(); + } + + @Override + public Set<String> getKeys() { + //unknowable + return this.getProperties(); + } + + @Override + public Set<String> getAllKeys() { + //unknowable + return this.getProperties(); + } + + @Override + public String getType(String name) { + String result = ""; + Class<?> resultClass = this.getClass(name); + if (resultClass != null) { + result = resultClass.getName(); + } + + if (result.equals("org.json.simple.JSONArray")) { + result = "java.util.List"; + } + + return result; + } + + @Override + public String getGenericType(String name) { + String result = ""; + Class<?> resultClass = this.getGenericTypeClass(name); + if (resultClass != null) { + result = resultClass.getName(); + } + return result; + } + + @Override + public String getJavaClassName() { + return json.getClass().getName(); + } + + @Override + public Class<?> getClass(String name) { + Class<?> result = null; + result = json.get(name).getClass(); + + return result; + } + + @Override + public Class<?> getGenericTypeClass(String name) { + Object resultObject = null; + Class<?> resultClass = null; + resultObject = this.getValue(name); + if (resultObject.getClass().getName().equals("org.json.simple.JSONArray")) { + resultClass = ((List)resultObject).get(0).getClass(); + } + + return resultClass; + } + + @Override + public Object newInstanceOfProperty(String name) { + try { + return this.getClass(name).newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + return null; + } + } + + @Override + public Object newInstanceOfNestedProperty(String name) { + try { + return this.getGenericTypeClass(name).newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + return null; + } + } + + @Override + public boolean isComplexType(String name) { + String result = this.getType(name); + + if (result.contains("JSONObject")) { + return true; + } else { + return false; + } + + } + + @Override + public boolean isComplexGenericType(String name) { + String result = this.getGenericType(name); + + if (result.contains("JSONObject")) { + return true; + } else { + return false; + } + + } + + @Override + public boolean isListType(String name) { + String result = this.getType(name); + + if (result.contains("java.util.List")) { + return true; + } else { + return false; + } + + } + + @Override + public boolean isContainer() { + Set<String> props = this.getProperties(); + boolean result = false; + if (props.size() == 1 && this.isListType(props.iterator().next())) { + result = true; + } + + return result; + } + @Override + protected String findKey() { + return ""; + } + + @Override + public String getName() { + return this.namedType; + } + + @Override + public String getDbName() { + return this.getName(); + } + + @Override + public String getURI() { + + // use a UUID for now + return UUID.randomUUID().toString(); + } + + @Override + public String getGenericURI() { + + //there is none defined for this + return ""; + } + + @Override + public String preProcessKey (String key) { + + // don't do anything with it + return key; + + } + + @Override + public String marshal(MarshallerProperties properties) { + //TODO + return null; + } + + @Override + public Object clone() { + //TODO + return null; + } + + /*@Override + public String findEdgeName(String parent, String child) { + + // Always has for now + return "has"; + + }*/ + + @Override + public ModelType getModelType() { + return ModelType.JSON; + } + + @Override + public Set<String> getIndexedProperties() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getChildName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean hasChild(Introspector child) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isSimpleType(String name) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isSimpleGenericType(String name) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Map<PropertyMetadata, String> getPropertyMetadata(String prop) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getMetadata(ObjectMetadata metadataName) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getChildDBName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getFullGenericURI() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Object get(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void set(String name, Object value) { + // TODO Auto-generated method stub + + } + + @Override + public String getObjectId() throws UnsupportedEncodingException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Version getVersion() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java new file mode 100644 index 00000000..76f00390 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Loader.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.util.Map; + +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException; +import org.openecomp.aai.restcore.MediaType; + +public abstract class Loader { + + private final Version version; + private final ModelType modelType; + + /** + * Instantiates a new loader. + * + * @param version the version + * @param modelType the model type + * @param llBuilder the ll builder + */ + public Loader (Version version, ModelType modelType) { + this.version = version; + this.modelType = modelType; + } + + /** + * Process. + * + * @param version the version + */ + protected abstract void process(Version version); + + /** + * Object from name. + * + * @param name the name + * @return the object + * @throws AAIUnknownObjectException + */ + public abstract Object objectFromName(String name) throws AAIUnknownObjectException; + + /** + * Introspector from name. + * + * @param name the name + * @return the introspector + * @throws AAIUnknownObjectException + */ + public abstract Introspector introspectorFromName(String name) throws AAIUnknownObjectException; + + /** + * Unmarshal. + * + * @param type the type + * @param json the json + * @param mediaType the media type + * @return the introspector + */ + public abstract Introspector unmarshal(String type, String json, MediaType mediaType) throws AAIUnmarshallingException; + + /** + * Unmarshal. + * + * @param type the type + * @param json the json + * @return the introspector + */ + public Introspector unmarshal(String type, String json) throws AAIUnmarshallingException { + return unmarshal(type, json, MediaType.APPLICATION_JSON_TYPE); + } + + + /** + * Gets the model type. + * + * @return the model type + */ + public ModelType getModelType() { + return this.modelType; + } + + /** + * Gets the version. + * + * @return the version + */ + public Version getVersion() { + return this.version; + } + + public abstract Map<String, Introspector> getAllObjects(); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/LoaderFactory.java b/aai-core/src/main/java/org/openecomp/aai/introspection/LoaderFactory.java new file mode 100644 index 00000000..04cc00df --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/LoaderFactory.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +public class LoaderFactory { + + /** + * Creates a new Loader object. + * + * @param type the type + * @param version the version + * @param llBuilder the ll builder + * @return the loader + */ + public static Loader createLoaderForVersion(ModelType type, Version version) { + + if (type.equals(ModelType.MOXY)) { + return new MoxyLoader(version); + } else if (type.equals(ModelType.POJO)) { + return new PojoLoader(version); + } + + return null; + + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MarshallerProperties.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MarshallerProperties.java new file mode 100644 index 00000000..25156c7b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MarshallerProperties.java @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.openecomp.aai.restcore.MediaType; + +public class MarshallerProperties { + + private final MediaType type; + private final boolean includeRoot; + private final boolean wrapperAsArrayName; + private final boolean formatted; + + /** + * Instantiates a new marshaller properties. + * + * @param builder the builder + */ + private MarshallerProperties(Builder builder) { + + this.type = builder.type; + this.includeRoot = builder.includeRoot; + this.wrapperAsArrayName = builder.wrapperAsArrayName; + this.formatted = builder.formatted; + } + + /** + * Gets the media type. + * + * @return the media type + */ + public MediaType getMediaType() { + return this.type; + } + + /** + * Gets the include root. + * + * @return the include root + */ + public boolean getIncludeRoot() { + return this.includeRoot; + } + + /** + * Gets the wrapper as array name. + * + * @return the wrapper as array name + */ + public boolean getWrapperAsArrayName() { + return this.wrapperAsArrayName; + } + + /** + * Gets the formatted. + * + * @return the formatted + */ + public boolean getFormatted() { + return this.formatted; + } + + public static class Builder { + + private final MediaType type; + private boolean includeRoot = false; + private boolean wrapperAsArrayName = true; + private boolean formatted = false; + + /** + * Instantiates a new builder. + * + * @param type the type + */ + public Builder(MediaType type) { + this.type = type; + } + + /** + * Include root. + * + * @param includeRoot the include root + * @return the builder + */ + public Builder includeRoot (boolean includeRoot) { + this.includeRoot = includeRoot; + return this; + } + + /** + * Wrapper as array name. + * + * @param wrapperAsArrayName the wrapper as array name + * @return the builder + */ + public Builder wrapperAsArrayName (boolean wrapperAsArrayName) { + this.wrapperAsArrayName = wrapperAsArrayName; + return this; + } + + /** + * Formatted. + * + * @param formatted the formatted + * @return the builder + */ + public Builder formatted (boolean formatted) { + this.formatted = formatted; + return this; + } + + /** + * Builds the properties. + * + * @return the marshaller properties + */ + public MarshallerProperties build() { + return new MarshallerProperties(this); + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java new file mode 100644 index 00000000..651b28d9 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelInjestor.java @@ -0,0 +1,176 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.bind.JAXBException; + +import org.eclipse.persistence.dynamic.DynamicType; +import org.eclipse.persistence.jaxb.JAXBContextProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory; + +import org.openecomp.aai.util.AAIConstants; + + +public class ModelInjestor { + + private Map<Version, DynamicJAXBContext> versionContextMap = new HashMap<>(); + private static final Pattern classNamePattern = Pattern.compile("\\.(v\\d+)\\."); + private static final Pattern uriPattern = Pattern.compile("(v\\d+)\\/"); + + + /** + * Instantiates a new model injestor. + */ + private ModelInjestor() { + try { + injestModels(); + } catch (FileNotFoundException | JAXBException e) { + throw new RuntimeException(e); + } + } + + private static class Helper { + private static final ModelInjestor INSTANCE = new ModelInjestor(); + } + + /** + * Gets the single instance of ModelInjestor. + * + * @return single instance of ModelInjestor + */ + public synchronized static ModelInjestor getInstance() { + return Helper.INSTANCE; + } + + /** + * Injest models. + * + * @throws FileNotFoundException the file not found exception + * @throws JAXBException the JAXB exception + */ + private void injestModels() throws FileNotFoundException, JAXBException { + + for (Version version : Version.values()) { + this.injestModel(version); + } + } + + /** + * Injest model. + * + * @param version the version + * @throws JAXBException the JAXB exception + * @throws FileNotFoundException the file not found exception + */ + private void injestModel (Version version) throws JAXBException, FileNotFoundException { + String fileName = this.getOXMFileName(version); + InputStream iStream = new FileInputStream(new File(fileName)); + Map<String, Object> properties = new HashMap<String, Object>(); + properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, iStream); + final DynamicJAXBContext jaxbContext = DynamicJAXBContextFactory.createContextFromOXM(this.getClass().getClassLoader(), properties); + versionContextMap.put(version, jaxbContext); + } + + /** + * Gets the version from class name. + * + * @param classname the classname + * @return the version from class name + */ + public Version getVersionFromClassName (String classname) { + Matcher m = classNamePattern.matcher(classname); + String version = "v2"; //for the OXM, only the v2 ones don't include a model name, hence this default + if (m.find()) { + version = m.group(1); + } + + return Version.valueOf(version); + } + + /** + * Gets the context for URI. + * + * @param uri the uri + * @return the context for URI + */ + public DynamicJAXBContext getContextForURI(String uri) { + DynamicJAXBContext result = null; + Matcher m = uriPattern.matcher(uri); + Version version = null; + if (m.find()) { + version = Version.valueOf(m.group(1)); + result = versionContextMap.get(version); + } + + return result; + } + + /** + * Gets the context for version. + * + * @param version the version + * @return the context for version + */ + public DynamicJAXBContext getContextForVersion(Version version) { + DynamicJAXBContext result = null; + + result = versionContextMap.get(version); + + + return result; + } + + /** + * Gets the dynamic type for class name. + * + * @param classname the classname + * @return the dynamic type for class name + */ + public DynamicType getDynamicTypeForClassName(String classname) { + DynamicType result = null; + DynamicJAXBContext context = null; + + Version version = this.getVersionFromClassName(classname); + + context = versionContextMap.get(version); + + if (context != null) { + result = context.getDynamicType(classname); + } + + return result; + } + + public String getOXMFileName(Version v) { + return AAIConstants.AAI_HOME_ETC_OXM + "aai_oxm_" + v.toString() + ".xml"; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/ModelType.java b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelType.java new file mode 100644 index 00000000..eddc9405 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/ModelType.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +public enum ModelType { + MOXY, POJO, JSON +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java new file mode 100644 index 00000000..60fb47d3 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyLoader.java @@ -0,0 +1,190 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.IOException; +import java.io.StringReader; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.restcore.MediaType; +import org.openecomp.aai.workarounds.NamingExceptions; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.google.common.collect.ImmutableMap; + +public class MoxyLoader extends Loader { + + private DynamicJAXBContext jaxbContext = null; + private EELFLogger LOGGER = EELFManager.getInstance().getLogger(MoxyLoader.class); + private Map<String, Introspector> allObjs = null; + + /** + * Instantiates a new moxy loader. + * + * @param version the version + * @param llBuilder the ll builder + */ + protected MoxyLoader(Version version) { + super(version, ModelType.MOXY); + process(version); + } + + /** + * {@inheritDoc} + * @throws AAIUnknownObjectException + */ + @Override + public Introspector introspectorFromName(String name) throws AAIUnknownObjectException { + + return IntrospectorFactory.newInstance(ModelType.MOXY, objectFromName(name)); + } + + /** + * {@inheritDoc} + */ + @Override + public Object objectFromName(String name) throws AAIUnknownObjectException { + + final String sanitizedName = NamingExceptions.getInstance().getObjectName(name); + final String upperCamel; + + //Contains any uppercase, then assume it's upper camel + if (name.matches(".*[A-Z].*")) { + upperCamel = sanitizedName; + } else { + upperCamel = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, sanitizedName); + } + + try { + final DynamicEntity result = jaxbContext.newDynamicEntity(upperCamel); + + if (result == null) throw new AAIUnknownObjectException("Unrecognized AAI object " + name); + + return result; + } catch (IllegalArgumentException e) { + //entity does not exist + throw new AAIUnknownObjectException("Unrecognized AAI object " + name, e); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void process(Version version) { + ModelInjestor injestor = ModelInjestor.getInstance(); + jaxbContext = injestor.getContextForVersion(version); + + } + + /** + * {@inheritDoc} + */ + @Override + public Introspector unmarshal(String type, String json, MediaType mediaType) throws AAIUnmarshallingException { + try { + final Object clazz = objectFromName(type); + final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + + if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE)) { + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + } + + final DynamicEntity entity = (DynamicEntity) unmarshaller.unmarshal(new StreamSource(new StringReader(json)), clazz.getClass()).getValue(); + return IntrospectorFactory.newInstance(ModelType.MOXY, entity); + } catch (JAXBException e) { + AAIException ex = new AAIException("AAI_4007", e); + ErrorLogHelper.logException(ex); + throw new AAIUnmarshallingException("Could not unmarshall: " + e.getMessage(), ex); + } catch (AAIUnknownObjectException e) { + throw new AAIUnmarshallingException("Could not unmarshall: " + e.getMessage(), e); + } + } + + @Override + public Map<String, Introspector> getAllObjects() { + if (this.allObjs != null) { + return allObjs; + } else { + ImmutableMap.Builder<String, Introspector> map = new ImmutableMap.Builder<String, Introspector>(); + Set<String> objs = objectsInVersion(); + for (String objName : objs) { + try { + Introspector introspector = this.introspectorFromName(objName); + map.put(introspector.getDbName(), introspector); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Unexpected AAIUnknownObjectException while running getAllObjects()", e); + } + } + allObjs = map.build(); + return allObjs; + } + } + + private Set<String> objectsInVersion() { + final Set<String> result = new HashSet<>(); + + try { + final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + final String fileName = ModelInjestor.getInstance().getOXMFileName(getVersion()); + + docFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + + final DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + final Document doc = docBuilder.parse(fileName); + final NodeList list = doc.getElementsByTagName("java-type"); + + for (int i = 0; i < list.getLength(); i++) { + result.add(list.item(i).getAttributes().getNamedItem("name").getNodeValue()); + } + } catch (ParserConfigurationException | SAXException | IOException e) { + LOGGER.warn("Exception while enumerating objects for API version " + getVersion() + " (returning partial results)", e); + } + + result.remove("EdgePropNames"); + return result; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java new file mode 100644 index 00000000..ebebf251 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/MoxyStrategy.java @@ -0,0 +1,394 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.StringReader; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.descriptors.ClassDescriptor; +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.dynamic.DynamicType; +import org.eclipse.persistence.exceptions.DynamicException; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.eclipse.persistence.mappings.DatabaseMapping; +import org.eclipse.persistence.oxm.XMLField; +import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping; +import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping; +import org.springframework.web.util.UriUtils; + +import org.openecomp.aai.restcore.MediaType; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; + +public class MoxyStrategy extends Introspector { + + private DynamicEntity internalObject = null; + private DynamicType internalType = null; + private DynamicJAXBContext jaxbContext = null; + private ClassDescriptor cd = null; + private Marshaller marshaller = null; + private Unmarshaller unmarshaller = null; + private Version version = null; + private Set<String> properties = null; + private Set<String> keys = null; + private Set<String> requiredProperties = null; + + private boolean isInitialized = false; + + protected MoxyStrategy(Object obj) { + super(obj); + /* must look up the correct jaxbcontext for this object */ + className = MoxyStrategy.class.getSimpleName(); + internalObject = (DynamicEntity)obj; + ModelInjestor injestor = ModelInjestor.getInstance(); + version = injestor.getVersionFromClassName(internalObject.getClass().getName()); + jaxbContext = injestor.getContextForVersion(version); + super.loader = LoaderFactory.createLoaderForVersion(getModelType(), version); + String simpleName = internalObject.getClass().getName(); + internalType = jaxbContext.getDynamicType(simpleName); + cd = internalType.getDescriptor(); + try { + marshaller = jaxbContext.createMarshaller(); + unmarshaller = jaxbContext.createUnmarshaller(); + } catch (JAXBException e) { + + } + + } + + private void init() { + isInitialized = true; + + Set<String> props = new LinkedHashSet<>(); + for (String s : internalType.getPropertiesNames()) { + props.add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, s)); + + } + props = Collections.unmodifiableSet(props); + this.properties = props; + + Set<String> requiredProps = new LinkedHashSet<>(); + requiredProps = new LinkedHashSet<>(); + for (DatabaseMapping dm : cd.getMappings()) { + if (dm.getField() instanceof XMLField) { + XMLField x = (XMLField)dm.getField(); + if (x != null) { + if (x.isRequired()) { + requiredProps.add(this.removeXPathDescriptor(x.getName())); + } + } + } + } + requiredProps = Collections.unmodifiableSet(requiredProps); + this.requiredProperties = requiredProps; + + Set<String> keys = new LinkedHashSet<>(); + + for (String name : internalType.getDescriptor().getPrimaryKeyFieldNames()) { + keys.add(this.removeXPathDescriptor(name)); + } + keys = Collections.unmodifiableSet(keys); + this.keys = keys; + + + } + + @Override + public boolean hasProperty(String name) { + String convertedName = convertPropertyName(name); + + return internalType.containsProperty(convertedName); + } + + @Override + public Object get(String name) { + return internalObject.get(name); + } + + @Override + public void set(String name, Object obj) throws IllegalArgumentException { + + internalObject.set(name, obj); + } + + @Override + public Set<String> getProperties() { + + if(!isInitialized){ + init(); + } + + return this.properties; + + } + + @Override + public Set<String> getRequiredProperties() { + + if(!isInitialized){ + init(); + } + + return this.requiredProperties; + } + + @Override + public Set<String> getKeys() { + + if(!isInitialized){ + init(); + } + + return this.keys; + } + + @Override + public Map<PropertyMetadata, String> getPropertyMetadata(String prop) { + String propName = this.convertPropertyName(prop); + DatabaseMapping mapping = cd.getMappingForAttributeName(propName); + Map<PropertyMetadata, String> result = new HashMap<>(); + if (mapping != null) { + Set<Entry> entrySet = mapping.getProperties().entrySet(); + for (Entry<?,?> entry : entrySet) { + result.put( + PropertyMetadata.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, (String)entry.getKey())), (String)entry.getValue()); + } + } + + return result; + } + + @Override + public String getJavaClassName() { + return internalObject.getClass().getName(); + } + + + + @Override + public Class<?> getClass(String name) { + name = convertPropertyName(name); + Class<?> resultClass = null; + try { + if (internalType.getPropertyType(name) == null) { + if (cd.getMappingForAttributeName(name) instanceof XMLCompositeDirectCollectionMapping) { + resultClass = cd.getMappingForAttributeName(name).getContainerPolicy().getContainerClass(); + + } else if (cd.getMappingForAttributeName(name) instanceof XMLCompositeCollectionMapping) { + resultClass = cd.getMappingForAttributeName(name).getContainerPolicy().getContainerClass(); + } else { + ClassDescriptor referenceDiscriptor = cd.getMappingForAttributeName(name).getReferenceDescriptor(); + if (referenceDiscriptor != null) { + resultClass = referenceDiscriptor.getJavaClass(); + } else { + resultClass = Object.class; + } + } + } else { + resultClass = internalType.getPropertyType(name); + } + } catch (DynamicException e) { + //property doesn't exist + } + return resultClass; + } + + @Override + public Class<?> getGenericTypeClass(String name) { + name = convertPropertyName(name); + Class<?> resultClass = null; + if (internalType.getPropertyType(name) == null) { + if (cd.getMappingForAttributeName(name) instanceof XMLCompositeDirectCollectionMapping) { + resultClass = cd.getMappingForAttributeName(name).getFields().get(0).getType(); + + } else if (cd.getMappingForAttributeName(name) instanceof XMLCompositeCollectionMapping) { + resultClass = cd.getMappingForAttributeName(name).getReferenceDescriptor().getJavaClass(); + } + } + + return resultClass; + } + + @Override + public Object getUnderlyingObject() { + return this.internalObject; + } + + @Override + public String getChildName() { + + String className = internalObject.getClass().getSimpleName(); + String lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className); + + if (this.isContainer()) { + lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().iterator().next()).getSimpleName()); + } + + return lowerHyphen; + } + + @Override + public String getName() { + String className = internalObject.getClass().getSimpleName(); + String lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className); + /* + if (this.isContainer()) { + lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().get(0)).getSimpleName()); + }*/ + + + return lowerHyphen; + } + + @Override + public String getObjectId() throws UnsupportedEncodingException { + String result = ""; + String container = this.getMetadata(ObjectMetadata.CONTAINER); + if (this.isContainer()) { + result += "/" + this.getName(); + } else { + + if (container != null) { + result += "/" + container; + } + result += "/" + this.getDbName() + "/" + this.findKey(); + + } + + return result; + } + + @Override + protected String findKey() throws UnsupportedEncodingException { + Set<String> keys = null; + keys = this.getKeys(); + List<String> results = new ArrayList<>(); + for (String key : keys) { + if (this.getType(key).toLowerCase().contains("long")) { + key = ((Long)this.getValue(key)).toString(); + } else { + key = (String)this.getValue(key); + } + key = UriUtils.encode(key, "UTF-8"); + + results.add(key); + } + + return Joiner.on("/").join(results); + } + + @Override + public String preProcessKey (String key) { + String result = ""; + //String trimmedRestURI = restURI.replaceAll("/[\\w\\-]+?/[\\w\\-]+?$", ""); + String[] split = key.split("/"); + int i = 0; + for (i = split.length-1; i >= 0; i--) { + + if (jaxbContext.getDynamicType(split[i]) != null) { + break; + + } + + } + result = Joiner.on("/").join(Arrays.copyOfRange(split, 0, i)); + + return result; + + } + + @Override + public String marshal(MarshallerProperties properties) { + StringWriter result = new StringWriter(); + try { + if (properties.getMediaType().equals(MediaType.APPLICATION_JSON_TYPE)) { + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE, "application/json"); + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.JSON_INCLUDE_ROOT, properties.getIncludeRoot()); + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, properties.getWrapperAsArrayName()); + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS, false); + } + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, properties.getFormatted()); + marshaller.marshal(this.internalObject, result); + } catch (JAXBException e) { + //e.printStackTrace(); + } + + return result.toString(); + } + + @Override + public Object clone() { + Object result = null; + try { + unmarshaller = jaxbContext.createUnmarshaller(); + + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + + result = unmarshaller.unmarshal(new StreamSource(new StringReader(this.marshal(true))), this.internalObject.getClass()).getValue(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + result = IntrospectorFactory.newInstance(getModelType(), result); + return result; + } + @Override + public ModelType getModelType() { + return ModelType.MOXY; + } + + private String removeXPathDescriptor(String name) { + + return name.replaceAll("/text\\(\\)", ""); + } + + @Override + public String getMetadata(ObjectMetadata name) { + + return (String)cd.getProperty(name.toString()); + } + + @Override + public Version getVersion() { + + return this.version; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java new file mode 100644 index 00000000..116cb787 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoInjestor.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; + +import org.eclipse.persistence.jaxb.JAXBContextFactory; + +import org.openecomp.aai.db.props.AAIProperties; + +public class PojoInjestor { + + private String POJO_CLASSPATH = "org.openecomp.aai.domain.yang"; + private final Pattern classNamePattern = Pattern.compile("\\.(v\\d+)\\."); + + public PojoInjestor() { + } + + public JAXBContext getContextForVersion(Version v) { + JAXBContext context = null; + try { + if (!v.equals(AAIProperties.LATEST)) { + POJO_CLASSPATH += "." + v; + } + context = JAXBContextFactory.createContext(POJO_CLASSPATH, this.getClass().getClassLoader()); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return context; + } + public Version getVersion (String classname) { + Matcher m = classNamePattern.matcher(classname); + String version; + if (m.find()) { + version = m.group(1); + } else { + //only POJOs of old versions have the version number in their classnames + //so if we can't find a version, default to the latest + version = AAIProperties.LATEST.toString(); + } + + return Version.valueOf(version); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java new file mode 100644 index 00000000..ac63e981 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoLoader.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.StringReader; +import java.util.Map; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.jaxb.UnmarshallerProperties; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.restcore.MediaType; +import org.openecomp.aai.workarounds.NamingExceptions; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import org.eclipse.persistence.jaxb.JAXBContextFactory; + +public class PojoLoader extends Loader { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(PojoLoader.class); + private static final String POJO_BASE_PACKAGE_NAME = "org.openecomp.aai.domain.yang"; + + protected JAXBContext context; + private final String pojoPackageName; + + protected PojoLoader(Version version) { + super(version, ModelType.POJO); + + if (!version.equals(AAIProperties.LATEST)) { + pojoPackageName = POJO_BASE_PACKAGE_NAME + "." + version; + } else { + pojoPackageName = POJO_BASE_PACKAGE_NAME; + } + + try { + context = JAXBContextFactory.createContext(pojoPackageName, this.getClass().getClassLoader()); + } catch (JAXBException e) { + LOGGER.error("JAXBException while instantiation contect for PojoLoader", e); + } + } + + @Override + public Introspector introspectorFromName(String name) throws AAIUnknownObjectException { + return IntrospectorFactory.newInstance(ModelType.POJO, objectFromName(name)); + } + + @Override + public Object objectFromName(String name) throws AAIUnknownObjectException { + + final String sanitizedName = NamingExceptions.getInstance().getObjectName(name); + final String upperCamel; + + //Contains any uppercase, then assume it's upper camel + if (sanitizedName.matches(".*[A-Z].*")) { + upperCamel = sanitizedName; + } else { + upperCamel = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, sanitizedName); + } + + final String objectClassName; + + if (!upperCamel.contains(pojoPackageName)) { + objectClassName = pojoPackageName + "." + upperCamel; + } else { + objectClassName = upperCamel; + } + + try { + return Class.forName(objectClassName).newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + throw new AAIUnknownObjectException("Unrecognized AAI object " + name); + } + } + + @Override + protected void process(Version version) { + LOGGER.warn("PojoLoader.process(Version) has not been implemented"); + } + + @Override + public Introspector unmarshal(String type, String json, MediaType mediaType) throws AAIUnmarshallingException { + + try { + final Unmarshaller unmarshaller = context.createUnmarshaller(); + + if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE)) { + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + } + + final Object clazz = objectFromName(type); + final Object obj = unmarshaller.unmarshal(new StreamSource(new StringReader(json)), clazz.getClass()).getValue(); + + return IntrospectorFactory.newInstance(ModelType.POJO, obj); + } catch (JAXBException e) { + ErrorLogHelper.logError("AAI_4007", "Could not unmarshall: " + e.getMessage()); + throw new AAIUnmarshallingException("Could not unmarshall: " + e.getMessage()); + } catch (AAIUnknownObjectException e) { + throw new AAIUnmarshallingException("Could not unmarshall: " + e.getMessage(), e); + } + } + + @Override + public Map<String, Introspector> getAllObjects() { + //TODO + return null; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java new file mode 100644 index 00000000..5632ddf7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PojoStrategy.java @@ -0,0 +1,389 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.io.StringReader; +import java.io.StringWriter; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.jaxb.UnmarshallerProperties; + +import org.openecomp.aai.annotations.Metadata; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.restcore.MediaType; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; +import com.google.common.collect.Multimap; + +public class PojoStrategy extends Introspector { + + private Object internalObject = null; + private PojoInjestor injestor = null; + private Multimap<String, String> keyProps = null; + private Metadata classLevelMetadata = null; + private Version version; + private JAXBContext jaxbContext; + private Marshaller marshaller; + private Unmarshaller unmarshaller; + private Set<String> properties = null; + private Set<String> keys = null; + private Set<String> requiredProperties = null; + + private boolean isInitialized = false; + + protected PojoStrategy(Object obj) { + super(obj); + className = PojoStrategy.class.getSimpleName(); + this.internalObject = obj; + injestor = new PojoInjestor(); + classLevelMetadata = obj.getClass().getAnnotation(Metadata.class); + + version = injestor.getVersion(obj.getClass().getName()); + jaxbContext = injestor.getContextForVersion(version); + super.loader = LoaderFactory.createLoaderForVersion(getModelType(), version); + try { + marshaller = jaxbContext.createMarshaller(); + unmarshaller = jaxbContext.createUnmarshaller(); + } catch (JAXBException e) { + + } + + } + + private void init() { + + isInitialized = true; + + Set<String> properties = new LinkedHashSet<>(); + Set<String> keys = new LinkedHashSet<>(); + Set<String> required = new LinkedHashSet<>(); + + Field[] fields = this.internalObject.getClass().getDeclaredFields(); + + for (Field field : fields) { + if (!field.getName().equals("any")) { + properties.add(covertFieldToOutputFormat(field.getName())); + Metadata annotation = field.getAnnotation(Metadata.class); + XmlElement xmlAnnotation = field.getAnnotation(XmlElement.class); + if (annotation != null) { + if (annotation.isKey()) { + keys.add(covertFieldToOutputFormat(field.getName())); + } + } + if (xmlAnnotation != null) { + if (xmlAnnotation.required()) { + required.add(covertFieldToOutputFormat(field.getName())); + } + } + } + } + properties = Collections.unmodifiableSet(properties); + this.properties = properties; + + keys = Collections.unmodifiableSet(keys); + this.keys = keys; + + required = Collections.unmodifiableSet(required); + this.requiredProperties = required; + + } + private String covertFieldToOutputFormat(String propName) { + return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, propName); + } + + @Override + public boolean hasProperty(String name) { + //TODO + return true; + } + + @Override + /** + * Gets the value of the property via reflection + */ + public Object get(String name) { + String getMethodName = "get" + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, name); + try { + return this.internalObject.getClass().getDeclaredMethod(getMethodName).invoke(this.internalObject); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + return null; + } + } + + @Override + public void set(String name, Object value) { + String setMethodName = "set" + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, name); + try { + this.internalObject.getClass().getDeclaredMethod(setMethodName, value.getClass()).invoke(this.internalObject, value); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { + ErrorLogHelper.logError("AAI_4017", "Error setting name/value pair on POJO: " + e.getMessage()); + } + } + + @Override + public Set<String> getProperties() { + + if(!isInitialized){ + this.init(); + } + return this.properties; + } + + + @Override + public Set<String> getRequiredProperties() { + + if(!isInitialized) { + this.init(); + } + return this.requiredProperties; + } + + @Override + public Set<String> getKeys() { + + if(!isInitialized){ + this.init(); + } + return this.keys; + } + + public Class<?> getClass(String name) { + + Field field = null; + try { + field = this.internalObject.getClass().getDeclaredField(CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name)); + } catch (NoSuchFieldException | SecurityException e) { + + return null; + } + + return field.getType(); + } + + public Class<?> getGenericTypeClass(String name) { + + try { + String getMethodName = "get" + CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, name); + Method method = internalObject.getClass().getDeclaredMethod(getMethodName); + Type t = method.getGenericReturnType(); + if(t instanceof ParameterizedType) { + ParameterizedType pt = (ParameterizedType)t; + return ((Class<?>)pt.getActualTypeArguments()[0]); + } else { + return null; + } + + } catch (Exception e) { + return null; + } + } + + @Override + public String getJavaClassName() { + return internalObject.getClass().getName(); + } + + @Override + public Object getUnderlyingObject() { + return this.internalObject; + } + + @Override + public String getName() { + String className = internalObject.getClass().getSimpleName(); + + return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className); + } + + @Override + protected String findKey() { + Set<String> keys = null; + keys = this.getKeys(); + List<String> results = new ArrayList<>(); + for (String key : keys) { + if (this.getType(key).toLowerCase().contains("long")) { + key = ((Long)this.getValue(key)).toString(); + } else { + key = (String)this.getValue(key); + } + results.add(key); + } + + return Joiner.on("/").join(results); + } + + @Override + public String marshal(MarshallerProperties properties) { + StringWriter result = new StringWriter(); + try { + if (properties.getMediaType().equals(MediaType.APPLICATION_JSON_TYPE)) { + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE, "application/json"); + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.JSON_INCLUDE_ROOT, properties.getIncludeRoot()); + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, properties.getWrapperAsArrayName()); + } + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, properties.getFormatted()); + marshaller.marshal(this.internalObject, result); + } catch (JAXBException e) { + //e.printStackTrace(); + } + + return result.toString(); + } + + @Override + public Object clone() { + Object result = null; + try { + unmarshaller = jaxbContext.createUnmarshaller(); + + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + + result = unmarshaller.unmarshal(new StreamSource(new StringReader(this.marshal(true))), this.internalObject.getClass()).getValue(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + result = IntrospectorFactory.newInstance(getModelType(), result); + return result; + } + + @Override + public String preProcessKey (String key) { + String result = ""; + //String trimmedRestURI = restURI.replaceAll("/[\\w\\-]+?/[\\w\\-]+?$", ""); + String[] split = key.split("/"); + int i = 0; + for (i = split.length-1; i >= 0; i--) { + + if (keyProps.containsKey(split[i])) { + break; + + } + + } + result = Joiner.on("/").join(Arrays.copyOfRange(split, 0, i)); + + return result; + + } + + @Override + public ModelType getModelType() { + return ModelType.POJO; + } + + @Override + public String getChildName() { + String className = internalObject.getClass().getSimpleName(); + String lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className); + + if (this.isContainer()) { + lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().iterator().next()).getSimpleName()); + } + + return lowerHyphen; + } + + @Override + public Map<PropertyMetadata, String> getPropertyMetadata(String prop) { + Field f; + Map<PropertyMetadata, String> result = new HashMap<>(); + try { + f = internalObject.getClass().getField(prop); + Metadata m = f.getAnnotation(Metadata.class); + if (m != null) { + Field[] fields = m.getClass().getFields(); + String fieldName; + for (Field field : fields) { + fieldName = field.getName(); + if (fieldName.equals("isAbstract")) { + fieldName = "abstract"; + } else if (fieldName.equals("extendsFrom")) { + fieldName = "extends"; + } + fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, fieldName); + result.put(PropertyMetadata.valueOf(fieldName), (String)field.get(m)); + } + } + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + // TODO Auto-generated catch block + } + + return result; + } + + @Override + public String getObjectId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getMetadata(ObjectMetadata metadataName) { + String value = null; + String methodName; + if (ObjectMetadata.ABSTRACT.equals(metadataName)) { + methodName = "isAbstract"; + } else if (ObjectMetadata.EXTENDS.equals(metadataName)) { + methodName = "extendsFrom"; + } else { + methodName = metadataName.toString(); + } + + try { + value = (String)this.classLevelMetadata.getClass().getMethod(methodName).invoke(classLevelMetadata); + } catch (IllegalArgumentException | IllegalAccessException | SecurityException | InvocationTargetException | NoSuchMethodException e) { + //TODO + } + + return value; + } + + @Override + public Version getVersion() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java new file mode 100644 index 00000000..5d23aa60 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicate.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.util.function.BiPredicate; +import java.util.function.Predicate; + +public interface PropertyPredicate<T, U> extends BiPredicate<T, U> { + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java new file mode 100644 index 00000000..eeca0864 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/PropertyPredicates.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.util.Map; +import java.util.Set; + +import org.openecomp.aai.schema.enums.PropertyMetadata; + +public final class PropertyPredicates { + + private PropertyPredicates() { + + } + + public static PropertyPredicate<Introspector, String> includeInTestGeneration() { + return (obj, prop) -> { + final Map<PropertyMetadata, String> map = obj.getPropertyMetadata(prop); + if (map.containsKey(PropertyMetadata.VISIBILITY)) { + return !(Visibility.internal.equals(Visibility.valueOf(map.get(PropertyMetadata.VISIBILITY))) + || Visibility.deployment.equals(Visibility.valueOf(map.get(PropertyMetadata.VISIBILITY)))); + } + if (map.containsKey("dataLocation")) { + return false; + } + return true; + }; + } + + public static PropertyPredicate<Introspector, String> isVisible() { + return (obj, prop) -> { + final Map<PropertyMetadata, String> map = obj.getPropertyMetadata(prop); + if (map.containsKey(PropertyMetadata.VISIBILITY)) { + return !Visibility.internal.equals(Visibility.valueOf(map.get(PropertyMetadata.VISIBILITY))); + } + return true; + }; + } + + public static PropertyPredicate<Introspector, String> includeInExamples() { + return (obj, prop) -> { + final Map<PropertyMetadata, String> map = obj.getPropertyMetadata(prop); + if (map.containsKey(PropertyMetadata.VISIBILITY)) { + return !Visibility.internal.equals(Visibility.valueOf(map.get(PropertyMetadata.VISIBILITY))); + } + if (map.containsKey("dataLocation")) { + return false; + } + return true; + }; + } + + public static PropertyPredicate<Introspector, String> isIndexed() { + return (obj, prop) -> { + Set<String> indexed = obj.getIndexedProperties(); + return indexed.contains(prop); + }; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Version.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Version.java new file mode 100644 index 00000000..fdb7a91e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Version.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +public enum Version { + v8, + v9, + v10; +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Visibility.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Visibility.java new file mode 100644 index 00000000..b9126c5b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Visibility.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +public enum Visibility { + + internal, + external, + deployment, + all +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java b/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java new file mode 100644 index 00000000..217366d4 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/Wanderer.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import java.util.List; + +import org.openecomp.aai.exceptions.AAIException; + +public interface Wanderer { + + /** + * Process primitive. + * + * @param propName the prop name + * @param obj the obj + */ + public void processPrimitive(String propName, Introspector obj); + + /** + * Process primitive list. + * + * @param propName the prop name + * @param obj the obj + */ + public void processPrimitiveList(String propName, Introspector obj); + + /** + * Process complex obj. + * + * @param obj the obj + * @throws AAIException + */ + public void processComplexObj(Introspector obj) throws AAIException; + + /** + * Modify complex list. + * + * @param list the list + * @param listReference TODO + * @param parent the parent + * @param child the child + */ + public void modifyComplexList(List<Introspector> list, List<Object> listReference, Introspector parent, Introspector child); + + /** + * Creates the complex obj if null. + * + * @return true, if successful + */ + public default boolean createComplexObjIfNull() { + return false; + } + + /** + * Creates the complex list size. + * + * @param parent the parent + * @param child the child + * @return the int + */ + public default int createComplexListSize(Introspector parent, Introspector child) { + return 0; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/exceptions/AAIUnknownObjectException.java b/aai-core/src/main/java/org/openecomp/aai/introspection/exceptions/AAIUnknownObjectException.java new file mode 100644 index 00000000..ed0b3207 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/exceptions/AAIUnknownObjectException.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class AAIUnknownObjectException extends AAIException { + + private static final long serialVersionUID = -504200228742133774L; + + public AAIUnknownObjectException() {} + + public AAIUnknownObjectException(String message) { + super("AAI_3000", message); + } + + public AAIUnknownObjectException(Throwable cause) { + super("AAI_3000", cause); + } + + public AAIUnknownObjectException(String message, Throwable cause) { + super("AAI_3000", cause, message); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/exceptions/AAIUnmarshallingException.java b/aai-core/src/main/java/org/openecomp/aai/introspection/exceptions/AAIUnmarshallingException.java new file mode 100644 index 00000000..edc06b3a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/exceptions/AAIUnmarshallingException.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class AAIUnmarshallingException extends AAIException { + + private static final long serialVersionUID = -5615651557821878103L; + + public AAIUnmarshallingException() {} + + public AAIUnmarshallingException(String message) { + super("AAI_3000", message); + } + + public AAIUnmarshallingException(Throwable cause) { + super("AAI_3000",cause); + } + + public AAIUnmarshallingException(String message, Throwable cause) { + super("AAI_3000", cause, message); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java b/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java new file mode 100644 index 00000000..fba4525e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/generator/CreateExample.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.generator; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.IntrospectorWalker; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.PropertyPredicates; +import org.openecomp.aai.introspection.Wanderer; + +public class CreateExample implements Wanderer { + + private Random rand = new Random(); + private final long range = 100000000L; + private Loader loader = null; + private Introspector result = null; + private String objectName = null; + private List<String> blacklist = null; + + /** + * Instantiates a new creates the example. + * + * @param loader the loader + * @param objectName the object name + */ + public CreateExample(Loader loader, String objectName) { + + this.loader = loader; + this.objectName = objectName; + this.blacklist = new ArrayList<>(); + + } + + /** + * Gets the example object. + * + * @return the example object + * @throws AAIException + */ + public Introspector getExampleObject() throws AAIException { + result = loader.introspectorFromName(objectName); + blacklist = new ArrayList<>(); + blacklist.add("any"); + blacklist.add("relationship-list"); + if (!result.isContainer()) { + blacklist.add("resource-version"); + } + IntrospectorWalker walker = new IntrospectorWalker(this, PropertyPredicates.includeInExamples()); + + walker.preventCycles(true); + walker.setBlacklist(blacklist); + walker.walk(result); + //this.getExampleObject(result); + + return result; + } + + /** + * Gets the value. + * + * @param property the property + * @param type the type + * @param suffix the suffix + * @return the value + */ + private Object getValue(String property, String type, String suffix) { + long randLong = (long)(rand.nextDouble()*range); + Integer randInt = rand.nextInt(100000); + Integer randShrt = rand.nextInt(20000); + short randShort = randShrt.shortValue(); + + Object newObj = null; + if (type.contains("java.lang.String")) { + newObj = "example-" + property + "-val-" + randInt + suffix; + } else if ( type.toLowerCase().equals("long") ||type.contains("java.lang.Long")) { + newObj = randLong; + } else if(type.toLowerCase().equals("boolean") || type.contains("java.lang.Boolean")){ + newObj = Boolean.TRUE; + } else if ( type.toLowerCase().equals("int") || type.contains("java.lang.Integer")){ + newObj = randInt; + } else if ( type.toLowerCase().equals("short") || type.contains("java.lang.Short")){ + newObj = randShort; + } + + return newObj; + } + + /** + * {@inheritDoc} + */ + @Override + public void processPrimitive(String propName, Introspector obj) { + String propType = obj.getType(propName); + + Object val = this.getValue(propName, propType, ""); + obj.setValue(propName, val); + } + + /** + * {@inheritDoc} + */ + @Override + public void processPrimitiveList(String propName, Introspector obj) { + int listSize = 2; + String propType = ""; + List<Object> list = new ArrayList<>(); + for (int i = 0; i < listSize; i++) { + propType = obj.getGenericType(propName); + Object val = this.getValue(propName, propType, "-" + (i + 1)); + list.add(val); + } + obj.setValue(propName, list); + } + + /** + * {@inheritDoc} + */ + @Override + public void processComplexObj(Introspector obj) { + + } + + /** + * {@inheritDoc} + */ + @Override + public void modifyComplexList(List<Introspector> list, List<Object> listReference, Introspector parent, Introspector child) { + // TODO Auto-generated method stub + + } + + /** + * {@inheritDoc} + */ + @Override + public boolean createComplexObjIfNull() { + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public int createComplexListSize(Introspector parent, Introspector child) { + return 1; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java new file mode 100644 index 00000000..98ff219c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataCopy.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.List; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMultiplePropertiesException; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.restcore.util.URITools; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + + +public class DataCopy extends SideEffect { + + + public DataCopy(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) { + super(obj, self, dbEngine, serializer); + } + + @Override + protected void processURI(Optional<String> completeUri, Entry<String, String> entry) throws URISyntaxException, UnsupportedEncodingException, AAIException { + if (completeUri.isPresent()) { + URI uri = new URI(completeUri.get()); + MultivaluedMap<String, String> map = URITools.getQueryMap(uri); + QueryParser uriQuery = dbEngine.getQueryBuilder(this.latestLoader).createQueryFromURI(uri, map); + List<Vertex> results = uriQuery.getQueryBuilder().toList(); + Introspector resultObj = this.latestLoader.introspectorFromName(uriQuery.getResultType()); + if (results.size() == 1) { + serializer.dbToObject(Collections.singletonList(results.get(0)), resultObj, 0, true, "false"); + try { + obj.setValue(entry.getKey(), Objects.requireNonNull(resultObj.getValue(uri.getFragment()), uri.getFragment() + " was null")); + } catch (NullPointerException e) { + throw new AAIMissingRequiredPropertyException("property " + uri.getFragment() + " not found at " + uri); + } + } else { + if (results.isEmpty()) { + throw new AAIException("AAI_6114", "object located at " + uri + " not found"); + } else if (results.size() > 1) { + throw new AAIMultiplePropertiesException("multiple values of " + entry.getKey() + " found when searching " + uri); + } + } + } else { + //skip processing because no required properties were specified + } + } + + @Override + protected PropertyMetadata getPropertyMetadata() { + return PropertyMetadata.DATA_COPY; + } + + @Override + protected boolean replaceWithWildcard() { + return false; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java new file mode 100644 index 00000000..81562f0b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkReader.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.restcore.util.URITools; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +import javax.ws.rs.core.MultivaluedMap; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.regex.Matcher; + +public class DataLinkReader extends SideEffect { + + public DataLinkReader(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) { + super(obj, self, dbEngine, serializer); + } + + @Override + protected boolean replaceWithWildcard() { + return true; + } + + @Override + protected PropertyMetadata getPropertyMetadata() { + return PropertyMetadata.DATA_LINK; + } + + @Override + protected void processURI(Optional<String> completeUri, Entry<String, String> entry) + throws URISyntaxException, UnsupportedEncodingException, AAIException { + + if (completeUri.isPresent()) { + URI uri = new URI(completeUri.get()); + MultivaluedMap<String, String> map = URITools.getQueryMap(uri); + QueryParser uriQuery = dbEngine.getQueryBuilder(this.latestLoader).createQueryFromURI(uri, map); + List<Vertex> results = uriQuery.getQueryBuilder().getVerticesByProperty(AAIProperties.LINKED, true).toList(); + if (results.size() == 1) { + if (results.get(0).<Boolean>property(AAIProperties.LINKED).orElse(false) && obj.getValue(entry.getKey()) == null) { + obj.setValue(entry.getKey(), results.get(0).property(entry.getKey()).orElse(null)); + } + } else { + //log something about not being able to return any values because there was more than one + } + } + } + + /** + * always fuzzy search on reads + */ + @Override + protected Map<String, String> findProperties(Introspector obj, String uriString) throws AAIMissingRequiredPropertyException { + + final Map<String, String> result = new HashMap<>(); + Matcher m = template.matcher(uriString); + while (m.find()) { + String propName = m.group(1); + if (replaceWithWildcard()) { + result.put(propName, "*"); + } + } + return result; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java new file mode 100644 index 00000000..09a1ce18 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/DataLinkWriter.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Map.Entry; +import java.util.Optional; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMultiplePropertiesException; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.uri.URIToObject; +import org.openecomp.aai.restcore.util.URITools; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +public class DataLinkWriter extends SideEffect { + + public DataLinkWriter(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) { + super(obj, self, dbEngine, serializer); + } + + @Override + protected PropertyMetadata getPropertyMetadata() { + return PropertyMetadata.DATA_LINK; + } + + @Override + protected void processURI(Optional<String> completeUri, Entry<String, String> entry) + throws URISyntaxException, UnsupportedEncodingException, AAIException { + if (completeUri.isPresent()) { + URI uri = new URI(completeUri.get()); + MultivaluedMap<String, String> map = URITools.getQueryMap(uri); + QueryParser uriQuery = dbEngine.getQueryBuilder(this.latestLoader).createQueryFromURI(uri, map); + List<Vertex> results = uriQuery.getQueryBuilder().toList(); + if (results.size() == 1) { + if (results.get(0).<Boolean>property(AAIProperties.LINKED).orElse(false) && obj.getValue(entry.getKey()) == null) { + //delete vertex because property was removed + serializer.delete(results.get(0), "", false); + } else { + //link vertex that already exists + this.addLinkedProperty(results.get(0)); + } + } else { + if (results.isEmpty()) { + //locate previously linked vertex + List<Vertex> linkedVertices = uriQuery.getQueryBuilder().getContainerQuery().getVerticesByProperty(AAIProperties.LINKED, true).toList(); + if (!linkedVertices.isEmpty()) { + if (linkedVertices.size() > 1) { + throw new AAIMultiplePropertiesException("multiple vertices found for single cardinality propery found when searching " + uri); + } else { + //found one, remove the linked property because it didn't match the uri + linkedVertices.get(0).property(AAIProperties.LINKED).remove(); + } + } + if (obj.getValue(entry.getKey()) != null) { + //add new vertex to database if we have values + URIToObject parser = new URIToObject(this.latestLoader, uri); + Introspector resultObj = parser.getEntity(); + Vertex newV = serializer.createNewVertex(resultObj); + serializer.serializeToDb(resultObj, newV, uriQuery, completeUri.get(), this.latestLoader.getVersion().toString()); + this.addLinkedProperty(newV); + } + } else if (results.size() > 1) { + throw new AAIMultiplePropertiesException("multiple values of " + entry.getKey() + " found when searching " + uri); + } + } + } else { + //skip processing because no required properties were specified + } + } + + @Override + protected boolean replaceWithWildcard() { + return true; + } + + private void addLinkedProperty(Vertex v) { + v.property(AAIProperties.LINKED, true); + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java new file mode 100644 index 00000000..3691651c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffect.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +public abstract class SideEffect { + + protected static final Pattern template = Pattern.compile("\\{(.*?)\\}"); + protected final Introspector obj; + protected final TransactionalGraphEngine dbEngine; + protected final DBSerializer serializer; + protected final Loader latestLoader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST); + protected final Vertex self; + public SideEffect (Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) { + this.obj = obj; + this.dbEngine = dbEngine; + this.serializer = serializer; + this.self = self; + } + + protected void execute() throws UnsupportedEncodingException, URISyntaxException, AAIException { + final Map<String, String> properties = this.findPopertiesWithMetadata(obj, this.getPropertyMetadata()); + for (Entry<String, String> entry : properties.entrySet()) { + Optional<String> populatedUri = this.replaceTemplates(obj, entry.getValue()); + Optional<String> completeUri = this.resolveRelativePath(populatedUri); + this.processURI(completeUri, entry); + } + } + + protected Map<String, String> findPopertiesWithMetadata(Introspector obj, PropertyMetadata metadata) { + final Map<String, String> result = new HashMap<>(); + for (String prop : obj.getProperties()) { + final Map<PropertyMetadata, String> map = obj.getPropertyMetadata(prop); + if (map.containsKey(metadata)) { + result.put(prop, map.get(metadata)); + } + } + return result; + } + + protected Map<String, String> findProperties(Introspector obj, String uriString) throws AAIMissingRequiredPropertyException { + + final Map<String, String> result = new HashMap<>(); + final Set<String> missing = new LinkedHashSet<>(); + Matcher m = template.matcher(uriString); + int properties = 0; + while (m.find()) { + String propName = m.group(1); + String value = obj.getValue(propName); + properties++; + if (value != null) { + result.put(propName, value); + } else { + if (replaceWithWildcard()) { + result.put(propName, "*"); + } + missing.add(propName); + } + } + + if (!missing.isEmpty() && (properties != missing.size())) { + throw new AAIMissingRequiredPropertyException("Cannot complete " + this.getPropertyMetadata().toString() + " uri. Missing properties " + missing); + } + return result; + } + + private Optional<String> replaceTemplates(Introspector obj, String uriString) throws AAIMissingRequiredPropertyException { + String result = uriString; + final Map<String, String> propMap = this.findProperties(obj, uriString); + if (propMap.isEmpty()) { + return Optional.empty(); + } + for (Entry<String, String> entry : propMap.entrySet()) { + result = result.replaceAll("\\{" + entry.getKey() + "\\}", entry.getValue()); + } + //drop out wildcards if they exist + result = result.replaceFirst("/[^/]+?(?:/\\*)+", ""); + return Optional.of(result); + } + + private Optional<String> resolveRelativePath(Optional<String> populatedUri) throws UnsupportedEncodingException { + if (!populatedUri.isPresent()) { + return Optional.empty(); + } else { + return Optional.of(populatedUri.get().replaceFirst("\\./", this.serializer.getURIForVertex(self) + "/")); + } + } + + protected abstract boolean replaceWithWildcard(); + protected abstract PropertyMetadata getPropertyMetadata(); + protected abstract void processURI(Optional<String> completeUri, Entry<String, String> entry) throws URISyntaxException, UnsupportedEncodingException, AAIException; +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java new file mode 100644 index 00000000..17127da7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunner.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.URISyntaxException; +import java.util.LinkedHashSet; +import java.util.Set; + +public class SideEffectRunner { + + protected final TransactionalGraphEngine dbEngine; + protected final DBSerializer serializer; + protected final Set<Class<? extends SideEffect>> sideEffects; + protected SideEffectRunner(Builder builder) { + this.dbEngine = builder.getDbEngine(); + this.serializer = builder.getSerializer(); + this.sideEffects = builder.getSideEffects(); + } + + public void execute(Introspector obj, Vertex self) throws AAIException { + + for (Class<? extends SideEffect> se : sideEffects) { + try { + se.getConstructor(Introspector.class, Vertex.class, TransactionalGraphEngine.class, DBSerializer.class) + .newInstance(obj, self, dbEngine, serializer).execute(); + } catch (UnsupportedEncodingException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException + | URISyntaxException e) { + throw new AAIException("strange exception", e); + } + } + } + + public static class Builder { + + private final TransactionalGraphEngine dbEngine; + private final DBSerializer serializer; + private final Set<Class<? extends SideEffect>> sideEffects; + + public Builder(final TransactionalGraphEngine dbEngine, final DBSerializer serializer) { + this.dbEngine = dbEngine; + this.serializer = serializer; + this.sideEffects = new LinkedHashSet<>(); + } + + public Builder addSideEffect(Class<? extends SideEffect> se) { + sideEffects.add(se); + return this; + } + + public Builder addSideEffects(Class<? extends SideEffect>... sideEffects) { + for (Class<? extends SideEffect> se : sideEffects) { + this.addSideEffect(se); + } + return this; + } + + public SideEffectRunner build() { + return new SideEffectRunner(this); + } + protected TransactionalGraphEngine getDbEngine() { + return dbEngine; + } + + protected DBSerializer getSerializer() { + return serializer; + } + + protected Set<Class<? extends SideEffect>> getSideEffects() { + return sideEffects; + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java new file mode 100644 index 00000000..9d214623 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/SideEffectRunnerHelper.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Wanderer; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Set; + +class SideEffectRunnerHelper implements Wanderer { + + + protected final TransactionalGraphEngine dbEngine; + protected final DBSerializer serializer; + protected final Set<Class<? extends SideEffect>> sideEffects; + protected SideEffectRunnerHelper(final TransactionalGraphEngine dbEngine, final DBSerializer serializer, final Set<Class<? extends SideEffect>> sideEffects) { + this.dbEngine = dbEngine; + this.serializer = serializer; + this.sideEffects = sideEffects; + } + + private void runSideEffects(Introspector obj) throws AAIException { + for (Class<? extends SideEffect> se : sideEffects) { + try { + se.getConstructor(Introspector.class, TransactionalGraphEngine.class, DBSerializer.class) + .newInstance(obj, dbEngine, serializer).execute(); + } catch (UnsupportedEncodingException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException + | URISyntaxException e) { + throw new AAIException("strange exception", e); + } + } + } + @Override + public void processPrimitive(String propName, Introspector obj) { + // TODO Auto-generated method stub + + } + + @Override + public void processPrimitiveList(String propName, Introspector obj) { + // TODO Auto-generated method stub + + } + + @Override + public void processComplexObj(Introspector obj) throws AAIException { + + runSideEffects(obj); + + } + + @Override + public void modifyComplexList(List<Introspector> list, List<Object> listReference, Introspector parent, + Introspector child) { + // TODO Auto-generated method stub + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/exceptions/AAIMissingRequiredPropertyException.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/exceptions/AAIMissingRequiredPropertyException.java new file mode 100644 index 00000000..9131f249 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/exceptions/AAIMissingRequiredPropertyException.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class AAIMissingRequiredPropertyException extends AAIException { + + + private static final long serialVersionUID = -8907079650472014019L; + + public AAIMissingRequiredPropertyException() {} + + public AAIMissingRequiredPropertyException(String message) { + super("AAI_5107", message); + } + + public AAIMissingRequiredPropertyException(Throwable cause) { + super("AAI_5107",cause); + } + + public AAIMissingRequiredPropertyException(String message, Throwable cause) { + super("AAI_5107", cause, message); + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/exceptions/AAIMultiplePropertiesException.java b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/exceptions/AAIMultiplePropertiesException.java new file mode 100644 index 00000000..0525b1b7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/sideeffect/exceptions/AAIMultiplePropertiesException.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class AAIMultiplePropertiesException extends AAIException { + + private static final long serialVersionUID = 2098371383166008345L; + + public AAIMultiplePropertiesException() {} + + public AAIMultiplePropertiesException(String message) { + super("AAI_6136", message); + } + + public AAIMultiplePropertiesException(Throwable cause) { + super("AAI_6136",cause); + } + + public AAIMultiplePropertiesException(String message, Throwable cause) { + super("AAI_6136", cause, message); + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java new file mode 100644 index 00000000..8932da2c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/CreateUUID.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +import java.util.Map; +import java.util.UUID; + +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.schema.enums.PropertyMetadata; + +public class CreateUUID implements IssueResolver { + + /** + * {@inheritDoc} + */ + @Override + public boolean resolveIssue(Issue issue) { + + Introspector obj = issue.getIntrospector(); + if (issue.getType().equals(IssueType.MISSING_KEY_PROP)) { + Map<PropertyMetadata, String> metadata = obj.getPropertyMetadata(issue.getPropName()); + if (metadata.containsKey(PropertyMetadata.AUTO_GENERATE_UUID) && metadata.get(PropertyMetadata.AUTO_GENERATE_UUID).equals("true")) { + obj.setValue(issue.getPropName(), UUID.randomUUID().toString()); + return true; + } + } + + return false; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java new file mode 100644 index 00000000..8a1143f0 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/DefaultFields.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +import java.util.Map; + +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.schema.enums.PropertyMetadata; + +public class DefaultFields implements IssueResolver { + + /** + * {@inheritDoc} + */ + @Override + public boolean resolveIssue(Issue issue) { + + Introspector obj = issue.getIntrospector(); + if (issue.getType().equals(IssueType.MISSING_REQUIRED_PROP)) { + Map<PropertyMetadata, String> metadata = obj.getPropertyMetadata(issue.getPropName()); + if (metadata.containsKey(PropertyMetadata.DEFAULT_VALUE)) { + obj.setValue(issue.getPropName(), metadata.get(PropertyMetadata.DEFAULT_VALUE)); + return true; + } + } + + return false; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java new file mode 100644 index 00000000..23855363 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/InjectKeysFromURI.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +import java.net.URI; + +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.uri.URIToObject; + +public class InjectKeysFromURI implements IssueResolver { + + private URI uri = null; + private Loader loader = null; + + /** + * Instantiates a new inject keys from URI. + * + * @param loader the loader + * @param uri the uri + */ + public InjectKeysFromURI(Loader loader, URI uri) { + this.loader = loader; + this.uri = uri; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean resolveIssue(Issue issue) { + boolean result = false; + Introspector obj = issue.getIntrospector(); + if (issue.getType().equals(IssueType.MISSING_KEY_PROP)) { + try { + URIToObject toObject = new URIToObject(loader, uri); + Introspector minimumObj = toObject.getEntity(); + if (toObject.getEntityName().equals(obj.getDbName())) { + obj.setValue(issue.getPropName(), minimumObj.getValue(issue.getPropName())); + result = true; + } + } catch (Exception e) { + //log something probably + result = false; + } + } + + return result; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java new file mode 100644 index 00000000..0e5b4bcd --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IntrospectorValidator.java @@ -0,0 +1,314 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.IntrospectorWalker; +import org.openecomp.aai.introspection.Visibility; +import org.openecomp.aai.introspection.Wanderer; +import org.openecomp.aai.schema.enums.PropertyMetadata; + +public class IntrospectorValidator implements Wanderer { + + + private List<Issue> issues = null; + private List<IssueResolver> issueResolvers = null; + private boolean validateRequired = true; + private final int maximumDepth; + private int currentDepth = 0; + + private final Set<String> relationshipChain; + /** + * Instantiates a new introspector validator. + * + * @param builder the builder + */ + private IntrospectorValidator(IntrospectorValidator.Builder builder) { + this.validateRequired = builder.getValidateRequired(); + this.issueResolvers = builder.getResolvers(); + this.maximumDepth = builder.getMaximumDepth(); + issues = new ArrayList<>(); + + relationshipChain = new HashSet<>(); + + relationshipChain.add("relationship-list"); + relationshipChain.add("relationship"); + relationshipChain.add("relationship-data"); + relationshipChain.add("related-to-property"); + + + } + + /** + * Validate. + * + * @param obj the obj + * @return true, if successful + * @throws AAIException + */ + public boolean validate(Introspector obj) throws AAIException { + IntrospectorWalker walker = new IntrospectorWalker(this); + this.currentDepth = 0; + walker.walk(obj); + + for (Issue m : issues) { + if (!m.getSeverity().equals(Severity.WARNING)) { + return false; + } + } + + return true; + } + + /** + * Gets the issues. + * + * @return the issues + */ + public List<Issue> getIssues() { + return this.issues; + } + + /** + * Sets the issue resolvers. + * + * @param resolvers the new issue resolvers + */ + public void setIssueResolvers(List<IssueResolver> resolvers) { + issueResolvers = new ArrayList<>(); + for (IssueResolver resolver : resolvers) { + issueResolvers.add(resolver); + } + } + + /** + * Resolve issues. + * + * @return true, if successful + */ + public boolean resolveIssues() { + boolean result = true; + for (Issue issue : issues) { + for (IssueResolver resolver : issueResolvers) { + if (resolver.resolveIssue(issue)) { + issue.setResolved(true); + } + } + if (!issue.isResolved()) { + result = false; + } + } + + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public void processComplexObj(Introspector obj) { + + if (this.currentDepth > this.maximumDepth && !relationshipChain.contains(obj.getDbName())) { + Issue message = + this.buildMessage(Severity.CRITICAL, IssueType.EXCEEDED_ALLOWED_DEPTH, "Maximum allowed depth of this object has been exceeded on: " + obj.getDbName()); + message.setIntrospector(obj); + issues.add(message); + } + Set<String> requiredProps = obj.getRequiredProperties(); + Set<String> keys = obj.getKeys(); + Set<String> props = obj.getProperties(); + + for (String prop : props) { + Object value = obj.getValue(prop); + if (keys.contains(prop)) { + if (value == null) { + Issue message = + this.buildMessage(Severity.CRITICAL, IssueType.MISSING_KEY_PROP, "Missing key property: " + prop); + message.setIntrospector(obj); + message.setPropName(prop); + issues.add(message); + } + } else if (requiredProps.contains(prop)) { + if (value == null && validateRequired) { + Issue message = + this.buildMessage(Severity.CRITICAL, IssueType.MISSING_REQUIRED_PROP, "Missing required property: " + prop); + message.setIntrospector(obj); + message.setPropName(prop); + issues.add(message); + } + } + + final Optional<String> visibility = obj.getPropertyMetadata(prop, PropertyMetadata.VISIBILITY); + if(visibility.isPresent() && Visibility.internal.equals(Visibility.valueOf(visibility.get()))) { + Issue message = + this.buildMessage(Severity.ERROR, IssueType.PROPERTY_NOT_VISIBLE, "client attemptted to set property not visible: " + prop); + message.setIntrospector(obj); + message.setPropName(prop); + issues.add(message); + + } + } + + if (!relationshipChain.contains(obj.getDbName())) { + this.currentDepth++; + } + + } + + /** + * {@inheritDoc} + */ + @Override + public void processPrimitive(String propName, Introspector obj) { + //NO OP + } + + /** + * {@inheritDoc} + */ + @Override + public void processPrimitiveList(String propName, Introspector obj) { + //NO OP + } + + /** + * {@inheritDoc} + */ + @Override + public void modifyComplexList(List<Introspector> list, List<Object> listReference, Introspector parent, Introspector child) { + //NO OP + } + + + /** + * Builds the message. + * + * @param severity the severity + * @param error the error + * @param detail the detail + * @return the issue + */ + private Issue buildMessage(Severity severity, IssueType error, String detail) { + Issue message = new Issue(); + message.setSeverity(severity); + message.setType(error); + message.setDetail(detail); + + return message; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean createComplexObjIfNull() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public int createComplexListSize(Introspector parent, Introspector child) { + return 0; + } + + public static class Builder { + + private boolean validateRequired = true; + private List<IssueResolver> issueResolvers = null; + private int maximumDepth = AAIProperties.MAXIMUM_DEPTH; + /** + * Instantiates a new builder. + * + * @param llBuilder the ll builder + */ + public Builder() { + issueResolvers = new ArrayList<IssueResolver>(); + } + + /** + * Validate required. + * + * @param validateRequired the validate required + * @return the builder + */ + public Builder validateRequired(boolean validateRequired) { + this.validateRequired = validateRequired; + return this; + } + + public Builder restrictDepth(int depth) { + this.maximumDepth = depth; + return this; + } + /** + * Adds the resolver. + * + * @param resolver the resolver + * @return the builder + */ + public Builder addResolver(IssueResolver resolver) { + issueResolvers.add(resolver); + return this; + } + + /** + * Builds the. + * + * @return the introspector validator + */ + public IntrospectorValidator build() { + return new IntrospectorValidator(this); + } + + /** + * Gets the validate required. + * + * @return the validate required + */ + public boolean getValidateRequired() { + return this.validateRequired; + } + + /** + * Gets the resolvers. + * + * @return the resolvers + */ + public List<IssueResolver> getResolvers() { + return this.issueResolvers; + } + + public int getMaximumDepth() { + return this.maximumDepth; + } + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/Issue.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/Issue.java new file mode 100644 index 00000000..b95643c1 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/Issue.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +import org.openecomp.aai.introspection.Introspector; + +public class Issue { + + private Severity severity; + private IssueType error; + private String detail; + private Introspector obj; + private String propName; + private boolean resolved = false; + + /** + * Sets the severity. + * + * @param severity the new severity + */ + public void setSeverity(Severity severity) { + + this.severity = severity; + } + + /** + * Sets the error. + * + * @param error the new error + */ + public void setType(IssueType error) { + this.error = error; + } + + /** + * Sets the detail. + * + * @param detail the new detail + */ + public void setDetail(String detail) { + this.detail = detail; + } + + /** + * Gets the severity. + * + * @return the severity + */ + public Object getSeverity() { + return this.severity; + } + + /** + * Sets the introspector. + * + * @param obj the new introspector + */ + public void setIntrospector(Introspector obj) { + this.obj = obj; + } + + /** + * Gets the introspector. + * + * @return the introspector + */ + public Introspector getIntrospector() { + return this.obj; + } + + /** + * Gets the detail. + * + * @return the detail + */ + public String getDetail() { + return this.detail; + } + + /** + * Gets the error. + * + * @return the error + */ + public IssueType getType() { + return this.error; + } + + /** + * Sets the prop name. + * + * @param prop the new prop name + */ + public void setPropName(String prop) { + this.propName= prop; + } + + /** + * Gets the prop name. + * + * @return the prop name + */ + public String getPropName() { + return this.propName; + } + + /** + * Checks if is resolved. + * + * @return true, if is resolved + */ + public boolean isResolved() { + return resolved; + } + + /** + * Sets the resolved. + * + * @param resolved the new resolved + */ + public void setResolved(boolean resolved) { + this.resolved = resolved; + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IssueResolver.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IssueResolver.java new file mode 100644 index 00000000..409a1c02 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IssueResolver.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +public interface IssueResolver { + + + /** + * Resolve issue. + * + * @param issue the issue + * @return true, if successful + */ + public boolean resolveIssue(Issue issue); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IssueType.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IssueType.java new file mode 100644 index 00000000..fad06d9a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/IssueType.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +public enum IssueType { + MISSING_REQUIRED_PROP, MISSING_KEY_PROP, EXCEEDED_ALLOWED_DEPTH, PROPERTY_NOT_VISIBLE +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/RemoveNonVisibleProperty.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/RemoveNonVisibleProperty.java new file mode 100644 index 00000000..2bf6afcc --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/RemoveNonVisibleProperty.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +public class RemoveNonVisibleProperty implements IssueResolver { + + @Override + public boolean resolveIssue(Issue issue) { + + if (IssueType.PROPERTY_NOT_VISIBLE.equals(issue.getType())) { + //remove property value + issue.getIntrospector().setValue(issue.getPropName(), null); + return true; + } + return false; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/introspection/tools/Severity.java b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/Severity.java new file mode 100644 index 00000000..17663f16 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/introspection/tools/Severity.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.tools; + +public enum Severity { + WARNING, + ERROR, + CRITICAL +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/CNName.java b/aai-core/src/main/java/org/openecomp/aai/logging/CNName.java new file mode 100644 index 00000000..28afd56a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/CNName.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.access.pattern.AccessConverter; +import ch.qos.logback.access.spi.IAccessEvent; + +import javax.security.auth.x500.X500Principal; +import javax.servlet.http.HttpServletRequest; +import java.security.cert.X509Certificate; + +import static java.util.Base64.getDecoder; + +public class CNName extends AccessConverter { + + /** + * Converts access events to String response codes + * + * @param accessEvent the IAccessEvent + */ + public String convert(IAccessEvent accessEvent) { + if (!isStarted()) { + return "INACTIVE_HEADER_CONV"; + } + + String cipherSuite = (String) accessEvent.getRequest().getAttribute("javax.servlet.request.cipher_suite"); + String authUser = null; + if (cipherSuite != null) { + try { + X509Certificate certChain[] = (X509Certificate[]) accessEvent.getRequest() + .getAttribute("javax.servlet.request.X509Certificate"); + if(certChain == null || certChain.length == 0){ + + HttpServletRequest request = accessEvent.getRequest(); + + String authorization = request.getHeader("Authorization"); + + // Set the auth user to "-" so if the authorization header is not found + // Or if the decoded basic auth credentials are not found in the format required + // it should return "-" + // If the decoded string is in the right format, find the index of ":" + // Then get the substring of the starting point to the colon not including the colon + + authUser = "-"; + + if(authorization != null && authorization.startsWith("Basic ")){ + String credentials = authorization.replace("Basic ", ""); + byte[] userCredentials = getDecoder().decode(credentials.getBytes("utf-8")); + credentials = new String(userCredentials); + + int codePoint = credentials.indexOf(':'); + + if(codePoint != -1){ + authUser = credentials.substring(0, codePoint); + } + + } + + return authUser; + + } else { + X509Certificate clientCert = certChain[0]; + X500Principal subjectDN = clientCert.getSubjectX500Principal(); + authUser = subjectDN.toString(); + return authUser; + } + } catch(Exception ex){ + return "-"; + } + } else { + return "-"; + } + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/CustomLogPatternLayout.java b/aai-core/src/main/java/org/openecomp/aai/logging/CustomLogPatternLayout.java new file mode 100644 index 00000000..0b2df03b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/CustomLogPatternLayout.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +public class CustomLogPatternLayout extends ch.qos.logback.access.PatternLayout { + static { + defaultConverterMap.put("z", CNName.class.getName()); + defaultConverterMap.put("y", DME2RestFlag.class.getName()); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/CustomLogPatternLayoutEncoder.java b/aai-core/src/main/java/org/openecomp/aai/logging/CustomLogPatternLayoutEncoder.java new file mode 100644 index 00000000..b335109b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/CustomLogPatternLayoutEncoder.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.access.PatternLayout; + +public class CustomLogPatternLayoutEncoder extends ch.qos.logback.access.PatternLayoutEncoder { + +/** + * @{inheritDoc} + */ + @Override + public void start(){ + PatternLayout patternLayout = new CustomLogPatternLayout(); + patternLayout.setContext(context); + patternLayout.setPattern(getPattern()); + patternLayout.start(); + this.layout = patternLayout; + super.start(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/DME2RestFlag.java b/aai-core/src/main/java/org/openecomp/aai/logging/DME2RestFlag.java new file mode 100644 index 00000000..b5426452 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/DME2RestFlag.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.access.pattern.AccessConverter; +import ch.qos.logback.access.spi.IAccessEvent; + +public class DME2RestFlag extends AccessConverter { + + /** + * @{inheritDoc} + */ + @Override + public String convert(IAccessEvent accessEvent) { + if (!isStarted()) { + return "INACTIVE_HEADER_CONV"; + } + + String flag = "-"; + + if (accessEvent.getRequestParameter("envContext").length > 0 + && !accessEvent.getRequestParameter("envContext")[0].isEmpty() + && !accessEvent.getRequestParameter("envContext")[0].equals("-") + && accessEvent.getRequestParameter("routeOffer").length > 0 + && !accessEvent.getRequestParameter("routeOffer")[0].isEmpty() + && !accessEvent.getRequestParameter("routeOffer")[0].equals("-") + && accessEvent.getRequestParameter("version").length > 0 + && !accessEvent.getRequestParameter("version")[0].isEmpty() + && !accessEvent.getRequestParameter("version")[0].equals("-")) { + flag = "DME2"; + } else { + flag = "REST"; + } + + return flag; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/EcompElapsedTime.java b/aai-core/src/main/java/org/openecomp/aai/logging/EcompElapsedTime.java new file mode 100644 index 00000000..1593e856 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/EcompElapsedTime.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.classic.pattern.ClassicConverter; +import ch.qos.logback.classic.spi.ILoggingEvent; +import org.openecomp.aai.logging.LoggingContext.LoggingField; + +public class EcompElapsedTime extends ClassicConverter { + + private static final String DEFAULT_ELAPSED_TIME_FORMAT = "%d"; + + private String ELAPSED_TIME_FORMAT; + + @Override + public void start() { + ELAPSED_TIME_FORMAT = getFirstOption(); + } + + @Override + public String convert(ILoggingEvent event) { + final long end = event.getTimeStamp(); + + if (!event.getMDCPropertyMap().containsKey(LoggingField.START_TIME.toString())) { + return format(0); + } else if (event.getMDCPropertyMap().containsKey(LoggingField.ELAPSED_TIME.toString())) { + return format( + Integer.parseInt(event.getMDCPropertyMap().get(LoggingField.ELAPSED_TIME.toString())) + ); + } + + final long start = LogFormatTools.toTimestamp(event.getMDCPropertyMap().get(LoggingField.START_TIME.toString())); + + return format(end - start); + } + + private String format(long elapsedTime) { + if (ELAPSED_TIME_FORMAT == null) { + return format(DEFAULT_ELAPSED_TIME_FORMAT, elapsedTime); + } + + return format (ELAPSED_TIME_FORMAT, elapsedTime); + } + + private String format(String format, long elapsedTime) { + return String.format(format, elapsedTime); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/EcompEncoder.java b/aai-core/src/main/java/org/openecomp/aai/logging/EcompEncoder.java new file mode 100644 index 00000000..daaa90de --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/EcompEncoder.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.classic.PatternLayout; +import ch.qos.logback.classic.encoder.PatternLayoutEncoder; + +public class EcompEncoder extends PatternLayoutEncoder { + + @Override + public void start() { + PatternLayout patternLayout = new EcompPatternLayout(); + patternLayout.setContext(context); + patternLayout.setPattern(getPattern()); + patternLayout.setOutputPatternAsHeader(outputPatternAsHeader); + patternLayout.start(); + this.layout = patternLayout; + super.start(); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/EcompPatternLayout.java b/aai-core/src/main/java/org/openecomp/aai/logging/EcompPatternLayout.java new file mode 100644 index 00000000..296e3b81 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/EcompPatternLayout.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.classic.PatternLayout; + +public class EcompPatternLayout extends PatternLayout { + static { + PatternLayout.defaultConverterMap.put("ecompStartTime", EcompStartTime.class.getName()); + PatternLayout.defaultConverterMap.put("ecompElapsedTime", EcompElapsedTime.class.getName()); + PatternLayout.defaultConverterMap.put("eelfClassOfCaller", EelfClassOfCaller.class.getName()); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/EcompStartTime.java b/aai-core/src/main/java/org/openecomp/aai/logging/EcompStartTime.java new file mode 100644 index 00000000..89cd81d2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/EcompStartTime.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.classic.pattern.ClassicConverter; +import ch.qos.logback.classic.spi.ILoggingEvent; +import org.openecomp.aai.logging.LoggingContext.LoggingField; + +public class EcompStartTime extends ClassicConverter { + + @Override + public String convert(ILoggingEvent event) { + + if (!event.getMDCPropertyMap().containsKey(LoggingField.START_TIME.toString())) { + return LogFormatTools.toDate(event.getTimeStamp()); + } + + return event.getMDCPropertyMap().get(LoggingField.START_TIME.toString()); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/EelfClassOfCaller.java b/aai-core/src/main/java/org/openecomp/aai/logging/EelfClassOfCaller.java new file mode 100644 index 00000000..a90fcc8d --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/EelfClassOfCaller.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import ch.qos.logback.classic.pattern.NamedConverter; +import ch.qos.logback.classic.spi.CallerData; +import ch.qos.logback.classic.spi.ILoggingEvent; + +public class EelfClassOfCaller extends NamedConverter { + protected String getFullyQualifiedName(ILoggingEvent event) { + + StackTraceElement[] cda = event.getCallerData(); + + //If using the EELFLogger, it "hides" the calling class because it wraps the logging calls + //Without this, you'd only ever see "com.att.eelf.configuration.SLF4jWrapper" when using the + // %C pattern converter + if (cda != null && cda.length > 2) { + return cda[2].getClassName(); + } else if (cda != null && cda.length > 0) { + return cda[0].getClassName(); + } else { + return CallerData.NA; + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/ErrorLogHelper.java b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorLogHelper.java new file mode 100644 index 00000000..dae30220 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorLogHelper.java @@ -0,0 +1,587 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.apache.commons.lang.StringUtils; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.logging.LoggingContext.StatusCode; +import org.openecomp.aai.util.AAIConstants; +import org.openecomp.aai.util.MapperUtil; +import org.slf4j.MDC; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.util.*; +import java.util.Map.Entry; + +/** + * + * This classes loads the application error properties file + * and provides a method that returns an ErrorObject + * + */ + +public class ErrorLogHelper { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ErrorLogHelper.class); + private static final HashMap<String, ErrorObject> ERROR_OBJECTS = new HashMap<String, ErrorObject> (); + + static { + try { + loadProperties(); + } catch (IOException e) { + throw new RuntimeException("Failed to load error.properties file", e); + } catch (ErrorObjectFormatException e) { + throw new RuntimeException("Failed to parse error.properties file", e); + } + } + + /** + * Load properties. + * @throws ErrorObjectFormatException + * @throws Exception the exception + */ + public static void loadProperties() throws IOException, ErrorObjectFormatException { + final String filePath = AAIConstants.AAI_HOME_ETC_APP_PROPERTIES + "error.properties"; + final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath); + final Properties properties = new Properties(); + + if (is != null) { + properties.load(is); + } else { + try (final FileInputStream fis = new FileInputStream(filePath)) { + properties.load(fis); + } + } + + for (Entry<Object, Object> entry : properties.entrySet()) { + final String key = (String) entry.getKey(); + final String value = (String) entry.getValue(); + final String[] errorProperties = value.split(":"); + + if (errorProperties.length != 7) throw new ErrorObjectFormatException(); + + final ErrorObject errorObject = new ErrorObject(); + + errorObject.setDisposition(errorProperties[0].trim()); + errorObject.setCategory(errorProperties[1].trim()); + errorObject.setSeverity(errorProperties[2].trim()); + errorObject.setErrorCode(errorProperties[3].trim()); + errorObject.setHTTPResponseCode(errorProperties[4].trim()); + errorObject.setRESTErrorCode(errorProperties[5].trim()); + errorObject.setErrorText(errorProperties[6].trim()); + + ERROR_OBJECTS.put(key, errorObject); + } + } + + /** + * Logs a known A&AI exception (i.e. one that can be found in error.properties) + * + * @param key The key for the error in the error.properties file + * @throws IOException + * @throws ErrorObjectNotFoundException + * @throws ErrorObjectFormatException + */ + public static ErrorObject getErrorObject(String code) throws ErrorObjectNotFoundException { + + if (code == null) throw new IllegalArgumentException("Key cannot be null"); + + final ErrorObject errorObject = ERROR_OBJECTS.get(code); + + if (errorObject == null) { + LOGGER.warn("Unknown AAIException with code=" + code + ". Using default AAIException"); + return ERROR_OBJECTS.get(AAIException.DEFAULT_EXCEPTION_CODE); + } + + return errorObject; + } + + /** + * Determines whether category is policy or not. If policy (1), this is a POL error, else it's a SVC error. + * The AAIRESTException may contain a different ErrorObject than that created with the REST error key. + * This allows lower level exception detail to be returned to the client to help troubleshoot the problem. + * If no error object is embedded in the AAIException, one will be created using the error object from the AAIException. + * @param are must have a restError value whose numeric value must match what should be returned in the REST API + * @param variables optional list of variables to flesh out text in error string + * @return appropriately formatted JSON response per the REST API spec. + * @throws ErrorObjectFormatException + * @throws ErrorObjectNotFoundException + * @throws IOException + * @deprecated + */ + public static String getRESTAPIErrorResponse(AAIException are, ArrayList<String> variables) { + List<MediaType> acceptHeaders = new ArrayList<MediaType>(); + acceptHeaders.add(MediaType.APPLICATION_JSON_TYPE); + + return getRESTAPIErrorResponse(acceptHeaders, are, variables); + } + + /** + * Determines whether category is policy or not. If policy (1), this is a POL error, else it's a SVC error. + * The AAIRESTException may contain a different ErrorObject than that created with the REST error key. + * This allows lower level exception detail to be returned to the client to help troubleshoot the problem. + * If no error object is embedded in the AAIException, one will be created using the error object from the AAIException. + * + * @param acceptHeadersOrig the accept headers orig + * @param are must have a restError value whose numeric value must match what should be returned in the REST API + * @param variables optional list of variables to flesh out text in error string + * @return appropriately formatted JSON response per the REST API spec. + * @throws ErrorObjectFormatException + * @throws ErrorObjectNotFoundException + * @throws IOException + */ + public static String getRESTAPIErrorResponse(List<MediaType> acceptHeadersOrig, AAIException are, ArrayList<String> variables) { + + + StringBuilder text = new StringBuilder(); + String response = null; + + List<MediaType> acceptHeaders = new ArrayList<MediaType>(); + // we might have an exception but no accept header, so we'll set default to JSON + boolean foundValidAcceptHeader = false; + for (MediaType mt : acceptHeadersOrig) { + if (MediaType.APPLICATION_XML_TYPE.isCompatible(mt) || + MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) { + acceptHeaders.add(mt); + foundValidAcceptHeader = true; + } + } + if (foundValidAcceptHeader == false) { + // override the exception, client needs to set an appropriate Accept header + are = new AAIException("AAI_4014"); + acceptHeaders.add(MediaType.APPLICATION_JSON_TYPE); + } + + final ErrorObject eo = are.getErrorObject(); + + int restErrorCode = Integer.parseInt(eo.getRESTErrorCode()); + + ErrorObject restErrorObject; + + try { + restErrorObject = ErrorLogHelper.getErrorObject("AAI_"+restErrorCode); + } catch (ErrorObjectNotFoundException e) { + LOGGER.warn("Failed to find related error object AAI_" + restErrorCode + " for error object " + eo.getErrorCode() + "; using AAI_" + restErrorCode); + restErrorObject = eo; + } + + text.append(restErrorObject.getErrorText()); + + // We want to always append the (msg=%n) (ec=%n+1) to the text, but have to find value of n + // This assumes that the variables in the ArrayList, which might be more than are needed to flesh out the + // error, are ordered based on the error string. + int localDataIndex = StringUtils.countMatches(restErrorObject.getErrorText(), "%"); + text.append(" (msg=%").append(localDataIndex+1).append(") (ec=%").append(localDataIndex+2).append(")"); + + if (variables == null) + { + variables = new ArrayList<String>(); + } + + if (variables.size() < localDataIndex) { + ErrorLogHelper.logError("AAI_4011", "data missing for rest error"); + while (variables.size() < localDataIndex) { + variables.add("null"); + } + } + + // This will put the error code and error text into the right positions + if (are.getMessage() == null || are.getMessage().length() == 0) { + variables.add(localDataIndex++, eo.getErrorText()); + } + else { + variables.add(localDataIndex++, eo.getErrorText() + ":" + are.getMessage()); + } + variables.add(localDataIndex, eo.getErrorCodeString()); + + for (MediaType mediaType : acceptHeaders) { + if (MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType)) { + JAXBContext context = null; + try { + if(eo.getCategory().equals("1")) { + + context = JAXBContext.newInstance(org.openecomp.aai.domain.restPolicyException.Fault.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + + org.openecomp.aai.domain.restPolicyException.ObjectFactory factory = new org.openecomp.aai.domain.restPolicyException.ObjectFactory(); + org.openecomp.aai.domain.restPolicyException.Fault fault = factory.createFault(); + org.openecomp.aai.domain.restPolicyException.Fault.RequestError requestError = factory.createFaultRequestError(); + org.openecomp.aai.domain.restPolicyException.Fault.RequestError.PolicyException policyException = factory.createFaultRequestErrorPolicyException(); + org.openecomp.aai.domain.restPolicyException.Fault.RequestError.PolicyException.Variables polvariables = factory.createFaultRequestErrorPolicyExceptionVariables(); + + policyException.setMessageId("POL" + eo.getRESTErrorCode()); + policyException.setText(text.toString()); + for (int i=0;i<variables.size();i++) + { + polvariables.getVariable().add(variables.get(i)); + } + policyException.setVariables(polvariables); + requestError.setPolicyException(policyException); + fault.setRequestError(requestError); + + StringWriter sw = new StringWriter(); + m.marshal(fault, sw); + + response = sw.toString(); + + } else { + + context = JAXBContext.newInstance(org.openecomp.aai.domain.restServiceException.Fault.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + + org.openecomp.aai.domain.restServiceException.ObjectFactory factory = new org.openecomp.aai.domain.restServiceException.ObjectFactory(); + org.openecomp.aai.domain.restServiceException.Fault fault = factory.createFault(); + org.openecomp.aai.domain.restServiceException.Fault.RequestError requestError = factory.createFaultRequestError(); + org.openecomp.aai.domain.restServiceException.Fault.RequestError.ServiceException serviceException = factory.createFaultRequestErrorServiceException(); + org.openecomp.aai.domain.restServiceException.Fault.RequestError.ServiceException.Variables svcvariables = factory.createFaultRequestErrorServiceExceptionVariables(); + serviceException.setMessageId("SVC" + eo.getRESTErrorCode()); + serviceException.setText(text.toString()); + for (int i=0;i<variables.size();i++) + { + svcvariables.getVariable().add(variables.get(i)); + } + serviceException.setVariables(svcvariables); + requestError.setServiceException(serviceException); + fault.setRequestError(requestError); + + StringWriter sw = new StringWriter(); + m.marshal(fault, sw); + + response = sw.toString(); + + } + } catch (Exception ex) { + LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error", ex); + } + } + else { + try { + if(eo.getCategory().equals("1")) { + org.openecomp.aai.domain.restPolicyException.RESTResponse restresp = new org.openecomp.aai.domain.restPolicyException.RESTResponse(); + org.openecomp.aai.domain.restPolicyException.RequestError reqerr = new org.openecomp.aai.domain.restPolicyException.RequestError(); + org.openecomp.aai.domain.restPolicyException.PolicyException polexc = new org.openecomp.aai.domain.restPolicyException.PolicyException(); + polexc.setMessageId("POL" + eo.getRESTErrorCode()); + polexc.setText(text.toString()); + polexc.setVariables(variables); + reqerr.setPolicyException(polexc); + restresp.setRequestError(reqerr); + response = (MapperUtil.writeAsJSONString((Object) restresp)); + + } else { + org.openecomp.aai.domain.restServiceException.RESTResponse restresp = new org.openecomp.aai.domain.restServiceException.RESTResponse(); + org.openecomp.aai.domain.restServiceException.RequestError reqerr = new org.openecomp.aai.domain.restServiceException.RequestError(); + org.openecomp.aai.domain.restServiceException.ServiceException svcexc = new org.openecomp.aai.domain.restServiceException.ServiceException(); + svcexc.setMessageId("SVC" + eo.getRESTErrorCode()); + svcexc.setText(text.toString()); + svcexc.setVariables(variables); + reqerr.setServiceException(svcexc); + restresp.setRequestError(reqerr); + response = (MapperUtil.writeAsJSONString((Object) restresp)); + } + } catch (AAIException ex) { + LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error", ex); + } + } + } + + + return response; + } + + /** + * Gets the RESTAPI error response with logging. + * + * @param acceptHeadersOrig the accept headers orig + * @param are the are + * @param variables the variables + * @param logline the logline + * @return the RESTAPI error response with logging + * @throws ErrorObjectFormatException + * @throws ErrorObjectNotFoundException + * @throws IOException + */ + public static String getRESTAPIErrorResponseWithLogging(List<MediaType> acceptHeadersOrig, AAIException are, ArrayList<String> variables) { + String response = ErrorLogHelper.getRESTAPIErrorResponse(acceptHeadersOrig, are, variables); + + LOGGER.error(are.getMessage(), are); + + return response; + } + + /** + * Gets the RESTAPI info response. + * + * @param acceptHeaders the accept headers + * @param areList the are list + * @return the RESTAPI info response + * @throws ErrorObjectFormatException + * @throws ErrorObjectNotFoundException + * @throws IOException + */ + public static Object getRESTAPIInfoResponse(List<MediaType> acceptHeaders, HashMap<AAIException,ArrayList<String>> areList) { + + Object respObj = null; + + org.openecomp.aai.domain.restResponseInfo.ObjectFactory factory = new org.openecomp.aai.domain.restResponseInfo.ObjectFactory(); + org.openecomp.aai.domain.restResponseInfo.Info info = factory.createInfo(); + org.openecomp.aai.domain.restResponseInfo.Info.ResponseMessages responseMessages = factory.createInfoResponseMessages(); + Iterator<Entry<AAIException, ArrayList<String>>> it = areList.entrySet().iterator(); + + while (it.hasNext()) { + Entry<AAIException,ArrayList<String>> pair = (Entry<AAIException, ArrayList<String>>)it.next(); + AAIException are = pair.getKey(); + ArrayList<String> variables = pair.getValue(); + + StringBuilder text = new StringBuilder(); + + ErrorObject eo = are.getErrorObject(); + + int restErrorCode = Integer.parseInt(eo.getRESTErrorCode()); + ErrorObject restErrorObject; + try { + restErrorObject = ErrorLogHelper.getErrorObject("AAI_"+String.format("%04d", restErrorCode)); + } catch (ErrorObjectNotFoundException e) { + restErrorObject = eo; + } + text.append(restErrorObject.getErrorText()); + + // We want to always append the (msg=%n) (ec=%n+1) to the text, but have to find value of n + // This assumes that the variables in the ArrayList, which might be more than are needed to flesh out the + // error, are ordered based on the error string. + int localDataIndex = StringUtils.countMatches(restErrorObject.getErrorText(), "%"); + text.append(" (msg=%").append(localDataIndex+1).append(") (rc=%").append(localDataIndex+2).append(")"); + + if (variables == null) + { + variables = new ArrayList<String>(); + } + + if (variables.size() < localDataIndex) { + ErrorLogHelper.logError("AAI_4011", "data missing for rest error"); + while (variables.size() < localDataIndex) { + variables.add("null"); + } + } + + // This will put the error code and error text into the right positions + if (are.getMessage() == null) { + variables.add(localDataIndex++, eo.getErrorText()); + } + else { + variables.add(localDataIndex++, eo.getErrorText() + ":" + are.getMessage()); + } + variables.add(localDataIndex, eo.getErrorCodeString()); + + try { + org.openecomp.aai.domain.restResponseInfo.Info.ResponseMessages.ResponseMessage responseMessage = factory.createInfoResponseMessagesResponseMessage(); + org.openecomp.aai.domain.restResponseInfo.Info.ResponseMessages.ResponseMessage.Variables infovariables = factory.createInfoResponseMessagesResponseMessageVariables(); + + responseMessage.setMessageId("INF" + eo.getRESTErrorCode()); + responseMessage.setText(text.toString()); + for (int i=0;i<variables.size();i++) + { + infovariables.getVariable().add(variables.get(i)); + } + + responseMessage.setVariables(infovariables); + responseMessages.getResponseMessage().add(responseMessage); + + } catch (Exception ex) { + LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error", ex); + } + } + + info.setResponseMessages(responseMessages); + respObj = (Object) info; + + return respObj; + } + + + /** + * Determines whether category is policy or not. If policy (1), this is a POL error, else it's a SVC error. + * The AAIRESTException may contain a different ErrorObject than that created with the REST error key. + * This allows lower level exception detail to be returned to the client to help troubleshoot the problem. + * If no error object is embedded in the AAIException, one will be created using the error object from the AAIException. + * @param are must have a restError value whose numeric value must match what should be returned in the REST API + * @param variables optional list of variables to flesh out text in error string + * @return appropriately formatted JSON response per the REST API spec. + * @throws ErrorObjectFormatException + * @throws ErrorObjectNotFoundException + * @throws IOException + */ + public static String getRESTAPIPolicyErrorResponseXML(AAIException are, ArrayList<String> variables) { + + StringBuilder text = new StringBuilder(); + String response = null; + JAXBContext context = null; + + ErrorObject eo = are.getErrorObject(); + + int restErrorCode = Integer.parseInt(eo.getRESTErrorCode()); + ErrorObject restErrorObject; + try { + restErrorObject = ErrorLogHelper.getErrorObject("AAI_"+restErrorCode); + } catch (ErrorObjectNotFoundException e) { + restErrorObject = eo; + } + + text.append(restErrorObject.getErrorText()); + + // We want to always append the (msg=%n) (ec=%n+1) to the text, but have to find value of n + // This assumes that the variables in the ArrayList, which might be more than are needed to flesh out the + // error, are ordered based on the error string. + int localDataIndex = StringUtils.countMatches(restErrorObject.getErrorText(), "%"); + text.append(" (msg=%").append(localDataIndex+1).append(") (ec=%").append(localDataIndex+2).append(")"); + + if (variables == null) + { + variables = new ArrayList<String>(); + } + + if (variables.size() < localDataIndex) { + ErrorLogHelper.logError("AAI_4011", "data missing for rest error"); + while (variables.size() < localDataIndex) { + variables.add("null"); + } + } + + // This will put the error code and error text into the right positions + if (are.getMessage() == null) { + variables.add(localDataIndex++, eo.getErrorText()); + } + else { + variables.add(localDataIndex++, eo.getErrorText() + ":" + are.getMessage()); + } + variables.add(localDataIndex, eo.getErrorCodeString()); + + try { + if(eo.getCategory().equals("1")) { + + context = JAXBContext.newInstance(org.openecomp.aai.domain.restPolicyException.Fault.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + + org.openecomp.aai.domain.restPolicyException.ObjectFactory factory = new org.openecomp.aai.domain.restPolicyException.ObjectFactory(); + org.openecomp.aai.domain.restPolicyException.Fault fault = factory.createFault(); + org.openecomp.aai.domain.restPolicyException.Fault.RequestError requestError = factory.createFaultRequestError(); + org.openecomp.aai.domain.restPolicyException.Fault.RequestError.PolicyException policyException = factory.createFaultRequestErrorPolicyException(); + org.openecomp.aai.domain.restPolicyException.Fault.RequestError.PolicyException.Variables polvariables = factory.createFaultRequestErrorPolicyExceptionVariables(); + + policyException.setMessageId("POL" + eo.getRESTErrorCode()); + policyException.setText(text.toString()); + for (int i=0;i<variables.size();i++) + { + polvariables.getVariable().add(variables.get(i)); + } + policyException.setVariables(polvariables); + requestError.setPolicyException(policyException); + fault.setRequestError(requestError); + + StringWriter sw = new StringWriter(); + m.marshal(fault, sw); + + response = sw.toString(); + + } else { + + context = JAXBContext.newInstance(org.openecomp.aai.domain.restServiceException.Fault.class); + Marshaller m = context.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + + org.openecomp.aai.domain.restServiceException.ObjectFactory factory = new org.openecomp.aai.domain.restServiceException.ObjectFactory(); + org.openecomp.aai.domain.restServiceException.Fault fault = factory.createFault(); + org.openecomp.aai.domain.restServiceException.Fault.RequestError requestError = factory.createFaultRequestError(); + org.openecomp.aai.domain.restServiceException.Fault.RequestError.ServiceException serviceException = factory.createFaultRequestErrorServiceException(); + org.openecomp.aai.domain.restServiceException.Fault.RequestError.ServiceException.Variables svcvariables = factory.createFaultRequestErrorServiceExceptionVariables(); + serviceException.setMessageId("POL" + eo.getRESTErrorCode()); + serviceException.setText(text.toString()); + for (int i=0;i<variables.size();i++) + { + svcvariables.getVariable().add(variables.get(i)); + } + serviceException.setVariables(svcvariables); + requestError.setServiceException(serviceException); + fault.setRequestError(requestError); + + StringWriter sw = new StringWriter(); + m.marshal(fault, sw); + + response = sw.toString(); + + } + } catch (Exception ex) { + LOGGER.error("We were unable to create a rest exception to return on an API because of a parsing error", ex); + } + return response; + } + + public static void logException(AAIException e) { + final ErrorObject errorObject = e.getErrorObject(); + + MDC.put("severity", errorObject.getSeverity()); //TODO Use LoggingContext.severity(int severity) + + final String errorMessage = new StringBuilder() + .append(errorObject.getErrorText()) + .append(":") + .append(errorObject.getRESTErrorCode()) + .append(":") + .append(errorObject.getHTTPResponseCode()) + .append(":") + .append(e.getMessage()) + .toString(); + + LoggingContext.responseCode(errorObject.getErrorCodeString()); + LoggingContext.responseDescription(errorMessage); + LoggingContext.statusCode(StatusCode.ERROR); + + if (errorObject.getSeverity().equalsIgnoreCase("WARN")) + LOGGER.warn(errorMessage, e); + else if (errorObject.getSeverity().equalsIgnoreCase("ERROR")) + LOGGER.error(errorMessage, e); + else if (errorObject.getSeverity().equalsIgnoreCase("FATAL")) + LOGGER.error(errorMessage, e); + else if (errorObject.getSeverity().equals("INFO")) + LOGGER.info(errorMessage + ", " + e.getMessage()); + } + + public static void logError(String code) { + logError(code, ""); + } + + public static void logError(String code, String message) { + logException(new AAIException(code, message)); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObject.java b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObject.java new file mode 100644 index 00000000..dc355cc7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObject.java @@ -0,0 +1,308 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import javax.ws.rs.core.Response.Status; + +/** + * + * Contains the definition of all error message fields to be mapped from the Error + * properties file + * + */ +public class ErrorObject { + + private String disposition; + private String category; + private String severity; + private Status httpResponseCode = Status.INTERNAL_SERVER_ERROR; // default + private String restErrorCode = "3002"; + private String errorCode; + private String errorText; + + /** + * Instantiates a new error object. + */ + public ErrorObject() { + super(); + } + + /** + * Creates an error object with the default HTTP Error Code (Status.INTERNAL_SERVER_ERROR) + * + * @param disposition the disposition + * @param category the category + * @param severity the severity + * @param httpResponseCode the http response code + * @param restErrorCode the rest error code + * @param errorCode the error code + * @param errorText the error text + */ + public ErrorObject(String disposition, String category, String severity, Integer httpResponseCode, String restErrorCode, String errorCode, String errorText) { + super(); + this.setDisposition(disposition); + this.setCategory(category); + this.severity = severity; + this.setHTTPResponseCode(httpResponseCode); + this.setRESTErrorCode(restErrorCode); + this.setErrorCode(errorCode); + this.setErrorText(errorText); + } + + // OLD STARTS HERE + + /** + * Instantiates a new error object. + * + * @param severity the severity + * @param errorCode the error code + * @param errorText the error text + * @param disposition the disposition + * @param category the category + */ + public ErrorObject(String severity, String errorCode, String errorText, String disposition, String category) { + this(severity, Status.INTERNAL_SERVER_ERROR, errorCode, errorText, disposition, category); + } + + /** + * Instantiates a new error object. + * + * @param severity the severity + * @param httpResponseCode the http response code + * @param errorCode the error code + * @param errorText the error text + * @param disposition the disposition + * @param category the category + */ + public ErrorObject(String severity, Integer httpResponseCode, String errorCode, String errorText, String disposition, String category) { + super(); + this.severity = severity; + this.setHTTPResponseCode(httpResponseCode); + this.setErrorCode(errorCode); + this.setErrorText(errorText); + this.setDisposition(disposition); + this.setCategory(category); + } + + /** + * Instantiates a new error object. + * + * @param severity the severity + * @param httpResponseCode the http response code + * @param errorCode the error code + * @param errorText the error text + * @param disposition the disposition + * @param category the category + */ + public ErrorObject(String severity, Status httpResponseCode, String errorCode, String errorText, String disposition, String category) { + super(); + this.severity = severity; + this.setHTTPResponseCode(httpResponseCode); + this.setErrorCode(errorCode); + this.setErrorText(errorText); + this.setDisposition(disposition); + this.setCategory(category); + } + + /** + * Gets the disposition. + * + * @return the disposition + */ + public String getDisposition() { + return disposition; + } + + /** + * Sets the disposition. + * + * @param disposition the new disposition + */ + public void setDisposition(String disposition) { + this.disposition = disposition; + } + + /** + * Gets the category. + * + * @return the category + */ + public String getCategory() { + return category; + } + + /** + * Sets the category. + * + * @param category the new category + */ + public void setCategory(String category) { + this.category = category; + } + + /** + * Gets the severity. + * + * @return the severity + */ + public String getSeverity() { + return severity; + } + + /** + * Sets the severity. + * + * @param severity the new severity + */ + public void setSeverity(String severity) { + this.severity = severity; + } + + /** + * Gets the error code. + * + * @return the error code + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Sets the error code. + * + * @param errorCode the new error code + */ + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + /** + * Gets the HTTP response code. + * + * @return the HTTP response code + */ + public Status getHTTPResponseCode() { + return httpResponseCode; + } + + /** + * Sets the HTTP response code. + * + * @param httpResponseCode the new HTTP response code + */ + public void setHTTPResponseCode(Integer httpResponseCode) { + this.httpResponseCode = Status.fromStatusCode(httpResponseCode); + if (this.httpResponseCode == null) { + throw new IllegalArgumentException("setHTTPResponseCode was passed an invalid Integer value, fix error.properties or your code "+httpResponseCode); + } + } + + /** + * Sets the HTTP response code. + * + * @param httpResponseCode the new HTTP response code + */ + public void setHTTPResponseCode(String httpResponseCode) { + this.httpResponseCode = Status.fromStatusCode(Integer.valueOf(httpResponseCode)); + if (this.httpResponseCode == null) { + throw new IllegalArgumentException("setHTTPResponseCode was passed an invalid String value, fix error.properties or your code "+httpResponseCode); + } + } + + /** + * Sets the REST error code. + * + * @param restErrorCode the new REST error code + */ + public void setRESTErrorCode(String restErrorCode) { + this.restErrorCode = restErrorCode; + } + + /** + * Gets the REST error code. + * + * @return the REST error code + */ + public String getRESTErrorCode() { + return this.restErrorCode; + } + + /** + * Sets the HTTP response code. + * + * @param httpResponseCode the new HTTP response code + */ + public void setHTTPResponseCode(Status httpResponseCode) { + this.httpResponseCode = httpResponseCode; + if (this.httpResponseCode == null) { + throw new IllegalArgumentException("setHTTPResponseCode was passed an invalid String value, fix error.properties or your code "+httpResponseCode); + } + } + + /** + * Gets the error text. + * + * @return the error text + */ + public String getErrorText() { + return errorText; + } + + /** + * Sets the error text. + * + * @param errorText the new error text + */ + public void setErrorText(String errorText) { + this.errorText = errorText; + } + + /** + * Gets the error code string. This is also the string + * configured in Nagios to alert on + * + * @return the error code string + */ + // Get the X.Y.Z representation of the error code + public String getErrorCodeString() { + String prefix = null; + switch (disposition) { + default: + prefix = ""; + break; + case "5": + prefix = "ERR."; + break; + } + return prefix + disposition + "." + category + "." + errorCode; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return "ErrorObject [errorCode="+ errorCode + ", errorText=" + errorText + + ", restErrorCode=" + restErrorCode + ", httpResponseCode="+ httpResponseCode + + ", severity=" + severity + ", disposition=" + disposition + ", category=" + category +"]"; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObjectFormatException.java b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObjectFormatException.java new file mode 100644 index 00000000..0bedfca2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObjectFormatException.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +public class ErrorObjectFormatException extends Exception { + + private static final long serialVersionUID = 3732705544448553685L; + + public ErrorObjectFormatException() { + super(); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObjectNotFoundException.java b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObjectNotFoundException.java new file mode 100644 index 00000000..28290542 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/ErrorObjectNotFoundException.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +public class ErrorObjectNotFoundException extends Exception { + + private static final long serialVersionUID = 4115316781400786740L; + + public ErrorObjectNotFoundException() { + // TODO Auto-generated constructor stub + } + + public ErrorObjectNotFoundException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + public ErrorObjectNotFoundException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + public ErrorObjectNotFoundException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + public ErrorObjectNotFoundException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + // TODO Auto-generated constructor stub + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/LogFormatTools.java b/aai-core/src/main/java/org/openecomp/aai/logging/LogFormatTools.java new file mode 100644 index 00000000..78ade267 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/LogFormatTools.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import java.time.Instant; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +public class LogFormatTools { + + private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; + private static final DateTimeFormatter DTF = DateTimeFormatter.ofPattern(DATE_FORMAT) + .withZone(ZoneOffset.UTC); + + public static String getCurrentDateTime() { + return DTF.format(ZonedDateTime.now()); + } + + public static String toDate(long timestamp) { + return DTF.format(Instant.ofEpochMilli(timestamp)); + } + + public static long toTimestamp(String date) { + return ZonedDateTime.parse(date, DTF).toInstant().toEpochMilli(); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/LoggingContext.java b/aai-core/src/main/java/org/openecomp/aai/logging/LoggingContext.java new file mode 100644 index 00000000..17d94e61 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/LoggingContext.java @@ -0,0 +1,299 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.json.JSONException; +import org.json.JSONObject; +import org.slf4j.MDC; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Iterator; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +public class LoggingContext { + + public enum StatusCode { + COMPLETE, + ERROR + } + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(LoggingContext.class); + + private static final String PREVIOUS_CONTEXT_KEY = "_PREVIOUS_CONTEXT"; + + //ECOMP Specific Log Event Fields + public static enum LoggingField { + START_TIME("startTime"), + REQUEST_ID("requestId"), + SERVICE_INSTANCE_ID("serviceInstanceId"), + SERVER_NAME("serverName"), + SERVICE_NAME("serviceName"), + PARTNER_NAME("partnerName"), + STATUS_CODE("statusCode"), + RESPONSE_CODE("responseCode"), + RESPONSE_DESCRIPTION("responseDescription"), + INSTANCE_UUID("instanceUUID"), + SEVERITY("severity"), + SERVER_IP_ADDRESS("serverIpAddress"), + ELAPSED_TIME("elapsedTime"), + SERVER("server"), + CLIENT_IP_ADDRESS("clientIpAddress"), + UNUSED("unused"), + PROCESS_KEY("processKey"), + CUSTOM_FIELD_1("customField1"), + CUSTOM_FIELD_2("customField2"), + CUSTOM_FIELD_3("customField3"), + CUSTOM_FIELD_4("customField4"), + + //ECOMP Specific Metric Log Event Fields + TARGET_ENTITY("targetEntity"), + + //A&AI Specific Log Event Fields + COMPONENT("component"), + STOP_WATCH_START("stopWatchStart"); + + private final String text; + + private LoggingField(final String text) { + this.text = text; + } + + public String toString() { + return text; + } + } + + + public static void init() { + LoggingContext.clear(); + LoggingContext.startTime(); + LoggingContext.server(); + LoggingContext.serverIpAddress(); + } + + private static void startTime() { + MDC.put(LoggingField.START_TIME.toString(), LogFormatTools.getCurrentDateTime()); + } + + public static void requestId(UUID requestId) { + MDC.put(LoggingField.REQUEST_ID.toString(), requestId.toString()); + } + + public static void requestId(String requestId) { + try { + MDC.put(LoggingField.REQUEST_ID.toString(), UUID.fromString(requestId).toString()); + } catch (IllegalArgumentException e) { + final UUID generatedRequestUuid = UUID.randomUUID(); + MDC.put(LoggingField.REQUEST_ID.toString(), generatedRequestUuid.toString()); + LOGGER.warn("Unable to use UUID " + requestId + " (Not formatted properly). Using generated UUID=" + generatedRequestUuid); + } + } + + public static void serviceInstanceId(String serviceInstanceId) { + MDC.put(LoggingField.SERVICE_INSTANCE_ID.toString(), serviceInstanceId); + } + + public static void serverName(String serverName) { + MDC.put(LoggingField.SERVER_NAME.toString(), serverName); + } + + public static void serviceName(String serviceName) { + MDC.put(LoggingField.SERVICE_NAME.toString(), serviceName); + } + + public static void partnerName(String partnerName) { + MDC.put(LoggingField.PARTNER_NAME.toString(), partnerName); + } + + public static void statusCode(LoggingContext.StatusCode statusCode) { + MDC.put(LoggingField.STATUS_CODE.toString(), statusCode.toString()); + } + + public static String responseCode() { + return (String) MDC.get(LoggingField.RESPONSE_CODE.toString()); + } + + public static void responseCode(String responseCode) { + MDC.put(LoggingField.RESPONSE_CODE.toString(), responseCode); + } + + public static void responseDescription(String responseDescription) { + MDC.put(LoggingField.RESPONSE_DESCRIPTION.toString(), responseDescription); + } + + public static void instanceUuid(UUID instanceUuid) { + MDC.put(LoggingField.INSTANCE_UUID.toString(), instanceUuid.toString()); + } + + public static void severity(int severity) { + MDC.put(LoggingField.SEVERITY.toString(), String.valueOf(severity)); + } + + private static void serverIpAddress() { + try { + MDC.put(LoggingField.SERVER_IP_ADDRESS.toString(), InetAddress.getLocalHost().getHostAddress()); + } catch (UnknownHostException e) { + LOGGER.warn("Unable to resolve server IP address - will not be displayed in logged events"); + } + } + + public static void elapsedTime(long elapsedTime, TimeUnit timeUnit) { + MDC.put(LoggingField.ELAPSED_TIME.toString(), String.valueOf(TimeUnit.MILLISECONDS.convert(elapsedTime, timeUnit))); + } + + private static void server() { + try { + MDC.put(LoggingField.SERVER.toString(), InetAddress.getLocalHost().getCanonicalHostName()); + } catch (UnknownHostException e) { + LOGGER.warn("Unable to resolve server IP address - hostname will not be displayed in logged events"); + } + } + + public static void clientIpAddress(InetAddress clientIpAddress) { + MDC.put(LoggingField.CLIENT_IP_ADDRESS.toString(), clientIpAddress.getHostAddress()); + } + + public static void clientIpAddress(String clientIpAddress) { + try { + MDC.put(LoggingField.CLIENT_IP_ADDRESS.toString(), InetAddress.getByName(clientIpAddress).getHostAddress()); + } catch (UnknownHostException e) { + //Ignore, will not be thrown since InetAddress.getByName(String) only + //checks the validity of the passed in string + } + } + + public static void unused(String unused) { + LOGGER.warn("Using field '" + LoggingField.UNUSED + "' (seems like this should go unused...)"); + MDC.put(LoggingField.UNUSED.toString(), unused); + } + + public static void processKey(String processKey) { + MDC.put(LoggingField.PROCESS_KEY.toString(), processKey); + } + + public static void customField1(String customField1) { + MDC.put(LoggingField.CUSTOM_FIELD_1.toString(), customField1); + } + + public static void customField2(String customField2) { + MDC.put(LoggingField.CUSTOM_FIELD_2.toString(), customField2); + } + + public static void customField3(String customField3) { + MDC.put(LoggingField.CUSTOM_FIELD_3.toString(), customField3); + } + + public static void customField4(String customField4) { + MDC.put(LoggingField.CUSTOM_FIELD_4.toString(), customField4); + } + + public static void component(String component) { + MDC.put(LoggingField.COMPONENT.toString(), component); + } + + public static void targetEntity(String targetEntity) { + MDC.put(LoggingField.TARGET_ENTITY.toString(), targetEntity); + } + + public static void stopWatchStart() { + MDC.put(LoggingField.STOP_WATCH_START.toString(), String.valueOf(System.nanoTime())); + } + + public static double stopWatchStop() { + final long stopWatchEnd = System.nanoTime(); + final Long stopWatchStart = Long.valueOf(MDC.get(LoggingField.STOP_WATCH_START.toString())); + + if (stopWatchStart == null) throw new StopWatchNotStartedException(); + + MDC.remove(LoggingField.STOP_WATCH_START.toString()); + + final double elapsedTimeMillis = (stopWatchEnd - stopWatchStart) / 1000.0 / 1000.0; + + LoggingContext.elapsedTime((long) elapsedTimeMillis, TimeUnit.MILLISECONDS); + + return elapsedTimeMillis; + } + + public static void put(String key, String value) { + MDC.put(key, value); + } + + public static void clear() { + MDC.clear(); + } + + public static void remove(String key) { + MDC.remove(key); + } + + public static void save() { + final JSONObject context = new JSONObject(); + + for (LoggingField field : LoggingField.values()) { + if (field == LoggingField.ELAPSED_TIME) continue; + + try { + context.put(field.toString(), MDC.get(field.toString())); + } catch (JSONException e) { + //Ignore - only occurs when the key is null (which can't happen) + // or the value is invalid (everything is converted to a string + // before it get put() to the MDC) + } + } + + MDC.put("_PREVIOUS_CONTEXT", context.toString()); + } + + public static void restore() { + + final String rawPreviousContext = MDC.get(PREVIOUS_CONTEXT_KEY); + + if (rawPreviousContext == null) { + throw new LoggingContextNotExistsException(); + } + + try { + final JSONObject previousContext = new JSONObject(rawPreviousContext); + + @SuppressWarnings("unchecked") + final Iterator<String> keys = previousContext.keys(); + + while (keys.hasNext()) { + final String key = keys.next(); + + try { + MDC.put(key, previousContext.getString(key)); + } catch (JSONException e) { + //Ignore, only occurs when the key is null (cannot happen) + // or the value is invalid (they are all strings) + } + } + + MDC.remove(PREVIOUS_CONTEXT_KEY); + } catch (JSONException e) { + //Ignore, the previousContext is serialized from a JSONObject + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/LoggingContextNotExistsException.java b/aai-core/src/main/java/org/openecomp/aai/logging/LoggingContextNotExistsException.java new file mode 100644 index 00000000..caba1df3 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/LoggingContextNotExistsException.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +public class LoggingContextNotExistsException extends RuntimeException { + + private static final long serialVersionUID = -4965807709525739623L; +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/StopWatch.java b/aai-core/src/main/java/org/openecomp/aai/logging/StopWatch.java new file mode 100644 index 00000000..0812698c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/StopWatch.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +import org.openecomp.aai.logging.LoggingContext.LoggingField; + +public final class StopWatch { + + private StopWatch() {} + + public static void start() { + LoggingContext.stopWatchStart(); + } + + public static double stop() { + return LoggingContext.stopWatchStop(); + } + + public static void clear() { + LoggingContext.remove(LoggingField.STOP_WATCH_START.toString()); + LoggingContext.remove(LoggingField.ELAPSED_TIME.toString()); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/logging/StopWatchNotStartedException.java b/aai-core/src/main/java/org/openecomp/aai/logging/StopWatchNotStartedException.java new file mode 100644 index 00000000..30a90e8e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/logging/StopWatchNotStartedException.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.logging; + +public class StopWatchNotStartedException extends RuntimeException { + + private static final long serialVersionUID = -4540164295822859408L; + + public StopWatchNotStartedException() { + super(); + } + + public StopWatchNotStartedException(String message) { + super(message); + } + + public StopWatchNotStartedException(Throwable cause) { + super(cause); + } + + public StopWatchNotStartedException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/exceptions/AAIIdentityMapParseException.java b/aai-core/src/main/java/org/openecomp/aai/parsers/exceptions/AAIIdentityMapParseException.java new file mode 100644 index 00000000..75ff6c42 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/exceptions/AAIIdentityMapParseException.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class AAIIdentityMapParseException extends AAIException { + + private static final long serialVersionUID = -888876613879411865L; + + public AAIIdentityMapParseException(String message) { + super("AAI_3000", message); + } + + public AAIIdentityMapParseException(Throwable cause) { + super("AAI_3000",cause); + } + + public AAIIdentityMapParseException(String message, Throwable cause) { + super("AAI_3000", cause, message); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/exceptions/AmbiguousMapAAIException.java b/aai-core/src/main/java/org/openecomp/aai/parsers/exceptions/AmbiguousMapAAIException.java new file mode 100644 index 00000000..2f2354c4 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/exceptions/AmbiguousMapAAIException.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class AmbiguousMapAAIException extends AAIException { + + private static final long serialVersionUID = -878581771971431246L; + + public AmbiguousMapAAIException(String message) { + super("AAI_6146", message); + } + + public AmbiguousMapAAIException(Throwable cause) { + super("AAI_6146",cause); + } + + public AmbiguousMapAAIException(String message, Throwable cause) { + super("AAI_6146", cause, message); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java new file mode 100644 index 00000000..8da382f7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/LegacyQueryParser.java @@ -0,0 +1,233 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.parsers.uri.Parsable; +import org.openecomp.aai.parsers.uri.URIParser; +import org.openecomp.aai.parsers.uri.URIToObject; +import org.openecomp.aai.query.builder.QueryBuilder; +import org.openecomp.aai.restcore.util.URITools; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.EdgeType; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +/** + * The Class LegacyQueryParser. + */ +public class LegacyQueryParser extends QueryParser implements Parsable { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(LegacyQueryParser.class); + + private Introspector previous = null; + + /** + * Instantiates a new legacy query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + * @param uri the uri + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public LegacyQueryParser(Loader loader, QueryBuilder queryBuilder, URI uri) throws UnsupportedEncodingException, AAIException { + super(loader, queryBuilder, uri); + URIParser parser = new URIParser(loader, uri); + parser.parse(this); + } + + /** + * Instantiates a new legacy query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + * @param uri the uri + * @param queryParams the query params + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public LegacyQueryParser(Loader loader, QueryBuilder queryBuilder, URI uri, MultivaluedMap<String, String> queryParams) throws UnsupportedEncodingException, AAIException { + super(loader, queryBuilder, uri); + URIParser parser = new URIParser(loader, uri, queryParams); + parser.parse(this); + } + + /** + * Instantiates a new legacy query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + */ + public LegacyQueryParser(Loader loader, QueryBuilder queryBuilder) { + super(loader, queryBuilder); + } + + /** + * @throws AAIException + * @{inheritDoc} + */ + @Override + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) throws AAIException { + if (previous != null) { + this.parentResourceType = previous.getDbName(); + queryBuilder.createEdgeTraversal(EdgeType.TREE, previous, obj); + } + if (previous == null) { + queryBuilder.createDBQuery(obj); + this.handleUriKeys(obj, uriKeys); + } else { + queryBuilder.createKeyQuery(obj); + this.handleUriKeys(obj, uriKeys); + } + previous = obj; + this.resultResource = obj.getDbName(); + } + + /** + * @{inheritDoc} + */ + @Override + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) throws AAIException { + if (isFinalContainer) { + if (previous != null) { + this.parentResourceType = previous.getDbName(); + queryBuilder.createEdgeTraversal(EdgeType.TREE, previous, obj); + } + + if (previous == null) { + queryBuilder.createContainerQuery(obj); + queryBuilder.markParentBoundary(); + } + if (!uriKeys.isEmpty()) { + + try { + Introspector child = obj.newIntrospectorInstanceOfNestedProperty(obj.getChildName()); + this.handleUriKeys(child, uriKeys); + } catch (AAIUnknownObjectException e) { + LOGGER.warn("Skipping container child " + obj.getChildName() + " (Unknown Object)", e); + } + } + + this.resultResource = obj.getChildDBName(); + this.containerResource = obj.getName(); + } + } + + private void handleUriKeys(Introspector obj, MultivaluedMap<String, String> uriKeys) throws AAIException { + for (String key : uriKeys.keySet()) { + //to validate whether this property exists + if (!obj.hasProperty(key)) { + throw new AAIException("AAI_3000", "property: " + key + " not found on " + obj.getDbName()); + } + + List<String> values = uriKeys.get(key); + String dbPropertyName = key; + Map<String, String> linkedProperties = new HashMap<>(); + final Map<PropertyMetadata, String> metadata = obj.getPropertyMetadata(key); + if (metadata.containsKey(PropertyMetadata.DATA_LINK)) { + linkedProperties.put(key, metadata.get(PropertyMetadata.DATA_LINK)); + } + if (metadata.containsKey(PropertyMetadata.DB_ALIAS)) { + dbPropertyName = metadata.get(PropertyMetadata.DB_ALIAS); + } + + if (!linkedProperties.containsKey(key)) { + if (values.size() > 1) { + queryBuilder.getVerticesByIndexedProperty(dbPropertyName, obj.castValueAccordingToSchema(key, values)); + } else { + queryBuilder.getVerticesByIndexedProperty(dbPropertyName, obj.castValueAccordingToSchema(key, values.get(0))); + } + } + handleLinkedProperties(obj, uriKeys, linkedProperties); + } + } + private void handleLinkedProperties(Introspector obj, MultivaluedMap<String, String> uriKeys, Map<String, String> linkedProperties) throws AAIException { + + QueryBuilder[] builders = new QueryBuilder[linkedProperties.keySet().size()]; + Set<Entry<String, String>> entrySet = linkedProperties.entrySet(); + int i = 0; + Iterator<Entry<String, String>> itr = entrySet.iterator(); + + while (itr.hasNext()) { + Entry<String, String> entry = itr.next(); + Introspector child; + try { + child = new URIToObject(this.latestLoader, new URI(URITools.replaceTemplates(obj, entry.getValue(), PropertyMetadata.DATA_LINK, true).orElse(""))).getEntity(); + } catch (IllegalArgumentException | UnsupportedEncodingException | URISyntaxException e) { + throw new AAIException("AAI_4000", e); + } + List<String> values = uriKeys.get(entry.getKey()); + QueryBuilder builder = queryBuilder.newInstance(); + builder.createEdgeTraversal(EdgeType.TREE, obj, child); + if (values.size() > 1) { + builder.getVerticesByIndexedProperty(entry.getKey(), obj.castValueAccordingToSchema(entry.getKey(), values)); + } else { + builder.getVerticesByIndexedProperty(entry.getKey(), obj.castValueAccordingToSchema(entry.getKey(), values.get(0))); + } + + builders[i] = builder; + i++; + } + + queryBuilder.where(builders); + + } + + /** + * @{inheritDoc} + */ + @Override + public void processNamespace(Introspector obj) { + + } + + /** + * @{inheritDoc} + */ + @Override + public String getCloudRegionTransform() { + return "add"; + } + + /** + * @{inheritDoc} + */ + @Override + public boolean useOriginalLoader() { + return false; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/ObjectNameQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/ObjectNameQueryParser.java new file mode 100644 index 00000000..6ea38893 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/ObjectNameQueryParser.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +package org.openecomp.aai.parsers.query; + +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.query.builder.QueryBuilder; + +public class ObjectNameQueryParser extends QueryParser { + + public ObjectNameQueryParser(Loader loader, QueryBuilder queryBuilder, String objName) { + super(loader, queryBuilder); + this.resultResource = objName; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java new file mode 100644 index 00000000..4fd6c230 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParser.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.net.URI; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.query.builder.QueryBuilder; + +/** + * The Class QueryParser. + */ +public abstract class QueryParser { + + protected Loader loader = null; + protected Loader latestLoader = null; + protected QueryBuilder queryBuilder = null; + + protected QueryBuilder parentQueryBuilder = null; + + protected URI uri = null; + + protected String resultResource = ""; + + protected String parentResourceType = ""; + + protected String containerResource = ""; + + /** + * Instantiates a new query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + * @param uri the uri + */ + protected QueryParser(Loader loader, QueryBuilder queryBuilder, URI uri) { + this.uri = uri; + this.queryBuilder = queryBuilder; + this.loader = loader; + this.latestLoader = LoaderFactory.createLoaderForVersion(loader.getModelType(), AAIProperties.LATEST); + } + + /** + * Instantiates a new query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + */ + protected QueryParser(Loader loader, QueryBuilder queryBuilder) { + this.queryBuilder = queryBuilder; + this.loader = loader; + this.latestLoader = LoaderFactory.createLoaderForVersion(loader.getModelType(), AAIProperties.LATEST); + } + + /** + * Gets the container type. + * + * @return the container type + */ + public String getContainerType() { + + return this.containerResource; + } + + /** + * Gets the parent result type. + * + * @return the parent result type + */ + public String getParentResultType() { + return this.parentResourceType; + } + + /** + * Gets the result type. + * + * @return the result type + */ + public String getResultType() { + return this.resultResource; + } + + /** + * Gets the query builder. + * + * @return the query builder + */ + public QueryBuilder getQueryBuilder() { + return this.queryBuilder; + } + + /** + * Gets the uri. + * + * @return the uri + */ + public URI getUri() { + return this.uri; + } + + /** + * Gets the parent query builder. + * + * @return the parent query builder + */ + public QueryBuilder getParentQueryBuilder() { + if (this.parentQueryBuilder != null) { + return this.parentQueryBuilder; + } else { + return this.queryBuilder; + } + } + + /** + * Checks if is dependent. + * + * @return true, if is dependent + */ + public boolean isDependent() { + return !this.queryBuilder.getQuery().toString().equals(this.queryBuilder.getParentQuery().getQuery().toString()); + } + +} + + diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java new file mode 100644 index 00000000..ea875f22 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/QueryParserStrategy.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.query.builder.QueryBuilder; + +/** + * The Class QueryParserStrategy. + */ +public abstract class QueryParserStrategy { + + protected Loader loader = null; + + protected QueryBuilder builder = null; + + /** + * Instantiates a new query parser strategy. + * + * @param loader the loader + * @param builder the builder + */ + public QueryParserStrategy(Loader loader, QueryBuilder builder) { + + this.loader = loader; + this.builder = builder; + } + + /** + * Builds the URI parser. + * + * @param uri the uri + * @return the query parser + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public abstract QueryParser buildURIParser(URI uri) throws UnsupportedEncodingException, AAIException; + + /** + * Builds the URI parser. + * + * @param uri the uri + * @param queryParams the query params + * @return the query parser + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public abstract QueryParser buildURIParser(URI uri,MultivaluedMap<String, String> queryParams) throws UnsupportedEncodingException, AAIException; + + /** + * Builds the relationship parser. + * + * @param obj the obj + * @return the query parser + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public abstract QueryParser buildRelationshipParser(Introspector obj) throws UnsupportedEncodingException, AAIException; + + /** + * Builds an ObjectNameQueryParser. + * + * @param objName - the name of the object type as used in the database + * @return + */ + public abstract QueryParser buildObjectNameParser(String objName); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java new file mode 100644 index 00000000..7904f756 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/RelationshipQueryParser.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.IntrospectorFactory; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.parsers.relationship.RelationshipToURI; +import org.openecomp.aai.parsers.uri.URIParser; +import org.openecomp.aai.query.builder.QueryBuilder; +import org.openecomp.aai.serialization.db.EdgeRules; +import com.google.common.base.CaseFormat; + +/** + * The Class RelationshipQueryParser. + */ +public class RelationshipQueryParser extends LegacyQueryParser { + + private Introspector relationship = null; + + private ModelType modelType = null; + + private EdgeRules edgeRules = null; + + /** + * Instantiates a new relationship query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + * @param obj the obj + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public RelationshipQueryParser(Loader loader, QueryBuilder queryBuilder, Introspector obj) throws UnsupportedEncodingException, AAIException { + super(loader, queryBuilder); + this.relationship = obj; + this.modelType = obj.getModelType(); + this.edgeRules = EdgeRules.getInstance(); + RelationshipToURI rToUri = new RelationshipToURI(loader, obj); + this.uri = rToUri.getUri(); + URIParser parser = new URIParser(loader, uri); + parser.parse(this); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java new file mode 100644 index 00000000..664a3274 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/TraversalStrategy.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.query.builder.QueryBuilder; + +/** + * The Class TraversalStrategy. + */ +public class TraversalStrategy extends QueryParserStrategy { + + + /** + * Instantiates a new traversal strategy. + * + * @param loader the loader + * @param builder the builder + */ + public TraversalStrategy(Loader loader, QueryBuilder builder) { + super(loader, builder); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildURIParser(URI uri) throws UnsupportedEncodingException, AAIException { + return new LegacyQueryParser(loader, builder, uri); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildRelationshipParser(Introspector obj) throws UnsupportedEncodingException, AAIException { + return new RelationshipQueryParser(loader, builder, obj); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildURIParser(URI uri, MultivaluedMap<String, String> queryParams) + throws UnsupportedEncodingException, AAIException { + return new LegacyQueryParser(loader, builder, uri, queryParams); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildObjectNameParser(String objName) { + return new ObjectNameQueryParser(loader, builder, objName); + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java new file mode 100644 index 00000000..e1502c31 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryParser.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.relationship.RelationshipToURI; +import org.openecomp.aai.query.builder.QueryBuilder; + +/** + * The Class UniqueRelationshipQueryParser. + */ +public class UniqueRelationshipQueryParser extends UniqueURIQueryParser { + + + /** + * Instantiates a new unique relationship query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + * @param obj the obj + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + */ + public UniqueRelationshipQueryParser(Loader loader, QueryBuilder queryBuilder, Introspector obj) throws UnsupportedEncodingException, IllegalArgumentException, AAIException { + super(loader, queryBuilder); + RelationshipToURI rToUri = new RelationshipToURI(loader, obj); + UniqueURIQueryParser parser = new UniqueURIQueryParser(loader, queryBuilder, rToUri.getUri()); + this.containerResource = parser.getContainerType(); + this.resultResource = parser.getResultType(); + this.queryBuilder = parser.getQueryBuilder(); + this.parentQueryBuilder = parser.getParentQueryBuilder(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java new file mode 100644 index 00000000..6d594778 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueStrategy.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.query.builder.QueryBuilder; + +/** + * The Class UniqueStrategy. + */ +public class UniqueStrategy extends QueryParserStrategy { + + + + /** + * Instantiates a new unique strategy. + * + * @param loader the loader + * @param builder the builder + */ + public UniqueStrategy(Loader loader, QueryBuilder builder) { + super(loader, builder); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildURIParser(URI uri) throws UnsupportedEncodingException, IllegalArgumentException, AAIException { + return new UniqueURIQueryParser(loader, builder, uri); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildRelationshipParser(Introspector obj) throws UnsupportedEncodingException, AAIException { + return new UniqueRelationshipQueryParser(loader, builder, obj); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildURIParser(URI uri, MultivaluedMap<String, String> queryParams) + throws UnsupportedEncodingException, AAIException { + return new LegacyQueryParser(loader, builder, uri, queryParams); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser buildObjectNameParser(String objName) { + return new ObjectNameQueryParser(loader, builder, objName); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java new file mode 100644 index 00000000..c62d0469 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/query/UniqueURIQueryParser.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriBuilder; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.uri.Parsable; +import org.openecomp.aai.parsers.uri.URIParser; +import org.openecomp.aai.parsers.uri.URIToDBKey; +import org.openecomp.aai.query.builder.QueryBuilder; +import org.openecomp.aai.serialization.db.EdgeType; + + +/** + * The Class UniqueURIQueryParser. + */ +public class UniqueURIQueryParser extends QueryParser implements Parsable { + + + private URIToDBKey dbKeyParser = null; + + private Introspector previous = null; + + private boolean endsInContainer = false; + + private Introspector finalContainer = null; + + private String parentName = ""; + + /** + * Instantiates a new unique URI query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + * @param uri the uri + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + */ + public UniqueURIQueryParser(Loader loader, QueryBuilder queryBuilder, URI uri) throws UnsupportedEncodingException, IllegalArgumentException, AAIException { + super(loader, queryBuilder, uri); + URIParser parser = new URIParser(loader, uri); + parser.parse(this); + + if (!endsInContainer) { + this.dbKeyParser = new URIToDBKey(loader, uri); + String dbKey = (String)dbKeyParser.getResult(); + queryBuilder.getVerticesByIndexedProperty("aai-unique-key", dbKey); + queryBuilder.markParentBoundary(); + + if (!(parentName.equals("") || parentName.equals(this.resultResource))) { + URI parentUri = UriBuilder.fromPath(uri.getRawPath().substring(0, uri.getRawPath().indexOf(containerResource))).build(); + this.dbKeyParser = new URIToDBKey(loader, parentUri); + this.parentQueryBuilder = queryBuilder.newInstance().getVerticesByIndexedProperty("aai-unique-key", (String)dbKeyParser.getResult()); + this.parentResourceType = parentName; + } + this.containerResource = ""; + } else { + URI parentUri = UriBuilder.fromPath(uri.getRawPath().substring(0, uri.getRawPath().indexOf(this.finalContainer.getDbName()))).build(); + this.dbKeyParser = new URIToDBKey(loader, parentUri); + String dbKey = (String)dbKeyParser.getResult(); + this.parentResourceType = parentName; + + if (!dbKey.equals("")) { + queryBuilder.getVerticesByIndexedProperty("aai-unique-key", dbKey); + queryBuilder.markParentBoundary(); + queryBuilder.createEdgeTraversal(EdgeType.TREE, previous, finalContainer); + + } + + queryBuilder.createContainerQuery(finalContainer); + + + } + } + + + /** + * Instantiates a new unique URI query parser. + * + * @param loader the loader + * @param queryBuilder the query builder + */ + public UniqueURIQueryParser(Loader loader, QueryBuilder queryBuilder) { + super(loader, queryBuilder); + } + + + /** + * @{inheritDoc} + */ + @Override + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) { + this.resultResource = obj.getDbName(); + if (previous != null) { + this.parentName = previous.getDbName(); + } + this.previous = obj; + + + } + + + /** + * @{inheritDoc} + */ + @Override + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) { + this.containerResource = obj.getName(); + if (previous != null) { + this.parentName = previous.getDbName(); + } + if (isFinalContainer) { + this.endsInContainer = true; + this.resultResource = obj.getChildDBName(); + + this.finalContainer = obj; + } + + } + + /** + * @{inheritDoc} + */ + @Override + public void processNamespace(Introspector obj) { + + } + + /** + * @{inheritDoc} + */ + @Override + public String getCloudRegionTransform() { + return "add"; + } + + /** + * @{inheritDoc} + */ + @Override + public boolean useOriginalLoader() { + return false; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java b/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java new file mode 100644 index 00000000..e6d09fbe --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/relationship/RelationshipToURI.java @@ -0,0 +1,284 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.relationship; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.tinkerpop.gremlin.structure.Direction; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.IntrospectorFactory; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.parsers.exceptions.AAIIdentityMapParseException; +import org.openecomp.aai.parsers.exceptions.AmbiguousMapAAIException; +import org.openecomp.aai.parsers.uri.URIParser; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.serialization.db.EdgeRule; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.serialization.db.EdgeType; +import org.openecomp.aai.workarounds.LegacyURITransformer; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +/** + * The Class RelationshipToURI. + */ +public class RelationshipToURI { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(RelationshipToURI.class); + + private Introspector relationship = null; + + private Loader loader = null; + + private ModelType modelType = null; + + private EdgeRules edgeRules = null; + + private URI uri = null; + + private LegacyURITransformer urlTransform = null; + + /** + * Instantiates a new relationship to URI. + * + * @param loader the loader + * @param relationship the relationship + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public RelationshipToURI(Loader loader, Introspector relationship) throws UnsupportedEncodingException, AAIException { + this.relationship = relationship; + this.modelType = relationship.getModelType(); + this.edgeRules = EdgeRules.getInstance(); + this.loader = loader; + this.urlTransform = LegacyURITransformer.getInstance(); + + this.parse(); + + } + + /** + * Parses the. + * @throws + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + protected void parse() throws AAIException { + String relatedLink = (String)relationship.getValue("related-link"); + Optional<URI> result; + try { + if (loader.getVersion().compareTo(Version.v10) >= 0) { + result = processRelatedLink(relatedLink); + if (!result.isPresent()) { + result = processRelationshipData(); + } + } else { + result = processRelationshipData(); + if (!result.isPresent()) { + result = processRelatedLink(relatedLink); + } + } + if (result.isPresent()) { + this.uri = result.get(); + } else { + throw new AAIIdentityMapParseException("nothing to parse"); + } + } catch (UnsupportedEncodingException | URISyntaxException e) { + throw new AAIIdentityMapParseException("Could not parse relationship-list object: " + e.getMessage(), e); + } + + } + + private Optional<URI> processRelationshipData() throws AAIException, UnsupportedEncodingException { + Optional<URI> result = Optional.empty(); + StringBuilder uriBuilder = new StringBuilder(); + List<Object> data = (List<Object>)relationship.getValue("relationship-data"); + Introspector wrapper; + String key; + String value; + String objectType; + String propertyName; + String topLevelType = null; + String[] split; + HashMap<String, Introspector> map = new HashMap<>(); + for (Object datum : data) { + wrapper = IntrospectorFactory.newInstance(modelType, datum); + key = (String)wrapper.getValue("relationship-key"); + value = (String)wrapper.getValue("relationship-value"); + split = key.split("\\."); + if (split == null || split.length != 2) { + throw new AAIIdentityMapParseException("incorrect format for key must be of the form {node-type}.{property-name}"); + } + //check node name ok + //check prop name ok + objectType = split[0]; + propertyName = split[1]; + + try { + Introspector wrappedObj = loader.introspectorFromName(objectType); + + if (!wrappedObj.hasProperty(propertyName)) { + throw new AAIIdentityMapParseException("invalid property name in map: " + propertyName); + } + if (map.containsKey(objectType)) { + wrappedObj = map.get(objectType); + } else { + map.put(objectType, wrappedObj); + } + if (wrappedObj.getValue(propertyName) == null) { + wrappedObj.setValue(propertyName, value); + } else { + throw new AmbiguousMapAAIException("cannot determine where key/value goes: " + propertyName + "/" + value); + } + + if (wrappedObj.getMetadata(ObjectMetadata.NAMESPACE) != null) { + if (topLevelType == null) { + topLevelType = objectType; + } else if (!topLevelType.equals(objectType)){ + throw new AmbiguousMapAAIException("found two top level nodes of different types: " + topLevelType + " and " + objectType); + } + } + } catch (AAIUnknownObjectException e) { + throw new AAIIdentityMapParseException("invalid object name in map: " + objectType, e); + } + + } + if (!map.isEmpty()) { + String startType = (String)relationship.getValue("related-to"); + List<String> nodeTypes = new ArrayList<>(); + nodeTypes.addAll(map.keySet()); + + String displacedType; + for (int i = 0; i < nodeTypes.size(); i++) { + if (nodeTypes.get(i).equals(startType)) { + displacedType = nodeTypes.set(nodeTypes.size() - 1, startType); + nodeTypes.set(i, displacedType); + break; + } + } + sortRelationships(nodeTypes, startType, 1); + int startTypeIndex = nodeTypes.indexOf(startType); + int topLevelIndex = 0; + if (topLevelType != null) { + topLevelIndex = nodeTypes.indexOf(topLevelType); + } + //remove additional types not needed if they are there + List<String> nodeTypesSubList = nodeTypes; + if (topLevelIndex != 0) { + nodeTypesSubList = nodeTypes.subList(topLevelIndex, startTypeIndex+1); + } + for (String type : nodeTypesSubList) { + uriBuilder.append(map.get(type).getURI()); + } + if (!nodeTypesSubList.isEmpty()) { + result = Optional.of(UriBuilder.fromPath(uriBuilder.toString()).build()); + } + } + return result; + } + + private Optional<URI> processRelatedLink(String relatedLink) throws URISyntaxException, UnsupportedEncodingException, AAIIdentityMapParseException { + Optional<URI> result = Optional.empty(); + if (relatedLink != null) { + URI resultUri = new URI(relatedLink); + String path = resultUri.toString(); + resultUri = UriBuilder.fromPath(resultUri.getRawPath()).build(); + URIParser uriParser = new URIParser(this.loader, resultUri); + try { + uriParser.validate(); + } catch (AAIException e) { + throw new AAIIdentityMapParseException("related link is invalid: " + relatedLink, e); + } + result = Optional.of(resultUri); + } + + return result; + } + + /** + * Sort relationships. + * + * @param data the data + * @param startType the start type + * @param i the i + * @return true, if successful + * @throws AAIException + */ + private boolean sortRelationships(List<String> data, String startType, int i) throws AAIException { + + if (i == data.size()) { + return true; + } + int j; + String objectType; + String displacedObject; + EdgeRule rule; + Direction direction; + for (j = (data.size() - i) - 1; j >= 0; j--) { + objectType = data.get(j); + try { + rule = edgeRules.getEdgeRule(EdgeType.TREE, startType, objectType); + direction = rule.getDirection(); + if (direction != null) { + if ((rule.getIsParent().equals("true") && direction.equals(Direction.IN)) || (rule.getIsParent().equals("reverse") && direction.equals(Direction.OUT))) { + displacedObject = data.set((data.size() - i) - 1, data.get(j)); + data.set(j, displacedObject); + if (sortRelationships(data, objectType, i+1)) { + return true; + } else { + //continue to process + } + } + } + } catch (AAIException e) { + //ignore exceptions generated + continue; + } + } + + + return false; + } + + /** + * Gets the uri. + * + * @return the uri + */ + public URI getUri() { + return uri; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java new file mode 100644 index 00000000..0d24b7c1 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/Parsable.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; + +/** + * The Interface Parsable. + */ +public interface Parsable { + + /** + * Process object. + * + * @param obj the obj + * @param uriKeys the uri keys + * @throws AAIException + */ + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) throws AAIException; + + /** + * Process container. + * + * @param obj the obj + * @param uriKeys the uri keys + * @param isFinalContainer the is final container + * @throws AAIException the AAI exception + */ + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) throws AAIException; + + /** + * Process namespace. + * + * @param obj the obj + */ + public void processNamespace(Introspector obj); + + /** + * Gets the cloud region transform. + * + * @return the cloud region transform + */ + public String getCloudRegionTransform(); + + /** + * Use original loader. + * + * @return true, if successful + */ + public boolean useOriginalLoader(); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java new file mode 100644 index 00000000..87439774 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIParser.java @@ -0,0 +1,249 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.Set; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriBuilder; + +import org.springframework.web.util.UriUtils; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.util.AAIConfig; + + +/** + * The Class URIParser. + */ +public class URIParser { + + private URI uri = null; + + protected Loader loader = null; + + protected Loader originalLoader = null; + + private URI originalURI = null; + + private MultivaluedMap<String, String> queryParams = null; + + + /** + * Instantiates a new URI parser. + * + * @param loader the loader + * @param uri the uri + */ + public URIParser(Loader loader, URI uri) { + this.uri = uri; + + String currentVersion = "v7"; + this.originalLoader = loader; + try { + currentVersion = AAIConfig.get("aai.default.api.version"); + } catch (AAIException e) { + ErrorLogHelper.logException(e); + } + + //Load the latest version because we need it for cloud region + + this.loader = loader; + } + + /** + * Instantiates a new URI parser. + * + * @param loader the loader + * @param uri the uri + * @param queryParams the query params + */ + public URIParser(Loader loader, URI uri, MultivaluedMap<String, String> queryParams) { + this(loader, uri); + this.queryParams = queryParams; + } + + public Loader getLoader() { + + return this.loader; + + } + + /** + * Gets the original URI. + * + * @return the original URI + */ + public URI getOriginalURI() { + return this.originalURI; + } + + /** + * Parses the. + * + * @param p the p + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public void parse(Parsable p) throws UnsupportedEncodingException, AAIException { + try { + boolean isRelative = false; + uri = this.trimURI(uri); + uri = handleCloudRegion(p.getCloudRegionTransform(), uri); + if (p.useOriginalLoader()) { + this.loader = this.originalLoader; + } + this.originalURI = UriBuilder.fromPath(uri.getRawPath()).build(); + if (uri.getRawPath().startsWith("./")) { + uri = new URI(uri.getRawPath().replaceFirst("\\./", "")); + isRelative = true; + } + String[] parts = uri.getRawPath().split("/"); + Introspector validNamespaces = loader.introspectorFromName("inventory"); + Set<String> keys = null; + String part = ""; + Introspector previousObj = null; + + for (int i = 0; i < parts.length;) { + part = parts[i]; + Introspector introspector = null; + introspector = loader.introspectorFromName(part); + if (introspector != null) { + + //previous has current as property + if (previousObj != null && !previousObj.hasChild(introspector) && !previousObj.getDbName().equals("nodes")) { + throw new AAIException("AAI_3001", uri + " not a valid path. " + part + " not valid"); + } else if (previousObj == null) { + String abstractType = introspector.getMetadata(ObjectMetadata.ABSTRACT); + if (abstractType == null) { + abstractType = ""; + } + //first time through, make sure it starts from a namespace + //ignore abstract types + if (!isRelative && !abstractType.equals("true") && !validNamespaces.hasChild(introspector)) { + throw new AAIException("AAI_3000", uri + " not a valid path. It does not start from a valid namespace"); + } + } + + keys = introspector.getKeys(); + if (keys.size() > 0) { + MultivaluedMap<String, String> uriKeys = new MultivaluedHashMap<>(); + i++; + if (i == parts.length && queryParams != null) { + Set<String> queryKeys = queryParams.keySet(); + for (String key : queryKeys) { + uriKeys.put(key, queryParams.get(key)); + } + } else { + for (String key : keys) { + part = UriUtils.decode(parts[i], "UTF-8"); + + introspector.setValue(key, part); + + //skip this for further processing + i++; + } + } + + p.processObject(introspector, uriKeys); + + } else if (introspector.isContainer()) { + boolean isFinalContainer = i == parts.length-1; + MultivaluedMap<String, String> uriKeys = new MultivaluedHashMap<>(); + + if (isFinalContainer && queryParams != null) { + Set<String> queryKeys = queryParams.keySet(); + for (String key : queryKeys) { + uriKeys.put(key, queryParams.get(key)); + + } + } + p.processContainer(introspector, uriKeys, isFinalContainer); + + i++; + } else { + p.processNamespace(introspector); + //namespace case + i++; + } + previousObj = introspector; + } else { + //invalid item found should log + //original said bad path + throw new AAIException("AAI_3001", "invalid item found in path: " + part); + } + } + } catch (AAIException e) { + throw e; + } catch (Exception e) { + throw new AAIException("AAI_3001", e); + } + } + + public boolean validate() throws UnsupportedEncodingException, AAIException { + this.parse(new URIValidate()); + return true; + } + /** + * Handle cloud region. + * + * @param action the action + * @param uri the uri + * @return the uri + */ + protected URI handleCloudRegion(String action, URI uri) { + + return uri; + + } + + /** + * Trim URI. + * + * @param uri the uri + * @return the uri + */ + protected URI trimURI(URI uri) { + + String result = uri.getRawPath(); + if (result.startsWith("/")) { + result = result.substring(1, result.length()); + } + + if (result.endsWith("/")) { + result = result.substring(0, result.length() - 1); + } + + result = result.replaceFirst("aai/v\\d+/", ""); + + return UriBuilder.fromPath(result).build(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java new file mode 100644 index 00000000..e286a532 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToDBKey.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import com.google.common.base.Joiner; + +/** + * Creates a Unique database key from a URI + * + * The key is of the form node-type/key(s). + */ +public class URIToDBKey implements Parsable { + + + private List<String> dbKeys = new ArrayList<>(); + + /** + * Instantiates a new URI to DB key. + * + * @param loader the loader + * @param uri the uri + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + public URIToDBKey(Loader loader, URI uri) throws IllegalArgumentException, AAIException, UnsupportedEncodingException { + + URIParser parser = new URIParser(loader, uri); + parser.parse(this); + } + /* + public URIToDBKey(Version version, String uri) throws IllegalArgumentException { + + super(version, uri); + try { + context = ModelInjestor.getInstance().getContextForVersion(version); + if (context == null) { + throw new IllegalArgumentException("could not find a context for version: " + version); + } + this.parse(); + } catch (Exception e) { + throw new IllegalArgumentException("uri not valid against our model: " + uri); + } + }*/ + + /** + * @{inheritDoc} + */ + @Override + public void processObject (Introspector obj, MultivaluedMap<String, String> uriKeys) { + + dbKeys.add(obj.getDbName()); + + for (String key : uriKeys.keySet()) { + dbKeys.add(uriKeys.getFirst(key).toString()); + } + } + + /** + * @{inheritDoc} + */ + @Override + public void processContainer (Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) { + + } + + /** + * @{inheritDoc} + */ + @Override + public void processNamespace(Introspector obj) { + + } + + /** + * @{inheritDoc} + */ + @Override + public String getCloudRegionTransform() { + return "add"; + } + + /** + * Gets the result. + * + * @return the result + */ + public Object getResult() { + return Joiner.on("/").join(this.dbKeys); + } + + /** + * @{inheritDoc} + */ + @Override + public boolean useOriginalLoader() { + return false; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java new file mode 100644 index 00000000..26cf4a54 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToExtensionInformation.java @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.restcore.HttpMethod; +import com.google.common.base.CaseFormat; +import com.google.common.base.Joiner; + +/** + * The Class URIToExtensionInformation. + */ +public class URIToExtensionInformation implements Parsable { + + private String namespace = ""; + + private String methodName = ""; + + private String topObject = ""; + + private List<String> pieces = null; + + /** + * Instantiates a new URI to extension information. + * + * @param loader the loader + * @param uri the uri + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + public URIToExtensionInformation(Loader loader, URI uri) throws IllegalArgumentException, AAIException, UnsupportedEncodingException { + pieces = new ArrayList<>(); + URIParser parser = new URIParser(loader, uri); + parser.parse(this); + + this.methodName = Joiner.on("").join(this.pieces); + } + + /** + * @{inheritDoc} + */ + @Override + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) { + String upperCamel = toUpperCamel(obj.getDbName()); + if (topObject.equals("")) { + topObject = upperCamel; + } + pieces.add(upperCamel); + + } + + /** + * @{inheritDoc} + */ + @Override + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) { + pieces.add(toUpperCamel(obj.getName())); + } + + /** + * @{inheritDoc} + */ + @Override + public void processNamespace(Introspector obj) { + this.namespace = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, obj.getDbName()); + pieces.add(toUpperCamel(obj.getDbName())); + + } + + /** + * @{inheritDoc} + */ + @Override + public String getCloudRegionTransform() { + return "remove"; + } + + /** + * @{inheritDoc} + */ + @Override + public boolean useOriginalLoader() { + return true; + } + + /** + * Gets the namespace. + * + * @return the namespace + */ + public String getNamespace() { + return this.namespace; + } + + /** + * Gets the top object. + * + * @return the top object + */ + public String getTopObject() { + return this.topObject; + } + + /** + * Gets the method name. + * + * @param httpMethod the http method + * @param isPreprocess the is preprocess + * @return the method name + */ + public String getMethodName(HttpMethod httpMethod, boolean isPreprocess) { + String result = "Dynamic"; + if (httpMethod.equals(HttpMethod.PUT)) { + result += "Add"; + } else if (httpMethod.equals(HttpMethod.DELETE)) { + result += "Del"; + } else { + throw new IllegalArgumentException("http method not supported: " + httpMethod); + } + result += this.methodName; + + if (isPreprocess) { + result += "PreProc"; + } else { + result += "PostProc"; + } + return result; + } + + /** + * To upper camel. + * + * @param name the name + * @return the string + */ + private String toUpperCamel(String name) { + String result = ""; + result = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, name); + return result; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java new file mode 100644 index 00000000..3242adb0 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToObject.java @@ -0,0 +1,229 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.HashMap; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.schema.enums.ObjectMetadata; + +/** + * Given a URI this class returns an object, or series of nested objects + * with their keys populated based off the values in the URI. + * + * It populates the keys in the order they are listed in the model. + * + + * + */ +public class URIToObject implements Parsable { + + + private Introspector topEntity = null; + + private String topEntityName = null; + + private String entityName = null; + + private Introspector entity = null; + + private Introspector previous = null; + + private List<Object> parentList = null; + + private Version version = null; + private Loader loader = null; + private final HashMap<String, Introspector> relatedObjects; + + /** + * Instantiates a new URI to object. + * + * @param loader the loader + * @param uri the uri + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + public URIToObject(Loader loader, URI uri) throws IllegalArgumentException, AAIException, UnsupportedEncodingException { + + URIParser parser = new URIParser(loader, uri); + this.relatedObjects = new HashMap<>(); + + parser.parse(this); + this.loader = parser.getLoader(); + this.version = loader.getVersion(); + } + public URIToObject(Loader loader, URI uri, HashMap<String, Introspector> relatedObjects) throws IllegalArgumentException, AAIException, UnsupportedEncodingException { + + URIParser parser = new URIParser(loader, uri); + this.relatedObjects = relatedObjects; + + parser.parse(this); + this.loader = parser.getLoader(); + this.version = loader.getVersion(); + + } + + /** + * @{inheritDoc} + */ + @Override + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) { + + if (this.entityName == null) { + this.topEntityName = obj.getDbName(); + this.topEntity = obj; + } + this.entityName = obj.getDbName(); + this.entity = obj; + this.parentList = (List<Object>)this.previous.getValue(obj.getName()); + this.parentList.add(entity.getUnderlyingObject()); + + for (String key : uriKeys.keySet()) { + entity.setValue(key, uriKeys.getFirst(key)); + } + try { + if (relatedObjects.containsKey(entity.getObjectId())) { + Introspector relatedObject = relatedObjects.get(entity.getObjectId()); + String nameProp = relatedObject.getMetadata(ObjectMetadata.NAME_PROPS); + if (nameProp == null) { + nameProp = ""; + } + if (nameProp != null && !nameProp.equals("")) { + String[] nameProps = nameProp.split(","); + for (String prop : nameProps) { + entity.setValue(prop, relatedObject.getValue(prop)); + } + } + } + } catch (UnsupportedEncodingException e) { + } + this.previous = entity; + + } + + /** + * @{inheritDoc} + */ + @Override + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) { + + this.previous = obj; + + if (this.entity != null) { + this.entity.setValue(obj.getName(), obj.getUnderlyingObject()); + } else { + this.entity = obj; + this.topEntity = obj; + } + + } + + /** + * @{inheritDoc} + */ + @Override + public void processNamespace(Introspector obj) { + + } + + /** + * @{inheritDoc} + */ + @Override + public String getCloudRegionTransform() { + return "add"; + } + + /** + * @{inheritDoc} + */ + @Override + public boolean useOriginalLoader() { + // TODO Auto-generated method stub + return false; + } + + /** + * Gets the top entity. + * + * @return the top entity + */ + public Introspector getTopEntity() { + return this.topEntity; + } + + /** + * Gets the entity. + * + * @return the entity + */ + public Introspector getEntity() { + return this.entity; + } + + /** + * Gets the parent list. + * + * @return the parent list + */ + public List<Object> getParentList() { + return this.parentList; + } + + /** + * Gets the entity name. + * + * @return the entity name + */ + public String getEntityName() { + return this.entityName; + } + + /** + * Gets the top entity name. + * + * @return the top entity name + */ + public String getTopEntityName() { + return this.topEntityName; + } + + /** + * Gets the object version. + * + * @return the object version + */ + public Version getObjectVersion() { + return this.loader.getVersion(); + } + public Loader getLoader() { + return this.loader; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java new file mode 100644 index 00000000..6888dec6 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIToRelationshipObject.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.util.AAIApiServerURLBase; +import org.openecomp.aai.workarounds.LegacyURITransformer; + +/** + * Given a URI a Relationship Object is returned. + * + * The relationship-data objects are created from the keys in the model. + * The keys are processed in the order they appear in the model. + + * + */ +public class URIToRelationshipObject implements Parsable { + + private Introspector result = null; + + private LegacyURITransformer uriTransformer = null; + + private Version originalVersion = null; + + private Introspector relationship = null; + + private Loader loader = null; + + private String baseURL; + + private final URI uri; + /** + * Instantiates a new URI to relationship object. + * + * @param loader the loader + * @param uri the uri + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws MalformedURLException the malformed URL exception + */ + public URIToRelationshipObject(Loader loader, URI uri) throws AAIException { + + this.loader = loader; + uriTransformer = LegacyURITransformer.getInstance(); + originalVersion = loader.getVersion(); + + try { + relationship = loader.introspectorFromName("relationship"); + } catch (AAIUnknownObjectException e1) { + throw new RuntimeException("Fatal error - could not load relationship object!", e1); + } + + this.baseURL = AAIApiServerURLBase.get(originalVersion); + this.uri = uri; + + } + + public URIToRelationshipObject(Loader loader, URI uri, String baseURL) throws AAIException { + this(loader, uri); + + if (baseURL != null) { + this.baseURL = baseURL; + } + } + + + /** + * @{inheritDoc} + */ + @Override + public String getCloudRegionTransform(){ + return "remove"; + } + + /** + * @{inheritDoc} + */ + @Override + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) { + + + for (String key : obj.getKeys()) { + try { + Introspector data = loader.introspectorFromName("relationship-data"); + data.setValue("relationship-key", obj.getDbName() + "." + key); + data.setValue("relationship-value", obj.getValue(key)); + + ((List<Object>)relationship.getValue("relationship-data")).add(data.getUnderlyingObject()); + } catch (AAIUnknownObjectException e) { + throw new RuntimeException("Fatal error - relationship-data object not found!"); + } + } + relationship.setValue("related-to", obj.getDbName()); + } + + /** + * @{inheritDoc} + */ + @Override + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) { + + } + + /** + * @{inheritDoc} + */ + @Override + public void processNamespace(Introspector obj) { + + } + + /** + * @{inheritDoc} + */ + @Override + public boolean useOriginalLoader() { + return true; + } + + /** + * Gets the result. + * + * @return the result + * @throws AAIException + * @throws UnsupportedEncodingException + * @throws URISyntaxException + */ + public Introspector getResult() throws UnsupportedEncodingException, AAIException, URISyntaxException { + URIParser parser = new URIParser(this.loader, this.uri); + parser.parse(this); + URI originalUri = parser.getOriginalURI(); + + URI relatedLink = new URI(this.baseURL + this.originalVersion + "/" + originalUri); + this.relationship.setValue("related-link", relatedLink); + + + this.result = relationship; + return this.result; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java new file mode 100644 index 00000000..1a7ac0b2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/parsers/uri/URIValidate.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import javax.ws.rs.core.MultivaluedMap; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; + +class URIValidate implements Parsable { + + @Override + public void processObject(Introspector obj, MultivaluedMap<String, String> uriKeys) throws AAIException { + //NO-OP + //just want to make sure this URI has valid tokens + } + + @Override + public void processContainer(Introspector obj, MultivaluedMap<String, String> uriKeys, boolean isFinalContainer) + throws AAIException { + //NO-OP + //just want to make sure this URI has valid tokens + + } + + @Override + public void processNamespace(Introspector obj) { + //NO-OP + //just want to make sure this URI has valid tokens + + } + + @Override + public String getCloudRegionTransform() { + return "none"; + } + + @Override + public boolean useOriginalLoader() { + + return true; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java new file mode 100644 index 00000000..336114f0 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GraphTraversalBuilder.java @@ -0,0 +1,491 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.process.traversal.P; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.EdgeRule; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.serialization.db.EdgeType; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; + +/** + * The Class GraphTraversalBuilder. + */ +public abstract class GraphTraversalBuilder extends QueryBuilder { + + protected GraphTraversal<Vertex, Vertex> traversal = null; + protected Admin<Vertex, Vertex> completeTraversal = null; + private EdgeRules edgeRules = EdgeRules.getInstance(); + + protected int parentStepIndex = 0; + protected int containerStepIndex = 0; + protected int stepIndex = 0; + + /** + * Instantiates a new graph traversal builder. + * + * @param loader the loader + */ + public GraphTraversalBuilder(Loader loader, GraphTraversalSource source) { + super(loader, source); + + traversal = __.start(); + + } + + /** + * Instantiates a new graph traversal builder. + * + * @param loader the loader + * @param start the start + */ + public GraphTraversalBuilder(Loader loader, GraphTraversalSource source, Vertex start) { + super(loader, source, start); + + traversal = __.start(); + + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByIndexedProperty(String key, Object value) { + + return this.getVerticesByProperty(key, value); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByIndexedProperty(String key, List<?> values) { + return this.getVerticesByProperty(key, values); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByProperty(String key, Object value) { + + //this is because the index is registered as an Integer + value = this.correctObjectType(value); + + traversal.has(key, value); + + stepIndex++; + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByProperty(final String key, final List<?> values) { + + //this is because the index is registered as an Integer + List<Object> correctedValues = new ArrayList<>(); + for (Object item : values) { + correctedValues.add(this.correctObjectType(item)); + } + + traversal.has(key, P.within(correctedValues)); + + stepIndex++; + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getChildVerticesFromParent(String parentKey, String parentValue, String childType) { + traversal.has(parentKey, parentValue).has(AAIProperties.NODE_TYPE, childType); + stepIndex++; + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getTypedVerticesByMap(String type, LinkedHashMap<String, String> map) { + + for (String key : map.keySet()) { + traversal.has(key, map.get(key)); + stepIndex++; + } + traversal.has(AAIProperties.NODE_TYPE, type); + stepIndex++; + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder createDBQuery(Introspector obj) { + this.createKeyQuery(obj); + this.createContainerQuery(obj); + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder createKeyQuery(Introspector obj) { + Set<String> keys = obj.getKeys(); + Object val; + for (String key : keys) { + val = obj.getValue(key); + Optional<String> metadata = obj.getPropertyMetadata(key, PropertyMetadata.DB_ALIAS); + if (metadata.isPresent()) { + //use the db name for the field rather than the object model + key = metadata.get(); + } + if (val != null) { + //this is because the index is registered as an Integer + if (val.getClass().equals(Long.class)) { + traversal.has(key,new Integer(val.toString())); + } else { + traversal.has(key, val); + } + stepIndex++; + } + } + return this; + } + + @Override + public QueryBuilder exactMatchQuery(Introspector obj) { + this.createKeyQuery(obj); + allPropertiesQuery(obj); + this.createContainerQuery(obj); + return this; + } + + private void allPropertiesQuery(Introspector obj) { + Set<String> props = obj.getProperties(); + Set<String> keys = obj.getKeys(); + Object val; + for (String prop : props) { + if (obj.isSimpleType(prop) && !keys.contains(prop)) { + val = obj.getValue(prop); + if (val != null) { + Optional<String> metadata = obj.getPropertyMetadata(prop, PropertyMetadata.DB_ALIAS); + if (metadata.isPresent()) { + //use the db name for the field rather than the object model + prop = metadata.get(); + } + //this is because the index is registered as an Integer + if (val != null && val.getClass().equals(Long.class)) { + traversal.has(prop,new Integer(val.toString())); + } else { + traversal.has(prop, val); + } + stepIndex++; + } + } + } + } + + /** + * @{inheritDoc} + */ + @Override + + public QueryBuilder createContainerQuery(Introspector obj) { + String type = obj.getChildDBName(); + String abstractType = obj.getMetadata(ObjectMetadata.ABSTRACT); + if (abstractType != null) { + String[] inheritors = obj.getMetadata(ObjectMetadata.INHERITORS).split(","); + traversal.has(AAIProperties.NODE_TYPE, P.within(inheritors)); + } else { + traversal.has(AAIProperties.NODE_TYPE, type); + } + stepIndex++; + markContainer(); + return this; + } + + /** + * @throws NoEdgeRuleFoundException + * @throws AAIException + * @{inheritDoc} + */ + @Override + public QueryBuilder createEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException, NoEdgeRuleFoundException { + String isAbstractType = parent.getMetadata(ObjectMetadata.ABSTRACT); + if ("true".equals(isAbstractType)) { + markParentBoundary(); + traversal.union(handleAbstractEdge(type, parent, child)); + stepIndex += 1; + } else { + this.edgeQuery(type, parent, child); + } + return this; + + } + + private Traversal<Vertex, Vertex>[] handleAbstractEdge(EdgeType type, Introspector abstractParent, Introspector child) throws AAIException, NoEdgeRuleFoundException { + String childName = child.getDbName(); + String inheritorMetadata = abstractParent.getMetadata(ObjectMetadata.INHERITORS); + String[] inheritors = inheritorMetadata.split(","); + Traversal<Vertex, Vertex>[] unionTraversals = new Traversal[inheritors.length]; + int traversalIndex = 0; + for (int i = 0; i < inheritors.length; i++) { + String inheritor = inheritors[i]; + if (edgeRules.hasEdgeRule(inheritor, childName) || edgeRules.hasEdgeRule(childName, inheritor)) { + EdgeRule rule = edgeRules.getEdgeRule(type, inheritor, childName); + GraphTraversal<Vertex, Vertex> innerTraversal = __.start(); + if (rule.getDirection().equals(Direction.OUT)) { + innerTraversal.out(rule.getLabel()); + } else { + innerTraversal.in(rule.getLabel()); + } + innerTraversal.has(AAIProperties.NODE_TYPE, childName); + unionTraversals[traversalIndex] = innerTraversal; + traversalIndex++; + } + } + if (traversalIndex < inheritors.length) { + Traversal<Vertex, Vertex>[] temp = Arrays.copyOfRange(unionTraversals, 0, traversalIndex); + unionTraversals = temp; + } + return unionTraversals; + } + /** + * @throws NoEdgeRuleFoundException + * @throws AAIException + * @{inheritDoc} + */ + @Override + public QueryBuilder createEdgeTraversal(EdgeType type, Vertex parent, Introspector child) throws AAIException, NoEdgeRuleFoundException { + + String nodeType = parent.<String>property(AAIProperties.NODE_TYPE).orElse(null); + Introspector parentObj = loader.introspectorFromName(nodeType); + this.edgeQuery(type, parentObj, child); + return this; + + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder union(QueryBuilder... builder) { + GraphTraversal<Vertex, Vertex>[] traversals = new GraphTraversal[builder.length]; + for (int i = 0; i < builder.length; i++) { + traversals[i] = (GraphTraversal<Vertex, Vertex>)builder[i].getQuery(); + } + this.traversal.union(traversals); + stepIndex++; + + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder where(QueryBuilder... builder) { + GraphTraversal<Vertex, Vertex>[] traversals = new GraphTraversal[builder.length]; + for (int i = 0; i < builder.length; i++) { + this.traversal.where((GraphTraversal<Vertex, Vertex>)builder[i].getQuery()); + stepIndex++; + } + + return this; + } + + /** + * Edge query. + * + * @param outType the out type + * @param inType the in type + * @throws NoEdgeRuleFoundException + * @throws AAIException + */ + private void edgeQuery(EdgeType type, Introspector outObj, Introspector inObj) throws AAIException, NoEdgeRuleFoundException { + String outType = outObj.getDbName(); + String inType = inObj.getDbName(); + + if (outObj.isContainer()) { + outType = outObj.getChildDBName(); + } + if (inObj.isContainer()) { + inType = inObj.getChildDBName(); + } + markParentBoundary(); + EdgeRule rule = edgeRules.getEdgeRule(type, outType, inType); + if (rule.getDirection().equals(Direction.OUT)) { + traversal.out(rule.getLabel()); + } else { + traversal.in(rule.getLabel()); + } + stepIndex++; + this.createContainerQuery(inObj); + } + + @Override + public QueryBuilder limit(long amount) { + traversal.limit(amount); + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public <T> T getQuery() { + return (T)this.traversal; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getParentQuery() { + + return cloneQueryAtStep(parentStepIndex); + } + + @Override + public QueryBuilder getContainerQuery() { + + if (this.parentStepIndex == 0) { + return removeQueryStepsBetween(0, containerStepIndex); + } else { + return cloneQueryAtStep(containerStepIndex); + } + } + + /** + * @{inheritDoc} + */ + @Override + public void markParentBoundary() { + parentStepIndex = stepIndex; + } + + @Override + public void markContainer() { + containerStepIndex = stepIndex; + } + + + /** + * @{inheritDoc} + */ + @Override + public Vertex getStart() { + return this.start; + } + + protected int getParentStepIndex() { + return parentStepIndex; + } + + protected int getContainerStepIndex() { + return containerStepIndex; + } + + protected int getStepIndex() { + return stepIndex; + } + + protected abstract QueryBuilder cloneQueryAtStep(int index); + /** + * end is exclusive + * + * @param start + * @param end + * @return + */ + protected abstract QueryBuilder removeQueryStepsBetween(int start, int end); + + private void executeQuery() { + + Admin<Vertex, Vertex> admin; + if (start != null) { + admin = source.V(start).asAdmin(); + } else { + admin = source.V().asAdmin(); + + } + + TraversalHelper.insertTraversal(admin.getEndStep(), traversal.asAdmin(), admin); + + this.completeTraversal = admin; + } + + @Override + public boolean hasNext() { + if (this.completeTraversal == null) { + executeQuery(); + } + + return this.completeTraversal.hasNext(); + } + + @Override + public Vertex next() { + if (this.completeTraversal == null) { + executeQuery(); + } + + return this.completeTraversal.next(); + } + + @Override + public List<Vertex> toList() { + if (this.completeTraversal == null) { + executeQuery(); + } + + return this.completeTraversal.toList(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinPipelineBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinPipelineBuilder.java new file mode 100644 index 00000000..d06e1e18 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinPipelineBuilder.java @@ -0,0 +1,214 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +/* +package org.openecomp.aai.query.builder; + +import java.util.LinkedHashMap; +import java.util.List; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.serialization.db.EdgeRule; +import org.openecomp.aai.serialization.db.EdgeRules; + +public abstract class GremlinPipelineBuilder extends QueryBuilder { + + private GremlinPipeline pipeline = null; + private EdgeRules edgeRules = EdgeRules.getInstance(); + private int parentStepIndex = 0; + private int stepIndex = 0; + + public GremlinPipelineBuilder(Loader loader) { + super(loader); + + pipeline = new GremlinPipeline(new IdentityPipe()).V(); + + } + + public GremlinPipelineBuilder(Loader loader, Vertex start) { + super(loader, start); + + pipeline = new GremlinPipeline(start); + + } + + @Override + public QueryBuilder getVerticesByIndexedProperty(String key, Object value) { + + return this.getVerticesByProperty(key, value); + } + + @Override + public QueryBuilder getVerticesByProperty(String key, Object value) { + + //this is because the index is registered as an Integer + if (value != null && value.getClass().equals(Long.class)) { + pipeline.has(key,new Integer(value.toString())); + } else { + pipeline.has(key, value); + } + stepIndex++; + return this; + } + + @Override + public QueryBuilder getChildVerticesFromParent(String parentKey, String parentValue, String childType) { + pipeline.has(parentKey, parentValue).has(AAIProperties.NODE_TYPE, childType); + stepIndex++; + return this; + } + + @Override + public QueryBuilder getTypedVerticesByMap(String type, LinkedHashMap<String, String> map) { + + for (String key : map.keySet()) { + pipeline.has(key, map.get(key)); + stepIndex++; + } + pipeline.has(AAIProperties.NODE_TYPE, type); + stepIndex++; + return this; + } + + @Override + public QueryBuilder createDBQuery(Introspector obj) { + this.createKeyQuery(obj); + this.createContainerQuery(obj); + return this; + } + + @Override + public QueryBuilder createKeyQuery(Introspector obj) { + List<String> keys = obj.getKeys(); + Object val = null; + for (String key : keys) { + val = obj.getValue(key); + //this is because the index is registered as an Integer + if (val != null && val.getClass().equals(Long.class)) { + pipeline.has(key,new Integer(val.toString())); + } else { + pipeline.has(key, val); + } + stepIndex++; + } + return this; + } + + @Override + + public QueryBuilder createContainerQuery(Introspector obj) { + String type = obj.getChildDBName(); + String abstractType = obj.getMetadata("abstract"); + if (abstractType != null) { + String[] inheritors = obj.getMetadata("inheritors").split(","); + GremlinPipeline[] pipes = new GremlinPipeline[inheritors.length]; + for (int i = 0; i < inheritors.length; i++) { + pipes[i] = new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, inheritors[i]); + } + pipeline.or(pipes); + } else { + pipeline.has(AAIProperties.NODE_TYPE, type); + } + stepIndex++; + return this; + } + + @Override + public QueryBuilder createEdgeTraversal(Introspector parent, Introspector child) { + String parentName = parent.getDbName(); + String childName = child.getDbName(); + String isAbstractType = parent.getMetadata("abstract"); + if ("true".equals(isAbstractType)) { + formBoundary(); + pipeline.outE().has("isParent", true).inV(); + } else { + if (parent.isContainer()) { + parentName = parent.getChildDBName(); + } + if (child.isContainer()) { + childName = child.getChildDBName(); + } + this.edgeQuery(parentName, childName); + } + return this; + + } + + @Override + public QueryBuilder createEdgeTraversal(Vertex parent, Introspector child) { + + String nodeType = parent.getProperty(AAIProperties.NODE_TYPE); + this.edgeQuery(nodeType, child.getDbName()); + return this; + + } + + private void edgeQuery(String outType, String inType) { + formBoundary(); + EdgeRule rule; + String label = ""; + try { + rule = edgeRules.getEdgeRule(outType, inType); + label = rule.getLabel(); + } catch (AAIException e) { + // TODO Auto-generated catch block + } + pipeline = pipeline.out(label); + stepIndex++; + } + + @Override + public Object getQuery() { + return this.pipeline; + } + + @Override + public Object getParentQuery() { + GremlinPipeline parent = new GremlinPipeline(); + if (parentStepIndex == 0) { + parentStepIndex = stepIndex; + } + List<Pipe> pipes = this.pipeline.getPipes(); + //add two for the garbage identity pipes + for (int i = 0; i < parentStepIndex + 2; i++) { + parent.add(pipes.get(i)); + } + + return parent; + } + + @Override + public void formBoundary() { + parentStepIndex = stepIndex; + } + + + @Override + public Vertex getStart() { + return this.start; + } + +} +*/ diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinPipelineTraversal.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinPipelineTraversal.java new file mode 100644 index 00000000..c8147ed4 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinPipelineTraversal.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +/* +package org.openecomp.aai.query.builder; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.query.TraversalStrategy; + +public class GremlinPipelineTraversal extends GremlinPipelineBuilder { + + public GremlinPipelineTraversal(Loader loader) { + super(loader); + this.factory = new TraversalStrategy(this.loader, this); + } + + public GremlinPipelineTraversal(Loader loader, Vertex start) { + super(loader, start); + this.factory = new TraversalStrategy(this.loader, this); + } + + @Override + public QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri); + } + + @Override + public QueryParser createQueryFromRelationship(Introspector relationship) throws UnsupportedEncodingException, AAIException { + return factory.buildRelationshipParser(relationship); + } + + @Override + public QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams) + throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri, queryParams); + } + + @Override + public QueryBuilder newInstance(Vertex start) { + return new GremlinPipelineTraversal(loader, start); + } + + @Override + public QueryBuilder newInstance() { + return new GremlinPipelineTraversal(loader); + } + +} +*/ diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java new file mode 100644 index 00000000..9c313ca8 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinQueryBuilder.java @@ -0,0 +1,416 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.restcore.search.GremlinGroovyShellSingleton; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.serialization.db.EdgeRule; +import org.openecomp.aai.serialization.db.EdgeRules; +import org.openecomp.aai.serialization.db.EdgeType; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; +import com.google.common.base.Joiner; + +/** + * The Class GremlinQueryBuilder. + */ +public abstract class GremlinQueryBuilder extends QueryBuilder { + + private EdgeRules edgeRules = EdgeRules.getInstance(); + private GremlinGroovyShellSingleton gremlinGroovy = GremlinGroovyShellSingleton.getInstance(); + private GraphTraversal<?, ?> completeTraversal = null; + protected List<String> list = null; + + protected int parentStepIndex = 0; + protected int containerStepIndex = 0; + protected int stepIndex = 0; + + /** + * Instantiates a new gremlin query builder. + * + * @param loader the loader + */ + public GremlinQueryBuilder(Loader loader, GraphTraversalSource source) { + super(loader, source); + list = new ArrayList<String>(); + } + + /** + * Instantiates a new gremlin query builder. + * + * @param loader the loader + * @param start the start + */ + public GremlinQueryBuilder(Loader loader, GraphTraversalSource source, Vertex start) { + super(loader, source, start); + list = new ArrayList<String>(); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder createDBQuery(Introspector obj) { + this.createKeyQuery(obj); + this.createContainerQuery(obj); + return this; + } + + @Override + public QueryBuilder exactMatchQuery(Introspector obj) { + // TODO not implemented because this is implementation is no longer used + this.createKeyQuery(obj); + //allPropertiesQuery(obj); + this.createContainerQuery(obj); + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByIndexedProperty(String key, Object value) { + return this.getVerticesByProperty(key, value); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByIndexedProperty(String key, List<?> values) { + return this.getVerticesByProperty(key, values); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByProperty(String key, Object value) { + + String term = ""; + if (value != null && !value.getClass().getName().equals("java.lang.String")) { + term = value.toString(); + } else { + term = "'" + value + "'"; + } + list.add(".has('" + key + "', " + term + ")"); + stepIndex++; + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getVerticesByProperty(String key, List<?> values) { + + String term = ""; + String predicate = "P.within(#!#argument#!#)"; + List<String> arguments = new ArrayList<>(); + for (Object item : values) { + if (item != null && !item.getClass().getName().equals("java.lang.String")) { + arguments.add(item.toString()); + } else { + arguments.add("'" + item + "'"); + } + } + String argument = Joiner.on(",").join(arguments); + predicate = predicate.replace("#!#argument#!#", argument); + list.add(".has('" + key + "', " + predicate + ")"); + stepIndex++; + return this; + } + + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getChildVerticesFromParent(String parentKey, String parentValue, String childType) { + /* + String query = ".has('aai-node-type', '" + childType + "')"; + + return this.processGremlinQuery(parentKey, parentValue, query); + */ + //TODO + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getTypedVerticesByMap(String type, LinkedHashMap<String, String> map) { + + for (String key : map.keySet()) { + list.add(".has('" + key + "', '" + map.get(key) + "')"); + stepIndex++; + } + list.add(".has('aai-node-type', '" + type + "')"); + stepIndex++; + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder createKeyQuery(Introspector obj) { + Set<String> keys = obj.getKeys(); + + for (String key : keys) { + + this.getVerticesByProperty(key, obj.<Object>getValue(key)); + + } + return this; + } + + /** + * @throws NoEdgeRuleFoundException + * @throws AAIException + * @{inheritDoc} + */ + @Override + public QueryBuilder createEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException, NoEdgeRuleFoundException { + String parentName = parent.getDbName(); + String childName = child.getDbName(); + if (parent.isContainer()) { + parentName = parent.getChildDBName(); + } + if (child.isContainer()) { + childName = child.getChildDBName(); + } + this.edgeQuery(type, parentName, childName); + return this; + + } + + /** + * @throws NoEdgeRuleFoundException + * @throws AAIException + * @{inheritDoc} + */ + @Override + public QueryBuilder createEdgeTraversal(EdgeType type, Vertex parent, Introspector child) throws AAIException, NoEdgeRuleFoundException { + String nodeType = parent.<String>property(AAIProperties.NODE_TYPE).orElse(null); + this.edgeQuery(type, nodeType, child.getDbName()); + + return this; + + } + + /** + * Edge query. + * + * @param outType the out type + * @param inType the in type + * @throws NoEdgeRuleFoundException + * @throws AAIException + */ + private void edgeQuery(EdgeType type, String outType, String inType) throws AAIException, NoEdgeRuleFoundException { + markParentBoundary(); + EdgeRule rule = edgeRules.getEdgeRule(type, outType, inType); + if (rule.getDirection().equals(Direction.OUT)) { + list.add(".out('" + rule.getLabel() + "')"); + } else { + list.add(".in('" + rule.getLabel() + "')"); + } + list.add(".has('" + AAIProperties.NODE_TYPE + "', '" + inType + "')"); + stepIndex += 2; + } + @Override + public QueryBuilder limit(long amount) { + list.add(".limit(" + amount + ")"); + return this; + } + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder createContainerQuery(Introspector obj) { + String type = obj.getChildDBName(); + String abstractType = obj.getMetadata(ObjectMetadata.ABSTRACT); + if (abstractType != null) { + String[] inheritors = obj.getMetadata(ObjectMetadata.INHERITORS).split(","); + String[] wrapped = new String[inheritors.length]; + StringBuilder command = new StringBuilder(); + command.append("P.within("); + for (int i = 0; i < inheritors.length; i++) { + wrapped[i] = "'" + inheritors[i] + "'"; + } + command.append(Joiner.on(",").join(wrapped)); + command.append(")"); + list.add(".has('aai-node-type', " + command + ")"); + + } else { + list.add(".has('aai-node-type', '" + type + "')"); + } + stepIndex++; + this.markContainer(); + return this; + } + + @Override + public QueryBuilder union(QueryBuilder... builder) { + markParentBoundary(); + String[] traversals = new String[builder.length]; + StringBuilder command = new StringBuilder(); + for (int i = 0; i < builder.length; i++) { + traversals[i] = "__" + (String)builder[i].getQuery(); + } + command.append(".union("); + command.append(Joiner.on(",").join(traversals)); + command.append(")"); + list.add(command.toString()); + stepIndex++; + + return this; + } + + @Override + public QueryBuilder where(QueryBuilder... builder) { + markParentBoundary(); + List<String> traversals = new ArrayList<>(); + for (int i = 0; i < builder.length; i++) { + traversals.add(".where(__" + (String)builder[i].getQuery() + ")"); + stepIndex++; + } + list.addAll(traversals); + + + return this; + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder getParentQuery() { + return cloneQueryAtStep(parentStepIndex); + } + + @Override + public QueryBuilder getContainerQuery() { + return cloneQueryAtStep(containerStepIndex); + } + + /** + * @{inheritDoc} + */ + @Override + public <T> T getQuery() { + StringBuilder sb = new StringBuilder(); + + for (String piece : this.list) { + sb.append(piece); + } + + return (T)sb.toString(); + } + + /** + * @{inheritDoc} + */ + @Override + public void markParentBoundary() { + parentStepIndex = stepIndex; + } + + @Override + public void markContainer() { + this.containerStepIndex = stepIndex; + } + + protected abstract QueryBuilder cloneQueryAtStep(int index); + /** + * @{inheritDoc} + */ + @Override + public Vertex getStart() { + return this.start; + } + + protected int getParentStepIndex() { + return parentStepIndex; + } + + protected int getContainerStepIndex() { + return containerStepIndex; + } + + protected int getStepIndex() { + return stepIndex; + } + + private void executeQuery() { + String queryString = "g" + Joiner.on("").join(list); + Map<String, Object> params = new HashMap<>(); + if (this.start == null) { + params.put("g", source.V()); + } else { + params.put("g", source.V(this.start)); + } + this.completeTraversal = this.gremlinGroovy.executeTraversal(queryString, params); + } + @Override + public boolean hasNext() { + if (this.completeTraversal == null) { + executeQuery(); + } + + return this.completeTraversal.hasNext(); + } + + @Override + public Vertex next() { + if (this.completeTraversal == null) { + executeQuery(); + } + + return (Vertex)this.completeTraversal.next(); + } + + @Override + public List<Vertex> toList() { + if (this.completeTraversal == null) { + executeQuery(); + } + + return (List<Vertex>)this.completeTraversal.toList(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinTraversal.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinTraversal.java new file mode 100644 index 00000000..5b70d43d --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinTraversal.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.query.TraversalStrategy; + +/** + * The Class GremlinTraversal. + */ +public class GremlinTraversal extends GremlinQueryBuilder { + + /** + * Instantiates a new gremlin traversal. + * + * @param loader the loader + */ + public GremlinTraversal(Loader loader, GraphTraversalSource source) { + super(loader, source); + this.factory = new TraversalStrategy(this.loader, this); + } + + /** + * Instantiates a new gremlin traversal. + * + * @param loader the loader + * @param start the start + */ + public GremlinTraversal(Loader loader, GraphTraversalSource source, Vertex start) { + super(loader, source, start); + this.factory = new TraversalStrategy(this.loader, this); + } + + protected GremlinTraversal(List<String> traversal, Loader loader, GraphTraversalSource source, GremlinQueryBuilder gtb) { + super(loader, source); + this.list = traversal; + this.stepIndex = gtb.getStepIndex(); + this.parentStepIndex = gtb.getParentStepIndex(); + this.containerStepIndex = gtb.getContainerStepIndex(); + this.factory = new TraversalStrategy(this.loader, this); + this.start = gtb.getStart(); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromRelationship(Introspector relationship) throws UnsupportedEncodingException, AAIException { + return factory.buildRelationshipParser(relationship); + } + + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams) + throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri, queryParams); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromObjectName(String objName) { + return factory.buildObjectNameParser(objName); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder newInstance(Vertex start) { + return new GremlinTraversal(loader, source, start); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder newInstance() { + return new GremlinTraversal(loader, source); + } + + @Override + protected QueryBuilder cloneQueryAtStep(int index) { + if (index == 0) { + index = stepIndex; + } + List<String> newList = new ArrayList<>(); + for (int i = 0; i < index; i++) { + newList.add(this.list.get(i)); + } + + return new GremlinTraversal(newList, loader, source, this); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinUnique.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinUnique.java new file mode 100644 index 00000000..d9fb06b8 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/GremlinUnique.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.query.TraversalStrategy; +import org.openecomp.aai.parsers.query.UniqueStrategy; + +/** + * The Class GremlinUnique. + */ +public class GremlinUnique extends GremlinQueryBuilder { + + /** + * Instantiates a new gremlin unique. + * + * @param loader the loader + */ + public GremlinUnique(Loader loader, GraphTraversalSource source) { + super(loader, source); + this.factory = new UniqueStrategy(this.loader, this); + } + + /** + * Instantiates a new gremlin unique. + * + * @param loader the loader + * @param start the start + */ + public GremlinUnique(Loader loader, GraphTraversalSource source, Vertex start) { + super(loader, source, start); + this.factory = new UniqueStrategy(this.loader, this); + } + + protected GremlinUnique(List<String> traversal, Loader loader, GraphTraversalSource source, GremlinQueryBuilder gtb) { + super(loader, source); + this.list = traversal; + this.stepIndex = gtb.getStepIndex(); + this.parentStepIndex = gtb.getParentStepIndex(); + this.containerStepIndex = gtb.getContainerStepIndex(); + this.factory = new TraversalStrategy(this.loader, this); + this.start = gtb.getStart(); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromRelationship(Introspector relationship) throws UnsupportedEncodingException, AAIException { + return factory.buildRelationshipParser(relationship); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams) + throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri, queryParams); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromObjectName(String objName) { + return factory.buildObjectNameParser(objName); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder newInstance() { + return new GremlinUnique(loader, source); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder newInstance(Vertex start) { + return new GremlinUnique(loader, source, start); + } + + @Override + protected QueryBuilder cloneQueryAtStep(int index) { + if (index == 0) { + index = stepIndex; + } + List<String> newList = new ArrayList<>(); + for (int i = 0; i < index; i++) { + newList.add(this.list.get(i)); + } + + return new GremlinUnique(newList, loader, source, this); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java new file mode 100644 index 00000000..ad9f3082 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/QueryBuilder.java @@ -0,0 +1,293 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.query.QueryParserStrategy; +import org.openecomp.aai.serialization.db.EdgeType; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; + +/** + * The Class QueryBuilder. + */ +public abstract class QueryBuilder implements Iterator<Vertex> { + + protected QueryParserStrategy factory = null; + + protected Loader loader = null; + + protected boolean optimize = false; + + protected Vertex start = null; + protected final GraphTraversalSource source; + + /** + * Instantiates a new query builder. + * + * @param loader the loader + */ + public QueryBuilder(Loader loader, GraphTraversalSource source) { + this.loader = loader; + this.source = source; + } + + /** + * Instantiates a new query builder. + * + * @param loader the loader + * @param start the start + */ + public QueryBuilder(Loader loader, GraphTraversalSource source, Vertex start) { + this.loader = loader; + this.start = start; + this.source = source; + } + + /** + * Gets the vertices by indexed property. + * + * @param key the key + * @param value the value + * @return the vertices by indexed property + */ + public abstract QueryBuilder getVerticesByIndexedProperty(String key, Object value); + + /** + * Gets the vertices by property. + * + * @param key the key + * @param value the value + * @return the vertices by property + */ + public abstract QueryBuilder getVerticesByProperty(String key, Object value); + + /** + * filters by all the values for this property + * @param key + * @param values + * @return vertices that match these values + */ + public abstract QueryBuilder getVerticesByIndexedProperty(String key, List<?> values); + + /** + * filters by all the values for this property + * @param key + * @param values + * @return vertices that match these values + */ + public abstract QueryBuilder getVerticesByProperty(String key, List<?> values); + + /** + * Gets the child vertices from parent. + * + * @param parentKey the parent key + * @param parentValue the parent value + * @param childType the child type + * @return the child vertices from parent + */ + public abstract QueryBuilder getChildVerticesFromParent(String parentKey, String parentValue, String childType); + + /** + * Gets the typed vertices by map. + * + * @param type the type + * @param map the map + * @return the typed vertices by map + */ + public abstract QueryBuilder getTypedVerticesByMap(String type, LinkedHashMap<String, String> map); + + /** + * Creates the DB query. + * + * @param obj the obj + * @return the query builder + */ + public abstract QueryBuilder createDBQuery(Introspector obj); + + /** + * Creates the key query. + * + * @param obj the obj + * @return the query builder + */ + public abstract QueryBuilder createKeyQuery(Introspector obj); + + /** + * Creates the container query. + * + * @param obj the obj + * @return the query builder + */ + public abstract QueryBuilder createContainerQuery(Introspector obj); + + /** + * Creates the edge traversal. + * + * @param parent the parent + * @param child the child + * @return the query builder + */ + public abstract QueryBuilder createEdgeTraversal(EdgeType type, Introspector parent, Introspector child) throws AAIException; + + /** + * Creates the edge traversal. + * + * @param parent the parent + * @param child the child + * @return the query builder + */ + public abstract QueryBuilder createEdgeTraversal(EdgeType type, Vertex parent, Introspector child) throws AAIException; + + public QueryBuilder createEdgeTraversal(EdgeType type, String outNodeType, String inNodeType) throws NoEdgeRuleFoundException, AAIException { + Introspector out = loader.introspectorFromName(outNodeType); + Introspector in = loader.introspectorFromName(inNodeType); + + return createEdgeTraversal(type, out, in); + } + + /** + * Creates the query from URI. + * + * @param uri the uri + * @return the query parser + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public abstract QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException; + + /** + * Creates the query from URI. + * + * @param uri the uri + * @param queryParams the query params + * @return the query parser + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public abstract QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams) throws UnsupportedEncodingException, AAIException; + + /** + * Creates a queryparser from a given object name. + * + * @param objName - name of the object type as it appears in the database + * @return + */ + public abstract QueryParser createQueryFromObjectName(String objName); + + /** + * Creates the query from relationship. + * + * @param relationship the relationship + * @return the query parser + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public abstract QueryParser createQueryFromRelationship(Introspector relationship) throws UnsupportedEncodingException, AAIException; + + /** + * Gets the parent query. + * + * @return the parent query + */ + public abstract QueryBuilder getParentQuery(); + + /** + * Gets the query. + * + * @return the query + */ + public abstract <T> T getQuery(); + + /** + * Form boundary. + */ + public abstract void markParentBoundary(); + + public abstract QueryBuilder limit(long amount); + /** + * New instance. + * + * @param start the start + * @return the query builder + */ + public abstract QueryBuilder newInstance(Vertex start); + + /** + * New instance. + * + * @return the query builder + */ + public abstract QueryBuilder newInstance(); + + /** + * Gets the start. + * + * @return the start + */ + public abstract Vertex getStart(); + + protected Object correctObjectType(Object obj) { + + if (obj != null && obj.getClass().equals(Long.class)) { + return new Integer(obj.toString()); + } + + return obj; + } + /** + * uses all fields in the introspector to create a query + * + * @param obj + * @return + */ + public abstract QueryBuilder exactMatchQuery(Introspector obj); + + /** + * lets you join any number of QueryBuilders + * <b>be careful about starting with a union it will not use indexes</b> + * @param builder + * @return + */ + public abstract QueryBuilder union(QueryBuilder[] builder); + + public abstract QueryBuilder where(QueryBuilder[] builder); + public abstract void markContainer(); + + public abstract QueryBuilder getContainerQuery(); + + public abstract List<Vertex> toList(); + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/query/builder/TraversalQuery.java b/aai-core/src/main/java/org/openecomp/aai/query/builder/TraversalQuery.java new file mode 100644 index 00000000..84e72860 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/query/builder/TraversalQuery.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.List; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.tinkerpop.gremlin.process.traversal.Step; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.query.TraversalStrategy; + +/** + * The Class TraversalQuery. + */ +public class TraversalQuery extends GraphTraversalBuilder { + + /** + * Instantiates a new traversal query. + * + * @param loader the loader + */ + public TraversalQuery(Loader loader, GraphTraversalSource source) { + super(loader, source); + this.factory = new TraversalStrategy(this.loader, this); + } + + /** + * Instantiates a new traversal query. + * + * @param loader the loader + * @param start the start + */ + public TraversalQuery(Loader loader, GraphTraversalSource source, Vertex start) { + super(loader, source, start); + this.factory = new TraversalStrategy(this.loader, this); + } + + protected TraversalQuery(GraphTraversal<Vertex, Vertex> traversal, Loader loader, GraphTraversalSource source, GraphTraversalBuilder gtb) { + super(loader, source); + this.traversal = traversal; + this.stepIndex = gtb.getStepIndex(); + this.parentStepIndex = gtb.getParentStepIndex(); + this.containerStepIndex = gtb.getContainerStepIndex(); + this.factory = new TraversalStrategy(this.loader, this); + this.start = gtb.getStart(); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromURI(URI uri) throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromRelationship(Introspector relationship) throws UnsupportedEncodingException, AAIException { + return factory.buildRelationshipParser(relationship); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromURI(URI uri, MultivaluedMap<String, String> queryParams) + throws UnsupportedEncodingException, AAIException { + return factory.buildURIParser(uri, queryParams); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryParser createQueryFromObjectName(String objName) { + return factory.buildObjectNameParser(objName); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder newInstance(Vertex start) { + return new TraversalQuery(loader, source, start); + } + + /** + * @{inheritDoc} + */ + @Override + public QueryBuilder newInstance() { + return new TraversalQuery(loader, source); + } + + @Override + protected QueryBuilder cloneQueryAtStep(int index) { + if (index == 0) { + index = stepIndex; + } + GraphTraversal<Vertex, Vertex> clone = this.traversal.asAdmin().clone(); + GraphTraversal.Admin<Vertex, Vertex> cloneAdmin = clone.asAdmin(); + List<Step> steps = cloneAdmin.getSteps(); + + for (int i = steps.size()-1; i >= index; i--) { + cloneAdmin.removeStep(i); + } + return new TraversalQuery(cloneAdmin, loader, source, this); + } + + @Override + protected QueryBuilder removeQueryStepsBetween(int start, int end) { + GraphTraversal<Vertex, Vertex> clone = this.traversal.asAdmin().clone(); + GraphTraversal.Admin<Vertex, Vertex> cloneAdmin = clone.asAdmin(); + + for (int i = end-2; i >= start; i--) { + cloneAdmin.removeStep(i); + } + return new TraversalQuery(cloneAdmin, loader, source, this); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/CustomJacksonJaxBJsonProvider.java b/aai-core/src/main/java/org/openecomp/aai/restcore/CustomJacksonJaxBJsonProvider.java new file mode 100644 index 00000000..b7360b1c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/CustomJacksonJaxBJsonProvider.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore; + +import javax.ws.rs.ext.Provider; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; + +/** + * The Class CustomJacksonJaxBJsonProvider. + */ +@Provider +public class CustomJacksonJaxBJsonProvider extends JacksonJaxbJsonProvider { + + private static ObjectMapper commonMapper = null; + + /** + * Instantiates a new custom jackson jax B json provider. + */ + public CustomJacksonJaxBJsonProvider() { + if (commonMapper == null) { + ObjectMapper mapper = new ObjectMapper(); + + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + mapper.configure(SerializationFeature.INDENT_OUTPUT, false); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + + mapper.registerModule(new JaxbAnnotationModule()); + + commonMapper = mapper; + } + super.setMapper(commonMapper); + } + + /** + * Gets the mapper. + * + * @return the mapper + */ + public ObjectMapper getMapper() { + return commonMapper; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/HttpMethod.java b/aai-core/src/main/java/org/openecomp/aai/restcore/HttpMethod.java new file mode 100644 index 00000000..0acaf35f --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/HttpMethod.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore; + +/** + * The Enum HttpMethod. + */ +public enum HttpMethod { + PUT, + MERGE_PATCH, + DELETE, + PUT_EDGE, + DELETE_EDGE, + GET; +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/JettyObfuscationConversionCommandLineUtil.java b/aai-core/src/main/java/org/openecomp/aai/restcore/JettyObfuscationConversionCommandLineUtil.java new file mode 100644 index 00000000..8a81ee44 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/JettyObfuscationConversionCommandLineUtil.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore; + +import org.apache.commons.cli.BasicParser; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.eclipse.jetty.util.security.Password; + +/* + * The purpose of this class is to be a tool for + * manually applying jetty obfuscation/deobfuscation + * so that one can obfuscate the various passwords/secrets + * in aaiconfig.properties. + * + * Originally, they were being encrypted by a similar + * command line utility, however the encryption key + * was being hardcoded in the src package + * which is a security violation. + * Since this ultimately just moved the problem of how + * to hide secrets to a different secret in a different file, + * and since that encryption was really just being done to + * obfuscate those values in case someone needed to look at + * properties with others looking at their screen, + * we decided that jetty obfuscation would be adequate + * for that task as well as + * removing the "turtles all the way down" secret-to-hide- + * the-secret-to-hide-the-secret problem. + */ +public class JettyObfuscationConversionCommandLineUtil { + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args){ + Options options = new Options(); + options.addOption("e", true, "obfuscate the given string"); + options.addOption("d", true, "deobfuscate the given string"); + + CommandLineParser parser = new BasicParser(); + + try { + CommandLine cmd = parser.parse(options, args); + String toProcess = null; + + if (cmd.hasOption("e")){ + toProcess = cmd.getOptionValue("e"); + String encoded = Password.obfuscate(toProcess); + System.out.println(encoded); + } else if (cmd.hasOption("d")) { + toProcess = cmd.getOptionValue("d"); + String decoded_str = Password.deobfuscate(toProcess); + System.out.println(decoded_str); + } else { + usage(); + } + } catch (ParseException e) { + System.out.println("failed to parse input"); + System.out.println(e.toString()); + usage(); + } catch (Exception e) { + System.out.println("exception:" + e.toString()); + } + } + + /** + * Usage. + */ + private static void usage(){ + System.out.println("usage:");; + System.out.println("-e [string] to obfuscate"); + System.out.println("-d [string] to deobfuscate"); + System.out.println("-h help"); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/MediaType.java b/aai-core/src/main/java/org/openecomp/aai/restcore/MediaType.java new file mode 100644 index 00000000..73cb0f22 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/MediaType.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore; + +/** + * The Enum MediaType. + */ +public enum MediaType { + APPLICATION_JSON_TYPE("application/json"), + APPLICATION_XML_TYPE("application/xml"); + + private final String text; + + /** + * Instantiates a new media type. + * + * @param text the text + */ + private MediaType(final String text) { + this.text = text; + } + + /** + * Gets the enum. + * + * @param value the value + * @return the enum + */ + public static MediaType getEnum(String value) { + + for(MediaType v : values()) { + if(v.toString().equalsIgnoreCase(value)) { + return v; + } + } + + throw new IllegalArgumentException("bad value: " + value); + + } + + /** + * @{inheritDoc} + */ + @Override + public String toString() { + return text; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/RESTAPI.java b/aai-core/src/main/java/org/openecomp/aai/restcore/RESTAPI.java new file mode 100644 index 00000000..59d35ff2 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/RESTAPI.java @@ -0,0 +1,343 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.Joiner; +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.dbmap.DBConnectionType; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.tools.*; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import org.openecomp.aai.util.AAITxnLog; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +/** + * Base class for AAI REST API classes. + * Provides method to validate header information + * TODO should authenticate caller and authorize them for the API they are calling + * TODO should store the transaction + + * + */ +public class RESTAPI { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(RESTAPI.class); + + protected final String COMPONENT = "aairest"; + + /** + * The Enum Action. + */ + public enum Action { + GET, PUT, POST, DELETE + }; + + + public AAITxnLog txn = null; + + /** + * Gets the from app id. + * + * @param headers the headers + * @param logline the logline + * @return the from app id + * @throws AAIException the AAI exception + */ + protected String getFromAppId(HttpHeaders headers) throws AAIException { + String fromAppId = null; + if (headers != null) { + List<String> fromAppIdHeader = headers.getRequestHeader("X-FromAppId"); + if (fromAppIdHeader != null) { + for (String fromAppIdValue : fromAppIdHeader) { + fromAppId = fromAppIdValue; + } + } + } + + if (fromAppId == null) { + throw new AAIException("AAI_4009"); + } + + return fromAppId; + } + + /** + * Gets the trans id. + * + * @param headers the headers + * @param logline the logline + * @return the trans id + * @throws AAIException the AAI exception + */ + protected String getTransId(HttpHeaders headers) throws AAIException { + String transId = null; + if (headers != null) { + List<String> transIdHeader = headers.getRequestHeader("X-TransactionId"); + if (transIdHeader != null) { + for (String transIdValue : transIdHeader) { + transId = transIdValue; + } + } + } + + if (transId == null) { + throw new AAIException("AAI_4010"); + } + + return transId; + } + + + /** + * Gen date. + * + * @return the string + */ + protected String genDate() { + Date date = new Date(); + DateFormat formatter = null; + try { + formatter = new SimpleDateFormat(AAIConfig.get(AAIConstants.HBASE_TABLE_TIMESTAMP_FORMAT)); + } catch (AAIException ex) { + ErrorLogHelper.logException(ex); + } finally { + if (formatter == null) { + formatter = new SimpleDateFormat("YYMMdd-HH:mm:ss:SSS"); + } + } + + return formatter.format(date); + } + + /** + * Gets the media type. + * + * @param mediaTypeList the media type list + * @return the media type + */ + protected String getMediaType(List <MediaType> mediaTypeList) { + String mediaType = MediaType.APPLICATION_JSON; // json is the default + for (MediaType mt : mediaTypeList) { + if (MediaType.APPLICATION_XML_TYPE.isCompatible(mt)) { + mediaType = MediaType.APPLICATION_XML; + } + } + return mediaType; + } + + + /** + * Log transaction. + * + * @param appId the app id + * @param tId the t id + * @param action the action + * @param input the input + * @param rqstTm the rqst tm + * @param respTm the resp tm + * @param request the request + * @param response the response + */ + /* ---------------- Log Transaction into HBase --------------------- */ + public void logTransaction( String appId, String tId, String action, + String input, String rqstTm, String respTm, String request, Response response) { + String respBuf = ""; + int status = 0; + + if (response != null && response.getEntity() != null) { + respBuf = response.getEntity().toString(); + status = response.getStatus(); + } + logTransaction(appId, tId, action, input, rqstTm, respTm, request, respBuf, String.valueOf(status)); + } + + /** + * Log transaction. + * + * @param appId the app id + * @param tId the t id + * @param action the action + * @param input the input + * @param rqstTm the rqst tm + * @param respTm the resp tm + * @param request the request + * @param respBuf the resp buf + * @param status the status + * @param logline the logline + */ + public void logTransaction( String appId, String tId, String action, + String input, String rqstTm, String respTm, String request, String respBuf, String status) { + try { + // we only run this way if we're not doing it in the CXF interceptor + if (!AAIConfig.get(AAIConstants.AAI_LOGGING_HBASE_INTERCEPTOR).equalsIgnoreCase("true")) { + if (AAIConfig.get(AAIConstants.AAI_LOGGING_HBASE_ENABLED).equalsIgnoreCase("true")) { + txn = new AAITxnLog(tId, appId); + // tid, status, rqstTm, respTm, srcId, rsrcId, rsrcType, rqstBuf, respBuf + String hbtid = txn.put(tId, status, + rqstTm, respTm, appId, input, action, request, respBuf); + + LOGGER.debug("HbTransId={}",hbtid); + LOGGER.debug("action={}", action); + LOGGER.debug("urlin={}", input); + } + + } + } catch (AAIException e) { + // i think we do nothing + } + } + + /* ----------helpers for common consumer actions ----------- */ + + /** + * Sets the depth. + * + * @param depthParam the depth param + * @return the int + * @throws AAIException the AAI exception + */ + protected int setDepth(String depthParam) throws AAIException { + int depth = AAIProperties.MAXIMUM_DEPTH; //default + if (depthParam != null && depthParam.length() > 0 && !depthParam.equals("all")){ + try { + depth = Integer.valueOf(depthParam); + } catch (Exception e) { + throw new AAIException("AAI_4016"); + } + } + return depth; + } + + /** + * Consumer exception response generator. + * + * @param headers the headers + * @param info the info + * @param templateAction the template action + * @param e the e + * @return the response + */ + protected Response consumerExceptionResponseGenerator(HttpHeaders headers, UriInfo info, HttpMethod templateAction, AAIException e) { + ArrayList<String> templateVars = new ArrayList<String>(); + templateVars.add(templateAction.toString()); //GET, PUT, etc + templateVars.add(info.getPath().toString()); + templateVars.addAll(e.getTemplateVars()); + + return Response + .status(e.getErrorObject().getHTTPResponseCode()) + .entity(ErrorLogHelper.getRESTAPIErrorResponseWithLogging(headers.getAcceptableMediaTypes(), e, templateVars)) + .build(); + } + + /** + * Validate introspector. + * + * @param obj the obj + * @param loader the loader + * @param uri the uri + * @param validateRequired the validate required + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + protected void validateIntrospector(Introspector obj, Loader loader, URI uri, HttpMethod method) throws AAIException, UnsupportedEncodingException { + + int maximumDepth = AAIProperties.MAXIMUM_DEPTH; + boolean validateRequired = true; + if (method.equals(HttpMethod.MERGE_PATCH)) { + validateRequired = false; + maximumDepth = 0; + } + IntrospectorValidator validator = new IntrospectorValidator.Builder() + .validateRequired(validateRequired) + .restrictDepth(maximumDepth) + .addResolver(new RemoveNonVisibleProperty()) + .addResolver(new CreateUUID()) + .addResolver(new DefaultFields()) + .addResolver(new InjectKeysFromURI(loader, uri)) + .build(); + boolean result = validator.validate(obj); + if (!result) { + result = validator.resolveIssues(); + } + if (!result) { + List<String> messages = new ArrayList<>(); + for (Issue issue : validator.getIssues()) { + if (!issue.isResolved()) { + messages.add(issue.getDetail()); + } + } + String errors = Joiner.on(",").join(messages); + throw new AAIException("AAI_3000", errors); + } + //check that key in payload and key in request uri are the same + String objURI = obj.getURI(); + //if requested object is a parent objURI will have a leading slash the input uri will lack + //this adds that leading slash for the comparison + String testURI = "/" + uri.getRawPath(); + if (!testURI.endsWith(objURI)) { + throw new AAIException("AAI_3000", "uri and payload keys don't match"); + } + } + + protected DBConnectionType determineConnectionType(String fromAppId, String realTime) { + DBConnectionType type = DBConnectionType.REALTIME; + boolean isRealTimeClient = AAIConfig.get("aai.realtime.clients", "").contains(fromAppId); + if (isRealTimeClient || realTime != null) { + type = DBConnectionType.REALTIME; + } else { + type = DBConnectionType.CACHED; + } + + return type; + } + + /** + * Gets the input media type. + * + * @param mediaType the media type + * @return the input media type + */ + protected String getInputMediaType(MediaType mediaType) { + String result = mediaType.getType() + "/" + mediaType.getSubtype(); + + return result; + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/search/GremlinGroovyShellSingleton.java b/aai-core/src/main/java/org/openecomp/aai/restcore/search/GremlinGroovyShellSingleton.java new file mode 100644 index 00000000..b80884b7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/search/GremlinGroovyShellSingleton.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore.search; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.codehaus.groovy.ast.ClassHelper; +import org.codehaus.groovy.ast.expr.ClassExpression; +import org.codehaus.groovy.ast.expr.PropertyExpression; +import org.codehaus.groovy.control.CompilerConfiguration; +import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer; +import org.codehaus.groovy.control.customizers.ImportCustomizer; + +import groovy.lang.Binding; +import groovy.lang.GroovyShell; +import groovy.lang.Script; +import groovy.transform.TimedInterrupt; + +/** + * Creates and returns a groovy shell with the + * configuration to statically import graph classes + * + */ +public class GremlinGroovyShellSingleton { + + private final GroovyShell shell; + private GremlinGroovyShellSingleton() { + Map<String, Object> parameters = new HashMap<>(); + parameters.put("value", 30000); + parameters.put("unit", new PropertyExpression(new ClassExpression(ClassHelper.make(TimeUnit.class)),"MILLISECONDS")); + + ASTTransformationCustomizer custom = new ASTTransformationCustomizer(parameters, TimedInterrupt.class); + ImportCustomizer imports = new ImportCustomizer(); + imports.addStaticStars( + "org.apache.tinkerpop.gremlin.process.traversal.P" + ); + imports.addImports( + "org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__", + "org.apache.tinkerpop.gremlin.structure.T", + "org.apache.tinkerpop.gremlin.process.traversal.P"); + CompilerConfiguration config = new CompilerConfiguration(); + config.addCompilationCustomizers(custom, imports); + + this.shell = new GroovyShell(config); + } + + private static class Helper { + private static final GremlinGroovyShellSingleton INSTANCE = new GremlinGroovyShellSingleton(); + } + + public static GremlinGroovyShellSingleton getInstance() { + + return Helper.INSTANCE; + } + + /** + * @param traversal + * @param params + * @return result of graph traversal + */ + public GraphTraversal<?, ?> executeTraversal (String traversal, Map<String, Object> params) { + Binding binding = new Binding(params); + Script script = shell.parse(traversal); + script.setBinding(binding); + return (GraphTraversal<?, ?>) script.run(); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/util/GenerateEdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/restcore/util/GenerateEdgeRules.java new file mode 100644 index 00000000..3bbe7dec --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/util/GenerateEdgeRules.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore.util; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; + +import java.io.*; +import java.util.*; + +public class GenerateEdgeRules { + + private static final EELFLogger LOG = EELFManager.getInstance().getLogger(GenerateEdgeRules.class); + + public static void main(String[] args) throws IOException, TemplateException { + + String filename = "/AAI8032.csv"; + InputStream inputStream = GenerateEdgeRules.class.getResourceAsStream(filename); + Map<String, Integer> headers = new HashMap<>(); + Map<String, Object> edgeRulesMap = new TreeMap<String, Object>(); + List<Map<String, String>> edgeRules = new ArrayList<>(); + + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + + String line = null; + + int rowNum = 0; + + // Retrieve the header line to map the indexes to their column names + + while ((line = reader.readLine()) != null) { + + if (rowNum == 0) { + headers = retrieveHeaderMap(line); + } else { + String[] columns = line.split(","); + + String originalNode = columns[headers.get("Orig NodeA|NodeB")]; + String finalNode = columns[headers.get("Final NodeA|NodeB")]; + String originalEdge = columns[headers.get("Orig EdgeLabel")]; + String finalEdge = columns[headers.get("Final EdgeLabel")]; + + String lineage = columns[headers.get("Final Lineage")]; + String originalParent = columns[headers.get("Orig ParentOf")]; + String usesResource = columns[headers.get("Revised UsesResource")]; + String hasDelTarget = columns[headers.get("Revised hasDelTarget")]; + String svcInfra = columns[headers.get("Final SVC-INFRA")]; + String svcInfraRev = ""; + + if(usesResource.equals("T")) + usesResource = "true"; + else if(usesResource.equals("F")) + usesResource = "false"; + + if (hasDelTarget.equals("T") || hasDelTarget.equals("AB")) { + hasDelTarget = "true"; + } else if (hasDelTarget.equals("F")) { + hasDelTarget = "false"; + } + + if (svcInfra.equals("T")) { + svcInfra = "true"; + } else if (svcInfra.equals("F")) { + svcInfra = "false"; + } else if (svcInfra.equals("R")) { + svcInfra = "reverse"; + } + + if (originalParent.equals("T")) { + if (lineage.trim().equalsIgnoreCase("CHILD")) { + lineage = "true"; + } else if (lineage.trim().equalsIgnoreCase("PARENT")) { + lineage = "reverse"; + } + } else { + lineage = "false"; + } + + Map<String, String> edgeMap = new HashMap<String, String>(); + + edgeMap.put("lineage", lineage); + edgeMap.put("usesResource", usesResource); + edgeMap.put("hasDelTarget", hasDelTarget); + edgeMap.put("SVC-INFRA", svcInfra); + edgeMap.put("SVC-INFRA-REV", svcInfraRev); + edgeMap.put("nodes", finalNode); + edgeMap.put("edge", finalEdge); + edgeMap.put("direction", columns[headers.get("Orig Direction")]); + edgeMap.put("multiplicity", columns[headers.get("Revised Multiplicity")]); + + edgeRules.add(edgeMap); + + } + ++rowNum; + } + } catch(Exception ex){ + ex.printStackTrace(); + } + + edgeRulesMap.put("edgeRules", edgeRules); + + Collections.sort(edgeRules, new Comparator<Map<String, String>>() { + @Override + public int compare(Map<String, String> o1, Map<String, String> o2) { + return o1.get("nodes").compareTo(o2.get("nodes")); + } + }); + + Configuration configuration = new Configuration(); + Template template = configuration.getTemplate("ajsc-aai/src/main/resources/EdgeRules.ftl"); + Writer file = new FileWriter(new File("ajsc-aai/src/main/resources" + "/" + "EdgeRules.txt")); + template.process(edgeRulesMap, file); + } + + private static Map<String, Integer> retrieveHeaderMap(String line){ + + if(line == null) + throw new NullPointerException(); + + String[] columnNames = line.split(","); + + Map<String, Integer> map = new HashMap<String, Integer>(); + + int index = 0; + + for(String columnName : columnNames){ + map.put(columnName, index++); + } + + return map; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/restcore/util/URITools.java b/aai-core/src/main/java/org/openecomp/aai/restcore/util/URITools.java new file mode 100644 index 00000000..2683240a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/restcore/util/URITools.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.restcore.util; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; + +import org.springframework.web.util.UriUtils; + +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; +import org.openecomp.aai.schema.enums.PropertyMetadata; + +public class URITools { + + protected static final Pattern template = Pattern.compile("\\{(.*?)\\}"); + + public static MultivaluedMap<String, String> getQueryMap(URI uri) { + MultivaluedMap<String, String> result = new MultivaluedHashMap<>(); + String queryParams = uri.getRawQuery(); + if (queryParams != null) { + try { + String[] sections = queryParams.split("&"); + String[] query = null; + String key, value = ""; + for (String section : sections) { + query = section.split("="); + key = UriUtils.decode(query[0], "UTF-8"); + value = UriUtils.decode(query[1], "UTF-8"); + if (result.containsKey(key)) { + result.add(key, value); + } else { + result.putSingle(key, value); + } + } + } catch (UnsupportedEncodingException e ) { + + } + } + return result; + + } + + public static Optional<String> replaceTemplates(Introspector obj, String uriString, PropertyMetadata metadata, boolean replaceWithWildcard) throws AAIMissingRequiredPropertyException { + String result = uriString; + final Map<String, String> propMap = URITools.findProperties(obj, uriString, metadata, replaceWithWildcard); + if (propMap.isEmpty()) { + return Optional.empty(); + } + for (Entry<String, String> entry : propMap.entrySet()) { + result = result.replaceAll("\\{" + entry.getKey() + "\\}", entry.getValue()); + } + //drop out wildcards if they exist + result = result.replaceFirst("/[^/]+?(?:/\\*)+", ""); + return Optional.of(result); + } + + private static Map<String, String> findProperties(Introspector obj, String uriString, PropertyMetadata metadata, boolean replaceWithWildcard) throws AAIMissingRequiredPropertyException { + + final Map<String, String> result = new HashMap<>(); + final Set<String> missing = new LinkedHashSet<>(); + Matcher m = template.matcher(uriString); + int properties = 0; + while (m.find()) { + String propName = m.group(1); + String value = obj.getValue(propName); + properties++; + if (value != null) { + result.put(propName, value); + } else { + if (replaceWithWildcard) { + result.put(propName, "*"); + } + missing.add(propName); + } + } + + if (!missing.isEmpty() && (properties != missing.size())) { + throw new AAIMissingRequiredPropertyException("Cannot complete " + metadata.toString() + " uri. Missing properties " + missing); + } + return result; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java new file mode 100644 index 00000000..fb3300e3 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DBSerializer.java @@ -0,0 +1,1484 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.base.CaseFormat; +import com.thinkaurelius.titan.core.SchemaViolationException; +import org.apache.commons.collections.IteratorUtils; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.*; +import org.javatuples.Pair; +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.*; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.introspection.sideeffect.DataCopy; +import org.openecomp.aai.introspection.sideeffect.DataLinkReader; +import org.openecomp.aai.introspection.sideeffect.DataLinkWriter; +import org.openecomp.aai.introspection.sideeffect.SideEffectRunner; +import org.openecomp.aai.logging.ErrorLogHelper; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.parsers.uri.URIParser; +import org.openecomp.aai.parsers.uri.URIToRelationshipObject; +import org.openecomp.aai.query.builder.QueryBuilder; +import org.openecomp.aai.schema.enums.ObjectMetadata; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import org.openecomp.aai.serialization.tinkerpop.TreeBackedVertex; +import org.openecomp.aai.util.AAIApiServerURLBase; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import org.openecomp.aai.workarounds.NamingExceptions; + +import javax.ws.rs.core.UriBuilder; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +public class DBSerializer { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DBSerializer.class); + + private final TransactionalGraphEngine engine; + private final String sourceOfTruth; + private final ModelType introspectionType; + private final Version version; + private final Loader latestLoader; + private final EdgeRules edgeRules = EdgeRules.getInstance(); + private final Loader loader; + private final String baseURL; + /** + * Instantiates a new DB serializer. + * + * @param version the version + * @param engine the engine + * @param g the g + * @param introspectionType the introspection type + * @param sourceOfTruth the source of truth + * @param llBuilder the ll builder + * @throws AAIException + */ + public DBSerializer(Version version, TransactionalGraphEngine engine, ModelType introspectionType, String sourceOfTruth) throws AAIException { + this.engine = engine; + this.sourceOfTruth = sourceOfTruth; + this.introspectionType = introspectionType; + this.latestLoader = LoaderFactory.createLoaderForVersion(introspectionType, AAIProperties.LATEST); + this.version = version; + this.loader = LoaderFactory.createLoaderForVersion(introspectionType, version); + this.baseURL = AAIApiServerURLBase.get(version); + } + + /** + * Touch standard vertex properties. + * + * @param v the v + * @param isNewVertex the is new vertex + */ + /* + * to be defined and expanded later + */ + public void touchStandardVertexProperties(Vertex v, boolean isNewVertex) { + + long unixTimeNow = System.currentTimeMillis(); + String timeNowInSec = "" + unixTimeNow; + if (isNewVertex) { + v.property(AAIProperties.SOURCE_OF_TRUTH, this.sourceOfTruth); + v.property(AAIProperties.CREATED_TS, timeNowInSec); + } + v.property(AAIProperties.RESOURCE_VERSION, timeNowInSec ); + v.property(AAIProperties.LAST_MOD_TS, timeNowInSec); + v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, this.sourceOfTruth); + + } + + + + /** + * Creates the new vertex. + * + * @param wrappedObject the wrapped object + * @return the vertex + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public Vertex createNewVertex(Introspector wrappedObject) { + + + Vertex v = this.engine.tx().addVertex(); + v.property(AAIProperties.NODE_TYPE, wrappedObject.getDbName()); + touchStandardVertexProperties(v, true); + + return v; + } + + /** + * Trim class name. + * + * @param className the class name + * @return the string + */ + /* + * Removes the classpath from a class name + */ + public String trimClassName (String className) { + String returnValue = ""; + + if (className.lastIndexOf('.') == -1) { + return className; + } + returnValue = className.substring(className.lastIndexOf('.') + 1, className.length()); + + return returnValue; + } + + /** + * Serialize to db. + * + * @param obj the obj + * @param v the v + * @param uriQuery the uri query + * @param identifier the identifier + * @throws SecurityException the security exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws InstantiationException the instantiation exception + * @throws InterruptedException the interrupted exception + * @throws NoSuchMethodException the no such method exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIUnknownObjectException + */ + public void serializeToDb(Introspector obj, Vertex v, QueryParser uriQuery, String identifier, String requestContext) throws AAIException, UnsupportedEncodingException { + + try { + if (uriQuery.isDependent()) { + //try to find the parent + List<Vertex> vertices = uriQuery.getQueryBuilder().getParentQuery().toList(); + if (!vertices.isEmpty()) { + Vertex parent = vertices.get(0); + this.reflectDependentVertex(parent, v, obj, requestContext); + } else { + throw new AAIException("AAI_6114", "No parent Node of type " + uriQuery.getParentResultType() + " for " + identifier); + } + } else { + serializeSingleVertex(v, obj, requestContext); + } + + } catch (SchemaViolationException e) { + throw new AAIException("AAI_6117", e); + } + + } + + public void serializeSingleVertex(Vertex v, Introspector obj, String requestContext) throws UnsupportedEncodingException, AAIException { + try { + boolean isTopLevel = obj.isTopLevel(); + if (isTopLevel) { + v.property(AAIProperties.AAI_URI, obj.getURI()); + } + processObject(obj, v, requestContext); + if (!isTopLevel) { + URI uri = this.getURIForVertex(v); + URIParser parser = new URIParser(this.loader, uri); + if (parser.validate()) { + VertexProperty<String> uriProp = v.property(AAIProperties.AAI_URI); + if (!uriProp.isPresent() || uriProp.isPresent() && !uriProp.value().equals(uri.toString())) { + v.property(AAIProperties.AAI_URI, uri.toString()); + } + } + } + } catch (SchemaViolationException e) { + throw new AAIException("AAI_6117", e); + } + } + + /** + * Process object. + * + * @param <T> the generic type + * @param obj the obj + * @param v the v + * @return the list + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws InstantiationException the instantiation exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIUnknownObjectException + */ + /* + * Helper method for reflectToDb + * Handles all the property setting + */ + private <T> List<Vertex> processObject (Introspector obj, Vertex v, String requestContext) throws UnsupportedEncodingException, AAIException { + Set<String> properties = new LinkedHashSet<>(obj.getProperties()); + properties.remove(AAIProperties.RESOURCE_VERSION); + List<Vertex> dependentVertexes = new ArrayList<>(); + List<Vertex> processedVertexes = new ArrayList<>(); + boolean isComplexType = false; + boolean isListType = false; + this.executePreSideEffects(obj, v); + for (String property : properties) { + Object value = null; + final String propertyType; + propertyType = obj.getType(property); + isComplexType = obj.isComplexType(property); + isListType = obj.isListType(property); + value = obj.getValue(property); + + if (!(isComplexType || isListType)) { + boolean canModify = this.canModify(obj, property, requestContext); + + if (canModify) { + final Map<PropertyMetadata, String> metadata = obj.getPropertyMetadata(property); + String dbProperty = property; + if (metadata.containsKey(PropertyMetadata.DB_ALIAS)) { + dbProperty = metadata.get(PropertyMetadata.DB_ALIAS); + } + if (metadata.containsKey(PropertyMetadata.DATA_LINK)) { + //data linked properties are ephemeral + //they are populated dynamically on GETs + continue; + } + if (value != null) { + if (propertyType.toLowerCase().contains(".long")) { + v.property(dbProperty, new Integer(((Long)value).toString())); + } else { + v.property(dbProperty, value); + } + } else { + v.property(dbProperty).remove(); + } + } + } else if (isListType) { + List<Object> list = (List<Object>)value; + if (obj.isComplexGenericType(property)) { + if (list != null) { + for (Object o : list) { + Introspector child = IntrospectorFactory.newInstance(this.introspectionType, o); + child.setURIChain(obj.getURI()); + processedVertexes.add(reflectDependentVertex(v, child, requestContext)); + } + } + } else { + //simple list case + engine.setListProperty(v, property, list); + } + } else { + //method.getReturnType() is not 'simple' then create a vertex and edge recursively returning an edge back to this method + if (value != null) { //effectively ignore complex properties not included in the object we're processing + if (value.getClass().isArray()) { + + int length = Array.getLength(value); + for (int i = 0; i < length; i ++) { + Object arrayElement = Array.get(value, i); + Introspector child = IntrospectorFactory.newInstance(this.introspectionType, arrayElement); + child.setURIChain(obj.getURI()); + processedVertexes.add(reflectDependentVertex(v, child, requestContext)); + + } + } else if (!property.equals("relationship-list")) { + // container case + Introspector introspector = IntrospectorFactory.newInstance(this.introspectionType, value); + if (introspector.isContainer()) { + dependentVertexes.addAll(this.engine.getQueryEngine().findChildrenOfType(v, introspector.getChildDBName())); + introspector.setURIChain(obj.getURI()); + + processedVertexes.addAll(processObject(introspector, v, requestContext)); + + } else { + dependentVertexes.addAll(this.engine.getQueryEngine().findChildrenOfType(v, introspector.getDbName())); + processedVertexes.add(reflectDependentVertex(v, introspector, requestContext)); + + } + } else if (property.equals("relationship-list")) { + handleRelationships(obj, v); + } + } + } + } + this.writeThroughDefaults(v, obj); + /* handle those vertexes not touched */ + for (Vertex toBeRemoved : processedVertexes) { + dependentVertexes.remove(toBeRemoved); + } + this.deleteItemsWithTraversal(dependentVertexes); + + this.executePostSideEffects(obj, v); + return processedVertexes; + } + + /** + * Handle relationships. + * + * @param obj the obj + * @param vertex the vertex + * @throws SecurityException the security exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + /* + * Handles the explicit relationships defined for an obj + */ + private void handleRelationships(Introspector obj, Vertex vertex) throws UnsupportedEncodingException, AAIException { + + + + Introspector wrappedRl = obj.getWrappedValue("relationship-list"); + processRelationshipList(wrappedRl, vertex); + + + } + + + /** + * Process relationship list. + * + * @param wrapped the wrapped + * @param v the v + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + private void processRelationshipList(Introspector wrapped, Vertex v) throws UnsupportedEncodingException, AAIException { + + List<Object> relationships = (List<Object>)wrapped.getValue("relationship"); + + List<Pair<Vertex, Vertex>> addEdges = new ArrayList<>(); + List<Edge> existingEdges = this.engine.getQueryEngine().findEdgesForVersion(v, wrapped.getLoader()); + + for (Object relationship : relationships) { + Edge e = null; + Vertex cousinVertex = null; + Introspector wrappedRel = IntrospectorFactory.newInstance(this.introspectionType, relationship); + QueryParser parser = engine.getQueryBuilder().createQueryFromRelationship(wrappedRel); + + List<Vertex> results = parser.getQueryBuilder().toList(); + if (results.isEmpty()) { + final AAIException ex = new AAIException("AAI_6129", "Node of type " + parser.getResultType() + ". Could not find object at: " + parser.getUri()); + ex.getTemplateVars().add(parser.getResultType()); + ex.getTemplateVars().add(parser.getUri().toString()); + throw ex; + } else { + //still an issue if there's more than one + cousinVertex = results.get(0); + } + + if (cousinVertex != null) { + try { + e = this.getEdgeBetween(EdgeType.COUSIN, v, cousinVertex); + + if (e == null) { + addEdges.add(new Pair<>(v, cousinVertex)); + } else { + existingEdges.remove(e); + } + } catch (NoEdgeRuleFoundException e1) { + throw new AAIException("AAI_6145"); + } + } + } + + for (Edge edge : existingEdges) { + edge.remove(); + } + for (Pair<Vertex, Vertex> pair : addEdges) { + try { + edgeRules.addEdge(this.engine.asAdmin().getTraversalSource(), pair.getValue0(), pair.getValue1()); + } catch (NoEdgeRuleFoundException e) { + throw new AAIException("AAI_6129", e); + } + } + + } + + /** + * Write through defaults. + * + * @param v the v + * @param obj the obj + * @throws AAIUnknownObjectException + */ + private void writeThroughDefaults(Vertex v, Introspector obj) throws AAIUnknownObjectException { + Introspector latest = this.latestLoader.introspectorFromName(obj.getName()); + if (latest != null) { + Set<String> required = latest.getRequiredProperties(); + + for (String field : required) { + String defaultValue = null; + Object vertexProp = null; + defaultValue = latest.getPropertyMetadata(field).get(PropertyMetadata.DEFAULT_VALUE); + if (defaultValue != null) { + vertexProp = v.<Object>property(field).orElse(null); + if (vertexProp == null) { + v.property(field, defaultValue); + } + } + } + } + + } + + + /** + * Reflect dependent vertex. + * + * @param v the v + * @param dependentObj the dependent obj + * @return the vertex + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws InstantiationException the instantiation exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIUnknownObjectException + */ + private Vertex reflectDependentVertex(Vertex v, Introspector dependentObj, String requestContext) throws AAIException, UnsupportedEncodingException { + + //QueryParser p = this.engine.getQueryBuilder().createQueryFromURI(obj.getURI()); + //List<Vertex> items = p.getQuery().toList(); + QueryBuilder query = this.engine.getQueryBuilder(v); + query.createEdgeTraversal(EdgeType.TREE, v, dependentObj); + query.createKeyQuery(dependentObj); + + List<Vertex> items = query.toList(); + + Vertex dependentVertex = null; + if (items.size() == 1) { + dependentVertex = items.get(0); + this.verifyResourceVersion("update", dependentObj.getDbName(), dependentVertex.<String>property(AAIProperties.RESOURCE_VERSION).orElse(null), (String)dependentObj.getValue(AAIProperties.RESOURCE_VERSION), (String)dependentObj.getURI()); + } else { + this.verifyResourceVersion("create", dependentObj.getDbName(), "", (String)dependentObj.getValue(AAIProperties.RESOURCE_VERSION), (String)dependentObj.getURI()); + dependentVertex = createNewVertex(dependentObj); + } + + return reflectDependentVertex(v, dependentVertex, dependentObj, requestContext); + + } + + /** + * Reflect dependent vertex. + * + * @param parent the parent + * @param child the child + * @param obj the obj + * @return the vertex + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws InstantiationException the instantiation exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIUnknownObjectException + */ + private Vertex reflectDependentVertex(Vertex parent, Vertex child, Introspector obj, String requestContext) throws AAIException, UnsupportedEncodingException { + + String parentUri = parent.<String>property(AAIProperties.AAI_URI).orElse(null); + if (parentUri != null) { + child.property(AAIProperties.AAI_URI, parentUri + obj.getURI()); + } + processObject(obj, child, requestContext); + + Edge e; + e = this.getEdgeBetween(EdgeType.TREE, parent, child); + if (e == null) { + String canBeLinked = obj.getMetadata(ObjectMetadata.CAN_BE_LINKED); + if (canBeLinked != null && canBeLinked.equals("true")) { + boolean isFirst = !this.engine.getQueryBuilder(parent).createEdgeTraversal(EdgeType.TREE, parent, obj).hasNext(); + if (isFirst) { + child.property(AAIProperties.LINKED, true); + } + } + edgeRules.addTreeEdge(this.engine.asAdmin().getTraversalSource(), parent, child); + } + return child; + + } + + /** + * Db to object. + * + * @param vertices the vertices + * @param obj the obj + * @param depth the depth + * @param cleanUp the clean up + * @return the introspector + * @throws AAIException the AAI exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws SecurityException the security exception + * @throws InstantiationException the instantiation exception + * @throws NoSuchMethodException the no such method exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws MalformedURLException the malformed URL exception + * @throws AAIUnknownObjectException + * @throws URISyntaxException + */ + public Introspector dbToObject(List<Vertex> vertices, final Introspector obj, int depth, boolean nodeOnly, String cleanUp) throws UnsupportedEncodingException, AAIException { + + final int internalDepth; + if (depth == Integer.MAX_VALUE) { + internalDepth = depth--; + } else { + internalDepth = depth; + } + if (vertices.size() > 1 && !obj.isContainer()) { + throw new AAIException("AAI_6136", "query object mismatch: this object cannot hold multiple items." + obj.getDbName()); + } else if (obj.isContainer()) { + final List getList; + String listProperty = null; + for (String property : obj.getProperties()) { + if (obj.isListType(property) && obj.isComplexGenericType(property)) { + listProperty = property; + break; + } + } + final String propertyName = listProperty; + getList = (List)obj.getValue(listProperty); + + /* This is an experimental multithreading experiment + * on get alls. + */ + ExecutorService pool = GetAllPool.getInstance().getPool(); + + List<Future<Object>> futures = new ArrayList<>(); + for (Vertex v : vertices) { + Callable<Object> task = () -> { + Set<Vertex> seen = new HashSet<>(); + Introspector childObject = obj.newIntrospectorInstanceOfNestedProperty(propertyName); + Tree<Element> tree = this.engine.getQueryEngine().findSubGraph(v, internalDepth, nodeOnly); + TreeBackedVertex treeVertex = new TreeBackedVertex(v, tree); + dbToObject(childObject, treeVertex, seen, internalDepth, nodeOnly, cleanUp); + return childObject.getUnderlyingObject(); + //getList.add(childObject.getUnderlyingObject()); + }; + futures.add(pool.submit(task)); + } + + for (Future<Object> future : futures) { + try { + getList.add(future.get()); + } catch (ExecutionException e) { + throw new AAIException("AAI_4000", e); + } catch (InterruptedException e) { + throw new AAIException("AAI_4000", e); + } + } + } else if (vertices.size() == 1) { + Set<Vertex> seen = new HashSet<>(); + Tree<Element> tree = this.engine.getQueryEngine().findSubGraph(vertices.get(0), depth, nodeOnly); + TreeBackedVertex treeVertex = new TreeBackedVertex(vertices.get(0), tree); + dbToObject(obj, treeVertex, seen, depth, nodeOnly, cleanUp); + } else { + //obj = null; + } + + + return obj; + } + + /** + * Db to object. + * + * @param obj the obj + * @param v the v + * @param seen the seen + * @param depth the depth + * @param cleanUp the clean up + * @return the introspector + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws SecurityException the security exception + * @throws InstantiationException the instantiation exception + * @throws NoSuchMethodException the no such method exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + * @throws MalformedURLException the malformed URL exception + * @throws AAIUnknownObjectException + * @throws URISyntaxException + */ + private Introspector dbToObject(Introspector obj, Vertex v, Set<Vertex> seen, int depth, boolean nodeOnly, String cleanUp) throws AAIException, UnsupportedEncodingException { + + if (depth < 0) { + return null; + } + depth--; + seen.add(v); + + boolean modified = false; + for (String property : obj.getProperties(PropertyPredicates.isVisible())) { + List<Object> getList = null; + Vertex[] vertices = null; + + if (!(obj.isComplexType(property) || obj.isListType(property))) { + this.copySimpleProperty(property, obj, v); + modified = true; + } else { + if (obj.isComplexType(property)) { + /* container case */ + + if (!property.equals("relationship-list") && depth >= 0) { + Introspector argumentObject = obj.newIntrospectorInstanceOfProperty(property); + Object result = dbToObject(argumentObject, v, seen, depth+1, nodeOnly, cleanUp); + if (result != null) { + obj.setValue(property, argumentObject.getUnderlyingObject()); + modified = true; + } + } else if (property.equals("relationship-list") && !nodeOnly){ + /* relationships need to be handled correctly */ + Introspector relationshipList = obj.newIntrospectorInstanceOfProperty(property); + relationshipList = createRelationshipList(v, relationshipList, cleanUp); + if (relationshipList != null) { + modified = true; + obj.setValue(property, relationshipList.getUnderlyingObject()); + modified = true; + } + + } + } else if (obj.isListType(property)) { + + if (property.equals("any")) { + continue; + } + String genericType = obj.getGenericTypeClass(property).getSimpleName(); + if (obj.isComplexGenericType(property) && depth >= 0) { + final String childDbName = convertFromCamelCase(genericType); + String vType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null); + EdgeRule rule; + + rule = edgeRules.getEdgeRule(EdgeType.TREE, vType, childDbName); + if (rule.getIsParent().equals("true") || rule.getIsParent().equals("reverse")) { + //vertices = this.queryEngine.findRelatedVertices(v, Direction.OUT, rule.getLabel(), childDbName); + Direction ruleDirection = rule.getDirection(); + Iterator<Vertex> itr = v.vertices(ruleDirection, rule.getLabel()); + List<Vertex> verticesList = (List<Vertex>) IteratorUtils.toList(itr); + itr = verticesList.stream().filter(item -> { + return item.property(AAIProperties.NODE_TYPE).orElse("").equals(childDbName); + }).iterator(); + if (itr.hasNext()) { + getList = (List<Object>)obj.getValue(property); + } + int processed = 0; + int removed = 0; + while (itr.hasNext()) { + Vertex childVertex = itr.next(); + if (!seen.contains(childVertex)) { + Introspector argumentObject = obj.newIntrospectorInstanceOfNestedProperty(property); + + Object result = dbToObject(argumentObject, childVertex, seen, depth, nodeOnly, cleanUp); + if (result != null) { + getList.add(argumentObject.getUnderlyingObject()); + } + + processed++; + } else { + removed++; + LOGGER.warn("Cycle found while serializing vertex id={}", childVertex.id().toString()); + } + } + if (processed == 0) { + //vertices were all seen, reset the list + getList = null; + } + if (processed > 0) { + modified = true; + } + } + } else if (obj.isSimpleGenericType(property)) { + List<Object> temp = this.engine.getListProperty(v, property); + if (temp != null) { + getList = (List<Object>)obj.getValue(property); + getList.addAll(temp); + modified = true; + } + + } + + } + + } + } + + //no changes were made to this obj, discard the instance + if (!modified) { + return null; + } + this.enrichData(obj, v); + return obj; + + } + + + public Introspector getVertexProperties(Vertex v) throws AAIException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, UnsupportedEncodingException, AAIUnknownObjectException, URISyntaxException { + String nodeType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null); + if (nodeType == null) { + throw new AAIException("AAI_6143"); + } + Introspector obj = this.latestLoader.introspectorFromName(nodeType); + Set<Vertex> seen = new HashSet<>(); + int depth = 0; + String cleanUp = "false"; + boolean nodeOnly = true; + this.dbToObject(obj, v, seen, depth, nodeOnly, cleanUp); + + return obj; + + } + public Introspector getLatestVersionView(Vertex v) throws AAIException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, UnsupportedEncodingException, AAIUnknownObjectException, URISyntaxException { + String nodeType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null); + if (nodeType == null) { + throw new AAIException("AAI_6143"); + } + Introspector obj = this.latestLoader.introspectorFromName(nodeType); + Set<Vertex> seen = new HashSet<>(); + int depth = AAIProperties.MAXIMUM_DEPTH; + String cleanUp = "false"; + boolean nodeOnly = false; + Tree<Element> tree = this.engine.getQueryEngine().findSubGraph(v, depth, nodeOnly); + TreeBackedVertex treeVertex = new TreeBackedVertex(v, tree); + this.dbToObject(obj, treeVertex, seen, depth, nodeOnly, cleanUp); + + return obj; + } + /** + * Copy simple property. + * + * @param property the property + * @param obj the obj + * @param v the v + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + */ + private void copySimpleProperty(String property, Introspector obj, Vertex v) { + final Map<PropertyMetadata, String> metadata = obj.getPropertyMetadata(property); + String dbPropertyName = property; + if (metadata.containsKey(PropertyMetadata.DB_ALIAS)) { + dbPropertyName = metadata.get(PropertyMetadata.DB_ALIAS); + } + final Object temp = v.<Object>property(dbPropertyName).orElse(null); + if (temp != null) { + + obj.setValue(property, temp); + } + } + + /** + * Simple db to object. + * + * @param obj the obj + * @param v the v + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + */ + private void simpleDbToObject (Introspector obj, Vertex v) { + for (String property : obj.getProperties()) { + + + if (!(obj.isComplexType(property) || obj.isListType(property))) { + this.copySimpleProperty(property, obj, v); + } + } + } + + /** + * Creates the relationship list. + * + * @param v the v + * @param obj the obj + * @param cleanUp the clean up + * @return the object + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + * @throws MalformedURLException the malformed URL exception + * @throws URISyntaxException + */ + private Introspector createRelationshipList(Vertex v, Introspector obj, String cleanUp) throws UnsupportedEncodingException, AAIException { + + + List<Vertex> cousins = this.engine.getQueryEngine().findCousinVertices(v); + + List<Object> relationshipObjList = obj.getValue("relationship"); + + for (Vertex cousin : cousins) { + + Introspector relationshipObj = obj.newIntrospectorInstanceOfNestedProperty("relationship"); + Object result = processEdgeRelationship(relationshipObj, cousin, cleanUp); + if (result != null) { + relationshipObjList.add(result); + } + + } + + if (relationshipObjList.isEmpty()) { + return null; + } else { + return obj; + } + } + + /** + * Process edge relationship. + * + * @param relationshipObj the relationship obj + * @param edge the edge + * @param direction the direction + * @param cleanUp the clean up + * @return the object + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + * @throws MalformedURLException the malformed URL exception + * @throws AAIUnknownObjectException + * @throws URISyntaxException + */ + private Object processEdgeRelationship(Introspector relationshipObj, Vertex cousin, String cleanUp) throws UnsupportedEncodingException, AAIUnknownObjectException { + + + //we must look up all parents in this case because we need to compute name-properties + //we cannot used the cached aaiUri to perform this action currently + Pair<Vertex, List<Introspector>> tuple = this.getParents(relationshipObj.getLoader(), cousin, "true".equals(cleanUp)); + //damaged vertex found, ignore + if (tuple == null) { + return null; + } + List<Introspector> list = tuple.getValue1(); + URI uri = this.getURIFromList(list); + + URIToRelationshipObject uriParser = null; + Introspector result = null; + try { + uriParser = new URIToRelationshipObject(relationshipObj.getLoader(), uri, this.baseURL); + result = uriParser.getResult(); + } catch (AAIException | URISyntaxException e) { + LOGGER.error("Error while processing edge relationship in version " + relationshipObj.getVersion() + " (bad vertex ID=" + tuple.getValue0().id().toString() + ": " + e.getMessage(), e); + if ("true".equals(cleanUp)) { + this.deleteWithTraversal(tuple.getValue0()); + } + return null; + } + return result.getUnderlyingObject(); + } + + /** + * Gets the URI for vertex. + * + * @param v the v + * @return the URI for vertex + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIUnknownObjectException + */ + public URI getURIForVertex(Vertex v) throws UnsupportedEncodingException { + + return getURIForVertex(v, false); + } + + public URI getURIForVertex(Vertex v, boolean overwrite) throws UnsupportedEncodingException { + URI uri = null; + + String aaiUri = v.<String>property(AAIProperties.AAI_URI).orElse(null); + + if (aaiUri != null && !overwrite) { + uri = UriBuilder.fromPath(aaiUri).build(); + } else { + Pair<Vertex, List<Introspector>> tuple = this.getParents(this.loader, v, false); + List<Introspector> list = tuple.getValue1(); + uri = this.getURIFromList(list); + } + return uri; + } + /** + * Gets the URI from list. + * + * @param list the list + * @return the URI from list + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + private URI getURIFromList(List<Introspector> list) throws UnsupportedEncodingException { + String uri = ""; + StringBuilder sb = new StringBuilder(); + for (Introspector i : list) { + sb.insert(0, i.getURI()); + } + + uri = sb.toString(); + URI result = UriBuilder.fromPath(uri).build(); + return result; + } + + /** + * Gets the parents. + * + * @param start the start + * @param removeDamaged the remove damaged + * @return the parents + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIUnknownObjectException + */ + private Pair<Vertex, List<Introspector>> getParents(Loader loader, Vertex start, boolean removeDamaged) { + + List<Vertex> results = this.engine.getQueryEngine().findParents(start); + List<Introspector> objs = new ArrayList<>(); + boolean shortCircuit = false; + for (Vertex v : results) { + String nodeType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null); + Introspector obj = null; + //vertex on the other end of this edge is bad + if (nodeType == null) { + //log something here about what was found and that it was removed + ErrorLogHelper.logError("AAI-6143", "Found a damaged parent vertex " + v.id().toString()); + if (removeDamaged) { + this.deleteWithTraversal(v); + } + shortCircuit = true; + } else { + try { + obj = loader.introspectorFromName(nodeType); + } catch (AAIUnknownObjectException e) { + LOGGER.info("attempted to create node type " + nodeType + " but we do not understand it for version: " + loader.getVersion()); + obj = null; + } + } + + if (obj == null) { + //can't make a valid path because we don't understand this object + // don't include it + } else { + this.simpleDbToObject(obj, v); + objs.add(obj); + } + } + + //stop processing and don't return anything for this bad vertex + if (shortCircuit) { + return null; + } + + return new Pair<>(results.get(results.size()-1), objs); + } + /** + * Takes a list of vertices and a list of objs and assumes they are in + * the order you want the URIs to be nested. + * [A,B,C] creates uris [A, AB, ABC] + * @param vertices + * @param objs + * @throws UnsupportedEncodingException + * @throws URISyntaxException + */ + public void setCachedURIs(List<Vertex> vertices, List<Introspector> objs) throws UnsupportedEncodingException, URISyntaxException { + + String uriChain = ""; + for (int i = 0; i < vertices.size(); i++) { + String aaiUri = ""; + Vertex v = null; + v = vertices.get(i); + aaiUri = v.<String>property(AAIProperties.AAI_URI).orElse(null); + if (aaiUri != null) { + uriChain += aaiUri; + } else { + URI uri = UriBuilder.fromPath(objs.get(i).getURI()).build(); + aaiUri = uri.toString(); + uriChain += aaiUri; + v.property(AAIProperties.AAI_URI, uriChain); + } + } + + + + } + + + /** + * Adds the r + * @throws AAIUnknownObjectException + * @throws IllegalArgumentException elated to property. + * + * @param relationship the relationship + * @param child the throws IllegalArgumentException, AAIUnknownObjectException child + */ + public void addRelatedToProperty(Introspector relationship, Introspector child) throws AAIUnknownObjectException { + String nameProps = child.getMetadata(ObjectMetadata.NAME_PROPS); + List<Introspector> relatedToProperties = new ArrayList<>(); + + if (nameProps != null) { + String[] props = nameProps.split(","); + for (String prop : props) { + Introspector relatedTo = relationship.newIntrospectorInstanceOfNestedProperty("related-to-property"); + relatedTo.setValue("property-key", child.getDbName() + "." + prop); + relatedTo.setValue("property-value", child.getValue(prop)); + relatedToProperties.add(relatedTo); + } + } + + if (relatedToProperties.size() > 0) { + List relatedToList = (List)relationship.getValue("related-to-property"); + for (Introspector obj : relatedToProperties) { + relatedToList.add(obj.getUnderlyingObject()); + } + } + + } + + /** + * Creates the edge. + * + * @param relationship the relationship + * @param inputVertex the input vertex + * @return true, if successful + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public boolean createEdge(Introspector relationship, Vertex inputVertex) throws UnsupportedEncodingException, AAIException { + + Vertex relatedVertex = null; + + QueryParser parser = engine.getQueryBuilder().createQueryFromRelationship(relationship); + + List<Vertex> results = parser.getQueryBuilder().toList(); + if (results.size() == 0) { + AAIException e = new AAIException("AAI_6129", "Node of type " + parser.getResultType() + ". Could not find object at: " + parser.getUri()); + e.getTemplateVars().add(parser.getResultType()); + e.getTemplateVars().add(parser.getUri().toString()); + throw e; + } else { + //still an issue if there's more than one + relatedVertex = results.get(0); + } + + if (relatedVertex != null) { + + Edge e; + try { + e = this.getEdgeBetween(EdgeType.COUSIN, inputVertex, relatedVertex); + if (e == null) { + edgeRules.addEdge(this.engine.asAdmin().getTraversalSource(), inputVertex, relatedVertex); + + } else { + //attempted to link two vertexes already linked + } + } catch (NoEdgeRuleFoundException e1) { + throw new AAIException("AAI_6129", e1); + } + + + + + } + + return true; + } + + /** + * Gets the edges between. + * + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return the edges between + * @throws AAIException the AAI exception + * @throws NoEdgeRuleFoundException + */ + private List<Edge> getEdgesBetween(EdgeType type, Vertex aVertex, Vertex bVertex) throws AAIException, NoEdgeRuleFoundException { + + List<Edge> result = new ArrayList<>(); + + if (bVertex != null) { + EdgeRule rule = edgeRules.getEdgeRule(type, aVertex, bVertex); + GraphTraversal<Vertex, Edge> findEdgesBetween = null; + findEdgesBetween = this.engine.asAdmin().getTraversalSource().V(aVertex).bothE(rule.getLabel()).filter(__.otherV().hasId(bVertex.id())); + List<Edge> edges = findEdgesBetween.toList(); + for (Edge edge : edges) { + if (edge.label().equals(rule.getLabel())) { + result.add(edge); + } + } + + } + + return result; + } + + /** + * Gets the edge between. + * + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return the edge between + * @throws AAIException the AAI exception + * @throws NoEdgeRuleFoundException + */ + private Edge getEdgeBetween(EdgeType type, Vertex aVertex, Vertex bVertex) throws AAIException { + + + + if (bVertex != null) { + + List<Edge> edges = this.getEdgesBetween(type, aVertex, bVertex); + + if (edges.size() > 0) { + return edges.get(0); + } + + } + + return null; + } + + + /** + * Delete edge. + * + * @param relationship the relationship + * @param inputVertex the input vertex + * @return true, if successful + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public boolean deleteEdge(Introspector relationship, Vertex inputVertex) throws UnsupportedEncodingException, AAIException { + + Vertex relatedVertex = null; + + QueryParser parser = engine.getQueryBuilder().createQueryFromRelationship(relationship); + + List<Vertex> results = parser.getQueryBuilder().toList(); + + if (results.size() == 0) { + return false; + } + + relatedVertex = results.get(0); + Edge edge; + try { + edge = this.getEdgeBetween(EdgeType.COUSIN, inputVertex, relatedVertex); + } catch (NoEdgeRuleFoundException e) { + throw new AAIException("AAI_6129", e); + } + if (edge != null) { + edge.remove(); + return true; + } else { + return false; + } + + } + + /** + * Delete items with traversal. + * + * @param vertexes the vertexes + * @throws IllegalStateException the illegal state exception + */ + public void deleteItemsWithTraversal(List<Vertex> vertexes) throws IllegalStateException { + for (Vertex v : vertexes) { + LOGGER.debug("About to delete the vertex with id: " + v.id()); + deleteWithTraversal(v); + } + } + + /** + * Delete with traversal. + * + * @param startVertex the start vertex + */ + public void deleteWithTraversal(Vertex startVertex) { + + List<Vertex> results = this.engine.getQueryEngine().findDeletable(startVertex); + + for (Vertex v : results) { + LOGGER.warn("Removing vertex " + v.id().toString()); + + v.remove(); + } + + } + + /** + * Delete. + * + * @param v the v + * @param resourceVersion the resource version + * @throws IllegalArgumentException the illegal argument exception + * @throws AAIException the AAI exception + * @throws InterruptedException the interrupted exception + */ + public void delete(Vertex v, String resourceVersion, boolean enableResourceVersion) throws IllegalArgumentException, AAIException { + + boolean result = verifyDeleteSemantics(v, resourceVersion, enableResourceVersion); + if (result) { + try { + deleteWithTraversal(v); + } catch (IllegalStateException e) { + throw new AAIException("AAI_6110", e); + } + + } + + } + + + /** + * Verify delete semantics. + * + * @param vertex the vertex + * @param resourceVersion the resource version + * @return true, if successful + * @throws AAIException the AAI exception + */ + private boolean verifyDeleteSemantics(Vertex vertex, String resourceVersion, boolean enableResourceVersion) throws AAIException { + boolean result = false; + String nodeType = ""; + DeleteSemantic semantic = null; + List<Edge> inEdges = null; + List<Edge> outEdges = null; + String errorDetail = " unknown delete semantic found"; + String aaiExceptionCode = ""; + nodeType = vertex.<String>property(AAIProperties.NODE_TYPE).orElse(null); + if (enableResourceVersion && !this.verifyResourceVersion("delete", nodeType, vertex.<String>property(AAIProperties.RESOURCE_VERSION).orElse(null), resourceVersion, nodeType)) { + } + semantic = edgeRules.getDeleteSemantic(nodeType); + inEdges = (List<Edge>) IteratorUtils.toList(vertex.edges(Direction.IN)); + outEdges = (List<Edge>) IteratorUtils.toList(vertex.edges(Direction.OUT)); + if (semantic.equals(DeleteSemantic.CASCADE_TO_CHILDREN)) { + result = true; + } else if (semantic.equals(DeleteSemantic.ERROR_IF_ANY_EDGES)) { + if (inEdges.isEmpty() && outEdges.isEmpty()) { + result = true; + } else { + errorDetail = " Node cannot be deleted because it still has Edges and the " + semantic + " scope was used.\n"; + aaiExceptionCode = "AAI_6110"; + } + } else if (semantic.equals(DeleteSemantic.ERROR_IF_ANY_IN_EDGES) || semantic.equals(DeleteSemantic.ERROR_4_IN_EDGES_OR_CASCADE)) { + + if (inEdges.isEmpty()) { + result = true; + } else { + //are there any cousin edges? + long children = 0; + for (Edge e : inEdges) { + if (e.<Boolean>property("isParent").orElse(false)) { + children++; + } + } + + result = children == inEdges.size(); + } + + if (!result) { + errorDetail = " Node cannot be deleted because it still has Edges and the " + semantic + " scope was used.\n"; + aaiExceptionCode = "AAI_6110"; + } + } else if (semantic.equals(DeleteSemantic.THIS_NODE_ONLY)) { + if (outEdges.isEmpty() && inEdges.isEmpty()) { + result = true; + } else { + result = true; + for (Edge edge : outEdges) { + Object property = edge.<Boolean>property("isParent").orElse(null); + if (property != null && property.equals(Boolean.TRUE)) { + Vertex v = edge.inVertex(); + String vType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null); + errorDetail = " Node cannot be deleted using scope = " + semantic + + " another node (type = " + vType + ") depends on it for uniqueness."; + aaiExceptionCode = "AAI_6110"; + result = false; + break; + } + } + + for (Edge edge : inEdges) { + Object property = edge.<Boolean>property("isParent-REV").orElse(null); + if (property != null && property.equals(Boolean.TRUE)) { + Vertex v = edge.outVertex(); + String vType = v.<String>property(AAIProperties.NODE_TYPE).orElse(null); + errorDetail = " Node cannot be deleted using scope = " + semantic + + " another node (type = " + vType + ") depends on it for uniqueness."; + aaiExceptionCode = "AAI_6110"; + result = false; + break; + } + } + } + } + + + if (!result) { + throw new AAIException(aaiExceptionCode, errorDetail); + } + return result; + } + + /** + * Verify resource version. + * + * @param action the action + * @param nodeType the node type + * @param currentResourceVersion the current resource version + * @param resourceVersion the resource version + * @param uri the uri + * @return true, if successful + * @throws AAIException the AAI exception + */ + public boolean verifyResourceVersion(String action, String nodeType, String currentResourceVersion, String resourceVersion, String uri) throws AAIException { + String enabled = ""; + String errorDetail = ""; + String aaiExceptionCode = ""; + if (currentResourceVersion == null) { + currentResourceVersion = ""; + } + + if (resourceVersion == null) { + resourceVersion = ""; + } + try { + enabled = AAIConfig.get(AAIConstants.AAI_RESVERSION_ENABLEFLAG); + } catch (AAIException e) { + ErrorLogHelper.logException(e); + } + // We're only doing the resource version checks for v5 and later + if (enabled.equals("true") && this.version.compareTo(Version.v8) > 0) { + if (!currentResourceVersion.equals(resourceVersion)) { + if (action.equals("create") && !resourceVersion.equals("")) { + errorDetail = "resource-version passed for " + action + " of " + uri; + aaiExceptionCode = "AAI_6135"; + } else if (resourceVersion.equals("")) { + errorDetail = "resource-version not passed for " + action + " of " + uri; + aaiExceptionCode = "AAI_6130"; + } else { + errorDetail = "resource-version MISMATCH for " + action + " of " + uri; + aaiExceptionCode = "AAI_6131"; + } + + throw new AAIException(aaiExceptionCode, errorDetail); + + } + } + return true; + } + + /** + * Convert from camel case. + * + * @param name the name + * @return the string + */ + private String convertFromCamelCase (String name) { + String result = ""; + result = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, name); + + NamingExceptions exceptions = NamingExceptions.getInstance(); + result = exceptions.getDBName(result); + + return result; + } + + private boolean canModify(Introspector obj, String propName, String requestContext) { + final String readOnly = obj.getPropertyMetadata(propName).get(PropertyMetadata.READ_ONLY); + if (readOnly != null) { + final String[] items = readOnly.split(","); + for (String item : items) { + if (requestContext.equals(item)) { + return false; + } + } + } + return true; + } + + private void executePreSideEffects(Introspector obj, Vertex self) throws AAIException { + + SideEffectRunner runner = new SideEffectRunner + .Builder(this.engine, this).addSideEffect(DataCopy.class).build(); + + runner.execute(obj, self); + } + + private void executePostSideEffects(Introspector obj, Vertex self) throws AAIException { + + SideEffectRunner runner = new SideEffectRunner + .Builder(this.engine, this).addSideEffect(DataLinkWriter.class).build(); + + runner.execute(obj, self); + } + + private void enrichData(Introspector obj, Vertex self) throws AAIException { + + SideEffectRunner runner = new SideEffectRunner + .Builder(this.engine, this).addSideEffect(DataLinkReader.class).build(); + + runner.execute(obj, self); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/DeleteSemantic.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DeleteSemantic.java new file mode 100644 index 00000000..65a39497 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/DeleteSemantic.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + + +/** + * Possible values for deleteScope can be: + * USE_DEFAULT - Get the scope from ref data for this node + * THIS_NODE_ONLY (but should fail if it there are nodes that depend on it for uniqueness) + * CASCADE_TO_CHILDREN - will look for OUT-Edges that have parentOf/hasDelTarget = true and follow those down + * ERROR_4_IN_EDGES_OR_CASCADE - combo of error-if-any-IN-edges + CascadeToChildren + * ERROR_IF_ANY_IN_EDGES - Fail if this node has any existing IN edges + * ERROR_IF_ANY_EDGES - Fail if this node has any existing edges at all! + */ +public enum DeleteSemantic { + USE_DEFAULT, + THIS_NODE_ONLY, + CASCADE_TO_CHILDREN, + ERROR_4_IN_EDGES_OR_CASCADE, + ERROR_IF_ANY_IN_EDGES, + ERROR_IF_ANY_EDGES, +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java new file mode 100644 index 00000000..d7abfdc0 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRule.java @@ -0,0 +1,202 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.tinkerpop.gremlin.structure.Direction; + +public class EdgeRule { + + private String label = ""; + private MultiplicityRule multiplicityRule = null; + private Direction direction = null; + private Map<String, String> edgeProperties = null; + private final String IS_PARENT = "isParent"; + private final String USES_RESOURCE = "usesResource"; + private final String HAS_DEL_TARGET = "hasDelTarget"; + private final String SVC_INFRA = "SVC-INFRA"; + + /** + * Instantiates a new edge rule. + */ + public EdgeRule() { + edgeProperties = new HashMap<>(); + } + + /** + * Gets the label. + * + * @return the label + */ + public String getLabel() { + return label; + } + + /** + * Sets the label. + * + * @param label the new label + */ + public void setLabel(String label) { + this.label = label; + } + + /** + * Gets the multiplicity rule. + * + * @return the multiplicity rule + */ + public MultiplicityRule getMultiplicityRule() { + return multiplicityRule; + } + + /** + * Sets the multiplicity rule. + * + * @param multiplicityRule the new multiplicity rule + */ + public void setMultiplicityRule(MultiplicityRule multiplicityRule) { + this.multiplicityRule = multiplicityRule; + } + + /** + * Gets the direction. + * + * @return the direction + */ + public Direction getDirection() { + return direction; + } + + /** + * Sets the direction. + * + * @param direction the new direction + */ + public void setDirection(Direction direction) { + this.direction = direction; + } + + /** + * Gets the checks if is parent. + * + * @return the checks if is parent + */ + public String getIsParent() { + return this.getProp(this.IS_PARENT); + } + + /** + * Sets the checks if is parent. + * + * @param isParent the new checks if is parent + */ + public void setIsParent(String isParent) { + this.setProp(this.IS_PARENT, isParent); + } + + /** + * Gets the uses resource. + * + * @return the uses resource + */ + public String getUsesResource() { + return this.getProp(this.USES_RESOURCE); + } + + /** + * Sets the uses resource. + * + * @param usesResource the new uses resource + */ + public void setUsesResource(String usesResource) { + this.setProp(this.USES_RESOURCE, usesResource); + } + + /** + * Gets the checks for del target. + * + * @return the checks for del target + */ + public String getHasDelTarget() { + return this.getProp(this.HAS_DEL_TARGET); + } + + /** + * Sets the checks for del target. + * + * @param hasDelTarget the new checks for del target + */ + public void setHasDelTarget(String hasDelTarget) { + this.setProp(this.HAS_DEL_TARGET, hasDelTarget); + } + + /** + * Gets the service infrastructure. + * + * @return the service infrastructure + */ + public String getServiceInfrastructure() { + return this.getProp(this.SVC_INFRA); + } + + /** + * Sets the service infrastructure. + * + * @param serviceInfrastructure the new service infrastructure + */ + public void setServiceInfrastructure(String serviceInfrastructure) { + this.setProp(this.SVC_INFRA, serviceInfrastructure); + } + + /** + * Gets the edge properties. + * + * @return the edge properties + */ + public Map<String, String> getEdgeProperties() { + return this.edgeProperties; + } + + /** + * Sets the prop. + * + * @param key the key + * @param value the value + */ + private void setProp(String key, String value) { + this.edgeProperties.put(key, value); + } + + /** + * Gets the prop. + * + * @param key the key + * @return the prop + */ + private String getProp(String key) { + return this.edgeProperties.get(key); + } + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java new file mode 100644 index 00000000..06dfe564 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java @@ -0,0 +1,379 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.dbmodel.DbEdgeRules; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; + +public class EdgeRules { + + private Multimap<String, String> rules = DbEdgeRules.EdgeRules; + private Multimap<String, String> deleteScope = DbEdgeRules.DefaultDeleteScope; + private final int EDGE_NAME = 0; + private final int DIRECTION = 1; + private final int MULTIPLICITY_RULE = 2; + private final int IS_PARENT = 3; + private final int USES_RESOURCE = 4; + private final int HAS_DEL_TARGET = 5; + private final int SVC_INFRA = 6; + + /** + * Instantiates a new edge rules. + */ + private EdgeRules() { + + } + private static class Helper { + private static final EdgeRules INSTANCE = new EdgeRules(); + + } + + /** + * Gets the single instance of EdgeRules. + * + * @return single instance of EdgeRules + */ + public static EdgeRules getInstance() { + return Helper.INSTANCE; + + } + + /** + * Adds the tree edge. + * + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return the edge + * @throws AAIException the AAI exception + * @throws NoEdgeRuleFoundException + */ + public Edge addTreeEdge(GraphTraversalSource traversalSource, Vertex aVertex, Vertex bVertex) throws AAIException { + return this.addEdge(EdgeType.TREE, traversalSource, aVertex, bVertex); + } + + /** + * Adds the edge. + * + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return the edge + * @throws AAIException the AAI exception + * @throws NoEdgeRuleFoundException + */ + public Edge addEdge(GraphTraversalSource traversalSource, Vertex aVertex, Vertex bVertex) throws AAIException { + return this.addEdge(EdgeType.COUSIN, traversalSource, aVertex, bVertex); + } + + /** + * Adds the edge. + * + * @param type the type + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return the edge + * @throws AAIException the AAI exception + * @throws NoEdgeRuleFoundException + */ + private Edge addEdge(EdgeType type, GraphTraversalSource traversalSource, Vertex aVertex, Vertex bVertex) throws AAIException, NoEdgeRuleFoundException { + + EdgeRule rule = this.getEdgeRule(type, aVertex, bVertex); + + Edge e = null; + if (this.validateMultiplicity(rule, traversalSource, aVertex, bVertex)) { + if (rule.getDirection().equals(Direction.OUT)) { + e = aVertex.addEdge(rule.getLabel(), bVertex); + } else if (rule.getDirection().equals(Direction.IN)) { + e = bVertex.addEdge(rule.getLabel(), aVertex); + } + + this.addProperties(e, rule); + } + return e; + } + + /** + * Adds the properties. + * + * @param edge the edge + * @param rule the rule + */ + public void addProperties(Edge edge, EdgeRule rule) { + + // In DbEdgeRules.EdgeRules -- What we have as "edgeRule" is a comma-delimited set of strings. + // The first item is the edgeLabel. + // The second in the list is always "direction" which is always OUT for the way we've implemented it. + // Items starting at "firstTagIndex" and up are all assumed to be booleans that map according to + // tags as defined in EdgeInfoMap. + // Note - if they are tagged as 'reverse', that means they get the tag name with "-REV" on it + Map<String, String> propMap = rule.getEdgeProperties(); + + for (String key : propMap.keySet()) { + String revKeyname = key + "-REV"; + String triple = propMap.get(key); + if(triple.equals("true")){ + edge.property(key, true); + edge.property(revKeyname,false); + } else if (triple.equals("false")) { + edge.property(key, false); + edge.property(revKeyname,false); + } else if (triple.equals("reverse")) { + edge.property(key, false); + edge.property(revKeyname,true); + } + } + } + + /** + * Checks for edge rule. + * + * @param outType the out type + * @param inType the in type + * @return true, if successful + */ + public boolean hasEdgeRule(String outType, String inType) { + + Collection<String> collection = rules.get(outType + "|" + inType); + + return !collection.isEmpty(); + + } + + /** + * Checks for edge rule. + * + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return true, if successful + */ + public boolean hasEdgeRule(Vertex aVertex, Vertex bVertex) { + String outType = (String)aVertex.<String>property("aai-node-type").orElse(null); + String inType = (String)bVertex.<String>property("aai-node-type").orElse(null); + + return this.hasEdgeRule(outType, inType); + + } + + public Map<String, EdgeRule> getEdgeRules(String outType, String inType) throws AAIException { + Map<String, EdgeRule> result = new HashMap<>(); + EdgeRule rule = null; + for (EdgeType type : EdgeType.values()) { + try { + rule = this.getEdgeRule(type, outType, inType); + result.put(rule.getLabel(), rule); + } catch (NoEdgeRuleFoundException e) { + continue; + } + } + + return result; + } + /** + * Gets the edge rule. + * + * @param outType the out type + * @param inType the in type + * @return the edge rule + * @throws AAIException the AAI exception + */ + public EdgeRule getEdgeRule(EdgeType type, String outType, String inType) throws AAIException { + EdgeRule rule = new EdgeRule(); + Collection<String> collection = null; + boolean isFlipped = false; + if (this.hasEdgeRule(outType, inType) || this.hasEdgeRule(inType, outType)) { + } else { + String detail = "No EdgeRule found for passed nodeTypes: " + outType + ", " + inType + "."; + throw new AAIException("AAI_6120", detail); + } + String key = outType + "|" + inType; + collection = rules.get(key); + + String[] info = null; + Iterator<String> iterator = collection.iterator(); + info = this.findRuleForContext(type, key, iterator); + if (info == null) { //didn't find anything in that order, look again + key = inType + "|" + outType; + collection = rules.get(key); + iterator = collection.iterator(); + info = this.findRuleForContext(type, key, iterator); + isFlipped = true; + } + if (info == null) { + throw new NoEdgeRuleFoundException("No EdgeRule found for EdgeType: " + type + " and node types: " + outType + " " + inType); + } + rule.setLabel(info[this.EDGE_NAME]); + rule.setMultiplicityRule(MultiplicityRule.valueOf(info[this.MULTIPLICITY_RULE].toUpperCase())); + rule.setHasDelTarget(info[this.HAS_DEL_TARGET]); + rule.setUsesResource(info[this.USES_RESOURCE]); + rule.setIsParent(info[this.IS_PARENT]); + rule.setServiceInfrastructure(info[this.SVC_INFRA]); + Direction direction = Direction.valueOf(info[this.DIRECTION]); + if (isFlipped && direction.equals(Direction.OUT)) { + rule.setDirection(Direction.IN); + } else if (isFlipped && direction.equals(Direction.IN)){ + rule.setDirection(Direction.OUT); + } else { + rule.setDirection(direction); + } + + return rule; + } + + private String[] findRuleForContext (EdgeType type, String key, Iterator<String> itr) { + String[] result = null; + String s = ""; + String isParent = ""; + String[] info = new String[10]; + while (itr.hasNext()) { + s = itr.next(); + info = s.split(","); + isParent = info[this.IS_PARENT]; + //lazily stop iterating if we find a match + //should there be a mismatch between type and isParent, + //the caller will receive something. + //this operates on the assumption that there are at most two rules + //for a given vertex pair + if (type.equals(EdgeType.TREE) && (isParent.equals("true") || isParent.equals("reverse"))) { + result = info; + break; + } else if (type.equals(EdgeType.COUSIN) && isParent.equals("false")) { + result = info; + break; + } + } + + + return result; + } + /** + * Gets the edge rule. + * + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return the edge rule + * @throws AAIException the AAI exception + * @throws NoEdgeRuleFoundException + */ + public EdgeRule getEdgeRule(EdgeType type, Vertex aVertex, Vertex bVertex) throws AAIException, NoEdgeRuleFoundException { + String outType = (String)aVertex.<String>property(AAIProperties.NODE_TYPE).orElse(null); + String inType = (String)bVertex.<String>property(AAIProperties.NODE_TYPE).orElse(null); + + return this.getEdgeRule(type, outType, inType); + + + } + + /** + * Gets the delete semantic. + * + * @param nodeType the node type + * @return the delete semantic + */ + public DeleteSemantic getDeleteSemantic(String nodeType) { + Collection<String> semanticCollection = deleteScope.get(nodeType); + String semantic = semanticCollection.iterator().next(); + + return DeleteSemantic.valueOf(semantic); + + } + + /** + * Validate multiplicity. + * + * @param rule the rule + * @param aVertex the out vertex + * @param bVertex the in vertex + * @return true, if successful + * @throws AAIException the AAI exception + */ + private boolean validateMultiplicity(EdgeRule rule, GraphTraversalSource traversalSource, Vertex aVertex, Vertex bVertex) throws AAIException { + + if (rule.getDirection().equals(Direction.OUT)) { + + } else if (rule.getDirection().equals(Direction.IN)) { + Vertex tempV = bVertex; + bVertex = aVertex; + aVertex = tempV; + } + + String aVertexType = aVertex.<String>property(AAIProperties.NODE_TYPE).orElse(null); + String bVertexType = bVertex.<String>property(AAIProperties.NODE_TYPE).orElse(null); + String label = rule.getLabel(); + MultiplicityRule multiplicityRule = rule.getMultiplicityRule(); + List<Edge> outEdges = traversalSource.V(aVertex).outE(label).where(__.inV().has(AAIProperties.NODE_TYPE, bVertexType)).toList(); + List<Edge> inEdges = traversalSource.V(bVertex).inE(label).where(__.outV().has(AAIProperties.NODE_TYPE, aVertexType)).toList(); + String detail = ""; + if (multiplicityRule.equals(MultiplicityRule.ONE2ONE)) { + if (inEdges.size() >= 1 || outEdges.size() >= 1 ) { + detail = "multiplicity rule violated: only one edge can exist with label: " + label + " between " + aVertexType + " and " + bVertexType; + } + } else if (multiplicityRule.equals(MultiplicityRule.ONE2MANY)) { + if (inEdges.size() >= 1) { + detail = "multiplicity rule violated: only one edge can exist with label: " + label + " between " + aVertexType + " and " + bVertexType; + } + } else if (multiplicityRule.equals(MultiplicityRule.MANY2ONE)) { + if (outEdges.size() >= 1) { + detail = "multiplicity rule violated: only one edge can exist with label: " + label + " between " + aVertexType + " and " + bVertexType; + } + } else { + + } + + if (!detail.equals("")) { + throw new AAIException("AAI_6140", detail); + } + + return true; + + } + + public Multimap<String, EdgeRule> getAllRules() throws AAIException { + + Multimap<String, EdgeRule> result = ArrayListMultimap.create(); + + for (String key : this.rules.keySet()) { + String outType = ""; + String inType = ""; + String[] split = key.split("\\|"); + outType = split[0]; + inType = split[1]; + result.putAll(key,this.getEdgeRules(outType, inType).values()); + } + + return result; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeType.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeType.java new file mode 100644 index 00000000..aabd74fe --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeType.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +public enum EdgeType { + COUSIN, + TREE; +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/GetAllPool.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GetAllPool.java new file mode 100644 index 00000000..356f70ae --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GetAllPool.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class GetAllPool { + + private ExecutorService pool; + + private GetAllPool() { + pool = Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors()); + } + + private static class Helper { + private static final GetAllPool INSTANCE = new GetAllPool(); + } + + public static GetAllPool getInstance() { + return Helper.INSTANCE; + } + + public ExecutorService getPool() { + + return this.pool; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java new file mode 100644 index 00000000..9f226dc1 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/GraphSingleton.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.openecomp.aai.dbmap.AAIGraph; +import org.openecomp.aai.dbmap.DBConnectionType; +import com.thinkaurelius.titan.core.TitanGraph; + +/* This class simply calls AAIGraph under the covers for now */ +public class GraphSingleton { + + protected AtomicInteger totalCount = new AtomicInteger(); + + private static class Helper { + private static final GraphSingleton INSTANCE = new GraphSingleton(); + } + + /** + * Gets the single instance of GraphSingleton. + * + * @return single instance of GraphSingleton + */ + public static GraphSingleton getInstance() { + return Helper.INSTANCE; + + } + + /** + * Gets the count. + * + * @return the count + */ + public AtomicInteger getCount() { + return totalCount; + } + + /** + * Gets the tx graph. + * + * @return the tx graph + */ + public TitanGraph getTxGraph() { + return AAIGraph.getInstance().getGraph(); + } + + public TitanGraph getTxGraph(DBConnectionType connectionType) { + return AAIGraph.getInstance().getGraph(connectionType); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java new file mode 100644 index 00000000..841b1b74 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/LegacyDBSerializer.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import org.apache.tinkerpop.gremlin.structure.Graph; + +public class LegacyDBSerializer extends DBSerializer { + + public LegacyDBSerializer(Version version, TransactionalGraphEngine engine, ModelType introspectionType, String sourceOfTruth) throws AAIException { + super(version, engine, introspectionType, sourceOfTruth); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/MultiplicityRule.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/MultiplicityRule.java new file mode 100644 index 00000000..734a44bc --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/MultiplicityRule.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +public enum MultiplicityRule { + MANY2ONE, + ONE2MANY, + ONE2ONE, + MANY2MANY +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/TitanGraphSingleton.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/TitanGraphSingleton.java new file mode 100644 index 00000000..bca2d70c --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/TitanGraphSingleton.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +/* This is class is just a wrapper of its parent */ +public class TitanGraphSingleton extends GraphSingleton { + + private static class Helper { + private static final TitanGraphSingleton INSTANCE = new TitanGraphSingleton(); + } + + /** + * Gets the single instance of TitanGraphSingleton. + * + * @return single instance of TitanGraphSingleton + */ + public static TitanGraphSingleton getInstance() { + return Helper.INSTANCE; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/db/exceptions/NoEdgeRuleFoundException.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/exceptions/NoEdgeRuleFoundException.java new file mode 100644 index 00000000..6647f4d5 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/db/exceptions/NoEdgeRuleFoundException.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db.exceptions; + +import org.openecomp.aai.exceptions.AAIException; + +public class NoEdgeRuleFoundException extends AAIException { + + private static final long serialVersionUID = -906843868234976763L; + + public NoEdgeRuleFoundException(String message) { + super("AAI_6129", message); + } + + public NoEdgeRuleFoundException(Throwable cause) { + super("AAI_6129",cause); + } + + public NoEdgeRuleFoundException(String message, Throwable cause) { + super("AAI_6129", cause, message); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/QueryStyle.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/QueryStyle.java new file mode 100644 index 00000000..acec8dff --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/QueryStyle.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.engines; + +public enum QueryStyle { + GREMLIN_TRAVERSAL, GREMLIN_UNIQUE, GREMLINPIPELINE_TRAVERSAL, TRAVERSAL +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java new file mode 100644 index 00000000..e3e0e857 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TitanDBEngine.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.engines; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; + +import org.openecomp.aai.dbmap.DBConnectionType; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.serialization.db.TitanGraphSingleton; +import com.thinkaurelius.titan.core.TitanVertex; + +public class TitanDBEngine extends TransactionalGraphEngine { + + /** + * Instantiates a new titan DB engine. + * + * @param style the style + * @param loader the loader + */ + public TitanDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) { + super(style, loader, connectionType, TitanGraphSingleton.getInstance()); + } + + /** + * Instantiates a new titan DB engine. + * + * @param style the style + * @param loader the loader + * @param connect the connect + */ + public TitanDBEngine(QueryStyle style, Loader loader, boolean connect) { + super(style, loader); + if (connect) { + this.singleton = TitanGraphSingleton.getInstance(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean setListProperty(Vertex v, String name, List<?> objs) { + + //clear out list full replace style + + Iterator<VertexProperty<Object>> iterator = v.properties(name); + while (iterator.hasNext()) { + iterator.next().remove(); + } + if (objs != null) { + for (Object obj : objs) { + v.property(name, obj); + } + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public List<Object> getListProperty(Vertex v, String name) { + + List<Object> result = new ArrayList<Object>(); + + Iterator<VertexProperty<Object>> iterator = v.properties(name); + + while (iterator.hasNext()) { + result.add(iterator.next().value()); + } + + if (result.size() == 0) { + result = null; + } + + return result; + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java new file mode 100644 index 00000000..7f63c055 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/TransactionalGraphEngine.java @@ -0,0 +1,234 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.engines; + +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.dbmap.DBConnectionType; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.query.builder.GremlinTraversal; +import org.openecomp.aai.query.builder.GremlinUnique; +import org.openecomp.aai.query.builder.QueryBuilder; +import org.openecomp.aai.query.builder.TraversalQuery; +import org.openecomp.aai.serialization.db.GraphSingleton; +import org.openecomp.aai.serialization.engines.query.GraphTraversalQueryEngine; +import org.openecomp.aai.serialization.engines.query.QueryEngine; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; +import com.thinkaurelius.titan.core.schema.TitanManagement; + +public abstract class TransactionalGraphEngine { + + protected GraphSingleton singleton = null; + protected QueryEngine queryEngine = null; + protected QueryBuilder queryBuilder = null; + protected QueryStyle style = null; + protected final DBConnectionType connectionType; + protected final Loader loader; + protected TitanTransaction currentTx = null; + protected GraphTraversalSource currentTraversal = null; + protected GraphTraversalSource readOnlyTraversal = null; + private final Admin admin; + /** + * Instantiates a new transactional graph engine. + * + * @param style the style + * @param loader the loader + */ + public TransactionalGraphEngine (QueryStyle style, Loader loader, DBConnectionType connectionType, GraphSingleton singleton) { + this.loader = loader; + this.style = style; + this.singleton = singleton; + this.connectionType = connectionType; + admin = new Admin(); + + } + + public TransactionalGraphEngine (QueryStyle style, Loader loader) { + this.loader = loader; + this.style = style; + this.connectionType = DBConnectionType.REALTIME; + admin = new Admin(); + } + + /** + * Sets the list property. + * + * @param v the v + * @param name the name + * @param obj the obj + * @return true, if successful + */ + public abstract boolean setListProperty(Vertex v, String name, List<?> obj); + + /** + * Gets the list property. + * + * @param v the v + * @param name the name + * @return the list property + */ + public abstract List<Object> getListProperty(Vertex v, String name); + + /** + * Gets the graph. + * + * @return the graph + */ + private TitanGraph getGraph() { + return singleton.getTxGraph(this.connectionType); + } + + /** + * Gets the count. + * + * @return the count + */ + public AtomicInteger getCount() { + return singleton.getCount(); + } + + + /** + * Gets the query engine. + * + * @return the query engine + */ + public QueryEngine getQueryEngine() { + QueryEngine engine = null; + if (style.equals(QueryStyle.GREMLIN_TRAVERSAL)) { + //this.queryEngine = new GremlinQueryEngine(this); + } else if (style.equals(QueryStyle.GREMLIN_UNIQUE)) { + //this.queryEngine = new GremlinQueryEngine(this); + } else if (style.equals(QueryStyle.GREMLINPIPELINE_TRAVERSAL)) { + //this.queryEngine = new GremlinPipelineQueryEngine(this); + } else if (style.equals(QueryStyle.TRAVERSAL)) { + + return new GraphTraversalQueryEngine(this.asAdmin().getTraversalSource()); + + } else { + throw new IllegalArgumentException("Query Engine type not recognized"); + } + + return engine; + } + + /** + * Gets the query builder. + * + * @return the query builder + */ + public QueryBuilder getQueryBuilder() { + return getQueryBuilder(this.loader); + } + + public QueryBuilder getQueryBuilder(Loader loader) { + if (style.equals(QueryStyle.GREMLIN_TRAVERSAL)) { + return new GremlinTraversal(loader, this.asAdmin().getTraversalSource()); + } else if (style.equals(QueryStyle.GREMLIN_UNIQUE)) { + return new GremlinUnique(loader, this.asAdmin().getTraversalSource()); + } else if (style.equals(QueryStyle.GREMLINPIPELINE_TRAVERSAL)) { + //return new GremlinPipelineTraversal(loader); + } else if (style.equals(QueryStyle.TRAVERSAL)) { + return new TraversalQuery(loader, this.asAdmin().getTraversalSource()); + } else { + throw new IllegalArgumentException("Query Builder type not recognized"); + } + return queryBuilder; + } + /** + * Gets the query builder. + * + * @param start the start + * @return the query builder + */ + public QueryBuilder getQueryBuilder(Vertex start) { + return getQueryBuilder(this.loader, start); + } + + public QueryBuilder getQueryBuilder(Loader loader, Vertex start) { + if (style.equals(QueryStyle.GREMLIN_TRAVERSAL)) { + return new GremlinTraversal(loader, this.asAdmin().getTraversalSource(), start); + } else if (style.equals(QueryStyle.GREMLIN_UNIQUE)) { + return new GremlinUnique(loader, this.asAdmin().getTraversalSource(), start); + } else if (style.equals(QueryStyle.GREMLINPIPELINE_TRAVERSAL)) { + //return new GremlinPipelineTraversal(loader,start); + } else if (style.equals(QueryStyle.TRAVERSAL)) { + return new TraversalQuery(loader, this.asAdmin().getTraversalSource(), start); + } else { + throw new IllegalArgumentException("Query Builder type not recognized"); + } + return queryBuilder; + } + + public TitanTransaction startTransaction() { + if (this.tx() == null) { + this.currentTx = this.getGraph().newTransaction(); + this.currentTraversal = this.tx().traversal(); + this.readOnlyTraversal = this.tx().traversal(GraphTraversalSource.build().with(ReadOnlyStrategy.instance())); + } + return currentTx; + } + + public void rollback() { + if (this.tx() != null) { + this.tx().rollback(); + this.currentTx = null; + this.currentTraversal = null; + this.readOnlyTraversal = null; + } + } + public void commit() { + if (this.tx() != null) { + this.tx().commit(); + this.currentTx = null; + this.currentTraversal = null; + this.readOnlyTraversal = null; + } + } + + public TitanTransaction tx() { + return this.currentTx; + } + + public Admin asAdmin() { + return admin; + } + + public class Admin { + + public GraphTraversalSource getTraversalSource() { + return currentTraversal; + } + public GraphTraversalSource getReadOnlyTraversalSource() { + return readOnlyTraversal; + } + + public TitanManagement getManagementSystem() { + return getGraph().openManagement(); + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java new file mode 100644 index 00000000..2f485b10 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GraphTraversalQueryEngine.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.engines.query; + +import java.util.List; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.process.traversal.P; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.introspection.Loader; + +/* + * This class needs some big explanation despite its compact size. + * This controls all the queries performed by the CRUD API in A&AI. + * findParents, findChildren, and findDeletable require special attention + * These methods use 'repeat'. You cannot use 'emit' with repeat currently + * as it is extremely buggy as of tinkerpop-3.0.1-incubating. The way around + * it (for now) is to sideEffect all the vertices we traverse into an ArrayList. + * + */ +public class GraphTraversalQueryEngine extends QueryEngine { + + /** + * Instantiates a new graph traversal query engine. + * + * @param graphEngine the graph engine + */ + public GraphTraversalQueryEngine(GraphTraversalSource g) { + super(g); + } + + /** + * {@inheritDoc} + */ + @Override + public List<Vertex> findParents(Vertex start) { + + final GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).emit(v -> true).repeat(__.inE().has("isParent", true).outV()); + return pipe.toList(); + } + + /** + * {@inheritDoc} + */ + @Override + public List<Vertex> findAllChildren(Vertex start) { + + GraphTraversal<Vertex, Vertex> pipe = this.g + .V(start).emit(v -> true).repeat(__.outE().has("isParent", true).inV()); + + + return pipe.toList(); + + } + + public List<Vertex> findChildrenOfType(Vertex start, String type) { + GraphTraversal<Vertex, Vertex> pipe = this.g.V(start).union( + __.outE().has("isParent", true).inV(), + __.inE().has("isParent-REV", true).outV() + ).has(AAIProperties.NODE_TYPE, type).dedup(); + + return pipe.toList(); + } + + /** + * {@inheritDoc} + */ + @Override + public List<Vertex> findDeletable(Vertex start) { + GraphTraversal<Vertex, Vertex> pipe = this.g + .V(start).emit(v -> true).repeat(__.outE().or( + __.has("isParent", true), + __.has("hasDelTarget", true)).inV()); + + return pipe.toList(); + } + + /** + * {@inheritDoc} + */ + @Override + public List<Vertex> findRelatedVertices(Vertex start, Direction direction, String label, String nodeType) { + GraphTraversal<Vertex, Vertex> pipe = this.g.V(start); + switch (direction) { + case OUT: + pipe.out(label); + break; + case IN: + pipe.in(label); + break; + case BOTH: + pipe.both(label); + break; + default: + break; + } + + pipe.has(AAIProperties.NODE_TYPE, nodeType).dedup(); + return pipe.toList(); + } + + @Override + public Tree<Element> findSubGraph(Vertex start, int iterations, boolean nodeOnly) { + final GraphTraversal<Vertex, ?> t = this.g.V(start).emit(v -> true).times(iterations).repeat( + __.outE().has("isParent", true).inV()); + + if (!nodeOnly) { + t.union( + __.identity(), + __.bothE().has("isParent", false).dedup().otherV() + ); + } + t.tree(); + if (t.hasNext()) { + return (Tree)t.next(); + } else { + return new Tree(); + } + } + + @Override + public List<Edge> findEdgesForVersion(Vertex start, Loader loader) { + final Set<String> objects = loader.getAllObjects().keySet(); + GraphTraversal<Vertex, Edge> pipeline = this.g.V(start).union( + __.inE().has("isParent", false).has("isParent-REV", false).where(__.outV().has(AAIProperties.NODE_TYPE, P.within(objects))), + __.outE().has("isParent", false).has("isParent-REV", false).where(__.inV().has(AAIProperties.NODE_TYPE, P.within(objects))) + ).dedup(); + + return pipeline.toList(); + } + + + @Override + public List<Vertex> findCousinVertices(Vertex start) { + GraphTraversal<Vertex, Vertex> pipeline = this.g.V(start).union( + __.inE().has("isParent", false).has("isParent-REV", false), + __.outE().has("isParent", false).has("isParent-REV", false)).otherV().dedup(); + + return pipeline.toList(); + } + +} + diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java new file mode 100644 index 00000000..adf5d405 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/GremlinPipelineQueryEngine.java @@ -0,0 +1,185 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +/* +package org.openecomp.aai.serialization.engines.query; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.query.builder.QueryBuilder; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import com.tinkerpop.blueprints.Direction; +import com.tinkerpop.blueprints.TransactionalGraph; +import com.tinkerpop.blueprints.Vertex; +import com.tinkerpop.gremlin.java.GremlinPipeline; +import com.tinkerpop.pipes.IdentityPipe; +import com.tinkerpop.pipes.PipeFunction; +import com.tinkerpop.pipes.branch.LoopPipe; + +public class GremlinPipelineQueryEngine extends QueryEngine { + + public GremlinPipelineQueryEngine(TransactionalGraphEngine graphEngine) { + super(graphEngine); + } + + @Override + public List<Vertex> executeQuery(TransactionalGraph g, QueryBuilder query) { + List<Vertex> results = null; + Vertex start = query.getStart(); + if (start != null) { + results = ((GremlinPipeline)query.getQuery()).cast(Vertex.class).toList(); + } else { + GremlinPipeline pipe = new GremlinPipeline(g); + results = process(pipe, (GremlinPipeline)query.getQuery()); + + } + return results; + } + + @Override + public List<Vertex> executeParentQuery(TransactionalGraph g, QueryBuilder query) { + List<Vertex> results = null; + Vertex start = query.getStart(); + if (start != null) { + results = ((GremlinPipeline)query.getParentQuery()).cast(Vertex.class).toList(); + } else { + GremlinPipeline pipe = new GremlinPipeline(g); + results = process(pipe, (GremlinPipeline)query.getParentQuery()); + + } + return results; + } + + @Override + public List<Vertex> findParents(Vertex start) { + GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline(start).as("x").inE() + .has("isParent", true).outV().loop("x", new PipeFunction<LoopPipe.LoopBundle<Vertex>, Boolean>() { + + @Override + public Boolean compute(LoopPipe.LoopBundle<Vertex> argument) { + GremlinPipeline<Vertex, Long> pipe = new GremlinPipeline<>(argument.getObject()); + return pipe.inE().has("isParent", true).count() == 1 || argument.getLoops() < 100; + } + + }, new PipeFunction<LoopPipe.LoopBundle<Vertex>, Boolean>() { + + @Override + public Boolean compute(LoopPipe.LoopBundle<Vertex> argument) { + return true; + } + + }); + + List<Vertex> results = pipe.toList(); + results.add(0, start); + return results; + } + + @Override + public List<Vertex> findChildren(Vertex start) { + Set<Vertex> seen = new HashSet<>(); + seen.add(start); + GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline(start).as("x").outE().has("isParent", true).inV() + .except(seen).store(seen).loop("x", new PipeFunction<LoopPipe.LoopBundle<Vertex>, Boolean>() { + + @Override + public Boolean compute(LoopPipe.LoopBundle<Vertex> argument) { + GremlinPipeline<Vertex, Long> pipe = new GremlinPipeline<>(argument.getObject()); + return pipe.outE().has("isParent", true).count() >= 1 || argument.getLoops() < 100; + } + + }, new PipeFunction<LoopPipe.LoopBundle<Vertex>, Boolean>() { + + @Override + public Boolean compute(LoopPipe.LoopBundle<Vertex> argument) { + return true; + } + + }); + + List<Vertex> results = pipe.toList(); + results.add(0, start); + return results; + } + + @Override + public List<Vertex> findDeletable(Vertex start) { + Set<Vertex> seen = new HashSet<>(); + seen.add(start); + GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>(start).as("x").outE().or( + new GremlinPipeline(new IdentityPipe()).has("isParent", true), + new GremlinPipeline(new IdentityPipe()).has("hasDelTarget", true)).inV() + .except(seen).store(seen).loop("x", new PipeFunction<LoopPipe.LoopBundle<Vertex>, Boolean>() { + + @Override + public Boolean compute(LoopPipe.LoopBundle<Vertex> argument) { + GremlinPipeline<Vertex, Long> pipe = new GremlinPipeline<>(argument.getObject()); + return pipe.outE().or( + new GremlinPipeline(new IdentityPipe()).has("isParent", true), + new GremlinPipeline(new IdentityPipe()).has("hasDelTarget", true)).count() >= 1 || argument.getLoops() < 100; + } + + }, new PipeFunction<LoopPipe.LoopBundle<Vertex>, Boolean>() { + + @Override + public Boolean compute(LoopPipe.LoopBundle<Vertex> argument) { + return true; + } + + }); + List<Vertex> results = pipe.toList(); + results.add(0, start); + + return results; + } + + private List<Vertex> process(GremlinPipeline start, GremlinPipeline pipe) { + + + return start.add(pipe).cast(Vertex.class).toList(); + } + + @Override + public List<Vertex> findRelatedVertices(Vertex start, Direction direction, String label, String nodeType) { + GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>(start); + switch (direction) { + case OUT: + pipe.out(label); + break; + case IN: + pipe.in(label); + break; + case BOTH: + pipe.both(label); + break; + default: + break; + } + + pipe.has(AAIProperties.NODE_TYPE, nodeType).dedup(); + List<Vertex> result = pipe.toList(); + return result; + } + +} +*/ diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java new file mode 100644 index 00000000..bff6f082 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/engines/query/QueryEngine.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.engines.query; + +import java.util.List; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.introspection.Loader; + +public abstract class QueryEngine { + + final protected GraphTraversalSource g; + + /** + * Instantiates a new query engine. + * + * @param graphEngine the graph engine + */ + public QueryEngine (GraphTraversalSource g) { + this.g = g; + } + + /** + * Find parents. + * + * @param start the start + * @return the list + */ + public abstract List<Vertex> findParents(Vertex start); + + /** + * Find children. + * + * @param start the start + * @return the list + */ + public abstract List<Vertex> findAllChildren(Vertex start); + + public abstract List<Vertex> findChildrenOfType(Vertex start, String type); + /** + * Find deletable. + * + * @param start the start + * @return the list + */ + public abstract List<Vertex> findDeletable(Vertex start); + + public Tree<Element> findSubGraph(Vertex start) { + return findSubGraph(start, AAIProperties.MAXIMUM_DEPTH, false); + } + public abstract Tree<Element> findSubGraph(Vertex start, int iterations, boolean nodeOnly); + /** + * Find related vertices. + * + * @param start the start + * @param direction the direction + * @param label the label + * @param nodeType the node type + * @return the list + */ + public abstract List<Vertex> findRelatedVertices(Vertex start, Direction direction, String label, String nodeType); + + public abstract List<Edge> findEdgesForVersion(Vertex start, Loader loader); + + public abstract List<Vertex> findCousinVertices(Vertex start); + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java new file mode 100644 index 00000000..7aaf02c8 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Console.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import com.google.gson.JsonObject; + +public class Console implements FormatMapper { + + @Override + public JsonObject formatObject(Object v) throws AAIFormatVertexException { + + JsonObject json = new JsonObject(); + json.addProperty("result", v.toString()); + + return json; + } + + @Override + public int parallelThreshold() { + return 100; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Format.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Format.java new file mode 100644 index 00000000..e3618917 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Format.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +public enum Format { + graphson, + pathed, id, resource, + simple, + resource_and_url, + console +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java new file mode 100644 index 00000000..d00b5cda --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatFactory.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; + +public class FormatFactory { + + private final Loader loader; + private final DBSerializer serializer; + private final UrlBuilder urlBuilder; + public FormatFactory (Loader loader, DBSerializer serializer) throws AAIException { + this.loader = loader; + this.serializer = serializer; + this.urlBuilder = new UrlBuilder(loader.getVersion(), serializer); + } + + public Formatter get(Format format) throws AAIException { + + Formatter formattter = null; + + switch (format) { + case graphson : + formattter = new Formatter(new GraphSON()); + break; + case pathed : + formattter = new Formatter(new PathedURL(loader, urlBuilder)); + break; + case id : + formattter = new Formatter(new IdURL(loader, urlBuilder)); + break; + case resource : + formattter = new Formatter(new Resource.Builder(loader, serializer, urlBuilder).build()); + break; + case resource_and_url : + formattter = new Formatter(new Resource.Builder(loader, serializer, urlBuilder).includeUrl().build()); + break; + case simple : + formattter = new Formatter(new SimpleFormat(urlBuilder)); + break; + case console : + formattter = new Formatter(new Console()); + break; + default : + break; + } + + return formattter; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java new file mode 100644 index 00000000..def68e0f --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/FormatMapper.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import com.google.gson.JsonObject; + +public interface FormatMapper { + + public JsonObject formatObject(Object v) throws AAIFormatVertexException; + + public int parallelThreshold(); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java new file mode 100644 index 00000000..f2bafe24 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Formatter.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Stream; + +public class Formatter { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(Formatter.class); + + protected JsonParser parser = new JsonParser(); + protected final FormatMapper format; + public Formatter(FormatMapper format) { + this.format = format; + } + + public JsonObject output(List<Object> vertices) { + Stream<Object> stream = null; + JsonObject result = new JsonObject(); + JsonArray body = new JsonArray(); + if (vertices.size() >= format.parallelThreshold()) { + stream = vertices.parallelStream(); + } else { + stream = vertices.stream(); + } + + stream.map(v -> { + try { + return Optional.<JsonObject>of(format.formatObject(v)); + } catch (AAIFormatVertexException e) { + LOGGER.warn("Failed to format vertex, returning a partial list", e); + } + + return Optional.<JsonObject>empty(); + }).forEach(obj -> { + if (obj.isPresent()) { + synchronized (body) { + body.add(obj.get()); + } + } + }); + + result.add("results", body); + + return result.getAsJsonObject(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java new file mode 100644 index 00000000..69bd1b24 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/GraphSON.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; +import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry; + +public class GraphSON implements FormatMapper { + + private final GraphSONMapper mapper = GraphSONMapper.build().addRegistry(TitanIoRegistry.INSTANCE).create(); + private final GraphSONWriter writer = GraphSONWriter.build().mapper(mapper).create(); + protected JsonParser parser = new JsonParser(); + + @Override + public JsonObject formatObject(Object v) { + OutputStream os = new ByteArrayOutputStream(); + String result = ""; + try { + writer.writeVertex(os, (Vertex)v, Direction.BOTH); + + result = os.toString(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return parser.parse(result).getAsJsonObject(); + + } + + @Override + public int parallelThreshold() { + return 50; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java new file mode 100644 index 00000000..a7d641dd --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/IdURL.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class IdURL implements FormatMapper { + + private final UrlBuilder urlBuilder; + private final JsonParser parser; + private final Loader loader; + + public IdURL (Loader loader, UrlBuilder urlBuilder) throws AAIException { + this.urlBuilder = urlBuilder; + this.parser = new JsonParser(); + this.loader = loader; + } + + @Override + public int parallelThreshold() { + return 2500; + } + + @Override + public JsonObject formatObject(Object input) throws AAIFormatVertexException { + Vertex v = (Vertex)input; + try { + final Introspector searchResult = this.loader.introspectorFromName("result-data"); + + searchResult.setValue("resource-type", v.value(AAIProperties.NODE_TYPE)); + searchResult.setValue("resource-link", this.urlBuilder.id(v)); + + final String json = searchResult.marshal(false); + + return parser.parse(json).getAsJsonObject(); + + } catch (AAIUnknownObjectException e) { + throw new RuntimeException("Fatal error - result-data object does not exist!"); + } + + + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java new file mode 100644 index 00000000..dda9f4af --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/PathedURL.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public final class PathedURL implements FormatMapper { + + private final UrlBuilder urlBuilder; + private final JsonParser parser; + private final Loader loader; + + public PathedURL (Loader loader, UrlBuilder urlBuilder) throws AAIException { + this.urlBuilder = urlBuilder; + this.parser = new JsonParser(); + this.loader = loader; + } + + @Override + public int parallelThreshold() { + return 20; + } + + @Override + public JsonObject formatObject(Object input) throws AAIFormatVertexException { + Vertex v = (Vertex)input; + try { + final Introspector searchResult = this.loader.introspectorFromName("result-data"); + + searchResult.setValue("resource-type", v.value(AAIProperties.NODE_TYPE)); + + searchResult.setValue("resource-link", this.urlBuilder.pathed(v)); + final String json = searchResult.marshal(false); + return this.parser.parse(json).getAsJsonObject(); + + } catch (AAIUnknownObjectException e) { + throw new RuntimeException("Fatal error - result-data does not exist!", e); + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java new file mode 100644 index 00000000..7859719e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/Resource.java @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class Resource implements FormatMapper { + + private final Loader loader; + private final DBSerializer serializer; + private final JsonParser parser; + private final UrlBuilder urlBuilder; + private final boolean includeUrl; + + private Resource (Builder builder) { + this.parser = new JsonParser(); + this.loader = builder.getLoader(); + this.serializer = builder.getSerializer(); + this.urlBuilder = builder.getUrlBuilder(); + this.includeUrl = builder.isIncludeUrl(); + } + + @Override + public JsonObject formatObject(Object input) throws AAIFormatVertexException { + Vertex v = (Vertex)input; + JsonObject json = new JsonObject(); + + if (this.includeUrl) { + json.addProperty("url", this.urlBuilder.pathed(v)); + } + json.add(v.<String>property(AAIProperties.NODE_TYPE) + .orElse(null), this.vertexToJsonObject(v)); + + return json; + } + + protected JsonObject vertexToJsonObject(Vertex v) throws AAIFormatVertexException { + try { + final Introspector obj = getLoader().introspectorFromName( + v.<String>property(AAIProperties.NODE_TYPE) + .orElse(null) + ); + + final List<Vertex> wrapper = new ArrayList<>(); + + wrapper.add(v); + + try { + getSerializer().dbToObject(wrapper, obj, 1, false, "false"); + } catch (AAIException | UnsupportedEncodingException e) { + throw new AAIFormatVertexException("Failed to format vertex - error while serializing: " + e.getMessage(), e); + } + + final String json = obj.marshal(false); + + return getParser().parse(json).getAsJsonObject(); + } catch (AAIUnknownObjectException e) { + throw new AAIFormatVertexException("Failed to format vertex - unknown object", e); + } + } + + @Override + public int parallelThreshold() { + return 20; + } + + private Loader getLoader() { return loader; } + private DBSerializer getSerializer() { return serializer; } + private JsonParser getParser() { return parser; } + + public static class Builder { + + private final Loader loader; + private final DBSerializer serializer; + private final UrlBuilder urlBuilder; + private boolean includeUrl = false; + + public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder) { + this.loader = loader; + this.serializer = serializer; + this.urlBuilder = urlBuilder; + } + + protected Loader getLoader() { + return this.loader; + } + + protected DBSerializer getSerializer() { + return this.serializer; + } + + protected UrlBuilder getUrlBuilder() { + return this.urlBuilder; + } + + public Builder includeUrl() { + this.includeUrl = true; + return this; + } + + protected boolean isIncludeUrl() { + return this.includeUrl; + } + + public Resource build() { + return new Resource(this); + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java new file mode 100644 index 00000000..222b0922 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SimpleFormat.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + +public class SimpleFormat implements FormatMapper { + + private final UrlBuilder urlBuilder; + private final Set<String> blacklist; + private final Collection<String> props = Arrays.asList(AAIProperties.AAI_URI, AAIProperties.NODE_TYPE); + public SimpleFormat(UrlBuilder urlBuilder) { + this.urlBuilder = urlBuilder; + this.blacklist = new HashSet<>(); + blacklist.addAll(props); + } + + @Override + public JsonObject formatObject(Object input) throws AAIFormatVertexException { + Vertex v = (Vertex)input; + JsonObject json = new JsonObject(); + json.addProperty("id", v.id().toString()); + json.addProperty("node-type", v.<String>value(AAIProperties.NODE_TYPE)); + json.addProperty("url", this.urlBuilder.pathed(v)); + json.add("properties", this.createPropertiesObject(v)); + json.add("related-to", this.createRelationshipObject(v)); + + return json; + } + + @Override + public int parallelThreshold() { + return 100; + } + + private JsonObject createPropertiesObject(Vertex v) { + JsonObject json = new JsonObject(); + Iterator<VertexProperty<Object>> iter = v.properties(); + + while (iter.hasNext()) { + VertexProperty<Object> prop = iter.next(); + if (!blacklist.contains(prop.key())) { + if (prop.value() instanceof String) { + json.addProperty(prop.key(), (String)prop.value()); + } else if (prop.value() instanceof Boolean) { + json.addProperty(prop.key(), (Boolean)prop.value()); + } else if (prop.value() instanceof Number) { + json.addProperty(prop.key(), (Number)prop.value()); + } else if (prop.value() instanceof List) { + Gson gson = new Gson(); + String list = gson.toJson(prop.value()); + + json.addProperty(prop.key(), list); + } else { + //throw exception? + return null; + } + } + } + + return json; + } + + private JsonArray createRelationshipObject(Vertex v) throws AAIFormatVertexException { + JsonArray jarray = new JsonArray(); + Iterator<Vertex> iter = v.vertices(Direction.BOTH); + + while (iter.hasNext()) { + Vertex related = iter.next(); + + JsonObject json = new JsonObject(); + json.addProperty("id", related.id().toString()); + json.addProperty("node-type", related.<String>value(AAIProperties.NODE_TYPE)); + json.addProperty("url", this.urlBuilder.pathed(related)); + jarray.add(json); + } + + return jarray; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SubGraphStyle.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SubGraphStyle.java new file mode 100644 index 00000000..7fa30431 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/SubGraphStyle.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +public enum SubGraphStyle { + star, + prune, + no_op +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/exceptions/AAIFormatVertexException.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/exceptions/AAIFormatVertexException.java new file mode 100644 index 00000000..692f4f65 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/exceptions/AAIFormatVertexException.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats.exceptions; + +public class AAIFormatVertexException extends Exception { + + private static final long serialVersionUID = -5814240841844624097L; + + public AAIFormatVertexException() {} + + public AAIFormatVertexException(String message) { + super(message); + } + + public AAIFormatVertexException(Throwable cause) { + super(cause); + } + + public AAIFormatVertexException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java new file mode 100644 index 00000000..1c79d24b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/queryformats/utils/UrlBuilder.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats.utils; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.tinkerpop.gremlin.structure.Vertex; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import org.openecomp.aai.util.AAIApiServerURLBase; +import org.openecomp.aai.workarounds.LegacyURITransformer; + +public class UrlBuilder { + + private final DBSerializer serializer; + private final Version version; + private final String serverBase; + + public UrlBuilder (Version version, DBSerializer serializer) throws AAIException { + this.serializer = serializer; + this.version = version; + this.serverBase = AAIApiServerURLBase.get(AAIProperties.LATEST); + } + + public String pathed(Vertex v) throws AAIFormatVertexException { + + try { + final StringBuilder result = new StringBuilder(); + final URI uri = this.serializer.getURIForVertex(v); + + result.append(this.serverBase); + result.append(this.version); + result.append(uri.getRawPath()); + + return result.toString(); + } catch (UnsupportedEncodingException | IllegalArgumentException | SecurityException e) { + throw new AAIFormatVertexException(e); + } + } + + public String id(Vertex v) { + final StringBuilder result = new StringBuilder(); + + result.append("/resources/id/" + v.id()); + result.insert(0, this.version); + result.insert(0, this.serverBase); + + return result.toString(); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java new file mode 100644 index 00000000..36fb6a87 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedEdge.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.tinkerpop; + +import java.util.Iterator; + +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge; +import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; + + +/** + * Represents a {@link Edge} that is disconnected from a {@link Graph} however, + * traversals are supported as they are backed by a Tree with saturated {@link Vertex} and {@link Edge} objects. + * These objects are not mutable and can only be used to read information out. + * + */ +public class TreeBackedEdge extends DetachedEdge implements Edge { + + private static final long serialVersionUID = 5419650145562077538L; + private TreeBackedVertex inVertex; + private TreeBackedVertex outVertex; + public TreeBackedEdge(Edge edge, TreeBackedVertex inVertex, TreeBackedVertex outVertex) { + super(edge, true); + this.inVertex = inVertex; + this.outVertex = outVertex; + } + + @Override + public Vertex inVertex() { + return this.inVertex; + } + + @Override + public Vertex outVertex() { + return this.outVertex; + } + + @Override + public Iterator<Vertex> bothVertices() { + return this.vertices(Direction.BOTH); + } + + @Override + public Iterator<Vertex> vertices(Direction direction) { + switch (direction) { + case OUT: + return IteratorUtils.of(this.outVertex); + case IN: + return IteratorUtils.of(this.inVertex); + default: + return IteratorUtils.of(this.outVertex, this.inVertex); + } + } + + + + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java new file mode 100644 index 00000000..92655803 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertex.java @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.tinkerpop; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex; + +/** + * Represents a {@link Vertex} that is disconnected from a {@link Graph} however, + * traversals are supported as they are backed by a Tree with saturated {@link Vertex} and {@link Edge} objects. + * These objects are not mutable and can only be used to read information out. + * + */ + +public class TreeBackedVertex extends DetachedVertex implements Vertex { + + private static final long serialVersionUID = -976854460992756953L; + private final Tree<Element> tree; + private final Vertex self; + public TreeBackedVertex (Vertex v, Tree<Element> tree) { + super(v, true); + this.self = v; + this.tree = tree; + } + + @Override + public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) { + final List<Element> edges = tree.getObjectsAtDepth(2); + final List<Tree<Element>> trees = tree.getTreesAtDepth(2); + final List<Tree<Element>> vTrees = tree.getTreesAtDepth(3); + return edges.stream().map( ele -> (Edge)ele).filter(e -> { + if (Direction.IN.equals(direction)) { + return e.inVertex().equals(self); + } else if (Direction.OUT.equals(direction)) { + return e.outVertex().equals(self); + } else { + return true; + } + }).filter(e -> { + boolean result = false; + if (edgeLabels.length == 0) { + return true; + } + for (String label : edgeLabels) { + if (label.equals(e.label())) { + result = true; + break; + } + } + return result; + }).map(e -> { + Tree<Element> eTree = new Tree<>(); + for (Tree<Element> tree : trees) { + if (tree.keySet().contains(e)) { + eTree = tree; + break; + } + } + TreeBackedVertex in = null; + TreeBackedVertex out = null; + if (e.inVertex().equals(self)) { + in = this; + out = this.createForVertex(e.outVertex(), vTrees); + } else if (e.outVertex().equals(self)) { + out = this; + in = this.createForVertex(e.inVertex(), vTrees); + } + return (Edge)new TreeBackedEdge(e, in, out); + }).iterator(); + + } + + private TreeBackedVertex createForVertex(Vertex v, List<Tree<Element>> trees) { + Tree<Element> vTree = new Tree<>(); + for (Tree<Element> tree : trees) { + if (tree.keySet().contains(v)) { + vTree = tree; + break; + } + } + + return new TreeBackedVertex((Vertex)vTree.keySet().iterator().next(), vTree); + } + @Override + public Iterator<Vertex> vertices(final Direction direction, final String... labels) { + final List<Tree<Element>> vertexElements = tree.getTreesAtDepth(3); + final List<Element> edgeElements = tree.getObjectsAtDepth(2); + return edgeElements.stream().map( ele -> (Edge)ele).filter(e -> { + boolean result = false; + if (labels.length == 0) { + return true; + } + for (String label : labels) { + if (label.equals(e.label())) { + result = true; + break; + } + } + return result; + }).filter(e -> { + if (Direction.IN.equals(direction) && e.inVertex().equals(self)) { + return true; + } else if (Direction.OUT.equals(direction) && e.outVertex().equals(self)) { + return true; + } else if (Direction.BOTH.equals(direction)){ + return true; + } else { + return false; + } + }).map(e -> { + final List<Vertex> list; + if (Direction.IN.equals(direction)) { + list = Collections.singletonList(e.outVertex()); + } else if (Direction.OUT.equals(direction)){ + list = Collections.singletonList(e.inVertex()); + } else { + list = new ArrayList<>(); + Iterator<Vertex> itr = e.bothVertices(); + while (itr.hasNext()) { + list.add(itr.next()); + } + } + return list; + + }).flatMap(list -> list.stream()).map(v -> { + Tree<Element> vTree = new Tree<Element>(); + for (Tree<Element> tree : vertexElements) { + if (tree.keySet().contains(v)) { + vTree = tree; + break; + } + } + + return (Vertex)new TreeBackedVertex(v, vTree); + }).iterator(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/tasks/ScheduledTasks.java b/aai-core/src/main/java/org/openecomp/aai/tasks/ScheduledTasks.java new file mode 100644 index 00000000..7cb17cf8 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/tasks/ScheduledTasks.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.tasks; + +import java.io.File; +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.comparator.LastModifiedFileComparator; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import org.openecomp.aai.logging.LoggingContext; +import org.openecomp.aai.util.AAIConfig; +import org.openecomp.aai.util.AAIConstants; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +@Component +public class ScheduledTasks { + + private static EELFLogger LOGGER = EELFManager.getInstance().getLogger(ScheduledTasks.class); + + private static final String COMPONENT = "Scheduler"; + private static final String FROM_APP_ID = "CronApp"; + private static final long PROPERTY_READ_INTERVAL = 60000; // every minute + + private String GlobalPropFileName = AAIConstants.AAI_CONFIG_FILENAME; + + // for read and possibly reloading aaiconfig.properties and other + /** + * Load AAI properties. + */ + // configuration properties files + @Scheduled(fixedRate = PROPERTY_READ_INTERVAL) + public void loadAAIProperties() { + final UUID transId = UUID.randomUUID(); + + LoggingContext.requestId(transId); + LoggingContext.partnerName(FROM_APP_ID); + LoggingContext.component(COMPONENT); + + String dir = FilenameUtils.getFullPathNoEndSeparator(GlobalPropFileName); + if (dir == null || dir.length() < 3) { + dir = "/opt/aai/etc"; + } + + File pdir = new File(dir); + File[] files = pdir.listFiles(); + Arrays.sort(files, LastModifiedFileComparator.LASTMODIFIED_REVERSE); + String fn; + + // leave this loop here since we may want to check other configurable + // property files in the SAME directory + for (File file : files) { + fn = file.getName(); + if (fn.equals("aaiconfig.properties")) { + Date lastMod = new Date(file.lastModified()); + long lastModTm = lastMod.getTime(); + Date curTS = new Date(); + long curTSTm = curTS.getTime(); + if (curTSTm - lastModTm < PROPERTY_READ_INTERVAL + 1000) { + AAIConfig.reloadConfig(); + LOGGER.info("reloaded from aaiconfig.properties"); + } + break; + } + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java new file mode 100644 index 00000000..da3bb11e --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIApiServerURLBase.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.util.List; +import java.util.Map; + +import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.PhaseInterceptorChain; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Version; + +public class AAIApiServerURLBase { + + /** + * Gets the. + * + * @return the string + * @throws AAIException the AAI exception + */ + public static String get() throws AAIException { + + String hostName = null; + try { + Message message = PhaseInterceptorChain.getCurrentMessage(); + Map<String, List<String>> headers = CastUtils.cast((Map) message.get(Message.PROTOCOL_HEADERS)); + List sa = null; + if (headers != null) { + sa = headers.get("host"); + } + + if (sa != null && sa.size() == 1) { + hostName = "https://"+ sa.get(0).toString() + "/aai/"; + } + } catch (Exception e) { + // TODO: we may want to log an error here + } + // TODO: should this check the value a little closer and look for a pattern? + if (hostName == null) { + hostName = AAIConfig.get(AAIConstants.AAI_SERVER_URL_BASE); + //AAIConstants.AAI_SERVER_URL_BASE; + } + return hostName; + } + + /** + * Gets the. + * + * @param v the v + * @return the string + * @throws AAIException the AAI exception + */ + public static String get(Version v) throws AAIException { + String hostName = null; + hostName = AAIApiServerURLBase.get(); + + return hostName; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIApiVersion.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIApiVersion.java new file mode 100644 index 00000000..56687244 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIApiVersion.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.PhaseInterceptorChain; + +import org.openecomp.aai.exceptions.AAIException; + +public class AAIApiVersion { + + private static final Pattern versionPattern = Pattern.compile("(^|\\/)(v\\d+)\\/"); + + private static final Pattern latestVersionPattern = Pattern.compile("(^|\\/)(latest)\\/"); + + /** + * Gets the. + * + * @return the string + * @throws AAIException the AAI exception + */ + public static String get() throws AAIException { + + String apiVersion = null; + try { + Message message = PhaseInterceptorChain.getCurrentMessage(); + String requestURI = (String) message.get(Message.REQUEST_URI); + + if (requestURI != null) { + Matcher matcher = versionPattern.matcher(requestURI); + if (matcher.find() && matcher.groupCount() >= 2) { + apiVersion = matcher.group(2); + } + if (apiVersion == null) { + Matcher latestMatcher = latestVersionPattern.matcher(requestURI); + if (latestMatcher.find() && latestMatcher.groupCount() >= 2) { + apiVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP, AAIConstants.AAI_DEFAULT_API_VERSION); + } + } + + } + + } catch (Exception e) { + // TODO: we may want to log an error here + } + // TODO: should this check the value a little closer and look for a pattern? + if (apiVersion == null || !apiVersion.startsWith("v")) { + apiVersion = AAIConfig.get (AAIConstants.AAI_DEFAULT_API_VERSION_PROP, AAIConstants.AAI_DEFAULT_API_VERSION); + //apiVersion = AAIConstants.AAI_DEFAULT_API_VERSION; + } + return apiVersion; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAICSVWriter.java b/aai-core/src/main/java/org/openecomp/aai/util/AAICSVWriter.java new file mode 100644 index 00000000..63383194 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAICSVWriter.java @@ -0,0 +1,167 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +package org.openecomp.aai.util; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; + +import com.opencsv.CSVWriter; + +/** + * had to overwrite the separate character to separate string + * Based on the public - A very simple CSV writer released under a commercial-friendly license. + * + + */ +public class AAICSVWriter extends CSVWriter { + + private String separatorStr; + private char overridequotechar; + private String overridelineEnd; + private Writer rawWriter; + private PrintWriter pw; + + /** + * Instantiates a new AAICSV writer. + * + * @param writer the writer + */ + public AAICSVWriter(Writer writer) { + super(writer); + // TODO Auto-generated constructor stub + } + + /** + * Constructs AAICSVWriter with supplied separator string and quote char. + * + * @param writer the writer to an underlying CSV source. + * @param overrideseparator the overrideseparator + * @param quotechar the character to use for quoted elements + * @param lineEnd the line feed terminator to use + */ + public AAICSVWriter(Writer writer, String overrideseparator, char quotechar, String lineEnd) { + super(writer, CSVWriter.DEFAULT_SEPARATOR, quotechar, DEFAULT_ESCAPE_CHARACTER, lineEnd); + separatorStr = overrideseparator; + overridequotechar = quotechar; + overridelineEnd = lineEnd; + this.rawWriter = writer; + this.pw = new PrintWriter(writer); + } + + /** + * String contains special characters. + * + * @param line the line + * @return true, if successful + */ + private boolean stringContainsSpecialCharacters(String line) { + return line.indexOf(overridequotechar) != -1 || line.indexOf(DEFAULT_ESCAPE_CHARACTER) != -1 || line.indexOf(separatorStr) != -1 || line.contains("\n") || line.contains("\r"); + } + + /** + * Close the underlying stream writer flushing any buffered content. + * + * @throws IOException if bad things happen + */ + public void close() throws IOException { + flush(); + pw.close(); + rawWriter.close(); + } + + /** + * Writes the next line to the file. + * + * @param nextLine a string array with each comma-separated element as a separate + * entry. + * @param applyQuotesToAll true if all values are to be quoted. false applies quotes only + * to values which contain the separator, escape, quote or new line characters. + */ + public void writeNext(String[] nextLine, boolean applyQuotesToAll) { + + if (nextLine == null) + return; + + StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE); + for (int i = 0; i < nextLine.length; i++) { + + if (i != 0) { + sb.append(separatorStr); + } + + String nextElement = nextLine[i]; + + if (nextElement == null) + continue; + + Boolean stringContainsSpecialCharacters = stringContainsSpecialCharacters(nextElement); + + if ((applyQuotesToAll || stringContainsSpecialCharacters) && overridequotechar != NO_QUOTE_CHARACTER) + sb.append(overridequotechar); + + if (stringContainsSpecialCharacters) { + sb.append(processLine(nextElement)); + } else { + sb.append(nextElement); + } + + if ((applyQuotesToAll || stringContainsSpecialCharacters) && overridequotechar != NO_QUOTE_CHARACTER) + sb.append(overridequotechar); + } + + sb.append(overridelineEnd); + pw.write(sb.toString()); + } + + + /** + * Writes the next line to the file ignoring all exceptions. + * + * @param nextLine a string array with each comma-separated element as a separate + * entry. + */ + public void writeColumn(String[] nextLine) { + + if (nextLine == null) + return; + + StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE); + for (int i = 0; i < nextLine.length; i++) { + + + String nextElement = nextLine[i]; + + if (nextElement == null) + continue; + + sb.append(nextElement); + + + } + + sb.append(overridelineEnd); + pw.write(sb.toString()); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIConfig.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIConfig.java new file mode 100644 index 00000000..eaea46e3 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIConfig.java @@ -0,0 +1,265 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.eclipse.jetty.util.security.Password; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.logging.ErrorLogHelper; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Properties; +import java.util.Timer; + + +public class AAIConfig { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAIConfig.class); + private static final String GLOBAL_PROP_FILE_NAME = AAIConstants.AAI_CONFIG_FILENAME; + private static Properties serverProps; + private static boolean propsInitialized = false; + + // this (probably) won't change between releases, put it in the config if it gets annoying... + private static HashMap<String,ArrayList<String>> defaultBools = new HashMap<String,ArrayList<String>>(); + private static Timer timer = new Timer(); + + /** + * Instantiates a new AAI config. + */ + // Don't instantiate + private AAIConfig() {} + + /** + * Inits the. + * + * @throws AAIException the AAI exception + */ + public synchronized static void init() throws AAIException { + LOGGER.info("Initializing AAIConfig"); + + ArrayList<String> genericVnfBools = new ArrayList<String>(); + ArrayList<String> l3NetworkBools = new ArrayList<String>(); + ArrayList<String> pserverBools = new ArrayList<String>(); + ArrayList<String> subnetBools = new ArrayList<String>(); + ArrayList<String> vserverBools = new ArrayList<String>(); + ArrayList<String> vnfcBools = new ArrayList<String>(); + + genericVnfBools.add("in-maint"); + genericVnfBools.add("is-closed-loop-disabled"); + l3NetworkBools.add("is-bound-to-vpn"); + pserverBools.add("in-maint"); + subnetBools.add("dhcp-enabled"); + vserverBools.add("in-maint"); + vserverBools.add("is-closed-loop-disabled"); + vnfcBools.add("in-maint"); + vnfcBools.add("is-closed-loop-disabled"); + + defaultBools.put("generic-vnf", genericVnfBools); + defaultBools.put("l3-network", l3NetworkBools); + defaultBools.put("pserver", pserverBools); + defaultBools.put("subnet", subnetBools); + defaultBools.put("vserver", vserverBools); + defaultBools.put("vnfc", vnfcBools); + + AAIConfig.getConfigFile(); + AAIConfig.reloadConfig(); + + if (AAIConstants.AAI_NODENAME == null || AAIConstants.AAI_NODENAME == "") { + ErrorLogHelper.logError("AAI_4005", " AAI_NODENAME is not defined"); + } else { + LOGGER.info("A&AI Server Node Name = " + AAIConstants.AAI_NODENAME); + } + } + + /** + * Gets the default bools. + * + * @return the default bools + */ + public static HashMap<String,ArrayList<String>> getDefaultBools() { + return defaultBools; + } + + /** + * Cleanup. + */ + public static void cleanup() { + timer.cancel(); + } + + /** + * Gets the config file. + * + * @return the config file + */ + public static String getConfigFile() { +// if (GlobalPropFileName == null) { +// String nc = System.getProperty("aaiconfig"); +// if (nc == null) nc = "/home/aaiadmin/etc/aaiconfig.props"; +// logger.info( "aaiconfig = " + nc==null?"null":nc); +// GlobalPropFileName = nc; +// } + return GLOBAL_PROP_FILE_NAME; + } + + /** + * Reload config. + */ + public synchronized static void reloadConfig() { + + String propFileName = GLOBAL_PROP_FILE_NAME; + Properties newServerProps = null; + + LOGGER.info("Reloading config from " + propFileName); + + try { + InputStream is = new FileInputStream(propFileName); + newServerProps = new Properties(); + newServerProps.load(is); + propsInitialized = true; + + serverProps = newServerProps; + newServerProps = null; + + } catch (FileNotFoundException fnfe) { + ErrorLogHelper.logError("AAI_4001", " " + propFileName + ". Exception: "+fnfe.getMessage()); + } catch (IOException e) { + ErrorLogHelper.logError("AAI_4002", " " + propFileName + ". IOException: "+e.getMessage()); + } + } + + /** + * Gets the. + * + * @param key the key + * @param defaultValue the default value + * @return the string + */ + public static String get(String key, String defaultValue) { + String result = defaultValue; + try { + result = get (key); + } + catch ( AAIException a ) { + + } + return ( result ); + } + + /** + * Gets the. + * + * @param key the key + * @return the string + * @throws AAIException the AAI exception + */ + public static String get(String key) throws AAIException { + String response = null; + + if (key.equals(AAIConstants.AAI_NODENAME)) { + // Get this from InetAddress rather than the properties file + String nodeName = getNodeName(); + if (nodeName != null) { + return nodeName; + } + // else get from property file + } + + if (!propsInitialized || (serverProps == null)) { + reloadConfig(); + } + + if ((key.endsWith("password") || key.endsWith("passwd") || key.endsWith("apisecret")) && serverProps.containsKey(key+".x")) { + String valx = serverProps.getProperty(key+".x"); + return Password.deobfuscate(valx); + } + + if (!serverProps.containsKey(key)) { + throw new AAIException("AAI_4005", "Property key "+key+" cannot be found"); + } else { + response = serverProps.getProperty(key); + if (response == null || response.isEmpty()) { + throw new AAIException("AAI_4005", "Property key "+key+" is null or empty"); + } + } + return response; + } + + /** + * Gets the int. + * + * @param key the key + * @return the int + * @throws AAIException the AAI exception + */ + public static int getInt(String key) throws AAIException { + return Integer.valueOf(AAIConfig.get(key)); + } + + /** + * Gets the server props. + * + * @return the server props + */ + public static Properties getServerProps() { + return serverProps; + } + + /** + * Gets the node name. + * + * @return the node name + */ + public static String getNodeName() { + try { + InetAddress ip = InetAddress.getLocalHost(); + if (ip != null) { + String hostname = ip.getHostName(); + if (hostname != null) { + return hostname; + } + } + } catch (Exception e) { + return null; + } + return null; + } + + + /** + * Check if a null or an Empty string is passed in. + * + * @param s the s + * @return boolean + */ + public static boolean isEmpty(String s) + { + return (s == null || s.length() == 0); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIConfigCommandLinePropGetter.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIConfigCommandLinePropGetter.java new file mode 100644 index 00000000..8844e824 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIConfigCommandLinePropGetter.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import org.openecomp.aai.exceptions.AAIException; + +/* + * The script deobfuscatePW.sh needs to retrieve pws from the AAIConfig file. + * As AAIConfig has no main to be callable on the command line, this class helps + * by providing one for accessing AAIConfig that way. + * (AAIConfig deobfuscates pws itself, so we just need to call its .get() on the desired pw.) + * + * This could be used to get any property from AAIConfig via the command line, + * not just the pws, even though it was made for pw-related needs. + */ +public class AAIConfigCommandLinePropGetter { + + /** + * The main method. + * + * @param args the arguments + */ + /* + * usage: + * AAIConfigCommandLinePropGetter propertyname + */ + public static void main(String[] args) { + if (args.length != 1) { + System.out.println("only one property may be requested at a time"); + System.out.println("usage: AAIConfigCommandLinePropGetter propertyname"); + } + try { + AAIConfig.init(); + String value = AAIConfig.get(args[0]); + if (value != null) { + System.out.println(value); //bc this utility used by a shell script so it needs the result sent to stdout + } else { + System.out.println("requested property could not be found"); + } + } catch(AAIException e) { + System.out.println("exception:" + e.toString()); //TODO is this reasonable? + } finally { + System.exit(0); + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java new file mode 100644 index 00000000..825a5eba --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIConstants.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +public final class AAIConstants { + + // + // + /** Default to unix file separator if system property file.separator is null */ + public static final String AAI_FILESEP = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator"); + // + /** Default to opt aai if system property aai.home is null, using file.separator */ + public static final String AAI_HOME = (System.getProperty("AJSC_HOME") == null) ? AAI_FILESEP + "opt" + AAI_FILESEP + "app" + AAI_FILESEP +"aai" : System.getProperty("AJSC_HOME"); + public static final String AAI_BUNDLECONFIG_NAME = (System.getProperty("BUNDLECONFIG_DIR") == null) ? "bundleconfig" : System.getProperty("BUNDLECONFIG_DIR"); + public static final String AAI_HOME_BUNDLECONFIG = (System.getProperty("AJSC_HOME") == null) ? AAI_FILESEP + "opt" + AAI_FILESEP + "app" + AAI_FILESEP + "aai" + AAI_FILESEP + AAI_BUNDLECONFIG_NAME : System.getProperty("AJSC_HOME")+ AAI_FILESEP + AAI_BUNDLECONFIG_NAME; + + /** etc directory, relative to AAI_HOME */ + public static final String AAI_HOME_ETC = AAI_HOME_BUNDLECONFIG + AAI_FILESEP + "etc" + AAI_FILESEP; + public static final String AAI_HOME_ETC_APP_PROPERTIES = AAI_HOME_ETC + "appprops" + AAI_FILESEP; + public static final String AAI_V2_OUTPUT_TRANSFORMS = AAIConstants.AAI_HOME_ETC_APP_PROPERTIES + AAIConstants.AAI_FILESEP + "output" + AAIConstants.AAI_FILESEP; + public static final String AAI_HOME_ETC_AUTH = AAI_HOME_ETC + "auth" + AAI_FILESEP; + public static final String AAI_CONFIG_FILENAME = AAI_HOME_ETC_APP_PROPERTIES + "aaiconfig.properties"; + public static final String AAI_AUTH_CONFIG_FILENAME = AAI_HOME_ETC_AUTH + "aai_policy.json"; + public static final String AAI_MECHID_CONFIG_FILENAME = AAI_HOME_ETC_APP_PROPERTIES + "mechIds.json"; + public static final String AAI_HOME_ETC_QUERY = AAI_HOME_ETC + "query" + AAI_FILESEP + "stored-queries.properties"; + public static final String REALTIME_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "titan-realtime.properties"; + public static final String CACHED_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "titan-cached.properties"; + public static final String AAI_HOME_ETC_OXM = AAI_HOME_ETC + "oxm" + AAI_FILESEP; + public static final String AAI_EVENT_DMAAP_PROPS = AAI_HOME_ETC_APP_PROPERTIES + "aaiEventDMaaPPublisher.properties"; + + public static final String AAI_PROV_LOGBACK_PROPS = "prov-logback.xml"; + public static final String AAI_GETRES_LOGBACK_PROPS = "getres-logback.xml"; + public static final String AAI_DELTOOL_LOGBACK_PROPS = "deltool-logback.xml"; + public static final String AAI_UPDTOOL_LOGBACK_PROPS = "updtool-logback.xml"; + public static final String AAI_PUTTOOL_LOGBACK_PROPS = "puttool-logback.xml"; + public static final String AAI_POSTTOOL_LOGBACK_PROPS = "posttool-logback.xml"; + public static final String AAI_NOTIFYSDNCTOOL_LOGBACK_PROPS = "notifysdnctool-logback.xml"; + public static final String AAI_RSHIPTOOL_LOGBACK_PROPS = "rshiptool-logback.xml"; + public static final String AAI_LOGBACK_PROPS = "logback.xml"; + + + public static final String AAI_CREATE_DB_SCHEMA_LOGBACK_PROPS = "createDBSchema-logback.xml"; + public static final String AAI_PULL_INV_DATA_LOGBACK_PROPS = "pullInvData-logback.xml"; + public static final String AAI_DATA_GROOMING_LOGBACK_PROPS = "dataGrooming-logback.xml"; + public static final String AAI_DATA_SNAPSHOT_LOGBACK_PROPS = "dataSnapshot-logback.xml"; + public static final String AAI_SCHEMA_MOD_LOGBACK_PROPS = "schemaMod-logback.xml"; + public static final String AAI_FORCE_DELETE_LOGBACK_PROPS = "forceDelete-logback.xml"; + + public static final String AAI_LOAD_DATA_DHV_LOGBACK_PROPS = "loadDataForDHV-logback.xml"; + + public static final String AVPN_INTERIM_LAG_INTERFACE = "aai.avpn.interim.laginterface"; + + public static final String AAI_TRUSTSTORE_FILENAME = "aai.truststore.filename"; + public static final String AAI_TRUSTSTORE_PASSWD = "aai.truststore.passwd"; + public static final String AAI_KEYSTORE_FILENAME = "aai.keystore.filename"; + public static final String AAI_KEYSTORE_PASSWD = "aai.keystore.passwd"; + + public static final String AAI_OLDSERVER_URL_BASE = "aai.oldserver.url.base"; + public static final String AAI_SERVER_URL_BASE = "aai.server.url.base"; + public static final String AAI_SERVER_URL = "aai.server.url"; + public static final String AAI_OLDSERVER_URL = "aai.oldserver.url"; + public static final String AAI_GLOBAL_CALLBACK_URL = "aai.global.callback.url"; + + public static final String AAI_DEFAULT_API_VERSION = "v7"; + public static final String AAI_DEFAULT_API_VERSION_PROP = "aai.default.api.version"; + public static final String AAI_NOTIFICATION_CURRENT_VERSION = "aai.notification.current.version"; + + public static final String AAI_NODENAME = "aai.config.nodename"; + + public static final String AAI_LOGGING_HBASE_INTERCEPTOR = "aai.logging.hbase.interceptor"; + public static final String AAI_LOGGING_HBASE_ENABLED = "aai.logging.hbase.enabled"; + public static final String AAI_LOGGING_HBASE_LOGREQUEST = "aai.logging.hbase.logrequest"; + public static final String AAI_LOGGING_HBASE_LOGRESPONSE = "aai.logging.hbase.logresponse"; + + public static final String AAI_LOGGING_TRACE_ENABLED = "aai.logging.trace.enabled"; + public static final String AAI_LOGGING_TRACE_LOGREQUEST = "aai.logging.trace.logrequest"; + public static final String AAI_LOGGING_TRACE_LOGRESPONSE = "aai.logging.trace.logresponse"; + + public static final String AAI_CONFIG_CHECKINGTIME = "aai.config.checktime"; + public static final String AAI_DBMODEL_FILENAME = "aai.dbmodel.filename"; + public static final String AAI_RESVERSION_ENABLEFLAG = "aai.resourceversion.enableflag"; + + public static final String ECM_OPENSTACK_TENANTID = "ecm.openstack.tenantid"; + + public static final String HBASE_TABLE_NAME = "hbase.table.name"; + public static final String HBASE_NOTIFICATION_TABLE_NAME = "hbase.notificationTable.name"; + public static final String HBASE_TABLE_TIMESTAMP_FORMAT = "hbase.table.timestamp.format"; + public static final String HBASE_CONFIGURATION_ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum"; + public static final String HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT = "hbase.zookeeper.property.clientPort"; + public static final String HBASE_ZOOKEEPER_ZNODE_PARENT = "hbase.zookeeper.znode.parent"; + public static final String ZOOKEEPER_ZNODE_PARENT = "zookeeper.znode.parent"; + + public static final int AAI_MAX_TRANS_RETRIES = 5; + public static final long AAI_TRANS_RETRY_SLEEP_MSEC = 500; + + public static final int AAI_GROOMING_DEFAULT_MAX_FIX = 150; + public static final int AAI_GROOMING_DEFAULT_SLEEP_MINUTES = 7; + + public static final int AAI_DUPETOOL_DEFAULT_MAX_FIX = 25; + public static final int AAI_DUPETOOL_DEFAULT_SLEEP_MINUTES = 7; + + public static final String LOGGING_MAX_STACK_TRACE_ENTRIES = "aai.logging.maxStackTraceEntries"; + + /** Default to skipping real-time grooming unless system property aai.skiprealtime.grooming is set to "false" */ + public static final String AAI_SKIPREALTIME_GROOMING = (System.getProperty("aai.skiprealtime.grooming") == null) ? "true" : System.getProperty("aai.skiprealtime.grooming"); + + + /*** UEB ***/ + public static final String UEB_PUB_PARTITION_AAI = "AAI"; + public static final String UEB_PUB_AAI_VCE_INTERFACE_DATA_TOPIC = "ueb.pub.aai.vce.interface.data.topic"; + + + /** Service description for Hosted Communications */ + public static final String AAI_SERVICEDESCRIPTION_HOSTEDCOMM = "aai.servicedescription.hostedcomm"; + + /** Service description for Mobility */ + public static final String AAI_SERVICEDESCRIPTION_MOBILITY = "aai.servicedescription.mobility"; + + /** Service description for Mobility */ + public static final String AAI_SERVICEDESCRIPTION_VUSP = "aai.servicedescription.vusp"; + + /** Service description for Vvig */ + public static final String AAI_SERVICEDESCRIPTION_VVIG = "aai.servicedescription.vvig"; + + /** Service description for LRSI */ + public static final String AAI_SERVICEDESCRIPTION_LRSI = "aai.servicedescription.lrsi"; + + /** + * Instantiates a new AAI constants. + */ + private AAIConstants() { + // prevent instantiation + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIMechIdConfig.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIMechIdConfig.java new file mode 100644 index 00000000..1d0cd74a --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIMechIdConfig.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import org.openecomp.aai.logging.ErrorLogHelper; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class AAIMechIdConfig { + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAIMechIdConfig.class); + private static final String mechIdConfigFileName = AAIConstants.AAI_HOME_ETC_APP_PROPERTIES + "mechid-config.json"; + + public static final String SYSTEM_GFP_IP = "GFP"; + public static final String SYSTEM_GCP = "GCP"; + public static final String SYSTEM_DCAE = "DCAE"; + public static final String SYSTEM_RUBY = "RUBY"; + public static final String SYSTEM_ACTION = "ACTION"; + public static final String SYSTEM_INSTAR = "INSTAR-LPP-AMS"; + public static final String FILE_CLASS_GFP_IP = "GFP-IP"; + public static final String FILE_CLASS_INSTAR = "INSTAR-LPP-AMS"; + + public static HashMap<String, String> mechIdtoSystem = new HashMap<String, String>(); + public static HashMap<String, ArrayList<String>> fileClassToMechId = new HashMap<String, ArrayList<String>>(); + + /** + * Inits the. + * + * @param tId the t id + * @param appId the app id + * @param logger the logger + */ + public static void init() { + LOGGER.debug("Initializing AAIMechIdConfig"); + Boolean enable; + String systemMechId = ""; + JSONParser parser = new JSONParser(); + + try { + Object obj = parser.parse(new FileReader(mechIdConfigFileName)); + JSONObject jsonObject = (JSONObject) obj; + JSONObject mechIds = (JSONObject) jsonObject.get("mech-ids"); + + @SuppressWarnings("unchecked") + Set<String> systemSet = mechIds.keySet(); + for (String system : systemSet) { + JSONObject systemJsonObj = (JSONObject) mechIds.get(system); + systemMechId = (String) systemJsonObj.get("mechid"); + enable = (Boolean) systemJsonObj.get("enable"); + if (systemMechId != null && !systemMechId.isEmpty() && enable != null && enable == true) { + mechIdtoSystem.put(systemMechId, system); + JSONArray fileClasses = (JSONArray) systemJsonObj.get("file-classes"); + if (fileClasses != null ) { + String fileClass = ""; + for (Object fileClassObj : fileClasses) { + fileClass = (String) fileClassObj; + + if (!fileClassToMechId.containsKey(fileClass)) { + fileClassToMechId.put(fileClass, new ArrayList<String>()); + fileClassToMechId.get(fileClass).add(systemMechId); + } else { + if(!fileClassToMechId.get(fileClass).contains(systemMechId)){ + fileClassToMechId.get(fileClass).add(systemMechId); + + } + } + } + } + } + } + + } catch (FileNotFoundException fnfe) { + ErrorLogHelper.logError("AAI_4001", + " " + mechIdConfigFileName + ". Exception: " + fnfe.getMessage()); + } catch (Exception e) { + ErrorLogHelper.logError("AAI_4004", + " " + mechIdConfigFileName + ". Exception: " + e.getMessage()); + } + } + + + /** + * Transform mech id to pickup dir. + * + * @param systemMechId the system mech id + * @return the string + */ + public static String transformMechIdToPickupDir(String systemMechId) { + String pickupDir = ""; + if (systemMechId != null && !systemMechId.isEmpty()) { + pickupDir = "/opt/aaihome/" + systemMechId + "/pickup"; + + if (pickupDir != null && !pickupDir.isEmpty() && new File(pickupDir).isDirectory()) { + return pickupDir; + } + + } + return null; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIRSyncUtility.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIRSyncUtility.java new file mode 100644 index 00000000..b32e8882 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIRSyncUtility.java @@ -0,0 +1,197 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +/** + * + */ +package org.openecomp.aai.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.openecomp.aai.exceptions.AAIException; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + + +public class AAIRSyncUtility { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAIRSyncUtility.class); + private final String DEFAULT_CHECK = new String("aai.primary.filetransfer."); + + /** + * Instantiates a new AAIR sync utility. + */ + public AAIRSyncUtility() { + + } + + /** + * Do command. + * + * @param command the command + * @return the int + * @throws Exception the exception + */ + public int doCommand(List<String> command) + throws Exception + { + String s = null; + + ProcessBuilder pb = new ProcessBuilder(command); + Process process = pb.start(); + + BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream())); + BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream())); + + LOGGER.debug("Here is the standard output of the command:\n"); + while ((s = stdInput.readLine()) != null) + { + LOGGER.debug(s); + } + + LOGGER.debug("Here is the standard error of the command (if any):\n"); + while ((s = stdError.readLine()) != null) + { + LOGGER.debug(s); + } + return process.waitFor(); + } + + + /** + * Method sendRsyncCommand. + * + * @param transId the trans id + * @param fileName the file name + */ + public void sendRsyncCommand(String transId, String fileName) + { + String aaiServerList = null; + String rsyncOptionsList = null; + + try { + aaiServerList = AAIConfig.get(DEFAULT_CHECK + "serverlist"); + rsyncOptionsList = AAIConfig.get("aai.rsync.options.list"); + String enableRsync = AAIConfig.get("aai.rsync.enabled"); + + if (!AAIConfig.isEmpty(enableRsync) && "n".equalsIgnoreCase(enableRsync)){ + LOGGER.info("rsync not invoked for " + fileName + ": rsync is not enabled in aaiconfig.properties"); + return; + } + } catch ( Exception e ) { + LOGGER.warn( "rsync not invoked: missing aaiconfig.properties entries for rsync" ); + } + + LOGGER.info("rsync to copy files started...."); + + ArrayList<String> remoteHostList = new ArrayList<String>(); + StringTokenizer serverList = new StringTokenizer( aaiServerList, "|" ); + String host = null; + try { + host = getHost(); + String remoteConnString = null; + + remoteHostList = getRemoteHostList(serverList, host); + LOGGER.debug("This host:" + host); + String pickUpDirectory = AAIConfig.get("instar.pickup.dir"); + String user = AAIConfig.get("aai.rsync.remote.user"); + String rsyncCmd = AAIConfig.get("aai.rsync.command"); + + //Push: rsync [OPTION...] SRC... [USER@]HOST:DEST + + java.util.Iterator<String> remoteHostItr = remoteHostList.iterator(); + while (!remoteHostList.isEmpty() && remoteHostItr.hasNext()) { + String remoteHost = remoteHostItr.next(); + remoteConnString =user+"@"+remoteHost+":"+pickUpDirectory; + + List<String> commands = new ArrayList<String>(); + commands.add(rsyncCmd); + StringTokenizer optionTks = new StringTokenizer( rsyncOptionsList, "|" ); + while (optionTks.hasMoreTokens()){ + commands.add(optionTks.nextToken()); + } + commands.add(fileName); // src directory/fileName + commands.add(remoteConnString); // target username/host/path + LOGGER.debug("Commands: " + commands.toString()); + int rsyncResult = doCommand(commands); + if ( rsyncResult == 0 ) { + LOGGER.info("rsync completed for "+remoteHost); + }else { + LOGGER.error("rsync failed for "+ remoteHost+ " with response code "+rsyncResult ); + } + } + } catch ( Exception e) { + LOGGER.error("no server found processing serverList for host " + host + ": " + e.getMessage() + " (AAI_4000)"); + } + } + + /** + * Gets the remote host list. + * + * @param serverList the server list + * @param host the host + * @return the remote host list + */ + private ArrayList<String> getRemoteHostList(StringTokenizer serverList, String host) { + ArrayList<String> remoteHostList = new ArrayList<String>(); + String remoteHost = null; + while ( serverList.hasMoreTokens() ) { + remoteHost = serverList.nextToken(); + if (!host.equalsIgnoreCase(remoteHost)){ + remoteHostList.add(remoteHost); + } + } + return remoteHostList; + } + + /** + * Gets the host. + * + * @return the host + * @throws AAIException the AAI exception + */ + private String getHost() throws AAIException { + String aaiServerList = AAIConfig.get(DEFAULT_CHECK + "serverlist"); + String hostname = null; + try { + InetAddress ip = InetAddress.getLocalHost(); + if ( ip != null ) { + hostname = ip.getHostName(); + if ( hostname != null ) { + if ( !( aaiServerList.contains(hostname) ) ) + LOGGER.warn("Host name not found in server list " + hostname); + } else + LOGGER.warn("InetAddress returned null hostname"); + } + + } catch (UnknownHostException e) { + LOGGER.warn("InetAddress getLocalHost exception " + e.getMessage()); + } + + return hostname; + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAITxnLog.java b/aai-core/src/main/java/org/openecomp/aai/util/AAITxnLog.java new file mode 100644 index 00000000..98a78478 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAITxnLog.java @@ -0,0 +1,501 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.client.*; +import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; +import org.apache.hadoop.hbase.filter.Filter; +import org.apache.hadoop.hbase.filter.FilterList; +import org.apache.hadoop.hbase.filter.RegexStringComparator; +import org.apache.hadoop.hbase.filter.SingleColumnValueFilter; +import org.apache.hadoop.hbase.util.Bytes; +import org.openecomp.aai.domain.notificationEvent.NotificationEvent; +import org.openecomp.aai.domain.translog.TransactionLogEntries; +import org.openecomp.aai.domain.translog.TransactionLogEntry; +import org.openecomp.aai.exceptions.AAIException; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class AAITxnLog { + + private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAITxnLog.class); + + private final org.apache.hadoop.conf.Configuration config; + private HTable table = null; + private String tm = null; + + /** + * Instantiates a new AAI txn log. + * + * @param transId the trans id + * @param fromAppId the from app id + */ + public AAITxnLog(String transId, String fromAppId) { + /* When you create a HBaseConfiguration, it reads in whatever you've set + into your hbase-site.xml and in hbase-default.xml, as long as these can + be found on the CLASSPATH */ + + config = HBaseConfiguration.create(); + + try { + config.set(AAIConstants.ZOOKEEPER_ZNODE_PARENT, AAIConfig.get(AAIConstants.HBASE_ZOOKEEPER_ZNODE_PARENT)); + config.set(AAIConstants.HBASE_CONFIGURATION_ZOOKEEPER_QUORUM, AAIConfig.get(AAIConstants.HBASE_CONFIGURATION_ZOOKEEPER_QUORUM)); + config.set(AAIConstants.HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT, AAIConfig.get(AAIConstants.HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT)); + + Date date = new Date(); + DateFormat formatter = new SimpleDateFormat(AAIConfig.get(AAIConstants.HBASE_TABLE_TIMESTAMP_FORMAT)); + tm = formatter.format(date); + } catch (AAIException e) { + LOGGER.warn("Missing configuration in AAIConfig: " + e.getMessage()); + } + } + + /** + * Put. + * + * @param status the status + * @param srcId the src id + * @param rsrcId the rsrc id + * @param rsrcType the rsrc type + * @param rqstBuf the rqst buf + * @param respBuf the resp buf + * @return the string + */ + public String put( + String status, + String srcId, + String rsrcId, + String rsrcType, + String rqstBuf, + String respBuf + ) { + return put ("",status,"","",srcId,rsrcId,rsrcType,rqstBuf,respBuf,false,new NotificationEvent()); + + } + + /** + * Put. + * + * @param tid the tid + * @param status the status + * @param srcId the src id + * @param rsrcId the rsrc id + * @param rsrcType the rsrc type + * @param rqstBuf the rqst buf + * @param respBuf the resp buf + * @return the string + */ + public String put( + String tid, + String status, + String srcId, + String rsrcId, + String rsrcType, + String rqstBuf, + String respBuf + ) { + return put (tid,status,"","",srcId,rsrcId,rsrcType,rqstBuf,respBuf,false,new NotificationEvent()); + } + + /** + * Put. + * + * @param tid the tid + * @param status the status + * @param rqstTm the rqst tm + * @param respTm the resp tm + * @param srcId the src id + * @param rsrcId the rsrc id + * @param rsrcType the rsrc type + * @param rqstBuf the rqst buf + * @param respBuf the resp buf + * @return the string + */ + public String put( + String tid, + String status, + String rqstTm, + String respTm, + String srcId, + String rsrcId, + String rsrcType, + String rqstBuf, + String respBuf + ) { + return put (tid,status,"","",srcId,rsrcId,rsrcType,rqstBuf,respBuf,false,new NotificationEvent()); + } + + /** + * Put. + * + * @param tid the tid + * @param status the status + * @param rqstTm the rqst tm + * @param respTm the resp tm + * @param srcId the src id + * @param rsrcId the rsrc id + * @param rsrcType the rsrc type + * @param rqstBuf the rqst buf + * @param respBuf the resp buf + * @param hasNotificationEvent the has notification event + * @param ne the ne + * @return the string + */ + public String put( + String tid, + String status, + String rqstTm, + String respTm, + String srcId, + String rsrcId, + String rsrcType, + String rqstBuf, + String respBuf, + boolean hasNotificationEvent, + NotificationEvent ne + ) { + + if (tid == null || "".equals(tid)) { + Date date = new Date(); + DateFormat formatter = null; + try { + formatter = new SimpleDateFormat(AAIConfig.get(AAIConstants.HBASE_TABLE_TIMESTAMP_FORMAT)); + } catch (Exception e) { + formatter = new SimpleDateFormat("YYYYMMdd-HH:mm:ss:SSS"); + } + tm = formatter.format(date); + tid = tm + "-"; + } + String htid = tid; + + //need to add a prefix for better hbase logging server balancing + htid = HbaseSaltPrefixer.getInstance().prependSalt(htid); + + if (rqstTm == null || "".equals(rqstTm)) { + rqstTm = tm; + } + + if (respTm == null || "".equals(respTm)) { + respTm = tm; + } + + try { + table = new HTable(config, AAIConfig.get(AAIConstants.HBASE_TABLE_NAME)); + + Put p = new Put(Bytes.toBytes(htid)); + + p.add(Bytes.toBytes("transaction"),Bytes.toBytes("tid"),Bytes.toBytes(tid)); + p.add(Bytes.toBytes("transaction"),Bytes.toBytes("status"),Bytes.toBytes(status)); + p.add(Bytes.toBytes("transaction"),Bytes.toBytes("rqstDate"),Bytes.toBytes(rqstTm)); + p.add(Bytes.toBytes("transaction"),Bytes.toBytes("respDate"),Bytes.toBytes(respTm)); + p.add(Bytes.toBytes("transaction"),Bytes.toBytes("sourceId"),Bytes.toBytes(srcId)); + + p.add(Bytes.toBytes("resource"),Bytes.toBytes("resourceId"),Bytes.toBytes(rsrcId)); + p.add(Bytes.toBytes("resource"),Bytes.toBytes("resourceType"),Bytes.toBytes(rsrcType)); + + p.add(Bytes.toBytes("payload"),Bytes.toBytes("rqstBuf"),Bytes.toBytes(rqstBuf)); + p.add(Bytes.toBytes("payload"),Bytes.toBytes("respBuf"),Bytes.toBytes(respBuf)); + + if (hasNotificationEvent == true) { + String eventType = ne.getEventHeader().getEventType(); + String eventStatus = ne.getEventHeader().getStatus(); + + if (eventStatus == null) { + eventStatus = AAIConfig.get("aai.notificationEvent.default.status", "UNPROCESSED"); + } + if (eventType == null) { + eventType = AAIConfig.get("aai.notificationEvent.default.eventType", "AAI-EVENT"); + } + + if (ne.getEntity() != null) { + PojoUtils pu = new PojoUtils(); + p.add(Bytes.toBytes("notification"),Bytes.toBytes("notificationPayload"),Bytes.toBytes(pu.getJsonFromObject(ne))); + } + if (ne.getEventHeader().getId() != null) { + p.add(Bytes.toBytes("notification"),Bytes.toBytes("notificationId"),Bytes.toBytes(ne.getEventHeader().getId())); + } + + p.add(Bytes.toBytes("notification"),Bytes.toBytes("notificationStatus"),Bytes.toBytes(eventStatus)); + p.add(Bytes.toBytes("notification"),Bytes.toBytes("notificationTopic"),Bytes.toBytes(eventType)); + + if (ne.getEventHeader().getEntityLink() != null) { + p.add(Bytes.toBytes("notification"),Bytes.toBytes("notificationEntityLink"),Bytes.toBytes(ne.getEventHeader().getEntityLink())); + } + if (ne.getEventHeader().getAction() != null) { + p.add(Bytes.toBytes("notification"),Bytes.toBytes("notificationAction"),Bytes.toBytes(ne.getEventHeader().getAction()) ); + } + } + /* Once you've adorned your Put instance with all the updates you want to + make, to commit it do the following */ + table.put(p); + table.flushCommits(); + table.close(); + return htid; + } catch (Exception e) { + LOGGER.warn("AAITxnLog: put: Exception", e); + return htid; + } + } + + /** + * Gets the. + * + * @param htid the htid + * @return the transaction log entry + * @throws AAIException the AAI exception + */ + public TransactionLogEntry get(String htid) throws AAIException { + + LOGGER.debug("In get: searching hbase config file..."); + String tidStr = ""; + TransactionLogEntry txObj = new TransactionLogEntry(); + + try { + table = new HTable(config, AAIConfig.get(AAIConstants.HBASE_TABLE_NAME)); + + Get g = new Get(Bytes.toBytes(htid)); + + Result r = table.get(g); + byte [] tid = r.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("tid")); + byte [] status = r.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("status")); + byte [] rqstDate = r.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("rqstDate")); + byte [] respDate = r.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("respDate")); + byte [] sourceId = r.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("sourceId")); + + byte [] resourceId = r.getValue(Bytes.toBytes("resource"),Bytes.toBytes("resourceId")); + byte [] resourceType = r.getValue(Bytes.toBytes("resource"),Bytes.toBytes("resourceType")); + + byte [] rqstBuf = r.getValue(Bytes.toBytes("payload"),Bytes.toBytes("rqstBuf")); + byte [] respBuf = r.getValue(Bytes.toBytes("payload"),Bytes.toBytes("respBuf")); + + byte [] notificationPayload = r.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationPayload")); + byte [] notificationStatus = r.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationStatus")); + byte [] notificationId = r.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationId")); + byte [] notificationTopic = r.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationTopic")); + byte [] notificationEntityLink = r.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationEntityLink")); + byte [] notificationAction = r.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationAction")); + + table.close(); + + tidStr = Bytes.toString(tid); + txObj.setTransactionLogEntryId(tidStr); + txObj.setStatus(Bytes.toString(status)); + txObj.setRqstDate(Bytes.toString(rqstDate)); + txObj.setRespDate(Bytes.toString(respDate)); + txObj.setSourceId(Bytes.toString(sourceId)); + txObj.setResourceId(Bytes.toString(resourceId)); + txObj.setResourceType(Bytes.toString(resourceType)); + txObj.setRqstBuf(Bytes.toString(rqstBuf)); + txObj.setrespBuf(Bytes.toString(respBuf)); + txObj.setNotificationPayload(Bytes.toString(notificationPayload)); + txObj.setNotificationStatus(Bytes.toString(notificationStatus)); + txObj.setNotificationId(Bytes.toString(notificationId)); + txObj.setNotificationTopic(Bytes.toString(notificationTopic)); + txObj.setNotificationEntityLink(Bytes.toString(notificationEntityLink)); + txObj.setNotificationAction(Bytes.toString(notificationAction)); + } catch (IOException e) { + LOGGER.error("IOException on hbase call", e); + throw new AAIException("AAI_4000"); + } + + return txObj; + } + + + /** + * Scan filtered. + * + * @param startMillis the start millis + * @param endMillis the end millis + * @param methodList the method list + * @param putFilter the put filter + * @param getFilter the get filter + * @param resourceFilter the resource filter + * @param fromAppIdFilter the from app id filter + * @return the transaction log entries + */ + public TransactionLogEntries scanFiltered(long startMillis, long endMillis, List<String> methodList, + String putFilter, String getFilter, String resourceFilter, String fromAppIdFilter) { + + LOGGER.debug("Starting scanFiltered()"); + + // we should have the config ready from the constructor + + TransactionLogEntries txs = new TransactionLogEntries(); + + if (config == null) { + LOGGER.debug("in scan: can't create HBase configuration"); + return txs; + } + + try { + table = new HTable(config, AAIConfig.get(AAIConstants.HBASE_TABLE_NAME)); + Scan s = new Scan(); + FilterList flMaster = new FilterList(FilterList.Operator.MUST_PASS_ALL); + FilterList methodflMaster = new FilterList(FilterList.Operator.MUST_PASS_ONE); + if (methodList != null) { + for (String method : methodList) { + Filter filt = new SingleColumnValueFilter(Bytes.toBytes("resource"), + Bytes.toBytes("resourceType"), CompareOp.EQUAL, Bytes.toBytes(method)); + methodflMaster.addFilter(filt); + } + flMaster.addFilter(methodflMaster); + } + + if (getFilter != null) { + Filter filt = new SingleColumnValueFilter(Bytes.toBytes("payload"), + Bytes.toBytes("respBuf"), CompareOp.EQUAL, new RegexStringComparator(getFilter)); + flMaster.addFilter(filt); + } + if (putFilter != null) { + Filter filt = new SingleColumnValueFilter(Bytes.toBytes("payload"), + Bytes.toBytes("rqstBuf"), CompareOp.EQUAL, new RegexStringComparator(putFilter)); + flMaster.addFilter(filt); + } + if (resourceFilter != null) { + Filter filt = new SingleColumnValueFilter(Bytes.toBytes("resource"), + Bytes.toBytes("resourceId"), CompareOp.EQUAL, new RegexStringComparator(resourceFilter)); + flMaster.addFilter(filt); + } + if (fromAppIdFilter != null) { + Filter filt = new SingleColumnValueFilter(Bytes.toBytes("transaction"), + Bytes.toBytes("sourceId"), CompareOp.EQUAL, new RegexStringComparator("^" + fromAppIdFilter)); + flMaster.addFilter(filt); + } + + if (flMaster.hasFilterRow()) { + s.setFilter(flMaster); + } + + s.setTimeRange(startMillis, endMillis); + ResultScanner scanner = table.getScanner(s); + + try { + for (Result rr = scanner.next(); rr != null; rr = scanner.next()) { + + byte [] tid = rr.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("tid")); + byte [] status = rr.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("status")); + byte [] rqstDate = rr.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("rqstDate")); + byte [] respDate = rr.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("respDate")); + byte [] sourceId = rr.getValue(Bytes.toBytes("transaction"),Bytes.toBytes("sourceId")); + + byte [] resourceId = rr.getValue(Bytes.toBytes("resource"),Bytes.toBytes("resourceId")); + byte [] resourceType = rr.getValue(Bytes.toBytes("resource"),Bytes.toBytes("resourceType")); + + byte [] rqstBuf = rr.getValue(Bytes.toBytes("payload"),Bytes.toBytes("rqstBuf")); + byte [] respBuf = rr.getValue(Bytes.toBytes("payload"),Bytes.toBytes("respBuf")); + + byte [] notificationPayload = rr.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationPayload")); + byte [] notificationStatus = rr.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationStatus")); + byte [] notificationId = rr.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationId")); + byte [] notificationTopic = rr.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationTopic")); + byte [] notificationEntityLink = rr.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationEntityLink")); + byte [] notificationAction = rr.getValue(Bytes.toBytes("notification"),Bytes.toBytes("notificationAction")); + TransactionLogEntry txObj = new TransactionLogEntry(); + String tidStr = Bytes.toString(tid); + txObj.setTransactionLogEntryId(tidStr); + txObj.setStatus(Bytes.toString(status)); + txObj.setRqstDate(Bytes.toString(rqstDate)); + txObj.setRespDate(Bytes.toString(respDate)); + txObj.setSourceId(Bytes.toString(sourceId)); + txObj.setResourceId(Bytes.toString(resourceId)); + txObj.setResourceType(Bytes.toString(resourceType)); + txObj.setRqstBuf(Bytes.toString(rqstBuf)); + txObj.setrespBuf(Bytes.toString(respBuf)); + txObj.setNotificationPayload(Bytes.toString(notificationPayload)); + txObj.setNotificationStatus(Bytes.toString(notificationStatus)); + txObj.setNotificationId(Bytes.toString(notificationId)); + txObj.setNotificationTopic(Bytes.toString(notificationTopic)); + txObj.setNotificationEntityLink(Bytes.toString(notificationEntityLink)); + txObj.setNotificationAction(Bytes.toString(notificationAction)); + txs.getTransactionLogEntries().add(txObj); + } + } finally { + // Make sure you close your scanners when you are done! + scanner.close(); + } + table.close(); + } catch (Exception e) { + LOGGER.warn("AAITxnLog: scan: Exception=" + e.toString()); + } + + return txs; + } + + /** + * Scan. + * + * @param htid the htid + * @return the list + */ + public List<String> scan(String htid) { + + List<String> list = new ArrayList<String>(); + LOGGER.debug("In scan: searching hbase config file..."); + // we should have the config ready from the constructor + if (config == null) { + LOGGER.debug("in scan: can't create HBase configuration"); + return list; + } + + try { + table = new HTable(config, AAIConfig.get(AAIConstants.HBASE_TABLE_NAME)); + Scan s = new Scan(Bytes.toBytes(htid)); + ResultScanner scanner = table.getScanner(s); + + try { + for (Result rr = scanner.next(); rr != null; rr = scanner.next()) { + list.add(rr.toString()); + LOGGER.debug("in scan: Found row : " + rr); + + } + } finally { + // Make sure you close your scanners when you are done! + scanner.close(); + } + table.close(); + } catch (Exception e) { + + LOGGER.debug("AAITxnLog: scan: Exception=" + e.toString()); + } + return list; + } + +} + +/* +Need to implement HBase Connection Pooling in the future. +This is to reduce the 1 second delay during the first open of HConnection, and HTable instantiation. +Hbase provides the Hconnection class and the HConnectionManager class. +Both provifde the functionaltity similar to jdbc connection pooling +to share pre-existing opened connections. +Here we should be able to use the getTable() method to get a +reference to an HTable instance. + + */ diff --git a/aai-core/src/main/java/org/openecomp/aai/util/AAIUtils.java b/aai-core/src/main/java/org/openecomp/aai/util/AAIUtils.java new file mode 100644 index 00000000..1ea39b0b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/AAIUtils.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.TimeZone; + +public class AAIUtils { + + /** + * Null check. + * + * @param <T> the generic type + * @param iterable the iterable + * @return the iterable + */ + public static <T> Iterable<T> nullCheck(Iterable<T> iterable) { + return iterable == null ? Collections.<T>emptyList() : iterable; + } + + /** + * Gen date. + * + * @return the string + */ + public static String genDate() { + Date date = new Date(); + DateFormat formatter = new SimpleDateFormat("YYMMdd-HH:mm:ss:SSS"); + formatter.setTimeZone(TimeZone.getTimeZone("GMT")); + return formatter.format(date); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/Entity.java b/aai-core/src/main/java/org/openecomp/aai/util/Entity.java new file mode 100644 index 00000000..865fe8b6 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/Entity.java @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "equipment-role", + "action", + "key-value-list", + "self-link" +}) +public class Entity { + + @JsonProperty("equipment-role") + private String equipmentRole; + @JsonProperty("action") + private String action; + @JsonProperty("key-value-list") + private List<KeyValueList> keyValueList = new ArrayList<KeyValueList>(); + @JsonProperty("self-link") + private String selfLink; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * + * @return + * The equipmentRole + */ + @JsonProperty("equipment-role") + public String getEquipmentRole() { + return equipmentRole; + } + + /** + * + * @param equipmentRole + * The equipment-role + */ + @JsonProperty("equipment-role") + public void setEquipmentRole(String equipmentRole) { + this.equipmentRole = equipmentRole; + } + + public Entity withEquipmentRole(String equipmentRole) { + this.equipmentRole = equipmentRole; + return this; + } + + /** + * + * @return + * The action + */ + @JsonProperty("action") + public String getAction() { + return action; + } + + /** + * + * @param action + * The action + */ + @JsonProperty("action") + public void setAction(String action) { + this.action = action; + } + + public Entity withAction(String action) { + this.action = action; + return this; + } + + /** + * + * @return + * The keyValueList + */ + @JsonProperty("key-value-list") + public List<KeyValueList> getKeyValueList() { + return keyValueList; + } + + /** + * + * @param keyValueList + * The key-value-list + */ + @JsonProperty("key-value-list") + public void setKeyValueList(List<KeyValueList> keyValueList) { + this.keyValueList = keyValueList; + } + + public Entity withKeyValueList(List<KeyValueList> keyValueList) { + this.keyValueList = keyValueList; + return this; + } + + /** + * + * @return + * The selfLink + */ + @JsonProperty("self-link") + public String getSelfLink() { + return selfLink; + } + + /** + * + * @param selfLink + * The self-link + */ + @JsonProperty("self-link") + public void setSelfLink(String selfLink) { + this.selfLink = selfLink; + } + + public Entity withSelfLink(String selfLink) { + this.selfLink = selfLink; + return this; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + public Entity withAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(equipmentRole).append(action).append(keyValueList).append(selfLink).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Entity) == false) { + return false; + } + Entity rhs = ((Entity) other); + return new EqualsBuilder().append(equipmentRole, rhs.equipmentRole).append(action, rhs.action).append(keyValueList, rhs.keyValueList).append(selfLink, rhs.selfLink).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/EntityList.java b/aai-core/src/main/java/org/openecomp/aai/util/EntityList.java new file mode 100644 index 00000000..db685dbc --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/EntityList.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "entity" +}) +public class EntityList { + + @JsonProperty("entity") + private List<Entity> entity = new ArrayList<Entity>(); + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * + * @return + * The entity + */ + @JsonProperty("entity") + public List<Entity> getEntity() { + return entity; + } + + /** + * + * @param entity + * The entity + */ + @JsonProperty("entity") + public void setEntity(List<Entity> entity) { + this.entity = entity; + } + + public EntityList withEntity(List<Entity> entity) { + this.entity = entity; + return this; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + public EntityList withAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(entity).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof EntityList) == false) { + return false; + } + EntityList rhs = ((EntityList) other); + return new EqualsBuilder().append(entity, rhs.entity).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/FileWatcher.java b/aai-core/src/main/java/org/openecomp/aai/util/FileWatcher.java new file mode 100644 index 00000000..6db89ebe --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/FileWatcher.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.util.*; +import java.io.*; + +public abstract class FileWatcher extends TimerTask { + private long timeStamp; + private File file; + + /** + * Instantiates a new file watcher. + * + * @param file the file + */ + public FileWatcher( File file ) { + this.file = file; + this.timeStamp = file.lastModified(); + } + + /** + * runs a timer task + * @see java.util.TimerTask.run + */ + public final void run() { + long timeStamp = file.lastModified(); + + if( (timeStamp - this.timeStamp) > 500 ) { + this.timeStamp = timeStamp; + onChange(file); + } + } + + /** + * On change. + * + * @param file the file + */ + protected abstract void onChange( File file ); +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java b/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java new file mode 100644 index 00000000..a1668886 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java @@ -0,0 +1,1672 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.SchemaOutputResolver; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Result; +import javax.xml.transform.stream.StreamResult; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import org.openecomp.aai.dbmodel.DbEdgeRules; +import com.google.common.base.Joiner; +import com.google.common.collect.Multimap; + + +public class GenerateXsd { + static String apiVersion = null; + static String apiVersionFmt = null; + static String responsesUrl = null; + static String responsesLabel = null; + static Map<String, String> generatedJavaType = new HashMap<String, String>(); + static Map<String, String> appliedPaths = new HashMap<String, String>(); + static NodeList javaTypeNodes; + static Class<?> versionedClass; + + + public static final int VALUE_NONE = 0; + public static final int VALUE_DESCRIPTION = 1; + public static final int VALUE_INDEXED_PROPS = 2; + + private static XPath xpath = XPathFactory.newInstance().newXPath(); + + + private enum LineageType { + PARENT, CHILD, UNRELATED; + } + private class EdgeDescription { + + private String ruleKey; + private LineageType type = LineageType.UNRELATED; + private String direction; + private String multiplicity; + private boolean hasDelTarget = false; + + public String getRuleKey() { + return ruleKey; + } + public String getMultiplicity() { + return multiplicity; + } + public String getDirection() { + return direction; + } + public void setRuleKey(String val) { + this.ruleKey=val; + } + public void setType(LineageType val) { + this.type=val; + } + public void setDirection(String val) { + this.direction = val; + } + public void setMultiplicity(String val) { + this.multiplicity=val; + } + public void setHasDelTarget(String val) { + hasDelTarget = Boolean.parseBoolean(val); + } + + public String getRelationshipDescription(String fromTo, String otherNodeName) { + + String result = ""; + + if ("FROM".equals(fromTo)) { + if ("OUT".equals(direction)) { + if (LineageType.PARENT == type) { + result = " (is composed of "+otherNodeName; + } + } + else { + if (LineageType.CHILD == type) { + result = " (comprises "+otherNodeName; + } + else if (LineageType.PARENT == type) { + result = " (comprises "+otherNodeName; + } + } + } else { + if ("OUT".equals(direction)) { + if (LineageType.PARENT == type) { + result = " (comprises "+otherNodeName; + } + } else { + if (LineageType.PARENT == type) { + result = " (is composed of "+otherNodeName; + } + } + } + +// if (type != null) { +// if (LineageType.PARENT.equals(type) && "FROM".equals(fromTo)) { +// if ("OUT".equals(direction)) { +// result = " (is composed of "+otherNodeName; +// } else { +// result = " (comprises "+otherNodeName; +// } +// } else { +// result = " (comprises " + otherNodeName; +// // if (!(multiplicity.startsWith("One"))) { +// // System.err.println("Surprised to find multiplicity "+multiplicity+" with comprises for "+ruleKey); +// // } +// } +// } + if ("TO".equals(fromTo)) { + if (result.length() == 0) result = result + " ("; + else result = result + ", "; + + result = result + mapMultiplicity(fromTo); + if (hasDelTarget) result = result + ", will delete target node"; + } + + if (result.length() > 0) result = result + ")"; + + return result; + } + + private String mapMultiplicity(String fromTo) { + String result = multiplicity; +// Below logic works if an IN switches multiplicity, which it doesn't today. +// if ("TO".equals(fromTo)) { +// if (direction.equals("OUT")) { +// result = multiplicity; +// } else { +// result = switchMultiplicity(multiplicity); +// } +// } else { +// if (direction.equals("OUT")) { +// result = multiplicity; +// } else { +// result = switchMultiplicity(multiplicity); +// } +// } + return result; + } + +// private String switchMultiplicity(String val) throws IllegalArgumentException +// { +// String result = null; +// switch (val) { +// case "Many2Many": +// case "One2One": +// result = val; +// break; +// case "Many2One": +// result = "One2Many"; +// break; +// case "One2Many": +// result = "Many2One"; +// break; +// default: +// throw new IllegalArgumentException("Multiplicity cannot be "+val); +// } +// System.out.println("Switched Multiplicity from "+val+" to "+result); +// return result; +// } + } + + public static void main(String[] args) throws IOException { + + if (args.length > 0) { + if (args[0] != null) { + apiVersion = args[0]; + } + } + boolean genDoc = false; + if ( args.length > 1 ) { + genDoc = true; + int index = args[1].indexOf("|"); + if ( index > 0 ) { + responsesUrl = args[1].substring(0, index); + responsesLabel = args[1].substring(index+1); + //System.out.println( "response URL " + responsesUrl); + //System.out.println( "response label " + responsesLabel); + responsesUrl = "description: "+ responsesLabel + "(" + + responsesUrl + ").\n"; + //System.out.println( "operation described with " + responsesUrl); + } else { // default + responsesUrl = ""; + } + } + String oxmPath = null; + if ( apiVersion == null ) { + // to run from eclipse, set these env, e.g. v7, \sources\aai\aaimastergit\bundleconfig-local\etc\oxm\ + String envRev= System.getenv("OXM_REV"); + if ( envRev != null ) + apiVersion = envRev; + + } + oxmPath = System.getenv("OXM_PATH"); + String outfileName; + if ( genDoc ) { + outfileName = "c:\\temp\\aai.yaml"; + } else + outfileName = "c:\\temp\\aai_schema.xsd"; + if ( apiVersion != null ) { // generate from oxm + apiVersionFmt = "." + apiVersion + "."; + if ( oxmPath == null ) { + oxmPath = AAIConstants.AAI_HOME_ETC_OXM + AAIConstants.AAI_FILESEP; + //oxmPath = "\\sources\\aai\\aaimastergit\\bundleconfig-local\\etc\\oxm\\"; + } + + File oxm_file = new File(oxmPath + "aai_oxm_" + apiVersion + ".xml"); + String xsd; + File outfile; + if ( genDoc ) { + xsd = generateSwaggerFromOxmFile( oxm_file); + outfile =new File(outfileName); + } else { + xsd = processOxmFile( oxm_file); + outfile =new File(outfileName); + } + + + try { + outfile.createNewFile(); + } catch (IOException e) { + System.out.println( "Exception creating output file " + outfileName); + e.printStackTrace(); + } + try { + FileWriter fw = new FileWriter(outfile.getAbsoluteFile()); + BufferedWriter bw = new BufferedWriter(fw); + bw.write(xsd); + bw.close(); + + } catch ( IOException e) { + System.out.println( "Exception writing output file " + outfileName); + e.printStackTrace(); + } + System.out.println( "GeneratedXSD successful, saved in " + outfileName); + return; + } + + JAXBContext jaxbContext = null; + try { + jaxbContext = JAXBContext.newInstance(org.openecomp.aai.domain.yang.Vce.class); + } catch (JAXBException e) { + + e.printStackTrace(); + } + SchemaOutputResolver sor = new MySchemaOutputResolver(); + jaxbContext.generateSchema(sor); + + } + + public static class MySchemaOutputResolver extends SchemaOutputResolver { + + public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { + File file = new File("c:\\temp\\aai_schema.xsd"); + StreamResult result = new StreamResult(file); + result.setSystemId(file.toURI().toURL().toString()); + return result; + } + + } + + public static String processJavaTypeElement( String javaTypeName, Element javaTypeElement) { + + String xmlRootElementName = null; + + NodeList parentNodes = javaTypeElement.getElementsByTagName("java-attributes"); + StringBuffer sb = new StringBuffer(); + if ( parentNodes.getLength() == 0 ) { + System.out.println( "no java-attributes for java-type " + javaTypeName); + return ""; + + } + + NamedNodeMap attributes; + + NodeList valNodes = javaTypeElement.getElementsByTagName("xml-root-element"); + Element valElement = (Element) valNodes.item(0); + attributes = valElement.getAttributes(); + for ( int i = 0; i < attributes.getLength(); ++i ) { + Attr attr = (Attr) attributes.item(i); + String attrName = attr.getNodeName(); + + String attrValue = attr.getNodeValue(); + //System.out.println("Found xml-root-element attribute: " + attrName + " with value: " + attrValue); + if ( attrName.equals("name")) + xmlRootElementName = attrValue; + } + /* + if ( javaTypeName.equals("RelationshipList")) { + System.out.println( "Skipping " + javaTypeName); + generatedJavaType.put(javaTypeName, null); + return ""; + } + */ + + Element parentElement = (Element)parentNodes.item(0); + NodeList xmlElementNodes = parentElement.getElementsByTagName("xml-element"); + NodeList childNodes; + Element childElement; + String xmlElementWrapper; + + Element xmlElementElement; + String addType; + String elementName, elementType, elementIsKey, elementIsRequired, elementContainerType; + StringBuffer sb1 = new StringBuffer(); + if ( xmlElementNodes.getLength() > 0 ) { + sb1.append(" <xs:element name=\"" + xmlRootElementName + "\">\n"); + sb1.append(" <xs:complexType>\n"); + NodeList properties = GenerateXsd.locateXmlProperties(javaTypeElement); + if (properties != null) { + System.out.println("properties found for: " + xmlRootElementName); + sb1.append(" <xs:annotation>\r\n"); + insertAnnotation(properties, false, "class", sb1, " "); + + sb1.append(" </xs:annotation>\r\n"); + } else { + System.out.println("no properties found for: " + xmlRootElementName); + } + sb1.append(" <xs:sequence>\n"); + for ( int i = 0; i < xmlElementNodes.getLength(); ++i ) { + + xmlElementElement = (Element)xmlElementNodes.item(i); + childNodes = xmlElementElement.getElementsByTagName("xml-element-wrapper"); + + xmlElementWrapper = null; + if ( childNodes.getLength() > 0 ) { + childElement = (Element)childNodes.item(0); + // get name + attributes = childElement.getAttributes(); + for ( int k = 0; k < attributes.getLength(); ++k ) { + Attr attr = (Attr) attributes.item(k); + String attrName = attr.getNodeName(); + String attrValue = attr.getNodeValue(); + if ( attrName.equals("name")) { + xmlElementWrapper = attrValue; + //System.out.println("found xml-element-wrapper " + xmlElementWrapper); + } + } + + } + attributes = xmlElementElement.getAttributes(); + addType = null; + + + elementName = elementType = elementIsKey = elementIsRequired = elementContainerType = null; + for ( int j = 0; j < attributes.getLength(); ++j ) { + Attr attr = (Attr) attributes.item(j); + String attrName = attr.getNodeName(); + + String attrValue = attr.getNodeValue(); + //System.out.println("For " + xmlRootElementName + " Found xml-element attribute: " + attrName + " with value: " + attrValue); + if ( attrName.equals("name")) { + elementName = attrValue; + } + if ( attrName.equals("type")) { + elementType = attrValue; + if ( attrValue.contains(apiVersionFmt) ) { + addType = attrValue.substring(attrValue.lastIndexOf('.')+1); + if ( !generatedJavaType.containsKey(addType) ) { + generatedJavaType.put(addType, attrValue); + sb.append(processJavaTypeElement( addType, getJavaTypeElement(addType) )); + } + } + + } + + if ( attrName.equals("xml-key")) { + elementIsKey = attrValue; + } + if ( attrName.equals("required")) { + elementIsRequired = attrValue; + } + if ( attrName.equals("container-type")) { + elementContainerType = attrValue; + } + } + + if ( xmlElementWrapper != null ) { + sb1.append(" <xs:element name=\"" + xmlElementWrapper +"\""); + if ( elementIsRequired == null || !elementIsRequired.equals("true")||addType != null) { + sb1.append(" minOccurs=\"0\""); + } + sb1.append(">\n"); + sb1.append(" <xs:complexType>\n"); + properties = GenerateXsd.locateXmlProperties(javaTypeElement); + if (properties != null) { + sb1.append(" <xs:annotation>\r\n"); + insertAnnotation(properties, false, "class", sb1, " "); + sb1.append(" </xs:annotation>\r\n"); + } else { + System.out.println("no properties found for: " + xmlElementWrapper); + } + sb1.append(" <xs:sequence>\n"); + sb1.append(" "); + } + if ("Nodes".equals(addType)) { + System.out.println ("Skipping nodes, temporary testing"); + continue; + } + if ( addType != null ) { + //sb1.append(" <xs:element ref=\"tns:" + elementName +"\""); + sb1.append(" <xs:element ref=\"tns:" + getXmlRootElementName(addType) +"\""); + } else { + sb1.append(" <xs:element name=\"" + elementName +"\""); + } + if ( elementType.equals("java.lang.String")) + sb1.append(" type=\"xs:string\""); + //if ( elementType.equals("java.lang.String")) + //sb1.append(" type=\"xs:string\""); + if ( elementType.equals("java.lang.Long")) + sb1.append(" type=\"xs:unsignedInt\""); + if ( elementType.equals("java.lang.Integer")) + sb1.append(" type=\"xs:int\""); + if ( elementType.equals("java.lang.Boolean")) + sb1.append(" type=\"xs:boolean\""); + //if ( elementIsRequired != null && elementIsRequired.equals("true")||addType != null) { + if ( elementIsRequired == null || !elementIsRequired.equals("true")||addType != null) { + sb1.append(" minOccurs=\"0\""); + } + if ( elementContainerType != null && elementContainerType.equals("java.util.ArrayList")) { + sb1.append(" maxOccurs=\"unbounded\""); + } + properties = GenerateXsd.locateXmlProperties(xmlElementElement); + if (properties != null || elementIsKey != null) { + sb1.append(">\n"); + sb1.append(" <xs:annotation>\r\n"); + insertAnnotation(properties, elementIsKey != null, "field", sb1, " "); + sb1.append(" </xs:annotation>\r\n"); + + if (xmlElementWrapper== null) { + sb1.append(" </xs:element>\n"); + } + } else { + sb1.append("/>\n"); + } + if ( xmlElementWrapper != null ) { + sb1.append(" </xs:sequence>\n"); + sb1.append(" </xs:complexType>\n"); + sb1.append(" </xs:element>\n"); + } + } + /* + if ( xmlRootElementName.equals("notify") || + xmlRootElementName.equals("relationship") || + xmlRootElementName.equals("relationship-data") || + xmlRootElementName.equals("related-to-property") ) + + sb1.append(" <xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n"); + */ + sb1.append(" </xs:sequence>\n"); + sb1.append(" </xs:complexType>\n"); + sb1.append(" </xs:element>\n"); + } + /* + NodeList valNodes = javaTypeElement.getElementsByTagName("xml-root-element"); + Element valElement = (Element) valNodes.item(0); + attributes = valElement.getAttributes(); + for ( int i = 0; i < attributes.getLength(); ++i ) { + Attr attr = (Attr) attributes.item(i); + String attrName = attr.getNodeName(); + + String attrValue = attr.getNodeValue(); + System.out.println("Found xml-root-element attribute: " + attrName + " with value: " + attrValue); + if ( attrValue.equals("name")) + xmlRootElementName = attrValue; + } + */ + + if ( xmlElementNodes.getLength() < 1 ) { + sb.append(" <xs:element name=\"" + xmlRootElementName + "\">\n"); + sb.append(" <xs:complexType>\n"); + sb.append(" <xs:sequence/>\n"); + sb.append(" </xs:complexType>\n"); + sb.append(" </xs:element>\n"); + generatedJavaType.put(javaTypeName, null); + return sb.toString(); + } + + sb.append( sb1 ); + + return sb.toString(); + } + + private static void insertAnnotation(NodeList items, boolean isKey, String target, StringBuffer sb1, String indentation) { + if (items != null || isKey) { + List<String> metadata = new ArrayList<>(); + + String name = ""; + String value = ""; + Element item = null; + if (isKey) { + metadata.add("isKey=true"); + } + if (items != null) { + for (int i = 0; i < items.getLength(); i++) { + item = (Element)items.item(i); + name = item.getAttribute("name"); + value = item.getAttribute("value"); + if (name.equals("abstract")) { + name = "isAbstract"; + } else if (name.equals("extends")) { + name = "extendsFrom"; + } + metadata.add(name + "=\"" + value.replaceAll("&", "&") + "\""); + System.out.println("property name: " + name); + + } + } + sb1.append( + indentation + " <xs:appinfo>\r\n" + + indentation + " <annox:annotate target=\""+target+"\">@org.openecomp.aai.annotations.Metadata(" + Joiner.on(",").join(metadata) + ")</annox:annotate>\r\n" + + indentation + " </xs:appinfo>\r\n"); + } + + } + + private static Element getJavaTypeElement( String javaTypeName ) + { + + String attrName, attrValue; + Attr attr; + Element javaTypeElement; + for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) { + javaTypeElement = (Element) javaTypeNodes.item(i); + NamedNodeMap attributes = javaTypeElement.getAttributes(); + for ( int j = 0; j < attributes.getLength(); ++j ) { + attr = (Attr) attributes.item(j); + attrName = attr.getNodeName(); + attrValue = attr.getNodeValue(); + if ( attrName.equals("name") && attrValue.equals(javaTypeName)) + return javaTypeElement; + } + } + System.out.println( "oxm file format error, missing java-type " + javaTypeName); + return (Element) null; + } + + private static Element getJavaTypeElementSwagger( String javaTypeName ) + { + + String attrName, attrValue; + Attr attr; + Element javaTypeElement; + for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) { + javaTypeElement = (Element) javaTypeNodes.item(i); + NamedNodeMap attributes = javaTypeElement.getAttributes(); + for ( int j = 0; j < attributes.getLength(); ++j ) { + attr = (Attr) attributes.item(j); + attrName = attr.getNodeName(); + attrValue = attr.getNodeValue(); + if ( attrName.equals("name") && attrValue.equals(javaTypeName)) + return javaTypeElement; + } + } + System.out.println( "oxm file format error, missing java-type " + javaTypeName); + return (Element) null; + } + private static String getXmlRootElementName( String javaTypeName ) + { + + String attrName, attrValue; + Attr attr; + Element javaTypeElement; + for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) { + javaTypeElement = (Element) javaTypeNodes.item(i); + NamedNodeMap attributes = javaTypeElement.getAttributes(); + for ( int j = 0; j < attributes.getLength(); ++j ) { + attr = (Attr) attributes.item(j); + attrName = attr.getNodeName(); + attrValue = attr.getNodeValue(); + if ( attrName.equals("name") && attrValue.equals(javaTypeName)) { + NodeList valNodes = javaTypeElement.getElementsByTagName("xml-root-element"); + Element valElement = (Element) valNodes.item(0); + attributes = valElement.getAttributes(); + for ( int k = 0; k < attributes.getLength(); ++k ) { + attr = (Attr) attributes.item(k); + attrName = attr.getNodeName(); + + attrValue = attr.getNodeValue(); + //System.out.println("Found xml-root-element attribute: " + attrName + " with value: " + attrValue); + if ( attrName.equals("name")) + return (attrValue); + } + } + } + } + System.out.println( "oxm file format error, missing java-type " + javaTypeName); + return null; + } + + + public static String processOxmFile( File oxmFile ) + { + StringBuffer sb = new StringBuffer(); + sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); + String namespace = "org.openecomp"; + sb.append("<xs:schema elementFormDefault=\"qualified\" version=\"1.0\" targetNamespace=\"http://" + namespace + ".aai.inventory/" + + apiVersion + "\" xmlns:tns=\"http://" + namespace + ".aai.inventory/" + apiVersion + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"" + + "\n" + + "xmlns:jaxb=\"http://java.sun.com/xml/ns/jaxb\"\r\n" + + " jaxb:version=\"2.1\" \r\n" + + " xmlns:annox=\"http://annox.dev.java.net\" \r\n" + + " jaxb:extensionBindingPrefixes=\"annox\">\n\n"); + + try { + + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + dbFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(oxmFile); + + NodeList bindingsNodes = doc.getElementsByTagName("xml-bindings"); + Element bindingElement; + NodeList javaTypesNodes; + Element javaTypesElement; + + Element javaTypeElement; + + + if ( bindingsNodes == null || bindingsNodes.getLength() == 0 ) { + System.out.println( "missing <binding-nodes> in " + oxmFile ); + return null; + } + + bindingElement = (Element) bindingsNodes.item(0); + javaTypesNodes = bindingElement.getElementsByTagName("java-types"); + if ( javaTypesNodes.getLength() < 1 ) { + System.out.println( "missing <binding-nodes><java-types> in " + oxmFile ); + return null; + } + javaTypesElement = (Element) javaTypesNodes.item(0); + javaTypeNodes = javaTypesElement.getElementsByTagName("java-type"); + if ( javaTypeNodes.getLength() < 1 ) { + System.out.println( "missing <binding-nodes><java-types><java-type> in " + oxmFile ); + return null; + } + + String javaTypeName; + String attrName, attrValue; + Attr attr; + for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) { + javaTypeElement = (Element) javaTypeNodes.item(i); + NamedNodeMap attributes = javaTypeElement.getAttributes(); + javaTypeName = null; + for ( int j = 0; j < attributes.getLength(); ++j ) { + attr = (Attr) attributes.item(j); + attrName = attr.getNodeName(); + attrValue = attr.getNodeValue(); + if ( attrName.equals("name")) + javaTypeName = attrValue; + } + if ( javaTypeName == null ) { + System.out.println( "<java-type> has no name attribute in " + oxmFile ); + return null; + } + if ("Nodes".equals(javaTypeName)) { + System.out.println("skipping Nodes entry (temporary feature)"); + continue; + } + if ( !generatedJavaType.containsKey(javaTypeName) ) { + generatedJavaType.put(javaTypeName, null); + sb.append(processJavaTypeElement( javaTypeName, javaTypeElement )); + } + } + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + sb.append("</xs:schema>\n"); + return sb.toString(); + } + + private static boolean isStandardType( String elementType ) + { + switch ( elementType ) { + case "java.lang.String": + case "java.lang.Long": + case "java.lang.Integer": + case"java.lang.Boolean": + return true; + } + return false; + } + + private static Vector<String> getIndexedProps( String attrValue ) + { + if ( attrValue == null ) + return null; + StringTokenizer st = new StringTokenizer( attrValue, ","); + if ( st.countTokens() == 0 ) + return null; + Vector<String> result = new Vector<String>(); + while ( st.hasMoreTokens()) { + result.add(st.nextToken()); + } + return result; + } + + private static Class<?> getEdgeRulesClass() throws ClassNotFoundException { + Class<?> result = null; + + // If a class matching the apiVersion exists, we are generating documentation for a prior release + // Otherwise, we're generated documentation for the current release. + try { + result = Class.forName("org.openecomp.aai.dbmodel." + apiVersion +".gen.DbEdgeRules"); + } catch (ClassNotFoundException ex) { + result = Class.forName("org.openecomp.aai.dbmodel.DbEdgeRules"); + } + return result; + } + + /** + * Guaranteed to at least return non null but empty collection of edge descriptions + * @param nodeName name of the vertex whose edge relationships to return + * @return collection of node neighbors based on DbEdgeRules + */ + private static Collection<EdgeDescription> getEdgeRules( String nodeName ) + { + + ArrayList<EdgeDescription> result = new ArrayList<>(); + Iterator<String> edgeRulesIterator; + + try { + + Field mapfield = versionedClass.getField("EdgeRules"); + Object map = mapfield.get(null); + if (map instanceof Multimap<?,?>) { + edgeRulesIterator = ((Multimap<String,String>) map).keySet().iterator(); + } else { + throw new NoSuchFieldException ("Didn't get back the multimap field expected"); + } + GenerateXsd x = new GenerateXsd(); + + while( edgeRulesIterator.hasNext() ){ + String ruleKey = edgeRulesIterator.next(); + if ( ruleKey.startsWith(nodeName + "|" ) || + ruleKey.endsWith("|" + nodeName)) { + Collection <String> edRuleColl = DbEdgeRules.EdgeRules.get(ruleKey); + Iterator <String> ruleItr = edRuleColl.iterator(); + while( ruleItr.hasNext() ){ + EdgeDescription edgeDes = x.new EdgeDescription(); + edgeDes.setRuleKey(ruleKey); + String fullRuleString = ruleItr.next(); + String[] toks = fullRuleString.split(","); + if (toks != null) { + if (toks.length > 1) { + edgeDes.setDirection(toks[1]); + } + if (toks.length > 2) { + edgeDes.setMultiplicity(toks[2]); + } + if (toks.length > 3) { + if (toks[3].equals("true")) + edgeDes.setType(LineageType.PARENT); + else if (toks[3].equals("parent")) + edgeDes.setType(LineageType.PARENT); + else if (toks[3].equals("child")) + edgeDes.setType(LineageType.CHILD); + else + edgeDes.setType(LineageType.UNRELATED); + } + if (toks.length > 5) { + edgeDes.setHasDelTarget(toks[5]);; + } + } + + //System.out.println( "nodeName " + nodeName + " ruleKey " + ruleKey + " ruleString " + fullRuleString); + //result.add(ruleKey + "-" + fullRuleString); + result.add(edgeDes); + } + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } + return result; + } + + /** + * Finds the default delete scope from DBEdgeRules + * @param nodeName name of vertex whose delete scope to return + * @return default delete scope of the input nodeName, null if none. + */ + private static String getDeleteRules( String nodeName ) + { + String result = null; + Iterator<String> delRulesIterator; + + try { + + Field mapfield = versionedClass.getField("DefaultDeleteScope"); + Object map = mapfield.get(null); + if (map instanceof Multimap<?,?>) { + delRulesIterator = ((Multimap<String,String>) map).keySet().iterator(); + } else { + throw new NoSuchFieldException ("Didn't get back the multimap field expected"); + } + + while( delRulesIterator.hasNext() ){ + String ruleKey = delRulesIterator.next(); + if ( ruleKey.equals(nodeName)) { + Collection <String> deRuleColl = DbEdgeRules.DefaultDeleteScope.get(ruleKey); + Iterator <String> ruleItr = deRuleColl.iterator(); + if( ruleItr.hasNext() ){ + result = ruleItr.next(); + } + } + } + + } catch (Exception ex) { + ex.printStackTrace(); + } + return result; + } + + public static String processJavaTypeElementSwagger( String javaTypeName, Element javaTypeElement, + StringBuffer pathSb, StringBuffer definitionsSb, String path, String tag, String opId, + String getItemName, StringBuffer pathParams, String queryParams, String validEdges) { + + String xmlRootElementName = null; + + //Map<String, String> addJavaType = new HashMap<String, String>(); + String useTag = null; + String useOpId = null; + + if ( tag != null ) { + switch ( tag ) { + case "Network": + case "ServiceDesignAndCreation": + case "Business": + case "CloudInfrastructure": + break; + default: + return null; + } + } + + if ( !javaTypeName.equals("Inventory") ) { + if ( javaTypeName.equals("AaiInternal")) + return null; + if ( opId == null ) + useOpId = javaTypeName; + else + useOpId = opId + javaTypeName; + if ( tag == null ) + useTag = javaTypeName; + } + + NodeList parentNodes = javaTypeElement.getElementsByTagName("java-attributes"); + + if ( parentNodes.getLength() == 0 ) { + System.out.println( "no java-attributes for java-type " + javaTypeName); + return ""; + + } + + NamedNodeMap attributes; + + NodeList valNodes = javaTypeElement.getElementsByTagName("xml-root-element"); + Element valElement = (Element) valNodes.item(0); + attributes = valElement.getAttributes(); + for ( int i = 0; i < attributes.getLength(); ++i ) { + Attr attr = (Attr) attributes.item(i); + String attrName = attr.getNodeName(); + + String attrValue = attr.getNodeValue(); + //System.out.println("Found xml-root-element attribute: " + attrName + " with value: " + attrValue); + if ( attrName.equals("name")) + xmlRootElementName = attrValue; + } + /* + if ( xmlRootElementName.equals("oam-networks")) + System.out.println( "xmlRootElement oam-networks with getItemData [" + getItemName + "]"); + */ + //already processed + /* + if ( generatedJavaType.containsKey(xmlRootElementName) ) { + return null; + } + */ + NodeList childNodes; + Element childElement; + NodeList xmlPropNodes = javaTypeElement.getElementsByTagName("xml-properties"); + Element xmlPropElement; + String pathDescriptionProperty = null; + + + Vector<String> indexedProps = null; + + /*System.out.println( "javaTypeName " + javaTypeName + " has xml-properties length " + xmlPropNodes.getLength()); + if ( path != null && path.equals("/network/generic-vnfs")) + System.out.println("path is " + "/network/generic-vnfs with getItemName " + getItemName); + */ + if ( xmlPropNodes.getLength() > 0 ) { + + for ( int i = 0; i < xmlPropNodes.getLength(); ++i ) { + xmlPropElement = (Element)xmlPropNodes.item(i); + if ( !xmlPropElement.getParentNode().isSameNode(javaTypeElement)) + continue; + childNodes = xmlPropElement.getElementsByTagName("xml-property"); + + if ( childNodes.getLength() > 0 ) { + for ( int j = 0; j < childNodes.getLength(); ++j ) { + childElement = (Element)childNodes.item(j); + // get name + int useValue = VALUE_NONE; + attributes = childElement.getAttributes(); + for ( int k = 0; k < attributes.getLength(); ++k ) { + Attr attr = (Attr) attributes.item(k); + String attrName = attr.getNodeName(); + String attrValue = attr.getNodeValue(); + if ( attrName == null || attrValue == null ) + continue; + if ( attrName.equals("name") && attrValue.equals("description")) { + useValue = VALUE_DESCRIPTION; + } + if ( useValue == VALUE_DESCRIPTION && attrName.equals("value")) { + pathDescriptionProperty = attrValue; + //break; + //System.out.println("found xml-element-wrapper " + xmlElementWrapper); + } + if ( attrValue.equals("indexedProps")) { + useValue = VALUE_INDEXED_PROPS; + } + if ( useValue == VALUE_INDEXED_PROPS && attrName.equals("value")) { + indexedProps = getIndexedProps( attrValue ); + } + } + } + } + } + } + //System.out.println("javaTypeName " + javaTypeName + " description " + pathDescriptionProperty); + + /* + if ( javaTypeName.equals("RelationshipList")) { + System.out.println( "Skipping " + javaTypeName); + generatedJavaType.put(javaTypeName, null); + return ""; + } + */ + + Element parentElement = (Element)parentNodes.item(0); + NodeList xmlElementNodes = parentElement.getElementsByTagName("xml-element"); + + + String attrDescription = null; + + Element xmlElementElement; + String addType = null; + String elementType = null, elementIsKey = null, elementIsRequired, elementContainerType = null; + String elementName = null; + StringBuffer sbParameters = new StringBuffer(); + + StringBuffer sbRequired = new StringBuffer(); + int requiredCnt = 0; + int propertyCnt = 0; + StringBuffer sbProperties = new StringBuffer(); + StringBuffer sbIndexedParams = new StringBuffer(); + + + StringTokenizer st; + if ( xmlRootElementName.equals("inventory")) + path = ""; + else if ( path == null ) + //path = "/aai/" + apiVersion; + path = "/" + xmlRootElementName; + else + path += "/" + xmlRootElementName; + st = new StringTokenizer(path, "/"); + /* + if ( path.equals("/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription")) + System.out.println("processing path /business/customers/customer/{global-customer-id}/service-subscriptions with tag " + tag); + */ + boolean genPath = false; + /* + if ( path != null && path.equals("/network/generic-vnfs/generic-vnf")) + System.out.println("path is " + "/network/generic-vnfs/generic-vnf"); + */ + if ( st.countTokens() > 1 && getItemName == null ) { + if ( appliedPaths.containsKey(path)) + return null; + appliedPaths.put(path, null); + genPath = true; + if ( path.contains("/relationship/") ) { // filter paths with relationship-list + genPath = false; + } + if ( path.endsWith("/relationship-list")) { + genPath = false; + } + + } + + Vector<String> addTypeV = null; + if ( xmlElementNodes.getLength() > 0 ) { + + for ( int i = 0; i < xmlElementNodes.getLength(); ++i ) { + xmlElementElement = (Element)xmlElementNodes.item(i); + if ( !xmlElementElement.getParentNode().isSameNode(parentElement)) + continue; + /*childNodes = xmlElementElement.getElementsByTagName("xml-element-wrapper"); + if ( childNodes.getLength() > 0 ) { + childElement = (Element)childNodes.item(0); + // get name + attributes = childElement.getAttributes(); + for ( int k = 0; k < attributes.getLength(); ++k ) { + Attr attr = (Attr) attributes.item(k); + String attrName = attr.getNodeName(); + String attrValue = attr.getNodeValue(); + if ( attrName.equals("name")) { + xmlElementWrapper = attrValue; + //System.out.println("found xml-element-wrapper " + xmlElementWrapper); + } + } + + } + */ + valNodes = xmlElementElement.getElementsByTagName("xml-properties"); + attrDescription = null; + if ( valNodes.getLength() > 0 ) { + for ( int j = 0; j < valNodes.getLength(); ++j ) { + valElement = (Element)valNodes.item(j); + if ( !valElement.getParentNode().isSameNode(xmlElementElement)) + continue; + childNodes = valElement.getElementsByTagName("xml-property"); + if ( childNodes.getLength() > 0 ) { + childElement = (Element)childNodes.item(0); + // get name + attributes = childElement.getAttributes(); + attrDescription = null; + boolean useValue = false; + for ( int k = 0; k < attributes.getLength(); ++k ) { + Attr attr = (Attr) attributes.item(k); + String attrName = attr.getNodeName(); + String attrValue = attr.getNodeValue(); + if ( attrName.equals("name") && attrValue.equals("description")) { + useValue = true; + } + if ( useValue && attrName.equals("value")) { + attrDescription = attrValue; + //System.out.println("found xml-element-wrapper " + xmlElementWrapper); + } + } + + } + } + } + + attributes = xmlElementElement.getAttributes(); + addTypeV = null; // vector of 1 + addType = null; + + elementName = elementType = elementIsKey = elementIsRequired = elementContainerType = null; + for ( int j = 0; j < attributes.getLength(); ++j ) { + Attr attr = (Attr) attributes.item(j); + String attrName = attr.getNodeName(); + + String attrValue = attr.getNodeValue(); + //System.out.println("For " + xmlRootElementName + " Found xml-element attribute: " + attrName + " with value: " + attrValue); + if ( attrName.equals("name")) { + elementName = attrValue; + + } + if ( attrName.equals("type") && getItemName == null ) { + elementType = attrValue; + if ( attrValue.contains(apiVersionFmt) ) { + addType = attrValue.substring(attrValue.lastIndexOf('.')+1); + if ( addTypeV == null ) + addTypeV = new Vector<String>(); + addTypeV.add(addType); + } + + } + if ( attrName.equals("xml-key")) { + elementIsKey = attrValue; + path += "/{" + elementName + "}"; + } + if ( attrName.equals("required")) { + elementIsRequired = attrValue; + } + if ( attrName.equals("container-type")) { + elementContainerType = attrValue; + } + } + if ( getItemName != null ) { + if ( getItemName.equals("array") ) { + if ( elementContainerType != null && elementContainerType.equals("java.util.ArrayList")) { + //System.out.println( " returning array " + elementName ); + return elementName; + } + + } else { // not an array check + if ( elementContainerType == null || !elementContainerType.equals("java.util.ArrayList")) { + //System.out.println( " returning object " + elementName ); + return elementName; + } + + } + //System.out.println( " returning null" ); + return null; + } + if ( elementIsRequired != null ) { + if ( requiredCnt == 0 ) + sbRequired.append(" required:\n"); + ++requiredCnt; + if ( addTypeV != null ) { + for ( int k = 0; k < addTypeV.size(); ++i ) { + sbRequired.append(" - " + getXmlRootElementName(addTypeV.elementAt(k)) + ":\n"); + } + } else + sbRequired.append(" - " + elementName + "\n"); + + } + + if ( elementIsKey != null ) { + sbParameters.append((" - name: " + elementName + "\n")); + sbParameters.append((" in: path\n")); + if ( attrDescription != null && attrDescription.length() > 0 ) + sbParameters.append((" description: " + attrDescription + "\n")); + sbParameters.append((" required: true\n")); + if ( elementType.equals("java.lang.String")) + sbParameters.append(" type: string\n"); + if ( elementType.equals("java.lang.Long")) { + sbParameters.append(" type: integer\n"); + sbParameters.append(" format: int64\n"); + } + if ( elementType.equals("java.lang.Integer")) { + sbParameters.append(" type: integer\n"); + sbParameters.append(" format: int32\n"); + } + if ( elementType.equals("java.lang.Boolean")) + sbParameters.append(" type: boolean\n"); + + + } else if ( indexedProps != null + && indexedProps.contains(elementName ) ) { + sbIndexedParams.append((" - name: " + elementName + "\n")); + sbIndexedParams.append((" in: query\n")); + if ( attrDescription != null && attrDescription.length() > 0 ) + sbIndexedParams.append((" description: " + attrDescription + "\n")); + sbIndexedParams.append((" required: false\n")); + if ( elementType.equals("java.lang.String")) + sbIndexedParams.append(" type: string\n"); + if ( elementType.equals("java.lang.Long")) { + sbIndexedParams.append(" type: integer\n"); + sbIndexedParams.append(" format: int64\n"); + } + if ( elementType.equals("java.lang.Integer")) { + sbIndexedParams.append(" type: integer\n"); + sbIndexedParams.append(" format: int32\n"); + } + if ( elementType.equals("java.lang.Boolean")) + sbIndexedParams.append(" type: boolean\n"); + } + + /* + if ( elementName != null && elementName.equals("inventory-item")) + System.out.println( "processing inventory-item elementName"); + */ + + if ( isStandardType(elementType)) { + sbProperties.append(" " + elementName + ":\n"); + ++propertyCnt; + sbProperties.append(" type: "); + + if ( elementType.equals("java.lang.String")) + sbProperties.append("string\n"); + else if ( elementType.equals("java.lang.Long")) { + sbProperties.append("integer\n"); + sbProperties.append(" format: int64\n"); + } + else if ( elementType.equals("java.lang.Integer")){ + sbProperties.append("integer\n"); + sbProperties.append(" format: int32\n"); + } + else if ( elementType.equals("java.lang.Boolean")) + sbProperties.append("boolean\n"); + if ( attrDescription != null && attrDescription.length() > 0 ) + sbProperties.append(" description: " + attrDescription + "\n"); + } + + //if ( addType != null && elementContainerType != null && elementContainerType.equals("java.util.ArrayList") ) { + + if ( addTypeV != null ) { + StringBuffer newPathParams = null; + if ( pathParams != null ) { + newPathParams = new StringBuffer(); + newPathParams.append(pathParams); + } + if ( sbParameters.toString().length() > 0 ) { + if ( newPathParams == null ) + newPathParams = new StringBuffer(); + newPathParams.append(sbParameters); + } + String newQueryParams = null; + if ( sbIndexedParams.toString().length() > 0 ) { + if ( queryParams == null ) + newQueryParams = sbIndexedParams.toString(); + else + newQueryParams = queryParams + sbIndexedParams.toString(); + } else { + newQueryParams = queryParams; + } + for ( int k = 0; k < addTypeV.size(); ++k ) { + addType = addTypeV.elementAt(k); + + if ( opId == null || !opId.contains(addType)) { + processJavaTypeElementSwagger( addType, getJavaTypeElementSwagger(addType), + pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, null, + newPathParams, newQueryParams, validEdges); + } + // need item name of array + String itemName = processJavaTypeElementSwagger( addType, getJavaTypeElementSwagger(addType), + pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, + "array", null, null, null ); + + if ( itemName != null ) { + if ( addType.equals("AaiInternal") ) { + //System.out.println( "addType AaiInternal, skip properties"); + + } else if ( getItemName == null) { + ++propertyCnt; + sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); + sbProperties.append(" type: array\n items:\n"); + sbProperties.append(" $ref: \"#/definitions/" + itemName + "\"\n"); + if ( attrDescription != null && attrDescription.length() > 0 ) + sbProperties.append(" description: " + attrDescription + "\n"); + } + } else { + /*itemName = processJavaTypeElementSwagger( addType, getJavaTypeElementSwagger(addType), + pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, "other" ); + if ( itemName != null ) { + */ + if ( elementContainerType != null && elementContainerType.equals("java.util.ArrayList")) { + // need properties for getXmlRootElementName(addType) + newPathParams = null; + if ( pathParams != null ) { + newPathParams = new StringBuffer(); + newPathParams.append(pathParams); + } + if ( sbParameters.toString().length() > 0 ) { + if ( newPathParams == null ) + newPathParams = new StringBuffer(); + newPathParams.append(sbParameters); + } + newQueryParams = null; + if ( sbIndexedParams.toString().length() > 0 ) { + if ( queryParams == null ) + newQueryParams = sbIndexedParams.toString(); + else + newQueryParams = queryParams + sbIndexedParams.toString(); + } else { + newQueryParams = queryParams; + } + processJavaTypeElementSwagger( addType, getJavaTypeElementSwagger(addType), + pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, + null, newPathParams, newQueryParams, validEdges ); + sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); + sbProperties.append(" type: array\n items: \n"); + sbProperties.append(" $ref: \"#/definitions/" + getXmlRootElementName(addType) + "\"\n"); + } else { + sbProperties.append(" " + getXmlRootElementName(addType) + ":\n"); + sbProperties.append(" type: object\n"); + sbProperties.append(" $ref: \"#/definitions/" + getXmlRootElementName(addType) + "\"\n"); + } + if ( attrDescription != null && attrDescription.length() > 0 ) + sbProperties.append(" description: " + attrDescription + "\n"); + ++propertyCnt; + /*} + else { + System.out.println(" unable to define swagger object for " + addType); + } + */ + } + //if ( getItemName == null) looking for missing properties + //generatedJavaType.put(addType, null); + } + } + } + } + if ( genPath ) { + /* + if ( useOpId.equals("CloudInfrastructureComplexesComplexCtagPools")) + System.out.println( "adding path CloudInfrastructureComplexesComplexCtagPools"); + */ + + if ( !path.endsWith("/relationship") ) { + pathSb.append(" " + path + ":\n" ); + pathSb.append(" get:\n"); + pathSb.append(" tags:\n"); + pathSb.append(" - " + tag + "\n"); + pathSb.append(" summary: returns " + xmlRootElementName + "\n"); + + pathSb.append(" description: returns " + xmlRootElementName + "\n"); + pathSb.append(" operationId: get" + useOpId + "\n"); + pathSb.append(" produces:\n"); + pathSb.append(" - application/json\n"); + pathSb.append(" - application/xml\n"); + + pathSb.append(" responses:\n"); + pathSb.append(" \"200\":\n"); + pathSb.append(" description: successful operation\n"); + pathSb.append(" schema:\n"); + pathSb.append(" $ref: \"#/definitions/" + xmlRootElementName + "\"\n"); + pathSb.append(" \"default\":\n"); + pathSb.append(" " + responsesUrl); + /* + pathSb.append(" \"200\":\n"); + pathSb.append(" description: successful operation\n"); + pathSb.append(" schema:\n"); + pathSb.append(" $ref: \"#/definitions/" + xmlRootElementName + "\"\n"); + pathSb.append(" \"404\":\n"); + pathSb.append(" description: resource was not found\n"); + pathSb.append(" \"400\":\n"); + pathSb.append(" description: bad request\n"); + */ + if ( path.indexOf('{') > 0 ) { + + if ( sbParameters.toString().length() > 0 ) { + if ( pathParams == null ) + pathParams = new StringBuffer(); + pathParams.append(sbParameters); + } + if ( pathParams != null) { + pathSb.append(" parameters:\n"); + pathSb.append(pathParams); + } else + System.out.println( "null pathParams for " + useOpId); + if ( sbIndexedParams.toString().length() > 0 ) { + if ( queryParams == null ) + queryParams = sbIndexedParams.toString(); + else + queryParams = queryParams + sbIndexedParams.toString(); + } + if ( queryParams != null ) { + if ( pathParams == null ) { + pathSb.append(" parameters:\n"); + } + pathSb.append(queryParams); + } + } + } + boolean skipPutDelete = false; // no put or delete for "all" + if ( !path.endsWith("/relationship") ) { + if ( !path.endsWith("}") ){ + skipPutDelete = true; + } + + } + if ( path.indexOf('{') > 0 && !opId.startsWith("Search") &&!skipPutDelete) { + // add PUT + if ( path.endsWith("/relationship") ) { + pathSb.append(" " + path + ":\n" ); + } + pathSb.append(" put:\n"); + pathSb.append(" tags:\n"); + pathSb.append(" - " + tag + "\n"); + + if ( path.endsWith("/relationship") ) { + pathSb.append(" summary: see node definition for valid relationships\n"); + } else { + pathSb.append(" summary: create or update an existing " + xmlRootElementName + "\n"); + pathSb.append(" description: create or update an existing " + xmlRootElementName + "\n"); + } + pathSb.append(" operationId: createOrUpdate" + useOpId + "\n"); + pathSb.append(" consumes:\n"); + pathSb.append(" - application/json\n"); + pathSb.append(" - application/xml\n"); + pathSb.append(" produces:\n"); + pathSb.append(" - application/json\n"); + pathSb.append(" - application/xml\n"); + pathSb.append(" responses:\n"); + pathSb.append(" \"default\":\n"); + pathSb.append(" " + responsesUrl); + /* + pathSb.append(" responses:\n"); + pathSb.append(" \"200\":\n"); + pathSb.append(" description: existing resource has been modified and there is a response buffer\n"); + pathSb.append(" \"201\":\n"); + pathSb.append(" description: new resource is created\n"); + pathSb.append(" \"202\":\n"); + pathSb.append(" description: action requested but may have taken other actions as well, which are returned in the response payload\n"); + pathSb.append(" \"204\":\n"); + pathSb.append(" description: existing resource has been modified and there is no response buffer\n"); + pathSb.append(" \"400\":\n"); + pathSb.append(" description: Bad Request will be returned if headers are missing\n"); + pathSb.append(" \"404\":\n"); + pathSb.append(" description: Not Found will be returned if an unknown URL is used\n"); + */ + pathSb.append(" parameters:\n"); + //pathSb.append(" - in: path\n"); + pathSb.append(pathParams); // for nesting + pathSb.append(" - name: body\n"); + pathSb.append(" in: body\n"); + pathSb.append(" description: " + xmlRootElementName + " object that needs to be created or updated\n"); + pathSb.append(" required: true\n"); + pathSb.append(" schema:\n"); + pathSb.append(" $ref: \"#/definitions/" + xmlRootElementName + "\"\n"); + /* + if ( queryParams != null ) { + pathSb.append(queryParams); + } + */ + // add DELETE + pathSb.append(" delete:\n"); + pathSb.append(" tags:\n"); + pathSb.append(" - " + tag + "\n"); + pathSb.append(" summary: delete an existing " + xmlRootElementName + "\n"); + + pathSb.append(" description: delete an existing " + xmlRootElementName + "\n"); + + pathSb.append(" operationId: delete" + useOpId + "\n"); + pathSb.append(" consumes:\n"); + pathSb.append(" - application/json\n"); + pathSb.append(" - application/xml\n"); + pathSb.append(" produces:\n"); + pathSb.append(" - application/json\n"); + pathSb.append(" - application/xml\n"); + pathSb.append(" responses:\n"); + pathSb.append(" \"default\":\n"); + pathSb.append(" " + responsesUrl); + /* + pathSb.append(" responses:\n"); + pathSb.append(" \"200\":\n"); + pathSb.append(" description: successful, the response includes an entity describing the status\n"); + pathSb.append(" \"204\":\n"); + pathSb.append(" description: successful, action has been enacted but the response does not include an entity\n"); + pathSb.append(" \"400\":\n"); + pathSb.append(" description: Bad Request will be returned if headers are missing\n"); + pathSb.append(" \"404\":\n"); + pathSb.append(" description: Not Found will be returned if an unknown URL is used\n"); + */ + pathSb.append(" parameters:\n"); + //pathSb.append(" - in: path\n"); + pathSb.append(pathParams); // for nesting + if ( !path.endsWith("/relationship") ) { + pathSb.append(" - name: resource-version\n"); + + pathSb.append(" in: query\n"); + pathSb.append(" description: resource-version for concurrency\n"); + pathSb.append(" required: true\n"); + pathSb.append(" type: string\n"); + } + /* + if ( queryParams != null ) { + pathSb.append(queryParams); + } + */ + } + + } + if ( generatedJavaType.containsKey(xmlRootElementName) ) { + return null; + } + + definitionsSb.append(" " + xmlRootElementName + ":\n"); + Collection<EdgeDescription> edges = getEdgeRules(xmlRootElementName ); + if ( edges.size() > 0 ) { + StringBuffer sbEdge = new StringBuffer(); + sbEdge.append(" ###### Related Nodes\n"); + for (EdgeDescription ed : edges) { + if ( ed.getRuleKey().startsWith(xmlRootElementName)) { + sbEdge.append(" - TO ").append(ed.getRuleKey().substring(ed.getRuleKey().indexOf("|")+1)); + sbEdge.append(ed.getRelationshipDescription("TO", xmlRootElementName)); + sbEdge.append("\n"); + } + } + for (EdgeDescription ed : edges) { + if ( ed.getRuleKey().endsWith(xmlRootElementName)) { + sbEdge.append(" - FROM ").append(ed.getRuleKey().substring(0, ed.getRuleKey().indexOf("|"))); + sbEdge.append(ed.getRelationshipDescription("FROM", xmlRootElementName)); + sbEdge.append("\n"); + } + } + validEdges = sbEdge.toString(); + } + + String deleteRule = getDeleteRules(xmlRootElementName); + // Handle description property. Might have a description OR valid edges OR both OR neither. + // Only put a description: tag if there is at least one. + if (pathDescriptionProperty != null || deleteRule != null || validEdges != null) { + definitionsSb.append(" description: |\n"); + + if ( pathDescriptionProperty != null ) + definitionsSb.append(" " + pathDescriptionProperty + "\n" ); + if (deleteRule != null) + definitionsSb.append(" ###### Default Delete Scope\n ").append(deleteRule).append("\n"); + if (validEdges != null) + definitionsSb.append(validEdges); + } + + if ( requiredCnt > 0 ) + definitionsSb.append(sbRequired); + if ( propertyCnt > 0 ) { + definitionsSb.append(" properties:\n"); + definitionsSb.append(sbProperties); + } + generatedJavaType.put(xmlRootElementName, null); + return null; + } + + public static String generateSwaggerFromOxmFile( File oxmFile ) + { + + StringBuffer sb = new StringBuffer(); + sb.append("swagger: \"2.0\"\ninfo:\n description:\n A&AI REST API\n version: \"" + apiVersion +"\"\n"); + sb.append(" title: Active and Available Inventory REST API\n"); + sb.append(" license:\n name: Apache 2.0\n url: http://www.apache.org/licenses/LICENSE-2.0.html\n"); + sb.append("schemes:\n - https\npaths:\n"); + /* + sb.append("responses:\n"); + sb.append(" \"200\":\n"); + sb.append(" description: successful operation\n"); + sb.append(" \"404\":\n"); + sb.append(" description: resource was not found\n"); + sb.append(" \"400\":\n"); + sb.append(" description: bad request\n"); + */ + try { + + versionedClass = getEdgeRulesClass(); + + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + dbFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(oxmFile); + + NodeList bindingsNodes = doc.getElementsByTagName("xml-bindings"); + Element bindingElement; + NodeList javaTypesNodes; + Element javaTypesElement; + + Element javaTypeElement; + + + if ( bindingsNodes == null || bindingsNodes.getLength() == 0 ) { + System.out.println( "missing <binding-nodes> in " + oxmFile ); + return null; + } + + bindingElement = (Element) bindingsNodes.item(0); + javaTypesNodes = bindingElement.getElementsByTagName("java-types"); + if ( javaTypesNodes.getLength() < 1 ) { + System.out.println( "missing <binding-nodes><java-types> in " + oxmFile ); + return null; + } + javaTypesElement = (Element) javaTypesNodes.item(0); + + javaTypeNodes = javaTypesElement.getElementsByTagName("java-type"); + if ( javaTypeNodes.getLength() < 1 ) { + System.out.println( "missing <binding-nodes><java-types><java-type> in " + oxmFile ); + return null; + } + + String javaTypeName; + String attrName, attrValue; + Attr attr; + StringBuffer pathSb = new StringBuffer(); + + StringBuffer definitionsSb = new StringBuffer("definitions:\n"); + + for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) { + javaTypeElement = (Element) javaTypeNodes.item(i); + NamedNodeMap attributes = javaTypeElement.getAttributes(); + javaTypeName = null; + for ( int j = 0; j < attributes.getLength(); ++j ) { + attr = (Attr) attributes.item(j); + attrName = attr.getNodeName(); + attrValue = attr.getNodeValue(); + if ( attrName.equals("name")) + javaTypeName = attrValue; + } + if ( javaTypeName == null ) { + System.out.println( "<java-type> has no name attribute in " + oxmFile ); + return null; + } + if ( !generatedJavaType.containsKey(getXmlRootElementName(javaTypeName)) ) { + + //generatedJavaType.put(javaTypeName, null); + //if ( javaTypeName.equals("search")||javaTypeName.equals("actions")) + + processJavaTypeElementSwagger( javaTypeName, javaTypeElement, pathSb, + definitionsSb, null, null, null, null, null, null, null); + } + } + sb.append(pathSb); + //System.out.println( "definitions block\n" + definitionsSb.toString()); + sb.append(definitionsSb.toString()); + //sb.append(definitionsSb); + + } catch (Exception e) { + e.printStackTrace(); + return null; + } + //System.out.println("generated " + sb.toString()); + return sb.toString(); + } + + private static NodeList locateXmlProperties(Element element) { + XPathExpression expr; + NodeList result = null; + try { + expr = xpath.compile("xml-properties"); + if (expr != null) { + Object nodeset = expr.evaluate(element, XPathConstants.NODESET); + if (nodeset != null) { + NodeList nodes = (NodeList) nodeset; + if (nodes != null && nodes.getLength() > 0) { + Element xmlProperty = (Element)nodes.item(0); + result = xmlProperty.getElementsByTagName("xml-property"); + } + } + } + } catch (XPathExpressionException e) { + e.printStackTrace(); + } + return result; + + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/HbaseSaltPrefixer.java b/aai-core/src/main/java/org/openecomp/aai/util/HbaseSaltPrefixer.java new file mode 100644 index 00000000..29373858 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/HbaseSaltPrefixer.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +/* + * logging to hbase encountered hotspotting issues, so per + * http://archive.cloudera.com/cdh5/cdh/5/hbase-0.98.6-cdh5.3.8/book/rowkey.design.html + * we decided to salt the rowkeys + * as these keys are generated in a couple places, I made a class to contain that logic + */ +public class HbaseSaltPrefixer { + private int NUM_REGION_BUCKETS = 3; //the number of hbase region servers per cluster + + private static class SingletonHolder{ + private static final HbaseSaltPrefixer INSTANCE = new HbaseSaltPrefixer(); + } + + /** + * Instantiates a new hbase salt prefixer. + */ + private HbaseSaltPrefixer(){} + + /** + * Gets the single instance of HbaseSaltPrefixer. + * + * @return single instance of HbaseSaltPrefixer + */ + public static HbaseSaltPrefixer getInstance() { + return SingletonHolder.INSTANCE; + } + + /** + * Prepend salt. + * + * @param key the key + * @return the string + */ + public String prependSalt(String key) { + int salt = Math.abs(key.hashCode()) % NUM_REGION_BUCKETS; + return salt + "-" + key; + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/KeyValueList.java b/aai-core/src/main/java/org/openecomp/aai/util/KeyValueList.java new file mode 100644 index 00000000..95f09d58 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/KeyValueList.java @@ -0,0 +1,138 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Generated("org.jsonschema2pojo") +@JsonPropertyOrder({ + "key", + "value" +}) +public class KeyValueList { + + @JsonProperty("key") + private String key; + @JsonProperty("value") + private String value; + @JsonIgnore + private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + + /** + * + * @return + * The key + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * + * @param key + * The key + */ + @JsonProperty("key") + public void setKey(String key) { + this.key = key; + } + + public KeyValueList withKey(String key) { + this.key = key; + return this; + } + + /** + * + * @return + * The value + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + /** + * + * @param value + * The value + */ + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + public KeyValueList withValue(String value) { + this.value = value; + return this; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map<String, Object> getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + public KeyValueList withAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(key).append(value).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof KeyValueList) == false) { + return false; + } + KeyValueList rhs = ((KeyValueList) other); + return new EqualsBuilder().append(key, rhs.key).append(value, rhs.value).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/MapperUtil.java b/aai-core/src/main/java/org/openecomp/aai/util/MapperUtil.java new file mode 100644 index 00000000..54f239b6 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/MapperUtil.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import org.openecomp.aai.exceptions.AAIException; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; + +public class MapperUtil { + + + /** + * Read as object of. + * + * @param <T> the generic type + * @param clazz the clazz + * @param value the value + * @return the t + * @throws AAIException the AAI exception + */ + public static <T> T readAsObjectOf(Class<T> clazz, String value) throws AAIException { + com.fasterxml.jackson.databind.ObjectMapper MAPPER = new ObjectMapper(); + try { + return MAPPER.readValue(value, clazz); + } catch (Exception e) { + throw new AAIException("AAI_4007", e); + } + } + + /** + * Read with dashes as object of. + * + * @param <T> the generic type + * @param clazz the clazz + * @param value the value + * @return the t + * @throws AAIException the AAI exception + */ + public static <T> T readWithDashesAsObjectOf(Class<T> clazz, String value) throws AAIException { + com.fasterxml.jackson.databind.ObjectMapper MAPPER = new ObjectMapper(); + try { + MAPPER.registerModule(new JaxbAnnotationModule()); + MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + MAPPER.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + + return MAPPER.readValue(value, clazz); + } catch (Exception e) { + throw new AAIException("AAI_4007", e); + } + } + + /** + * Write as JSON string. + * + * @param obj the obj + * @return the string + * @throws AAIException the AAI exception + */ + public static String writeAsJSONString(Object obj) throws AAIException { + com.fasterxml.jackson.databind.ObjectMapper MAPPER = new ObjectMapper(); + try { + String s = MAPPER.writeValueAsString(obj); + return s; + //readValue(value, clazz); + } catch (Exception e) { + throw new AAIException("AAI_4008", e); + } + } + + /** + * Write as JSON string with dashes. + * + * @param obj the obj + * @return the string + * @throws AAIException the AAI exception + */ + public static String writeAsJSONStringWithDashes(Object obj) throws AAIException { + com.fasterxml.jackson.databind.ObjectMapper MAPPER = new ObjectMapper(); + try { + MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + MAPPER.configure(SerializationFeature.INDENT_OUTPUT, false); + MAPPER.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + + MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + MAPPER.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + + MAPPER.registerModule(new JaxbAnnotationModule()); + String s = MAPPER.writeValueAsString(obj); + return s; + } catch (Exception e) { + throw new AAIException("AAI_4008", e); + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/PojoUtils.java b/aai-core/src/main/java/org/openecomp/aai/util/PojoUtils.java new file mode 100644 index 00000000..cd4d771f --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/PojoUtils.java @@ -0,0 +1,738 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; +import com.google.common.base.CaseFormat; +import com.google.common.collect.Multimap; +import com.thinkaurelius.titan.core.TitanVertex; +import org.apache.commons.io.output.ByteArrayOutputStream; +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.dynamic.DynamicType; +import org.eclipse.persistence.jaxb.MarshallerProperties; +import org.openecomp.aai.domain.model.AAIResource; +import org.openecomp.aai.exceptions.AAIException; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import java.io.IOException; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.*; +import java.util.Map.Entry; + +public class PojoUtils { + + /** + * Gets the key value list. + * + * @param <T> the generic type + * @param e the e + * @param clazz the clazz + * @return the key value list + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + */ + public <T> List<KeyValueList> getKeyValueList(Entity e, T clazz) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + List<KeyValueList> kvList = e.getKeyValueList(); + Object value = null; + Method[] methods = clazz.getClass().getDeclaredMethods(); + String propertyName = ""; + + for (Method method : methods) { + if (method.getName().startsWith("get")) { + propertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(3)); + if (!(method.getReturnType().getName().contains("aai")) || method.getReturnType().getName().contains("java.util.List")) { + value = method.invoke(clazz); + KeyValueList kv = new KeyValueList(); + kv.setKey(propertyName); + if (value != null) { + kv.setValue(value.toString()); + } else { + kv.setValue(""); + } + kvList.add(kv); + } + } + } + return kvList; + } + + /** + * Gets the json from object. + * + * @param <T> the generic type + * @param clazz the clazz + * @return the json from object + * @throws JsonGenerationException the json generation exception + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. + */ + public <T> String getJsonFromObject(T clazz) throws JsonGenerationException, JsonMappingException, IOException { + return getJsonFromObject(clazz, false, true); + } + + /** + * Gets the json from object. + * + * @param <T> the generic type + * @param clazz the clazz + * @param wrapRoot the wrap root + * @param indent the indent + * @return the json from object + * @throws JsonGenerationException the json generation exception + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. + */ + public <T> String getJsonFromObject(T clazz, boolean wrapRoot, boolean indent) throws JsonGenerationException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + mapper.configure(SerializationFeature.INDENT_OUTPUT, indent); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, wrapRoot); + + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot); + + mapper.registerModule(new JaxbAnnotationModule()); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + mapper.writeValue(baos, clazz); + + return baos.toString(); + } + + /** + * Gets the json from dynamic object. + * + * @param ent the ent + * @param jaxbContext the jaxb context + * @param includeRoot the include root + * @return the json from dynamic object + * @throws JsonGenerationException the json generation exception + * @throws JsonMappingException the json mapping exception + * @throws IOException Signals that an I/O exception has occurred. + * @throws JAXBException the JAXB exception + */ + public String getJsonFromDynamicObject(DynamicEntity ent, org.eclipse.persistence.jaxb.JAXBContext jaxbContext, boolean includeRoot) throws JsonGenerationException, JsonMappingException, IOException, JAXBException { + org.eclipse.persistence.jaxb.JAXBMarshaller marshaller = jaxbContext.createMarshaller(); + + marshaller.setProperty(org.eclipse.persistence.jaxb.JAXBMarshaller.JAXB_FORMATTED_OUTPUT, false); + marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS, Boolean.FALSE) ; + marshaller.setProperty("eclipselink.json.include-root", includeRoot); + marshaller.setProperty("eclipselink.media-type", "application/json"); + StringWriter writer = new StringWriter(); + marshaller.marshal(ent, writer); + + return writer.toString(); + } + + /** + * Gets the xml from object. + * + * @param <T> the generic type + * @param clazz the clazz + * @return the xml from object + * @throws JAXBException the JAXB exception + */ + public <T> String getXmlFromObject(T clazz) throws JAXBException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + JAXBContext jc = JAXBContext.newInstance(clazz.getClass().getPackage().getName()); + + Marshaller marshaller = jc.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(clazz, baos); + + return baos.toString(); + } + + /** + * Gets the lookup key. + * + * @param baseKey the base key + * @param lookupHash the lookup hash + * @param keyProps the key props + * @return the lookup key + */ + public String getLookupKey (String baseKey, HashMap<String,Object> lookupHash, Collection<String> keyProps) { + int baseKeyLen = baseKey.length(); + StringBuffer newKey = new StringBuffer(); + if (baseKeyLen > 0) { + newKey.append(baseKey); + } + + Iterator <String> keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + String keyProp = keyPropI.next(); + if (baseKeyLen > 0) { + newKey.append("&"); + } + newKey.append(keyProp + "=" + lookupHash.get(keyProp)); + } + return newKey.toString(); + } + + /** + * Gets the lookup keys. + * + * @param lookupHashes the lookup hashes + * @param _dbRulesNodeKeyProps the db rules node key props + * @return the lookup keys + */ + public String getLookupKeys (LinkedHashMap<String,HashMap<String,Object>> lookupHashes, Multimap<String, String> _dbRulesNodeKeyProps) { + Iterator<String> it = lookupHashes.keySet().iterator(); + String lookupKeys = ""; + while (it.hasNext()) { + String objectType = (String)it.next(); + HashMap<String,Object> lookupHash = lookupHashes.get(objectType); + + Collection<String> keyProps = _dbRulesNodeKeyProps.get(objectType); + Iterator <String> keyPropI = keyProps.iterator(); + while( keyPropI.hasNext() ){ + lookupKeys += lookupHash.get(keyPropI.next()); + } + } + return lookupKeys; + } + + /** + * Gets the example object. + * + * @param <T> the generic type + * @param clazz the clazz + * @param singleton the singleton + * @return the example object + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception + */ + public <T> void getExampleObject(T clazz, boolean singleton) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, AAIException { + Method[] methods = clazz.getClass().getDeclaredMethods(); + String dnHypPropertyName = ""; + String upCamPropertyName = ""; + Random rand = new Random(); + int randInt = rand.nextInt(10000000); + + for (Method method : methods) { + boolean go = false; + if (method.getName().startsWith("get")) { + dnHypPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(3)); + upCamPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL,method.getName().substring(3)); + go = true; + } else if (method.getName().startsWith("is")) { + dnHypPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(2)); + upCamPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL,method.getName().substring(2)); + go = true; + } + // don't return resource-version on a singleton + if (singleton && dnHypPropertyName.equals("resource-version")) { + go = false; + } + if (go) { + String retType = method.getReturnType().getName(); + if (!retType.contains("aai") && !retType.contains("java.util.List")) { + // get the setter + Method meth = clazz.getClass().getMethod("set" + upCamPropertyName, method.getReturnType()); + + if (retType.contains("String")) { + String val = "example-" + dnHypPropertyName + "-val-" + randInt; + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("long")) { + Integer foo = rand.nextInt(100000); + meth.invoke(clazz, foo.longValue()); + } else if (retType.toLowerCase().contains("int")) { + meth.invoke(clazz, rand.nextInt(100000)); + } else if (retType.toLowerCase().contains("short")) { + Integer randShort = rand.nextInt(10000); + meth.invoke(clazz, randShort.shortValue()); + } else if (retType.toLowerCase().contains("boolean")) { + meth.invoke(clazz, true); + } + } + } + } + } + + + /** + * Gets the aai object from vertex. + * + * @param <T> the generic type + * @param clazz the clazz + * @param vert the vert + * @param _propertyDataTypeMap the property data type map + * @return the aai object from vertex + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception + */ + public <T> void getAaiObjectFromVertex(T clazz, TitanVertex vert, Map<String, String> _propertyDataTypeMap) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, AAIException { + Method[] methods = clazz.getClass().getDeclaredMethods(); + String dnHypPropertyName = ""; + String upCamPropertyName = ""; + for (Method method : methods) { + boolean go = false; + if (method.getName().startsWith("get")) { + dnHypPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(3)); + upCamPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL,method.getName().substring(3)); + go = true; + } else if (method.getName().startsWith("is")) { + dnHypPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(2)); + upCamPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL,method.getName().substring(2)); + go = true; + } + if (go) { + String retType = method.getReturnType().getName(); + if (!retType.contains("aai") && !retType.contains("java.util.List")) { + // get the setter + Method meth = clazz.getClass().getMethod("set" + upCamPropertyName, method.getReturnType()); + + if (retType.contains("String")) { + String val = (String)vert.<String>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("long")) { + String titanType = _propertyDataTypeMap.get(dnHypPropertyName); + + Long val = null; + // we have a case where the type in titan is "Integer" but in the POJO it's Long or long + if (titanType.toLowerCase().contains("int")) { + Integer intVal = (Integer)vert.<Integer>property(dnHypPropertyName).orElse(null); + if (intVal != null) { + val = intVal.longValue(); + } + } else { + val = (Long)vert.<Long>property(dnHypPropertyName).orElse(null); + } + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("int")) { + Integer val = (Integer)vert.<Integer>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("short")) { + Short val = (Short)vert.<Short>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("boolean")) { + Boolean val = (Boolean)vert.<Boolean>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } + } + } + } + } + + /** + * Gets the topology object. + * + * @param <T> the generic type + * @param clazz the clazz + * @param _dbRulesNodeNameProps the db rules node name props + * @param _dbRulesNodeKeyProps the db rules node key props + * @param vert the vert + * @return the topology object + * @throws IllegalAccessException the illegal access exception + * @throws IllegalArgumentException the illegal argument exception + * @throws InvocationTargetException the invocation target exception + * @throws NoSuchMethodException the no such method exception + * @throws SecurityException the security exception + * @throws AAIException the AAI exception + */ + public <T> void getTopologyObject(T clazz, Multimap<String, String> _dbRulesNodeNameProps, Multimap<String, String> _dbRulesNodeKeyProps, TitanVertex vert) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, AAIException { + Method[] methods = clazz.getClass().getDeclaredMethods(); + String dnHypPropertyName = ""; +// Object value = null; + List<String> includeProps = new ArrayList<String>(); + + if ("false".equals(AAIConfig.get("aai.notification.topology.allAttrs", "false"))) { + for (Method method : methods) { + if (method.getName().startsWith("is")) { + dnHypPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(2)); + String upCamPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL,method.getName().substring(2)); + String retType = method.getReturnType().getName(); + if (retType.equals("java.lang.Boolean")) { + // get the setter + Method setterMeth = clazz.getClass().getMethod("set" + upCamPropertyName, method.getReturnType()); + setterMeth.invoke(clazz, (Boolean)null); + } + } + } + String dnHypClassName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,clazz.getClass().getSimpleName()); + Collection<String> keepProps = _dbRulesNodeNameProps.get(dnHypClassName); + Iterator <String> keepPropI = keepProps.iterator(); + while( keepPropI.hasNext() ){ + includeProps.add(keepPropI.next()); + } + Collection<String> keepProps2 = _dbRulesNodeKeyProps.get(dnHypClassName); + Iterator <String> keepPropI2 = keepProps2.iterator(); + while( keepPropI2.hasNext() ){ + includeProps.add(keepPropI2.next()); + } + } + + for (Method method : methods) { + if (method.getName().startsWith("get")) { + dnHypPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,method.getName().substring(3)); + if (includeProps.size() > 0) { + if (!includeProps.contains(dnHypPropertyName)) { + continue; + } + } + String upCamPropertyName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_CAMEL,method.getName().substring(3)); + String retType = method.getReturnType().getName(); + if (!retType.contains("aai") && !retType.contains("java.util.List")) { + // get the setter + Method meth = clazz.getClass().getMethod("set" + upCamPropertyName, method.getReturnType()); + + if (retType.contains("String")) { + String val = (String)vert.<String>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("long")) { + Long val = (Long)vert.<Long>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("int")) { + Integer val = (Integer)vert.<Integer>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } else if (retType.toLowerCase().contains("short")) { + Short val = (Short)vert.<Short>property(dnHypPropertyName).orElse(null); + if (val != null) { + meth.invoke(clazz, val); + } + } + } + } + } + } + + /** + * Gets the dynamic topology object. + * + * @param aaiRes the aai res + * @param meObjectType the me object type + * @param _dbRulesNodeNameProps the db rules node name props + * @param _dbRulesNodeKeyProps the db rules node key props + * @param _propertyDataTypeMap the property data type map + * @param vert the vert + * @return the dynamic topology object + * @throws AAIException the AAI exception + */ + public DynamicEntity getDynamicTopologyObject(AAIResource aaiRes, DynamicType meObjectType, Multimap<String, String> _dbRulesNodeNameProps, + Multimap<String, String> _dbRulesNodeKeyProps, Map<String, String> _propertyDataTypeMap, TitanVertex vert) throws AAIException { + + DynamicEntity meObject = meObjectType.newDynamicEntity(); + + List<String> includeProps = new ArrayList<String>(); + + if ("false".equals(AAIConfig.get("aai.notification.topology.allAttrs", "false"))) { + String dnHypClassName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,meObjectType.getJavaClass().getSimpleName()); + Collection<String> keepProps = _dbRulesNodeNameProps.get(dnHypClassName); + Iterator <String> keepPropI = keepProps.iterator(); + while( keepPropI.hasNext() ){ + includeProps.add(keepPropI.next()); + } + Collection<String> keepProps2 = _dbRulesNodeKeyProps.get(dnHypClassName); + Iterator <String> keepPropI2 = keepProps2.iterator(); + while( keepPropI2.hasNext() ) { + includeProps.add(keepPropI2.next()); + } + } + + + + for (String attrName : aaiRes.getStringFields()) { + if (includeProps.contains(attrName)) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), vert.<String>property(attrName).orElse(null)); + } + } + // the attrName might need to be converted to camel case!!! + for (String attrName : aaiRes.getLongFields()) { + if (includeProps.contains(attrName)) { + String titanType = _propertyDataTypeMap.get(attrName); + + Long val = null; + // we have a case where the type in titan is "Integer" but in the POJO it's Long or long + if (titanType.toLowerCase().contains("int")) { + Integer intVal = (Integer)vert.<Integer>property(attrName).orElse(null); + if (intVal != null) { + val = intVal.longValue(); + } + } else { + val = (Long)vert.<Long>property(attrName).orElse(null); + } + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + + for (String attrName : aaiRes.getIntFields()) { + if (includeProps.contains(attrName)) { + Integer val = (Integer)vert.<Integer>property(attrName).orElse(null); + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + + for (String attrName : aaiRes.getShortFields()) { + if (includeProps.contains(attrName)) { + String titanType = _propertyDataTypeMap.get(attrName); + + Short val = null; + // we have a case where the type in titan is "Integer" but in the POJO it's Long or long + if (titanType.toLowerCase().contains("int")) { + Integer intVal = (Integer)vert.<Integer>property(attrName).orElse(null); + if (intVal != null) { + val = intVal.shortValue(); + } + } else { + val = (Short)vert.<Short>property(attrName).orElse(null); + } + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + + for (String attrName : aaiRes.getBooleanFields()) { + if (includeProps.contains(attrName)) { + Boolean val = (Boolean)vert.<Boolean>property(attrName).orElse(null); + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + return meObject; + } + + /** + * Gets the aai dynamic object from vertex. + * + * @param aaiRes the aai res + * @param meObject the me object + * @param vert the vert + * @param _propertyDataTypeMap the property data type map + * @return the aai dynamic object from vertex + */ + public void getAaiDynamicObjectFromVertex(AAIResource aaiRes, DynamicEntity meObject, TitanVertex vert, + Map<String, String> _propertyDataTypeMap) { + getAaiDynamicObjectFromVertex(aaiRes, meObject, vert, _propertyDataTypeMap, null); + } + + /** + * Gets the aai dynamic object from vertex. + * + * @param aaiRes the aai res + * @param meObject the me object + * @param vert the vert + * @param _propertyDataTypeMap the property data type map + * @param propertyOverRideHash the property over ride hash + * @return the aai dynamic object from vertex + */ + @SuppressWarnings("unchecked") + public void getAaiDynamicObjectFromVertex(AAIResource aaiRes, DynamicEntity meObject, TitanVertex vert, + Map<String, String> _propertyDataTypeMap, HashMap<String, Object> propertyOverRideHash) { + + for (String attrName : aaiRes.getStringFields()) { + if (propertyOverRideHash == null || (propertyOverRideHash != null && propertyOverRideHash.containsKey(attrName))) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), vert.<String>property(dbAliasWorkaround(attrName)).orElse(null)); + } + } + + for (String attrName : aaiRes.getStringListFields()) { + if (propertyOverRideHash == null || (propertyOverRideHash != null && propertyOverRideHash.containsKey(attrName))) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), vert.<ArrayList<String>>property(attrName).orElse(null)); + } + } + + // the attrName might need to be converted to camel case!!! + for (String attrName : aaiRes.getLongFields()) { + String titanType = _propertyDataTypeMap.get(attrName); + Long val = null; + // we have a case where the type in titan is "Integer" but in the POJO it's Long or long + if (titanType.toLowerCase().contains("int")) { + Object vertexVal = vert.property(attrName).orElse(null); + if (vertexVal != null) { + if (vertexVal instanceof Integer) { + val = ((Integer)vertexVal).longValue(); + + } else { + val = (Long)vert.<Long>property(attrName).orElse(null); + } + } + } else { + val = (Long)vert.<Long>property(attrName).orElse(null); + } + if (val != null) { + if (propertyOverRideHash == null || (propertyOverRideHash != null && propertyOverRideHash.containsKey(attrName))) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + } + + for (String attrName : aaiRes.getIntFields()) { + Integer val = (Integer)vert.<Integer>property(attrName).orElse(null); + if (val != null) { + if (propertyOverRideHash == null || (propertyOverRideHash != null && propertyOverRideHash.containsKey(attrName))) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + } + + for (String attrName : aaiRes.getShortFields()) { + String titanType = _propertyDataTypeMap.get(attrName); + Short val = null; + // we have a case where the type in titan is "Integer" but in the POJO it's Long or long + if (titanType.toLowerCase().contains("int")) { + Integer intVal = (Integer)vert.<Integer>property(attrName).orElse(null); + if (intVal != null) { + val = intVal.shortValue(); + } + } else { + val = (Short)vert.<Short>property(attrName).orElse(null); + } + if (val != null) { + if (propertyOverRideHash == null || (propertyOverRideHash != null && propertyOverRideHash.containsKey(attrName))) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + } + + for (String attrName : aaiRes.getBooleanFields()) { + Boolean val = (Boolean)vert.<Boolean>property(attrName).orElse(null); + // This is not ideal, but moxy isn't marshalling these attributes. + // TODO: Figure out how to see the default-value from the OXM at startup (or at runtime). + String dnHypClassName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,aaiRes.getSimpleName()); + if (val == null && AAIConfig.getDefaultBools().containsKey(dnHypClassName)) { + if (AAIConfig.getDefaultBools().get(dnHypClassName).contains(attrName)) { + val = false; + } + } + if (val != null) { + if (propertyOverRideHash == null || (propertyOverRideHash != null && propertyOverRideHash.containsKey(attrName))) { + meObject.set((CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,attrName)), val); + } + } + } + + } + + private String dbAliasWorkaround(String propName) { + final String modelInvariantIdLocal = "model-invariant-id-local"; + final String modelVersionIdLocal = "model-version-id-local"; + final String modelInvariantId = "model-invariant-id"; + final String modelVersionId = "model-version-id"; + + if (propName.equals(modelInvariantId)) { + return modelInvariantIdLocal; + } + if (propName.equals(modelVersionId)) { + return modelVersionIdLocal; + } + + return propName; + + } + + /** + * Gets the dynamic example object. + * + * @param childObject the child object + * @param aaiRes the aai res + * @param singleton the singleton + * @return the dynamic example object + */ + public void getDynamicExampleObject(DynamicEntity childObject, AAIResource aaiRes, boolean singleton) { + // TODO Auto-generated method stub + + Random rand = new Random(); + Integer randInt = rand.nextInt(100000); + long range = 100000000L; + long randLong = (long)(rand.nextDouble()*range); + Integer randShrt = rand.nextInt(20000); + short randShort = randShrt.shortValue(); + + for (String dnHypAttrName : aaiRes.getStringFields()) { + + if (singleton && ("resource-version").equals(dnHypAttrName)) { + continue; + } + + String dnCamAttrName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,dnHypAttrName); + childObject.set(dnCamAttrName, "example-" + dnHypAttrName + "-val-" + randInt); + + } + + for (String dnHypAttrName : aaiRes.getStringListFields()) { + ArrayList<String> exampleList = new ArrayList<String>(); + exampleList.add("example-" + dnHypAttrName + "-val-" + randInt + "-" + 1); + exampleList.add("example-" + dnHypAttrName + "-val-" + randInt + "-" + 2); + String dnCamAttrName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,dnHypAttrName); + childObject.set(dnCamAttrName, exampleList); + } + + // the attrName might need to be converted to camel case!!! + for (String dnHypAttrName : aaiRes.getLongFields()) { + String dnCamAttrName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,dnHypAttrName); + childObject.set(dnCamAttrName, randLong); + } + + for (String dnHypAttrName : aaiRes.getIntFields()) { + String dnCamAttrName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,dnHypAttrName); + childObject.set(dnCamAttrName, randInt); + } + + for (String dnHypAttrName : aaiRes.getShortFields()) { + String dnCamAttrName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,dnHypAttrName); + childObject.set(dnCamAttrName, randShort); + } + + for (String dnHypAttrName : aaiRes.getBooleanFields()) { + String dnCamAttrName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL,dnHypAttrName); + childObject.set(dnCamAttrName, Boolean.TRUE); + } + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/Request.java b/aai-core/src/main/java/org/openecomp/aai/util/Request.java new file mode 100644 index 00000000..cc812f0d --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/Request.java @@ -0,0 +1,160 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import javax.ws.rs.core.UriBuilder; + +import org.openecomp.aai.exceptions.AAIException; + +public class Request<T> { + + public static final String V2 = "v2"; + public static final String V3 = "v3"; + public static final String V4 = "v4"; + public static final String V5 = "v5"; + public final String fromAppId; + public final String transactionId; + public final String path; + public final RestObject<T> restObj; + public final boolean oldServer; + public final String apiVersion; + + + /** + * Instantiates a new request. + * + * @param builder the builder + */ + public Request(RequestBuilder<T> builder) { + + fromAppId = builder.fromAppId; + transactionId = builder.transactionId; + restObj = builder.restObj; + oldServer = builder.oldServer; + apiVersion = builder.apiVersion; + + if (!oldServer) { + path = apiVersion + "/" + builder.path; + } else { + path = builder.path; + } + + + } + + public static class RequestBuilder<T> { + private String fromAppId; + private String transactionId; + private String path; + private RestObject<T> restObj; + private boolean oldServer; + private String apiVersion = Request.V4; + + + /** + * Sets the from app id. + * + * @param fromAppId the from app id + * @return the request builder + */ + public RequestBuilder<T> setFromAppId(String fromAppId) { + this.fromAppId = fromAppId; + return this; + } + + /** + * Sets the transaction id. + * + * @param transactionId the transaction id + * @return the request builder + */ + public RequestBuilder<T> setTransactionId(String transactionId) { + this.transactionId = transactionId; + return this; + + } + + /** + * Sets the path. + * + * @param path the path + * @return the request builder + */ + public RequestBuilder<T> setPath(String path) { + + this.path = path; + return this; + + } + + /** + * Sets the restcore obj. + * + * @param restObj the restcore obj + * @return the request builder + */ + public RequestBuilder<T> setRestObj(RestObject<T> restObj) { + this.restObj = restObj; + return this; + + } + + /** + * Sets the old server. + * + * @param oldServer the old server + * @return the request builder + */ + public RequestBuilder<T> setOldServer(boolean oldServer) { + this.oldServer = oldServer; + return this; + + } + + /** + * Sets the api version. + * + * @param apiVersion the api version + * @return the request builder + */ + public RequestBuilder<T> setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + + /** + * Builds the. + * + * @return the request + */ + public Request<T> build() { + return new Request<T>(this); + } + + } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/RestObject.java b/aai-core/src/main/java/org/openecomp/aai/util/RestObject.java new file mode 100644 index 00000000..c8b78d41 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/RestObject.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +public class RestObject<T> { + + /** + * Generic version of the RestObject class. + * @param <T> the type of the value being called for the Rest object interface + */ + // T stands for "Type" + private T t; + + /** + * Sets the. + * + * @param t the t + */ + public void set(T t) { this.t = t; } + + /** + * Gets the. + * + * @return the t + */ + public T get() { return t; } + +} diff --git a/aai-core/src/main/java/org/openecomp/aai/util/RestURLEncoder.java b/aai-core/src/main/java/org/openecomp/aai/util/RestURLEncoder.java new file mode 100644 index 00000000..d75fe27b --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/RestURLEncoder.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import java.io.UnsupportedEncodingException; +import org.springframework.web.util.UriUtils; + + +public class RestURLEncoder { + + + /** + * Encode URL. + * + * @param nodeKey the node key + * @return the string + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + public static final String encodeURL (String nodeKey) throws UnsupportedEncodingException { + return UriUtils.encode(nodeKey, "UTF-8").replaceAll("\\+", "%20"); + } +} + diff --git a/aai-core/src/main/java/org/openecomp/aai/util/UniquePropertyCheck.java b/aai-core/src/main/java/org/openecomp/aai/util/UniquePropertyCheck.java new file mode 100644 index 00000000..58eb41a4 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/util/UniquePropertyCheck.java @@ -0,0 +1,264 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.UUID; + +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.slf4j.MDC; + +import org.openecomp.aai.exceptions.AAIException; +import com.att.eelf.configuration.Configuration; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.thinkaurelius.titan.core.TitanEdge; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; +import com.thinkaurelius.titan.core.TitanVertex; + + + +public class UniquePropertyCheck { + + + private static final String FROMAPPID = "AAI-UTILS"; + private static final String TRANSID = UUID.randomUUID().toString(); + private static final String COMPONENT = "UniquePropertyCheck"; + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args) { + + + Properties props = System.getProperties(); + props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "uniquePropertyCheck-logback.xml"); + props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); + EELFLogger logger = EELFManager.getInstance().getLogger(UniquePropertyCheck.class.getSimpleName()); + MDC.put("logFilenameAppender", UniquePropertyCheck.class.getSimpleName()); + + if( args == null || args.length != 1 ){ + String msg = "usage: UniquePropertyCheck propertyName \n"; + System.out.println(msg); + logAndPrint(logger, msg ); + System.exit(1); + } + String propertyName = args[0]; + TitanTransaction graph = null; + + try { + AAIConfig.init(); + System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n"); + TitanGraph tGraph = TitanFactory.open(AAIConstants.REALTIME_DB_CONFIG); + + if( tGraph == null ) { + logAndPrint(logger, " Error: Could not get TitanGraph "); + System.exit(1); + } + + graph = tGraph.newTransaction(); + if( graph == null ){ + logAndPrint(logger, "could not get graph object in UniquePropertyCheck() \n"); + System.exit(0); + } + } + catch (AAIException e1) { + String msg = "Threw Exception: [" + e1.toString() + "]"; + logAndPrint(logger, msg); + System.exit(0); + } + catch (Exception e2) { + String msg = "Threw Exception: [" + e2.toString() + "]"; + logAndPrint(logger, msg); + System.exit(0); + } + + runTheCheckForUniqueness( TRANSID, FROMAPPID, graph, propertyName, logger ); + System.exit(0); + + }// End main() + + + /** + * Run the check for uniqueness. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param graph the graph + * @param propertyName the property name + * @param logger the logger + * @return the boolean + */ + public static Boolean runTheCheckForUniqueness( String transId, String fromAppId, TitanTransaction graph, + String propertyName, EELFLogger logger ){ + + // Note - property can be found in more than one nodetype + // our uniqueness constraints are always across the entire db - so this + // tool looks across all nodeTypes that the property is found in. + Boolean foundDupesFlag = false; + + HashMap <String,String> valuesAndVidHash = new HashMap <String, String> (); + HashMap <String,String> dupeHash = new HashMap <String, String> (); + + int propCount = 0; + int dupeCount = 0; + Iterable <?> vertItr = graph.query().has(propertyName).vertices(); + Iterator <?> vertItor = vertItr.iterator(); + while( vertItor.hasNext() ){ + propCount++; + TitanVertex v = (TitanVertex)vertItor.next(); + String thisVid = v.id().toString(); + Object val = (v.<Object>property(propertyName)).orElse(null); + if( valuesAndVidHash.containsKey(val) ){ + // We've seen this one before- track it in our dupe hash + dupeCount++; + if( dupeHash.containsKey(val) ){ + // This is not the first one being added to the dupe hash for this value + String updatedDupeList = dupeHash.get(val) + "|" + thisVid; + dupeHash.put(val.toString(), updatedDupeList); + } + else { + // This is the first time we see this value repeating + String firstTwoVids = valuesAndVidHash.get(val) + "|" + thisVid; + dupeHash.put(val.toString(), firstTwoVids); + } + } + else { + valuesAndVidHash.put(val.toString(), thisVid); + } + } + + + String info = "\n Found this property [" + propertyName + "] " + propCount + " times in our db."; + logAndPrint(logger, info); + info = " Found " + dupeCount + " cases of duplicate values for this property.\n\n"; + logAndPrint(logger, info); + + try { + if( ! dupeHash.isEmpty() ){ + Iterator <?> dupeItr = dupeHash.entrySet().iterator(); + while( dupeItr.hasNext() ){ + Map.Entry pair = (Map.Entry) dupeItr.next(); + String dupeValue = pair.getKey().toString();; + String vidsStr = pair.getValue().toString(); + String[] vidArr = vidsStr.split("\\|"); + logAndPrint(logger, "\n\n -------------- Found " + vidArr.length + + " nodes with " + propertyName + " of this value: [" + dupeValue + "]. Node details: "); + + for( int i = 0; i < vidArr.length; i++ ){ + String vidString = vidArr[i]; + Long idLong = Long.valueOf(vidString); + TitanVertex tvx = (TitanVertex)graph.getVertex(idLong); + showPropertiesAndEdges( TRANSID, FROMAPPID, tvx, logger ); + } + } + } + } + catch( Exception e2 ){ + logAndPrint(logger, "Threw Exception: [" + e2.toString() + "]"); + } + finally { + if( graph != null ){ + graph.rollback(); + } + } + + return foundDupesFlag; + + }// end of runTheCheckForUniqueness() + + + /** + * Show properties and edges. + * + * @param transId the trans id + * @param fromAppId the from app id + * @param tVert the t vert + * @param logger the logger + */ + private static void showPropertiesAndEdges( String transId, String fromAppId, TitanVertex tVert, + EELFLogger logger ){ + + if( tVert == null ){ + logAndPrint(logger, "Null node passed to showPropertiesAndEdges."); + } + else { + String nodeType = ""; + Object ob = tVert.<String>property("aai-node-type").orElse(null); + if( ob == null ){ + nodeType = "null"; + } + else{ + nodeType = ob.toString(); + } + + logAndPrint(logger, " AAINodeType/VtxID for this Node = [" + nodeType + "/" + tVert.id() + "]"); + logAndPrint(logger, " Property Detail: "); + Iterator<VertexProperty<Object>> pI = tVert.properties(); + while( pI.hasNext() ){ + VertexProperty<Object> tp = pI.next(); + Object val = tp.value(); + logAndPrint(logger, "Prop: [" + tp.key() + "], val = [" + val + "] "); + } + + Iterator <Edge> eI = tVert.edges(Direction.BOTH); + if( ! eI.hasNext() ){ + logAndPrint(logger, "No edges were found for this vertex. "); + } + while( eI.hasNext() ){ + TitanEdge ed = (TitanEdge) eI.next(); + String lab = ed.label(); + TitanVertex vtx = (TitanVertex) ed.otherVertex(tVert); + if( vtx == null ){ + logAndPrint(logger, " >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< "); + } + else { + String nType = vtx.<String>property("aai-node-type").orElse(null); + String vid = vtx.id().toString(); + logAndPrint(logger, "Found an edge (" + lab + ") from this vertex to a [" + nType + "] node with VtxId = " + vid); + } + } + } + } // End of showPropertiesAndEdges() + + + /** + * Log and print. + * + * @param logger the logger + * @param msg the msg + */ + protected static void logAndPrint(EELFLogger logger, String msg) { + System.out.println(msg); + logger.info(msg); + } + +} + + diff --git a/aai-core/src/main/java/org/openecomp/aai/workarounds/LegacyURITransformer.java b/aai-core/src/main/java/org/openecomp/aai/workarounds/LegacyURITransformer.java new file mode 100644 index 00000000..896243cc --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/workarounds/LegacyURITransformer.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.workarounds; + +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class LegacyURITransformer { + + private final Pattern legacyUriPattern = Pattern.compile("/aai/servers/(?<version>v[23])/(?<tenantKey>.*?)/vservers/(?<vserverKey>[^/]*?$)"); + private final Pattern currentUriPattern = Pattern.compile("/aai/(?<version>v\\d+)/cloud-infrastructure/tenants/tenant/(?<tenantKey>.*?)/vservers/vserver/(?<vserverKey>[^/]*?$)"); + /** + * Instantiates a new legacy URL transformer. + */ + private LegacyURITransformer() { + + } + + private static class Helper { + private static final LegacyURITransformer INSTANCE = new LegacyURITransformer(); + } + + /** + * Gets the single instance of LegacyURLTransformer. + * + * @return single instance of LegacyURLTransformer + */ + public static LegacyURITransformer getInstance() { + return Helper.INSTANCE; + } + + /** + * Gets the legacy URL. + * + * @param url the url + * @return the legacy URL + * @throws URISyntaxException + * @throws MalformedURLException the malformed URL exception + */ + public URI getLegacyURI(URI url) throws URISyntaxException { + String replacement = "/aai/servers/${version}/${tenantKey}/vservers/${vserverKey}"; + String result = url.toString(); + Matcher m = currentUriPattern.matcher(result); + if (m.find()) { + result = m.replaceFirst(replacement); + + } + + return new URI(result); + + } + + /** + * Gets the current URL. + * + * @param url the url + * @return the current URL + * @throws URISyntaxException + * @throws MalformedURLException the malformed URL exception + */ + public URI getCurrentURI(URI url) throws URISyntaxException { + String replacement = "/aai/${version}/cloud-infrastructure/tenants/tenant/${tenantKey}/vservers/vserver/${vserverKey}"; + String result = url.toString(); + Matcher m = legacyUriPattern.matcher(result); + if (m.find()) { + result = m.replaceFirst(replacement); + + } + + return new URI(result); + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/workarounds/NamingExceptions.java b/aai-core/src/main/java/org/openecomp/aai/workarounds/NamingExceptions.java new file mode 100644 index 00000000..ac1d2cc7 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/workarounds/NamingExceptions.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.workarounds; + +public class NamingExceptions { + + /** + * Instantiates a new naming exceptions. + */ + private NamingExceptions() { + + } + + private static class Helper { + private static final NamingExceptions INSTANCE = new NamingExceptions(); + } + + /** + * Gets the single instance of NamingExceptions. + * + * @return single instance of NamingExceptions + */ + public static NamingExceptions getInstance() { + return Helper.INSTANCE; + } + + /** + * Gets the object name. + * + * @param name the name + * @return the object name + */ + public String getObjectName(String name) { + + String result = name; + + if (name.equals("cvlan-tag")) { + result = "cvlan-tag-entry"; + } + + return result; + } + + /** + * Gets the DB name. + * + * @param name the name + * @return the DB name + */ + public String getDBName(String name) { + + String result = name; + + if (name.equals("cvlan-tag-entry")) { + result = "cvlan-tag"; + } + + return result; + + } +} diff --git a/aai-core/src/main/java/org/openecomp/aai/workarounds/RemoveDME2QueryParams.java b/aai-core/src/main/java/org/openecomp/aai/workarounds/RemoveDME2QueryParams.java new file mode 100644 index 00000000..8713de63 --- /dev/null +++ b/aai-core/src/main/java/org/openecomp/aai/workarounds/RemoveDME2QueryParams.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.workarounds; + +import javax.ws.rs.core.MultivaluedMap; + +public class RemoveDME2QueryParams { + + private final String[] blacklist = {"version", "envContext", "routeOffer"}; + + + /** + * Should remove query params. + * + * @param params the params + * @return true, if successful + */ + public boolean shouldRemoveQueryParams(MultivaluedMap<String, String> params) { + boolean remove = true; + + for (String param : blacklist) { + if (!params.containsKey(param)) { + remove = false; + break; + } + } + + return remove; + + } + + /** + * Removes the query params. + * + * @param params the params + */ + public void removeQueryParams(MultivaluedMap<String, String> params) { + + + for (String param : blacklist) { + params.remove(param); + } + + + } + +} diff --git a/aai-core/src/main/resources/EdgeRules.ftl b/aai-core/src/main/resources/EdgeRules.ftl new file mode 100644 index 00000000..1601ab27 --- /dev/null +++ b/aai-core/src/main/resources/EdgeRules.ftl @@ -0,0 +1,26 @@ +<#-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + ============LICENSE_END========================================================= +--> + +public static final Multimap<String, String> EdgeRules = new ImmutableSetMultimap.Builder<String, String>() +<#list edgeRules as edgeRule> + .putAll("${edgeRule["nodes"]}", + "${edgeRule["edge"]},${edgeRule["direction"]},${edgeRule["multiplicity"]},${edgeRule["lineage"]},${edgeRule["usesResource"]},${edgeRule["hasDelTarget"]},${edgeRule["SVC-INFRA"]}") +</#list> +.build(); diff --git a/aai-core/src/test/java/org/openecomp/aai/exceptions/AAIExceptionTest.java b/aai-core/src/test/java/org/openecomp/aai/exceptions/AAIExceptionTest.java new file mode 100644 index 00000000..231101a8 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/exceptions/AAIExceptionTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.exceptions; + + +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class AAIExceptionTest { + private static final String code = "4004"; + private static final String details = "This is a detailed description of the exception."; + private static final Throwable cause = new RuntimeException("This is a runtime exception."); + private static final Throwable noMessage = new RuntimeException(); + + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + /** + * Test constructor with 0 params. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith0Params() throws Exception { + AAIException exception = new AAIException(); + assertEquals(exception, exception); + } + + /** + * Test constructor with 1 params. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith1Params() throws Exception { + AAIException exception = new AAIException(code); + assertEquals(exception, exception); + } + + /** + * Test constructor with 2 params details. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith2ParamsDetails() throws Exception { + AAIException exception = new AAIException(code, details); + assertEquals(details, exception.getMessage()); + } + + /** + * Test constructor with 2 params cause. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith2ParamsCause() throws Exception { + AAIException exception = new AAIException(code, cause); + assertEquals(cause.getMessage(), exception.getMessage()); + } + + /** + * Test constructor with 2 params null message. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith2ParamsNullMessage() throws Exception { + AAIException exception = new AAIException(code, noMessage); + assertEquals(noMessage.toString(), exception.getMessage()); + } + + /** + * Test constructor with 3 params. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith3Params() throws Exception { + AAIException exception = new AAIException(code, cause, details); + String details = "This is a runtime exception.-This is a detailed description of the exception."; + assertEquals(details, exception.getMessage()); + } + + /** + * Test constructor with 3 params null message. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith3ParamsNullMessage() throws Exception { + AAIException exception = new AAIException(code, noMessage, details); + String detailString = new String(noMessage.toString() + "-" + details); + assertEquals(detailString, exception.getMessage()); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/exceptions/AAIExceptionWithInfoTest.java b/aai-core/src/test/java/org/openecomp/aai/exceptions/AAIExceptionWithInfoTest.java new file mode 100644 index 00000000..03de45d8 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/exceptions/AAIExceptionWithInfoTest.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.exceptions; + +import org.junit.Test; + +import java.util.HashMap; + +import static org.junit.Assert.assertEquals; + +public class AAIExceptionWithInfoTest { + + + private static final HashMap<String, Object> map = new HashMap<String, Object>(); + + { + map.put("itemInteger", 1); + map.put("itemString", "Two"); + map.put("itemThree", Boolean.TRUE); + } + + private static final String info = "An error has occurred."; + private static final String code = "4004"; + private static final String details = "This is a detailed description of the exception."; + private static final Throwable cause = new RuntimeException("This is a runtime exception."); + + /** + * Test constructor with 2 params. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith2Params() throws Exception { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(map, info); + + assertEquals(map, exception.getInfoHash()); + assertEquals(info, exception.getInfo()); + } + + /** + * Test constructor with 3 params. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith3Params() throws Exception { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(code, map, info); + + assertEquals(code, exception.getErrorObject().getErrorCode()); + assertEquals(map, exception.getInfoHash()); + assertEquals(info, exception.getInfo()); + } + + /** + * Test constructor with 4 params I. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith4ParamsI() throws Exception { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(code, details, map, info); + + assertEquals(code, exception.getErrorObject().getErrorCode()); + assertEquals(details, exception.getMessage()); + assertEquals(map, exception.getInfoHash()); + assertEquals(info, exception.getInfo()); + } + + /** + * Test constructor with 4 params II. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith4ParamsII() throws Exception { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(code, cause, map, info); + + assertEquals(code, exception.getErrorObject().getErrorCode()); + assertEquals(cause.getMessage(), exception.getMessage()); + assertEquals(map, exception.getInfoHash()); + assertEquals(info, exception.getInfo()); + } + + /** + * Test constructor with 5 params. + * + * @throws Exception the exception + */ + @Test + public void testConstructorWith5Params() throws Exception { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(code, cause, details, map, info); + + assertEquals(code, exception.getErrorObject().getErrorCode()); + assertEquals(cause.getMessage() + "-" + details, exception.getMessage()); + assertEquals(map, exception.getInfoHash()); + assertEquals(info, exception.getInfo()); + } + + /** + * Test set info hash. + */ + @Test + public void testSetInfoHash() { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(map, info); + + HashMap<String, Object> newMap = new HashMap<String, Object>(); + newMap.put("itemInteger", 2); + exception.setInfoHash(newMap); + + assertEquals(newMap, exception.getInfoHash()); + assertEquals(info, exception.getInfo()); + } + + /** + * Test set info. + */ + @Test + public void testSetInfo() { + AAIExceptionWithInfo exception = new AAIExceptionWithInfo(map, info); + + String newInfo = "This is updated info."; + exception.setInfo(newInfo); + + assertEquals(map, exception.getInfoHash()); + assertEquals(newInfo, exception.getInfo()); + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/IntrospectorTestSpec.java b/aai-core/src/test/java/org/openecomp/aai/introspection/IntrospectorTestSpec.java new file mode 100644 index 00000000..3f9eafd5 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/IntrospectorTestSpec.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import com.google.common.collect.Sets; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; + +import java.util.Set; + +import static org.junit.Assert.assertEquals; + +public class IntrospectorTestSpec { + + + + /** + * Container test set. + * + * @param wrappedPortGroups the wrapped port groups + * @throws AAIUnknownObjectException + */ + protected void containerTestSet(Introspector wrappedPortGroups) throws AAIUnknownObjectException { + + assertEquals( + "isContainer", + true, + wrappedPortGroups.isContainer()); + + assertEquals( + "newInstanceOfNestedProperty", + "PortGroup", + wrappedPortGroups.newInstanceOfNestedProperty("port-group").getClass().getSimpleName()); + + assertEquals( + "isComplexGenericType", + true, + wrappedPortGroups.isComplexGenericType("port-group")); + + + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/MoxyEngineTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/MoxyEngineTest.java new file mode 100644 index 00000000..7e6dacee --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/MoxyEngineTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import java.io.StringReader; + +public class MoxyEngineTest extends IntrospectorTestSpec { + + /** + * Configure. + * @throws Exception + * @throws SecurityException + * @throws NoSuchFieldException + */ + @BeforeClass + public static void configure() throws NoSuchFieldException, SecurityException, Exception { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + } + + /** + * Container object. + * @throws AAIUnknownObjectException + */ + @Test + public void containerObject() throws AAIUnknownObjectException { + + Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9); + + Introspector obj = loader.introspectorFromName("port-groups"); + + this.containerTestSet(obj); + + } + + + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/PojoInjestorTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/PojoInjestorTest.java new file mode 100644 index 00000000..90d754a3 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/PojoInjestorTest.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.aai.db.props.AAIProperties; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; + +import static org.junit.Assert.*; + +public class PojoInjestorTest { + + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + @Test + public void getVersionTest() { + String latestVersion = "org.openecomp.aai.yang.VnfImage"; + PojoInjestor testPI = new PojoInjestor(); + assertEquals("", AAIProperties.LATEST, testPI.getVersion(latestVersion)); + + String oldVersion = "org.openecomp.aai.yang.v8.VnfImage"; + assertEquals("", Version.v8, testPI.getVersion(oldVersion)); + } + + @Test + public void getContextForVersionTest() { + PojoInjestor testPI = new PojoInjestor(); + JAXBContext context = testPI.getContextForVersion(Version.v9); + try { + Marshaller marshaller = context.createMarshaller(); + //this will fail if the context wasn't initialized successfully (I think) + marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.MEDIA_TYPE, "application/json"); + } catch (JAXBException e) { + e.printStackTrace(); + fail("failed on setting marshaller property"); + } + //if we get to here that means everything went ok + assertTrue(true); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/PojoLoaderTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/PojoLoaderTest.java new file mode 100644 index 00000000..f782e66b --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/PojoLoaderTest.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.aai.domain.yang.v9.VnfImage; +import org.openecomp.aai.introspection.exceptions.AAIUnmarshallingException; +import org.openecomp.aai.restcore.MediaType; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class PojoLoaderTest { + + + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + @Test + public void test() { + Loader pojoLoader = LoaderFactory.createLoaderForVersion(ModelType.POJO, Version.v9); + String payload = "{\"vnf-image-uuid\":\"myuuid\",\"application\":\"testApp\",\"application-vendor\":\"testVendor\",\"application-version\":\"versionTest\"}"; + try { + Introspector intro = pojoLoader.unmarshal("vnf-image", payload, MediaType.APPLICATION_JSON_TYPE); + VnfImage myVnfImage = (VnfImage) intro.getUnderlyingObject(); + assertTrue("myuuid".equals(myVnfImage.getVnfImageUuid())); + assertTrue("testApp".equals(myVnfImage.getApplication())); + assertTrue("testVendor".equals(myVnfImage.getApplicationVendor())); + assertTrue("versionTest".equals(myVnfImage.getApplicationVersion())); + } catch (AAIUnmarshallingException e) { + e.printStackTrace(); + fail("AAIUnmarshallingException thrown"); + } + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/PojoStrategyTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/PojoStrategyTest.java new file mode 100644 index 00000000..d2f67836 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/PojoStrategyTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.junit.Test; +import org.openecomp.aai.domain.yang.CloudRegion; +import org.openecomp.aai.domain.yang.VolumeGroup; +import org.openecomp.aai.schema.enums.ObjectMetadata; + +import static org.junit.Assert.assertEquals; + +public class PojoStrategyTest { + + @Test + public void getMetadataTest() { + Introspector cloudregion = IntrospectorFactory.newInstance(ModelType.POJO, new CloudRegion()); + assertEquals("cloud-infrastructure", cloudregion.getMetadata(ObjectMetadata.NAMESPACE)); + assertEquals("cloud-regions", cloudregion.getMetadata(ObjectMetadata.CONTAINER)); + + Introspector volumegroup = IntrospectorFactory.newInstance(ModelType.POJO, new VolumeGroup()); + assertEquals("cloud-region", volumegroup.getMetadata(ObjectMetadata.DEPENDENT_ON)); + assertEquals("", volumegroup.getMetadata(ObjectMetadata.NAMESPACE)); + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java new file mode 100644 index 00000000..6b37f4c6 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/PropertyPredicatesTest.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; + +import java.util.Set; + +import static org.hamcrest.Matchers.hasItems; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class PropertyPredicatesTest { + + + private final static Version version = Version.v10; + private static Loader loader; + private final static ModelType introspectorFactoryType = ModelType.MOXY; + private static Introspector obj; + + @BeforeClass + public static void setup() throws NoSuchFieldException, SecurityException, Exception { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); + obj = loader.introspectorFromName("test-object"); + + } + + @Test + public void includeInTestGeneration() throws AAIUnknownObjectException { + + Set<String> props = obj.getProperties(PropertyPredicates.includeInTestGeneration()); + + assertThat("props not found", props, + not(hasItems("persona-model-ver", "not-visible-test-element", "model-invariant-id", "model-version-id"))); + } + + @Test + public void isVisible() throws AAIUnknownObjectException { + + Set<String> props = obj.getProperties(PropertyPredicates.isVisible()); + + assertThat("props not found", props, not(hasItems("persona-model-ver"))); + } + + @Test + public void all() throws AAIUnknownObjectException { + + Set<String> props = obj.getProperties(); + + assertThat("all found", props, hasItems("persona-model-ver", "not-visible-test-element")); + } + + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/ReflectionEngineTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/ReflectionEngineTest.java new file mode 100644 index 00000000..37df2aeb --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/ReflectionEngineTest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; +import org.openecomp.aai.restcore.CustomJacksonJaxBJsonProvider; + +import javax.xml.bind.JAXBException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +public class ReflectionEngineTest extends IntrospectorTestSpec { + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + /** + * Container object. + * + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws ClassNotFoundException the class not found exception + * @throws AAIUnknownObjectException + */ + @Test + public void containerObject() throws InstantiationException, IllegalAccessException, ClassNotFoundException, AAIUnknownObjectException { + Object javaObj = null; + String className = "org.openecomp.aai.domain.yang.v8.PortGroups"; + javaObj = Class.forName(className).newInstance(); + + Introspector obj = IntrospectorFactory.newInstance(ModelType.POJO, javaObj); + + this.containerTestSet(obj); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java new file mode 100644 index 00000000..3a45a9f4 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java @@ -0,0 +1,278 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; + +import org.apache.commons.io.IOUtils; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.dbmap.DBConnectionType; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; + +public class DataCopyTest { + + private static TitanGraph graph; + private final static Version version = Version.v10; + private final static ModelType introspectorFactoryType = ModelType.MOXY; + private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL; + private final static DBConnectionType type = DBConnectionType.REALTIME; + private static Loader loader; + private static TransactionalGraphEngine dbEngine; + @Mock private Vertex self; + @Mock private VertexProperty<String> prop; + @Mock private QueryParser uriQuery; + @Rule + public ExpectedException thrown = ExpectedException.none(); + + + @BeforeClass + public static void setup() throws NoSuchFieldException, SecurityException, Exception { + graph = TitanFactory.build().set("storage.backend","inmemory").open(); + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); + dbEngine = new TitanDBEngine( + queryStyle, + type, + loader); + + graph.traversal().addV("aai-node-type", "model", "model-invariant-id", "key1").as("v1") + .addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key2", "model-version", "testValue").addInE("has", "v1", "isParent", true) + .addV("aai-node-type", "model", "model-invariant-id", "key3").as("v2") + .addV("aai-node-type", "model-ver", "model-ver", "myValue", "model-version-id", "key4").addInE("has", "v2", "isParent", true) + .next(); + graph.tx().commit(); + } + + @AfterClass + public static void tearDown() { + graph.tx().rollback(); + graph.close(); + } + + @Before + public void initMock() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void runPopulatePersonaModelVer() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Introspector obj = loader.introspectorFromName("test-object"); + obj.setValue("vnf-id", "myId"); + obj.setValue("model-invariant-id", "key1"); + obj.setValue("model-version-id", "key2"); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataCopy.class).build(); + + runner.execute(obj, self); + + assertEquals("value populated", "testValue", obj.getValue("persona-model-ver")); + + g.rollback(); + + + } + + @Test + public void runPopulateModelVersionId() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9); + final Introspector obj = loader.introspectorFromName("test-object"); + obj.setValue("vnf-id", "myId"); + obj.setValue("persona-model-id", "key1"); + obj.setValue("persona-model-version", "testValue"); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataCopy.class).build(); + + runner.execute(obj, self); + + assertEquals("value populated", "key2", obj.getValue("model-version-id")); + + g.rollback(); + } + + @Test + public void verifyNestedSideEffect() throws URISyntaxException, AAIException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, IOException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Introspector obj = loader.unmarshal("customer", this.getJsonString("nested-case.json")); + System.out.println(obj.marshal(true)); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.tx()).thenReturn(g); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + when(uriQuery.isDependent()).thenReturn(false); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + Vertex v= serializer.createNewVertex(obj); + serializer.serializeToDb(obj, v, uriQuery, obj.getURI(), "test"); + + assertEquals("nested value populated", "testValue", g.traversal().V().has("service-instance-id", "nested-instance-key").next().property("persona-model-version").orElse("")); + + g.rollback(); + + } + + @Test + public void expectedMissingPropertyExceptionInURI() throws AAIException, UnsupportedEncodingException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Introspector obj = loader.introspectorFromName("test-object"); + obj.setValue("vnf-id", "myId"); + obj.setValue("model-invariant-id", "key1"); + + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataCopy.class).build(); + + thrown.expect(AAIMissingRequiredPropertyException.class); + runner.execute(obj, self); + } + + @Test + public void expectedMissingPropertyExceptionForResultingObject() throws AAIException, UnsupportedEncodingException { + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Introspector obj = loader.introspectorFromName("test-object"); + obj.setValue("vnf-id", "myId"); + obj.setValue("model-invariant-id", "key3"); + obj.setValue("model-version-id", "key4"); + + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataCopy.class).build(); + + thrown.expect(AAIMissingRequiredPropertyException.class); + runner.execute(obj, self); + } + + @Test + public void expectNoProcessingWithNoProperties() throws AAIException, UnsupportedEncodingException { + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Introspector obj = loader.introspectorFromName("test-object"); + obj.setValue("vnf-id", "myId"); + + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataCopy.class).build(); + + runner.execute(obj, self); + + assertEquals("no model-version-id", true, obj.getValue("model-version-id") == null); + assertEquals("no model-invariant-id", true, obj.getValue("model-invariant-id") == null); + + } + + private String getJsonString(String filename) throws IOException { + + + FileInputStream is = new FileInputStream("src/test/resources/org/openecomp/aai/introspection/sideeffect/" + filename); + String s = IOUtils.toString(is, "UTF-8"); + IOUtils.closeQuietly(is); + + return s; + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java new file mode 100644 index 00000000..063a7c15 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataLinkTest.java @@ -0,0 +1,268 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.introspection.sideeffect; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.util.List; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.dbmap.DBConnectionType; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.serialization.db.DBSerializer; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; + +public class DataLinkTest { + + private static TitanGraph graph; + private final static Version version = Version.v10; + private final static ModelType introspectorFactoryType = ModelType.MOXY; + private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL; + private final static DBConnectionType type = DBConnectionType.REALTIME; + private static Loader loader; + private static TransactionalGraphEngine dbEngine; + @Mock private QueryParser parser; + @Mock private Vertex self; + @Mock private VertexProperty<String> prop; + @Rule + public ExpectedException thrown = ExpectedException.none(); + + + @BeforeClass + public static void setup() throws NoSuchFieldException, SecurityException, Exception { + graph = TitanFactory.build().set("storage.backend","inmemory").open(); + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); + dbEngine = new TitanDBEngine( + queryStyle, + type, + loader); + + graph.traversal().addV("aai-node-type", "vpn-binding", "vpn-id", "addKey").as("v1") + .addV("aai-node-type", "vpn-binding", "vpn-id", "modifyKey").as("v2") + .addV("aai-node-type", "route-target", "global-route-target", "modifyTargetKey", "route-target-role", "modifyRoleKey", "linked", true).addInE("has", "v2", "isParent", true) + .addV("aai-node-type", "vpn-binding", "vpn-id", "deleteKey").as("v3") + .addV("aai-node-type", "route-target", "global-route-target", "deleteTargetKey", "route-target-role", "deleteRoleKey", "linked", true).addInE("has", "v3", "isParent", true) + .addV("aai-node-type", "vpn-binding", "vpn-id", "getKey").as("v4") + .addV("aai-node-type", "route-target", "global-route-target", "getTargetKey", "route-target-role", "getRoleKey", "linked", true).addInE("has", "v4", "isParent", true) + .addV("aai-node-type", "vpn-binding", "vpn-id", "getKeyNoLink").as("v5") + .addV("aai-node-type", "route-target", "global-route-target", "getTargetKeyNoLink", "route-target-role", "getRoleKeyNoLink").addInE("has", "v5", "isParent", true) + .next(); + graph.tx().commit(); + } + + @AfterClass + public static void tearDown() { + graph.tx().rollback(); + graph.close(); + } + + @Before + public void initMock() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void verifyCreationOfVertex() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9); + final Introspector obj = loader.introspectorFromName("vpn-binding"); + obj.setValue("vpn-id", "addKey"); + obj.setValue("global-route-target", "key1"); + obj.setValue("route-target-role", "key2"); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(spy.tx()).thenReturn(g); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataLinkWriter.class).build(); + + runner.execute(obj, self); + + assertEquals("route-target vertex found", true, traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "key1").has("route-target-role", "key2").has("linked", true).hasNext()); + + g.rollback(); + + } + + @Test + public void verifyModificationOfVertex() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9); + final Introspector obj = loader.introspectorFromName("vpn-binding"); + obj.setValue("vpn-id", "modifyKey"); + obj.setValue("global-route-target", "modifyTargetKey2"); + obj.setValue("route-target-role", "modifyRoleKey2"); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(spy.tx()).thenReturn(g); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataLinkWriter.class).build(); + + runner.execute(obj, self); + + assertEquals("route-target vertex found", true, traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").has("linked", true).hasNext()); + assertEquals("previous link removed", true, traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").hasNot("linked").hasNext()); + g.rollback(); + + } + + @Test + public void verifyDeleteOfVertex() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9); + final Introspector obj = loader.introspectorFromName("vpn-binding"); + obj.setValue("vpn-id", "deleteKey"); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(spy.tx()).thenReturn(g); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataLinkWriter.class).build(); + + runner.execute(obj, self); + + assertEquals("route-target vertex not found", false, traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "deleteTargetKey").has("route-target-role", "deleteRoleKey").has("linked", true).hasNext()); + g.rollback(); + + } + + @Test + public void verifyPropertyPopulation() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9); + final Introspector obj = loader.introspectorFromName("vpn-binding"); + obj.setValue("vpn-id", "getKey"); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(spy.tx()).thenReturn(g); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + SideEffectRunner runner = new SideEffectRunner + .Builder(spy, serializer).addSideEffect(DataLinkReader.class).build(); + + runner.execute(obj, self); + + assertEquals("both properties have been populated in target object", true, obj.getValue("global-route-target").equals("getTargetKey") && obj.getValue("route-target-role").equals("getRoleKey")); + g.rollback(); + + } + + @Test + public void verifyPropertyPopulationWithV10OnlyPut() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { + final Introspector obj = loader.introspectorFromName("vpn-binding"); + obj.setValue("vpn-id", "getKeyNoLink"); + final Introspector routeTargets = loader.introspectorFromName("route-targets"); + obj.setValue("route-targets", routeTargets.getUnderlyingObject()); + List<Object> targets = routeTargets.getValue("route-target"); + final Introspector routeTargetOne = loader.introspectorFromName("route-target"); + routeTargetOne.setValue("global-route-target", "getTargetKeyNoLink"); + routeTargetOne.setValue("route-target-role", "getRoleKeyNoLink"); + targets.add(routeTargetOne.getUnderlyingObject()); + final Introspector routeTargetTwo = loader.introspectorFromName("route-target"); + routeTargetTwo.setValue("global-route-target", "getTargetKeyNoLink2"); + routeTargetTwo.setValue("route-target-role", "getRoleKeyNoLink2"); + targets.add(routeTargetTwo.getUnderlyingObject()); + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.tx()).thenReturn(g); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + when(spy.tx()).thenReturn(g); + when(parser.isDependent()).thenReturn(false); + when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); + when(prop.orElse(null)).thenReturn(obj.getURI()); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + Vertex v = serializer.createNewVertex(obj); + serializer.serializeToDb(obj, v, parser, obj.getURI(), "testing"); + Vertex routeTargetOneV = traversal.V().has("global-route-target", "getTargetKeyNoLink").next(); + Vertex routeTargetTwoV = traversal.V().has("global-route-target", "getTargetKeyNoLink2").next(); + + assertEquals("first route target put has linked", true, routeTargetOneV.property(AAIProperties.LINKED).orElse(false)); + assertEquals("second route target put does not have linked", false, routeTargetTwoV.property(AAIProperties.LINKED).orElse(false)); + + g.rollback(); + + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java new file mode 100644 index 00000000..2f0d67df --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/GraphTraversalTest.java @@ -0,0 +1,704 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.UriBuilder; + +import org.apache.tinkerpop.gremlin.process.traversal.P; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; + + +public class GraphTraversalTest { + + private static TransactionalGraphEngine dbEngine; + + private static TransactionalGraphEngine dbEnginev9; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + /** + * Configure. + * @throws Exception + * @throws SecurityException + * @throws NoSuchFieldException + */ + @BeforeClass + public static void configure() throws NoSuchFieldException, SecurityException, Exception { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + dbEngine = + new TitanDBEngine(QueryStyle.TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST), + false); + + dbEnginev9 = + new TitanDBEngine(QueryStyle.TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9), + false); + } + + /** + * Parent query. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("physical-location-id", "key1").has("aai-node-type", "complex"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal to normal query", + expected.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be complex", + "complex", + query.getResultType()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals("dependent",false, query.isDependent()); + + + } + + /** + * Child query. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void childQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("physical-location-id", "key1").has("aai-node-type", "complex") + .out("hasCtagPool") + .has("aai-node-type", "ctag-pool") + .has("target-pe", "key2").has("availability-zone-name", "key3"); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("physical-location-id", "key1").has("aai-node-type", "complex"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for complex", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be complex", + "complex", + query.getParentResultType()); + assertEquals( + "result type should be ctag-pool", + "ctag-pool", + query.getResultType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + /** + * Naming exceptions. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void namingExceptions() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .out("hasPortGroup") + .has("aai-node-type", "port-group") + .has("interface-id", "key2").out("hasCTag") + .has("aai-node-type", "cvlan-tag") + .has("cvlan-tag", 655); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .out("hasPortGroup") + .has("aai-node-type", "port-group") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "contaner type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + /** + * Gets the all. + * + * @return the all + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void getAll() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .out("hasPortGroup") + .has("aai-node-type", "port-group") + .has("interface-id", "key2").out("hasCTag") + .has("aai-node-type", "cvlan-tag"); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .out("hasPortGroup") + .has("aai-node-type", "port-group") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "container type should be cvlan-tags", + "cvlan-tags", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void getAllParent() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/pservers").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("aai-node-type", "pserver"); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("aai-node-type", "pserver"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for pserver", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "parent result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be pserver", + "pserver", + query.getResultType()); + assertEquals( + "container type should be pservers", + "pservers", + query.getContainerType()); + assertEquals("dependent",false, query.isDependent()); + + + } + + + /** + * Gets the via query param. + * + * @return the via query param + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void getViaQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/cloud-regions/cloud-region/mycloudowner/mycloudregionid/tenants/tenant").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("tenant-name", "Tenant1"); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("cloud-owner", "mycloudowner").has("cloud-region-id", "mycloudregionid") + .has("aai-node-type", "cloud-region") + .out("has") + .has("aai-node-type", "tenant") + .has("tenant-name", "Tenant1"); + + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("cloud-owner", "mycloudowner").has("cloud-region-id", "mycloudregionid") + .has("aai-node-type", "cloud-region"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for cloud-region", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be cloud-region", + "cloud-region", + query.getParentResultType()); + assertEquals( + "result type should be tenant", + "tenant", + query.getResultType()); + assertEquals( + "container type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getViaDuplicateQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/cloud-regions/cloud-region/mycloudowner/mycloudregionid/tenants/tenant").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + List<String> values = new ArrayList<>(); + values.add("Tenant1"); + values.add("Tenant2"); + map.put("tenant-name", values); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("cloud-owner", "mycloudowner").has("cloud-region-id", "mycloudregionid") + .has("aai-node-type", "cloud-region") + .out("has") + .has("aai-node-type", "tenant") + .has("tenant-name", P.within(values)); + + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("cloud-owner", "mycloudowner").has("cloud-region-id", "mycloudregionid") + .has("aai-node-type", "cloud-region"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for cloud-region", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be cloud-region", + "cloud-region", + query.getParentResultType()); + assertEquals( + "result type should be tenant", + "tenant", + query.getResultType()); + assertEquals( + "container type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + /** + * Gets the plural via query param. + * + * @return the plural via query param + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void getPluralViaQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vnfcs").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("prov-status", "up"); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("aai-node-type", "vnfc") + .has("prov-status", "up"); + + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("aai-node-type", "vnfc"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "parent result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnfc", + "vnfc", + query.getResultType()); + assertEquals( + "container type should be empty", + "vnfcs", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + /** + * Gets the all query param naming exception. + * + * @return the all query param naming exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void getAllQueryParamNamingException() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("cvlan-tag", "333"); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .out("hasPortGroup") + .has("aai-node-type", "port-group") + .has("interface-id", "key2").out("hasCTag") + .has("aai-node-type", "cvlan-tag") + .has("cvlan-tag", 333); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .out("hasPortGroup") + .has("aai-node-type", "port-group") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "container type should be cvlan-tags", + "cvlan-tags", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + /** + * Abstract type. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void abstractType() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("vnf/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("vnf-id", "key1").or( + __.has(AAIProperties.NODE_TYPE, "vce"), + __.has(AAIProperties.NODE_TYPE, "vpe"), + __.has(AAIProperties.NODE_TYPE, "generic-vnf")); + + GraphTraversal<Vertex, Vertex> expectedParent = expected; + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnf", + "vnf", + query.getResultType()); + + assertEquals("dependent",false, query.isDependent()); + + + } + + /** + * Non parent abstract type. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void nonParentAbstractType() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/pservers/pserver/key2/vnf/key1").build(); + thrown.expect(AAIException.class); + thrown.expectMessage(containsString("not a valid path")); + dbEngine.getQueryBuilder().createQueryFromURI(uri); + } + + @Test + public void parentAbstractTypeWithNesting() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("vnf/key1/vf-modules/vf-module/key2").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("vnf-id", "key1").or( + __.has(AAIProperties.NODE_TYPE, "vce"), + __.has(AAIProperties.NODE_TYPE, "vpe"), + __.has(AAIProperties.NODE_TYPE, "generic-vnf")) + .filter(x -> true).outE().has("isParent", true).inV().has("vf-module-id", "key2"); + + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("vnf-id", "key1").or( + __.has(AAIProperties.NODE_TYPE, "vce"), + __.has(AAIProperties.NODE_TYPE, "vpe"), + __.has(AAIProperties.NODE_TYPE, "generic-vnf")); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for ", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "result type should be vnf", + "vnf", + query.getParentResultType()); + assertEquals( + "result type should be vf-module", + "vf-module", + query.getResultType()); + + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getViaBadQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/cloud-regions/cloud-region/a/b/tenants/tenant").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("tenant-n231ame", "Tenant1"); + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + + } + + @Test + public void getPluralViaBadQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/cloud-regions/cloud-region/a/b/tenants").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("tenant-n231ame", "Tenant1"); + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + + } + + @Test + public void getPluralViaDuplicateQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vnfcs").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + List<String> values = new ArrayList<>(); + values.add("up"); + values.add("down"); + values.add("left"); + values.add("right"); + values.add("start"); + map.put("prov-status", values); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("aai-node-type", "vnfc") + .has("prov-status", P.within(values)); + + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("aai-node-type", "vnfc"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + assertEquals( + "parent result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnfc", + "vnfc", + query.getResultType()); + assertEquals( + "container type should be empty", + "vnfcs", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void dbAliasedSearch() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/test-objects").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("persona-model-customization-id", "key2"); + QueryParser query = dbEnginev9.getQueryBuilder().createQueryFromURI(uri, map); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("aai-node-type", "test-object") + .has("model-customization-id", "key2"); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("aai-node-type", "test-object"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + + assertEquals( + "result type should be", + "test-object", + query.getResultType()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void dataLinkedSearch() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vpn-bindings").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("global-route-target", "key2"); + QueryParser query = dbEnginev9.getQueryBuilder().createQueryFromURI(uri, map); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .has("aai-node-type", "vpn-binding") + .where(__.out("has").has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "key2")); + GraphTraversal<Vertex, Vertex> expectedParent = __.<Vertex>start() + .has("aai-node-type", "vpn-binding"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().getQuery().toString()); + + assertEquals( + "result type should be", + "vpn-binding", + query.getResultType()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals("dependent",true, query.isDependent()); + + + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/LegacyQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/LegacyQueryTest.java new file mode 100644 index 00000000..4302de61 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/LegacyQueryTest.java @@ -0,0 +1,162 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelInjestor; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import static org.junit.Assert.assertEquals; + + +public class LegacyQueryTest { + private ModelInjestor injestor = ModelInjestor.getInstance(); + private TransactionalGraphEngine dbEngine = + new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), + false); + private final Version version = Version.v8; + private DynamicJAXBContext context = injestor.getContextForVersion(version); + + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + /** + * Parent query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + + URI uri = UriBuilder.fromPath("cloud-infrastructure/pservers/pserver/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + String expected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal to normal query", + expected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be pserver", + "pserver", + query.getResultType()); + + } + + /** + * Child query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void childQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/pservers/pserver/key1/lag-interfaces/lag-interface/key2").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + String expected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')" + + ".in('tosca.relationships.BindsTo').has('aai-node-type', 'lag-interface')" + + ".has('interface-name', 'key2')"; + String parentExpected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')"; + assertEquals( + "gremlin query should be for node", + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be for parent", + parentExpected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be lag-interface", + "lag-interface", + query.getResultType()); + } + + /** + * Naming exceptions. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void namingExceptions() throws JAXBException, UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + String expected = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'cvlan-tag')" + + ".has('cvlan-tag', 655)"; + String expectedParent = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java new file mode 100644 index 00000000..eef3529c --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipGremlinQueryTest.java @@ -0,0 +1,677 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; + +import java.io.StringReader; +import java.io.UnsupportedEncodingException; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.IntrospectorFactory; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelInjestor; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +public class RelationshipGremlinQueryTest { + + private ModelInjestor injestor = ModelInjestor.getInstance(); + private TransactionalGraphEngine dbEngine = + new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), + false); + private final Version version = Version.v8; + private DynamicJAXBContext context = injestor.getContextForVersion(version); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + + /** + * Parent query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + + String content = + "{" + + "\"related-to\" : \"pserver\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"pserver.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String expected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal to normal query", + expected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be pserver", + "pserver", + query.getResultType()); + + } + + /** + * Child query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void childQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"lag-interface\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"pserver.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String expected = ".has('hostname', 'key1').has('aai-node-type', 'pserver').in('tosca.relationships.BindsTo').has('aai-node-type', 'lag-interface')" + + ".has('interface-name', 'key2')"; + String parentExpected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')"; + assertEquals( + "gremlin query should be for node", + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be for parent", + parentExpected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be lag-interface", + "lag-interface", + query.getResultType()); + } + + /** + * Naming exceptions. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void namingExceptions() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"cvlan-tag\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"vce.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"port-group.interface-id\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"cvlan-tag.cvlan-tag\"," + + "\"relationship-value\" : \"655\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String expected = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'cvlan-tag')" + + ".has('cvlan-tag', 655)"; + String expectedParent = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + + } + + /** + * Scrambled relationship. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void scrambledRelationship() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"l3-interface-ipv4-address-list\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"l3-interface-ipv4-address-list.l3-interface-ipv4-address\"," + + "\"relationship-value\" : \"key5\"" + + "},{" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"l-interface.interface-name\"," + + "\"relationship-value\" : \"key3\"" + + "},{" + + "\"relationship-key\" : \"vlan.vlan-interface\"," + + "\"relationship-value\" : \"key4\"" + + "},{" + + "\"relationship-key\" : \"generic-vnf.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "}]" + + "}"; + scrambledRelationshipSpec(content); + } + + /** + * Reversed relationship. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void reversedRelationship() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"l3-interface-ipv4-address-list\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"l3-interface-ipv4-address-list.l3-interface-ipv4-address\"," + + "\"relationship-value\" : \"key5\"" + + "},{" + + "\"relationship-key\" : \"vlan.vlan-interface\"," + + "\"relationship-value\" : \"key4\"" + + "},{" + + "\"relationship-key\" : \"l-interface.interface-name\"," + + "\"relationship-value\" : \"key3\"" + + "},{" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"generic-vnf.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "}]" + + "}"; + scrambledRelationshipSpec(content); + } + + /** + * Ordered ambiguous relationship. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void orderedAmbiguousRelationship() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"l3-interface-ipv4-address-list\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"generic-vnf.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "},{" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"l-interface.interface-name\"," + + "\"relationship-value\" : \"key3\"" + + "},{" + + "\"relationship-key\" : \"vlan.vlan-interface\"," + + "\"relationship-value\" : \"key4\"" + + "},{" + + "\"relationship-key\" : \"l3-interface-ipv4-address-list.l3-interface-ipv4-address\"," + + "\"relationship-value\" : \"key5\"" + + "}]" + + "}"; + scrambledRelationshipSpec(content); + } + + /** + * Scrambled relationship spec. + * + * @param content the content + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + public void scrambledRelationshipSpec(String content) throws JAXBException, UnsupportedEncodingException, AAIException { + + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String expected = + ".has('vnf-id', 'key1').has('aai-node-type', 'generic-vnf')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'lag-interface')" + + ".has('interface-name', 'key2').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'l-interface')" + + ".has('interface-name', 'key3').out('tosca.relationships.LinksTo').has('aai-node-type', 'vlan')" + + ".has('vlan-interface', 'key4').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'l3-interface-ipv4-address-list')" + + ".has('l3-interface-ipv4-address', 'key5')"; + String expectedParent = + ".has('vnf-id', 'key1').has('aai-node-type', 'generic-vnf')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'lag-interface')" + + ".has('interface-name', 'key2').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'l-interface')" + + ".has('interface-name', 'key3').out('tosca.relationships.LinksTo').has('aai-node-type', 'vlan')" + + ".has('vlan-interface', 'key4')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for vlan", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be l3-interface-ipv4-address-list", + "l3-interface-ipv4-address-list", + query.getResultType()); + + } + + /** + * Short circuit. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void shortCircuit() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"cvlan-tag\"," + + "\"related-link\" : \"http://mock-system-name.com:8443/aai/v6/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"vce.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"port-group.interface-id\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"cvlan-tag.cvlan-tag\"," + + "\"relationship-value\" : \"655\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String expected = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'cvlan-tag')" + + ".has('cvlan-tag', 655)"; + String expectedParent = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + + } + + @Test + public void shorterCircuit() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"cvlan-tag\"," + + "\"related-link\" : \"file:///network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655\"" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String expected = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'cvlan-tag')" + + ".has('cvlan-tag', 655)"; + String expectedParent = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'port-group')" + + ".has('interface-id', 'key2')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + + } + + /** + * Double key. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void doubleKey() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"ctag-pool\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"complex.physical-location-id\"," + + "\"relationship-value\" : \"key1\"" + + " }, { " + + "\"relationship-key\" : \"ctag-pool.target-pe\"," + + " \"relationship-value\" : \"key2\"" + + " },{" + + "\"relationship-key\" : \"ctag-pool.availability-zone-name\"," + + "\"relationship-value\" : \"key3\"" + + "}]" + + "}"; + + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String expected = + ".has('physical-location-id', 'key1').has('aai-node-type', 'complex')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'ctag-pool')" + + ".has('target-pe', 'key2')" + + ".has('availability-zone-name', 'key3')"; + String expectedParent = + ".has('physical-location-id', 'key1').has('aai-node-type', 'complex')"; + + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be ctag-pool", + "ctag-pool", + query.getResultType()); + + } + + /** + * Abstract type. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void abstractType() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"vnf\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"vnf.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + " }]" + + "}"; + + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String expected = + ".has('vnf-id', 'key1')" + + ".has('aai-node-type', P.within('vce','vpe','generic-vnf'))"; + + String expectedParent = + ".has('vnf-id', 'key1')" + + ".has('aai-node-type', P.within('vce','vpe','generic-vnf'))"; + + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be vnf", + "vnf", + query.getResultType()); + + } + + /** + * Invalid node name. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void invalidNodeName() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"l3-interface-ipv4-address-list\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"generic-vnf.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "},{" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"l-infeaterface.interface-name\"," + + "\"relationship-value\" : \"key3\"" + + "},{" + + "\"relationship-key\" : \"vlan.vlan-interface\"," + + "\"relationship-value\" : \"key4\"" + + "},{" + + "\"relationship-key\" : \"l3-interface-ipv4-address-list.l3-interface-ipv4-address\"," + + "\"relationship-value\" : \"key5\"" + + "}]" + + "}"; + thrown.expect(AAIException.class); + thrown.expectMessage(containsString("invalid object name")); + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + } + + /** + * Invalid property name. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void invalidPropertyName() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"l3-interface-ipv4-address-list\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"generic-vnf.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "},{" + + "\"relationship-key\" : \"lag-interface.intfdaferface-name\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"l-interface.interface-name\"," + + "\"relationship-value\" : \"key3\"" + + "},{" + + "\"relationship-key\" : \"vlan.vlan-interface\"," + + "\"relationship-value\" : \"key4\"" + + "},{" + + "\"relationship-key\" : \"l3-interface-ipv4-address-list.l3-interface-ipv4-address\"," + + "\"relationship-value\" : \"key5\"" + + "}]" + + "}"; + thrown.expect(AAIException.class); + thrown.expectMessage(containsString("invalid property name")); + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipQueryTest.java new file mode 100644 index 00000000..18fc16d0 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/RelationshipQueryTest.java @@ -0,0 +1,282 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import static org.junit.Assert.assertEquals; + +import java.io.StringReader; +import java.io.UnsupportedEncodingException; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; + +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.junit.BeforeClass; +import org.junit.Test; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.IntrospectorFactory; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelInjestor; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +public class RelationshipQueryTest { + private ModelInjestor injestor = ModelInjestor.getInstance(); + + private TransactionalGraphEngine dbEngine = + new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), + false); + private final Version version = Version.v8; + private DynamicJAXBContext context = injestor.getContextForVersion(version); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + + /** + * Parent query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + + String content = + "{" + + "\"related-to\" : \"pserver\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"pserver.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String expected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')"; + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal to normal query", + expected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be pserver", + "pserver", + query.getResultType()); + + } + + /** + * Child query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void childQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"lag-interface\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"pserver.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String expected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver').in('tosca.relationships.BindsTo').has('aai-node-type', 'lag-interface')" + + ".has('interface-name', 'key2')"; + String parentExpected = + ".has('hostname', 'key1').has('aai-node-type', 'pserver')"; + assertEquals( + "gremlin query should be for node", + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be for parent", + parentExpected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be lag-interface", + "lag-interface", + query.getResultType()); + } + + /** + * Naming exceptions. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void namingExceptions() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"cvlan-tag\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"vce.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"port-group.interface-id\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"cvlan-tag.cvlan-tag\"," + + "\"relationship-value\" : \"655\"" + + "}]" + + "}"; + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String expected = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce').in('org.onap.relationships.inventory.BelongsTo')" + + ".has('aai-node-type', 'port-group').has('interface-id', 'key2').in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'cvlan-tag')" + + ".has('cvlan-tag', 655)"; + String expectedParent = + ".has('vnf-id', 'key1').has('aai-node-type', 'vce').in('org.onap.relationships.inventory.BelongsTo')" + + ".has('aai-node-type', 'port-group').has('interface-id', 'key2')"; + + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + + } + + /** + * Double key. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void doubleKey() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"ctag-pool\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"complex.physical-location-id\"," + + "\"relationship-value\" : \"key1\"" + + " }, { " + + "\"relationship-key\" : \"ctag-pool.target-pe\"," + + " \"relationship-value\" : \"key2\"" + + " },{" + + "\"relationship-key\" : \"ctag-pool.availability-zone-name\"," + + "\"relationship-value\" : \"key3\"" + + "}]" + + "}"; + + + Unmarshaller unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String expected = + ".has('physical-location-id', 'key1').has('aai-node-type', 'complex')" + + ".in('org.onap.relationships.inventory.BelongsTo').has('aai-node-type', 'ctag-pool')" + + ".has('target-pe', 'key2')" + + ".has('availability-zone-name', 'key3')"; + String expectedParent = + ".has('physical-location-id', 'key1').has('aai-node-type', 'complex')"; + + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "result type should be ctag-pool", + "ctag-pool", + query.getResultType()); + + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryTest.java new file mode 100644 index 00000000..fd05dede --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/UniqueRelationshipQueryTest.java @@ -0,0 +1,305 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.eclipse.persistence.dynamic.DynamicEntity; +import org.eclipse.persistence.jaxb.UnmarshallerProperties; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.*; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; + +import static org.junit.Assert.assertEquals; + +@Ignore +public class UniqueRelationshipQueryTest { + private ModelInjestor injestor = ModelInjestor.getInstance(); + private TransactionalGraphEngine dbEngine = + new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), + false); + private final Version version = Version.v8; + private DynamicJAXBContext context = injestor.getContextForVersion(version); + private Unmarshaller unmarshaller = null; + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + + /** + * Setup. + * + * @throws JAXBException the JAXB exception + */ + @Before + public void setup() throws JAXBException { + unmarshaller = context.createUnmarshaller(); + unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json"); + unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); + unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true); + } + + /** + * Parent query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + + String content = + "{" + + "\"related-to\" : \"pserver\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"pserver.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}]" + + "}"; + + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String key = "pserver/key1"; + GraphTraversal<Vertex, Vertex> expected = + __.<Vertex>start().has("aai-unique-key", key); + String resultType = "pserver"; + String containerType = ""; + + testSet(query, expected, expected, resultType, containerType); + + } + + /** + * Child query. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void childQuery() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"lag-interface\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"pserver.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"lag-interface.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "}]" + + "}"; + + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String key = "pserver/key1/lag-interface/key2"; + GraphTraversal<Vertex, Vertex> expected = + __.<Vertex>start().has("aai-unique-key", key); + GraphTraversal<Vertex, Vertex> parentExpected = + __.<Vertex>start().has("aai-unique-key", "pserver/key1"); + String resultType = "lag-interface"; + String containerType = ""; + + testSet(query, expected, parentExpected, resultType, containerType); + } + + /** + * Naming exceptions. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void namingExceptions() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"cvlan-tag\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"vce.vnf-id\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"port-group.interface-id\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"cvlan-tag.cvlan-tag\"," + + "\"relationship-value\" : \"655\"" + + "}]" + + "}"; + + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String key = "vce/key1/port-group/key2/cvlan-tag/655"; + GraphTraversal<Vertex, Vertex> expected = + __.<Vertex>start().has("aai-unique-key", key); + GraphTraversal<Vertex, Vertex> parentExpected = + __.<Vertex>start().has("aai-unique-key", "vce/key1/port-group/key2"); + String resultType = "cvlan-tag"; + String containerType = ""; + + testSet(query, expected, parentExpected, resultType, containerType); + + } + + /** + * Double key. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void doubleKey() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"service-capability\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"service-capability.service-type\"," + + "\"relationship-value\" : \"key1\"" + + " }, { " + + "\"relationship-key\" : \"service-capability.vnf-type\"," + + " \"relationship-value\" : \"key2\"" + + " }]" + + "}"; + + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + + String key = "service-capability/key1/key2"; + GraphTraversal<Vertex, Vertex> expected = + __.<Vertex>start().has("aai-unique-key", key); + GraphTraversal<Vertex, Vertex> parentExpected = + __.<Vertex>start().has("aai-unique-key", "service-capability/key1/key2"); + String resultType = "service-capability"; + String containerType = ""; + + testSet(query, expected, parentExpected, resultType, containerType); + + } + + /** + * Short circuit. + * + * @throws JAXBException the JAXB exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void shortCircuit() throws JAXBException, UnsupportedEncodingException, AAIException { + String content = + "{" + + "\"related-to\" : \"cvlan-tag\"," + + "\"related-link\" : \"http://mock-system-name.com:8443/aai/v6/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655\"," + + "\"relationship-data\" : [{" + + "\"relationship-key\" : \"vce.hostname\"," + + "\"relationship-value\" : \"key1\"" + + "}, {" + + "\"relationship-key\" : \"port-group.interface-name\"," + + "\"relationship-value\" : \"key2\"" + + "},{" + + "\"relationship-key\" : \"cvlan-tag.-name\"," + + "\"relationship-value\" : \"655\"" + + "}]" + + "}"; + + Object obj = context.newDynamicEntity("Relationship"); + + DynamicEntity entity = (DynamicEntity)unmarshaller.unmarshal(new StreamSource(new StringReader(content)), obj.getClass()).getValue(); + + Introspector wrappedObj = IntrospectorFactory.newInstance(ModelType.MOXY, entity); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromRelationship(wrappedObj); + String key = "vce/key1/port-group/key2/cvlan-tag/655"; + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", key); + GraphTraversal<Vertex, Vertex> parentExpected = __.<Vertex>start().has("aai-unique-key", "vce/key1/port-group/key2"); + String resultType = "cvlan-tag"; + String containerType = ""; + + testSet(query, expected, parentExpected, resultType, containerType); + + } + + /** + * Test set. + * + * @param query the query + * @param expected the expected + * @param parentExpected the parent expected + * @param resultType the result type + * @param containerType the container type + */ + public void testSet(QueryParser query, GraphTraversal<Vertex, Vertex> expected, GraphTraversal<Vertex, Vertex> parentExpected, String resultType, String containerType) { + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be " + parentExpected, + parentExpected, + query.getParentQueryBuilder().getParentQuery()); + assertEquals( + "result type should be " + resultType, + resultType, + query.getResultType()); + assertEquals( + "container type should be " + containerType, + containerType, + query.getContainerType()); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/query/UniqueURIQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/query/UniqueURIQueryTest.java new file mode 100644 index 00000000..534386d0 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/query/UniqueURIQueryTest.java @@ -0,0 +1,205 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.query; + +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelInjestor; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; + +@Ignore +public class UniqueURIQueryTest { + private ModelInjestor injestor = ModelInjestor.getInstance(); + private TransactionalGraphEngine dbEngine = + new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), + false); + private final Version version = Version.v8; + private DynamicJAXBContext context = injestor.getContextForVersion(version); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + + /** + * Parent query. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build(); + String key = "complex/key1"; + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", key); + String parentResultType = ""; + String resultType = "complex"; + String containerType = ""; + + testSet(query, expected, expected, parentResultType, resultType, containerType); + + } + + /** + * Parent plural query. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void parentPluralQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-node-type", "complex"); + String parentResultType = ""; + String resultType = "complex"; + String containerType = "complexes"; + + testSet(query, expected, expected, parentResultType, resultType, containerType); + + } + + /** + * Child query. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void childQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + String parentKey = "complex/key1"; + String key = parentKey + "/ctag-pool/key2/key3"; + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", key); + GraphTraversal<Vertex, Vertex> parentExpected = __.<Vertex>start().has("aai-unique-key", parentKey); + String parentResultType = "complex"; + String resultType = "ctag-pool"; + String containerType = ""; + + testSet(query, expected, parentExpected, parentResultType, resultType, containerType); + + } + + /** + * Naming exceptions. + * + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void namingExceptions() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + String parentKey = "vce/key1/port-group/key2"; + String key = parentKey + "/cvlan-tag/655"; + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", key); + GraphTraversal<Vertex, Vertex> parentExpected = __.<Vertex>start().has("aai-unique-key", parentKey); + String parentResultType = "port-group"; + String resultType = "cvlan-tag"; + String containerType = ""; + + testSet(query, expected, parentExpected, parentResultType, resultType, containerType); + + } + + /** + * Gets the all. + * + * @return the all + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void getAll() throws UnsupportedEncodingException, AAIException { + String parentURI = "network/vces/vce/key1/port-groups/port-group/key2"; + String parentKey = "vce/key1/port-group/key2"; + URI uri = UriBuilder.fromPath(parentURI + "/cvlan-tags").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", parentKey).out("hasCTag").has("aai-node-type", "cvlan-tag"); + GraphTraversal<Vertex, Vertex> parentExpected = __.<Vertex>start().has("aai-unique-key",parentKey); + String parentResultType = "port-group"; + String resultType = "cvlan-tag"; + String containerType = "cvlan-tags"; + + testSet(query, expected, parentExpected, parentResultType, resultType, containerType); + + } + + /** + * Test set. + * + * @param query the query + * @param expected the expected + * @param parentExpected the parent expected + * @param parentResultType the parent result type + * @param resultType the result type + * @param containerType the container type + */ + public void testSet(QueryParser query, GraphTraversal<Vertex, Vertex> expected, GraphTraversal<Vertex, Vertex> parentExpected, String parentResultType, String resultType, String containerType) { + assertEquals( + "gremlin query should be " + expected, + expected, + query.getQueryBuilder().getQuery()); + assertEquals( + "parent gremlin query should be " + parentExpected, + parentExpected, + query.getQueryBuilder().getParentQuery().getQuery()); + assertEquals( + "parent result type should be " + parentResultType, + parentResultType, + query.getParentResultType()); + assertEquals( + "result type should be " + resultType, + resultType, + query.getResultType()); + assertEquals( + "container type should be " + containerType, + containerType, + query.getContainerType()); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/relationship/RelationshipToURITest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/relationship/RelationshipToURITest.java new file mode 100644 index 00000000..2be7887b --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/relationship/RelationshipToURITest.java @@ -0,0 +1,229 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.relationship; + +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.commons.io.IOUtils; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.parsers.exceptions.AAIIdentityMapParseException; +import org.openecomp.aai.parsers.exceptions.AmbiguousMapAAIException; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; + +public class RelationshipToURITest { + + + + private final ModelType modelType = ModelType.MOXY; + private final Version version10 = Version.v10; + private final Version version9 = Version.v9; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @BeforeClass + public static void setup() throws NoSuchFieldException, SecurityException, Exception { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + + } + + @Test + public void onlyLink() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("only-related-link.json")); + URI expected = new URI("/aai/v10/network/test-objects/test-object/key1"); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected.getPath(), uri.getPath()); + } + + @Test + public void onlyData() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("only-relationship-data.json")); + URI expected = new URI("/network/test-objects/test-object/key1"); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected, uri); + } + + @Test + public void failV10() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("both-failv10-successv9.json")); + URI expected = new URI("/aai/v10/network/test-objects/test-object/key1"); + + thrown.expect(AAIIdentityMapParseException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + + URI uri = parse.getUri(); + + } + + @Test + public void successV9() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version9); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("both-failv10-successv9.json")); + URI expected = new URI("/network/test-objects/test-object/key2"); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected, uri); + + + } + + @Test + public void failV9() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version9); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("both-successv10-failv9.json")); + URI expected = new URI("/network/test-objects/test-object/key1"); + + thrown.expect(AAIIdentityMapParseException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + + URI uri = parse.getUri(); + + } + + @Test + public void successV10() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("both-successv10-failv9.json")); + URI expected = new URI("/aai/v10/network/test-objects/test-object/key1"); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected, uri); + + + } + + @Test + public void ambiguousRelationship() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("ambiguous-relationship.json")); + URI expected = new URI("/aai/v10/network/test-objects/test-object/key1"); + + thrown.expect(AmbiguousMapAAIException.class); + thrown.expect(hasProperty("code", is("AAI_6146"))); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected, uri); + + + } + + @Test + public void moreItemsThanRequired() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("too-many-items-relationship.json")); + URI expected = new URI("/network/generic-vnfs/generic-vnf/key1/l-interfaces/l-interface/key2"); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected.toString(), uri.toString()); + + } + + @Test + public void twoTopLevelNodes() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("two-top-level-relationship.json")); + URI expected = new URI("/network/generic-vnfs/generic-vnf/key1/l-interfaces/l-interface/key2"); + + thrown.expect(AmbiguousMapAAIException.class); + thrown.expect(hasProperty("code", is("AAI_6146"))); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected, uri); + + } + + @Test + public void topLevelWithTwoKeys() throws AAIException, URISyntaxException, IOException { + Loader loader = LoaderFactory.createLoaderForVersion(modelType, version10); + Introspector obj = loader.unmarshal("relationship", this.getJsonString("top-level-two-keys-relationship.json")); + URI expected = new URI("/cloud-infrastructure/cloud-regions/cloud-region/key1/key2/availability-zones/availability-zone/key3"); + + RelationshipToURI parse = new RelationshipToURI(loader, obj); + + URI uri = parse.getUri(); + + assertEquals("related-link is equal", expected.toString(), uri.toString()); + + } + + + private String getJsonString(String filename) throws IOException { + + + FileInputStream is = new FileInputStream("src/test/resources/org/openecomp/aai/parsers/relationship/" + filename); + String s = IOUtils.toString(is, "UTF-8"); + IOUtils.closeQuietly(is); + + return s; + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIParserTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIParserTest.java new file mode 100644 index 00000000..b413c9d1 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIParserTest.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; + + +public class URIParserTest { + + private Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + /** + * Invalid path. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void invalidPath() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/network/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3001"))); + + new URIToDBKey(loader, uri); + } + + /** + * Invalid path no name space. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void invalidPathNoNameSpace() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + + new URIToDBKey(loader, uri); + } + + /** + * Invalid path partial. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void invalidPathPartial() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + + new URIToDBKey(loader, uri); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToExtensionInformationTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToExtensionInformationTest.java new file mode 100644 index 00000000..5c82e452 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToExtensionInformationTest.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; + +import org.junit.BeforeClass; +import org.junit.Test; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.restcore.HttpMethod; + + +public class URIToExtensionInformationTest { + + private Loader v6Loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8); + private Loader v7Loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + /** + * Vservers V 7. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void vserversV7() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + v7Loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/key1/vservers/vserver/key2").build(); + URIToExtensionInformation parse = new URIToExtensionInformation(v7Loader, uri); + + String namespace = "cloudInfrastructure"; + String preMethodName = "DynamicAddCloudInfrastructureCloudRegionsCloudRegionTenantsTenantVserversVserverPreProc"; + String postMethodName = "DynamicAddCloudInfrastructureCloudRegionsCloudRegionTenantsTenantVserversVserverPostProc"; + String topLevel = "CloudRegion"; + testSpec(parse, HttpMethod.PUT, namespace, preMethodName, postMethodName, topLevel); + + } + + /** + * New vce V 6. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void newVceV6() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + v6Loader.getVersion() + "/network/newvces/newvce/key1").build(); + URIToExtensionInformation parse = new URIToExtensionInformation(v6Loader, uri); + + String namespace = "network"; + String preMethodName = "DynamicDelNetworkNewvcesNewvcePreProc"; + String postMethodName = "DynamicDelNetworkNewvcesNewvcePostProc"; + String topLevel = "Newvce"; + testSpec(parse, HttpMethod.DELETE, namespace, preMethodName, postMethodName, topLevel); + + } + + /** + * New vce V 7. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void newVceV7() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + v7Loader.getVersion() + "/network/newvces/newvce/key1").build(); + URIToExtensionInformation parse = new URIToExtensionInformation(v7Loader, uri); + + String namespace = "network"; + String preMethodName = "DynamicDelNetworkNewvcesNewvcePreProc"; + String postMethodName = "DynamicDelNetworkNewvcesNewvcePostProc"; + String topLevel = "Newvce"; + testSpec(parse, HttpMethod.DELETE, namespace, preMethodName, postMethodName, topLevel); + + } + + /** + * Test spec. + * + * @param info the info + * @param httpMethod the http method + * @param namespace the namespace + * @param preMethodName the pre method name + * @param postMethodName the post method name + * @param topLevel the top level + */ + private void testSpec(URIToExtensionInformation info, HttpMethod httpMethod, String namespace, String preMethodName, String postMethodName, String topLevel) { + + + String namespaceResult = info.getNamespace(); + String methodNameResult = info.getMethodName(httpMethod, true); + + assertEquals("namespace", namespace, namespaceResult); + assertEquals("preprocess method name", preMethodName, methodNameResult); + methodNameResult = info.getMethodName(httpMethod, false); + + assertEquals("postprocess method name", postMethodName, methodNameResult); + + String topLevelResult = info.getTopObject(); + + assertEquals("topLevel", topLevel, topLevelResult); + } + + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToObjectTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToObjectTest.java new file mode 100644 index 00000000..5313aeca --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToObjectTest.java @@ -0,0 +1,260 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.HashMap; + +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.exceptions.AAIUnknownObjectException; + + + +public class URIToObjectTest { + + private Version version = Version.v8; + private Version currentVersion = AAIProperties.LATEST; + private Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, version); + @Rule + public ExpectedException thrown = ExpectedException.none(); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + + /** + * Uri. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void uri() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + URIToObject parse = new URIToObject(loader, uri); + Introspector result = parse.getTopEntity(); + String expected = "{\"cloud-owner\":\"mycloudowner\",\"cloud-region-id\":\"mycloudregionid\",\"tenants\":{\"tenant\":[{\"tenant-id\":\"key1\",\"vservers\":{\"vserver\":[{\"vserver-id\":\"key2\",\"l-interfaces\":{\"l-interface\":[{\"interface-name\":\"key3\"}]}}]}}]}}"; + String topEntity = "cloud-region"; + String entity = "l-interface"; + + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + + } + + /** + * Uri no version. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIUnknownObjectException + */ + @Test + public void uriNoVersion() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, AAIUnknownObjectException { + URI uri = UriBuilder.fromPath("/cloud-infrastructure/cloud-regions/cloud-region/mycloudowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + HashMap<String, Introspector> relatedObjects = new HashMap<>(); + Introspector tenantObj = this.loader.introspectorFromName("tenant"); + tenantObj.setValue("tenant-id", "key1"); + tenantObj.setValue("tenant-name", "name1"); + relatedObjects.put(tenantObj.getObjectId(), tenantObj); + Introspector vserverObj = this.loader.introspectorFromName("vserver"); + vserverObj.setValue("vserver-id", "key2"); + vserverObj.setValue("vserver-name", "name2"); + relatedObjects.put(vserverObj.getObjectId(), vserverObj); + + URIToObject parse = new URIToObject(loader, uri, relatedObjects); + Introspector result = parse.getTopEntity(); + String expected = "{\"cloud-owner\":\"mycloudowner\",\"cloud-region-id\":\"mycloudregionid\",\"tenants\":{\"tenant\":[{\"tenant-id\":\"key1\",\"tenant-name\":\"name1\",\"vservers\":{\"vserver\":[{\"vserver-id\":\"key2\",\"vserver-name\":\"name2\",\"l-interfaces\":{\"l-interface\":[{\"interface-name\":\"key3\"}]}}]}}]}}"; + String topEntity = "cloud-region"; + String entity = "l-interface"; + + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + + + } + + + /** + * Bad URI. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void badURI() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interadsfaces/l-interface/key3").build(); + + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + + new URIToObject(loader, uri); + } + + /** + * Starts with valid namespace. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void startsWithValidNamespace() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/cloud-infrastructure/cloud-regions/cloud-region/mycloudowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + URIToObject parse = new URIToObject(loader, uri); + Introspector result = parse.getTopEntity(); + String expected = "{\"cloud-owner\":\"mycloudowner\",\"cloud-region-id\":\"mycloudregionid\",\"tenants\":{\"tenant\":[{\"tenant-id\":\"key1\",\"vservers\":{\"vserver\":[{\"vserver-id\":\"key2\",\"l-interfaces\":{\"l-interface\":[{\"interface-name\":\"key3\"}]}}]}}]}}"; + String topEntity = "cloud-region"; + String entity = "l-interface"; + + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + } + + /** + * Single top level. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void singleTopLevel() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/network/generic-vnfs/generic-vnf/key1").build(); + URIToObject parse = new URIToObject(loader, uri); + Introspector result = parse.getTopEntity(); + String expected = "{\"vnf-id\":\"key1\"}"; + + String topEntity = "generic-vnf"; + String entity = "generic-vnf"; + + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + + } + + /** + * Naming exceptions. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void namingExceptions() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655").build(); + URIToObject parse = new URIToObject(loader, uri); + Introspector result = parse.getTopEntity(); + String expected = "{\"vnf-id\":\"key1\",\"port-groups\":{\"port-group\":[{\"interface-id\":\"key2\",\"cvlan-tags\":{\"cvlan-tag-entry\":[{\"cvlan-tag\":655}]}}]}}"; + String topEntity = "vce"; + String entity = "cvlan-tag"; + + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + + } + + /** + * No list object. + * + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws AAIException the AAI exception + */ + @Test + public void noListObject() throws IllegalArgumentException, UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("/aai/v6/network/vpls-pes/vpls-pe/0e6189fd-9257-49b9-a3be-d7ba980ccfc9/lag-interfaces/lag-interface/8ae5aa76-d597-4382-b219-04f266fe5e37/l-interfaces/l-interface/9e141d03-467b-437f-b4eb-b3133ec1e205/l3-interface-ipv4-address-list/8f19f0ea-a81f-488e-8d5c-9b7b53696c11").build(); + URIToObject parse = new URIToObject(loader, uri); + Introspector result = parse.getTopEntity(); + String topEntity = "vpls-pe"; + String entity = "l3-interface-ipv4-address-list"; + String expected = "{\"equipment-name\":\"0e6189fd-9257-49b9-a3be-d7ba980ccfc9\",\"lag-interfaces\":{\"lag-interface\":[{\"interface-name\":\"8ae5aa76-d597-4382-b219-04f266fe5e37\",\"l-interfaces\":{\"l-interface\":[{\"interface-name\":\"9e141d03-467b-437f-b4eb-b3133ec1e205\",\"l3-interface-ipv4-address-list\":[{\"l3-interface-ipv4-address\":\"8f19f0ea-a81f-488e-8d5c-9b7b53696c11\"}]}]}}]}}"; + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + + } + + @Test + public void relativePath() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("./l-interfaces/l-interface/key1").build(); + URIToObject parse = new URIToObject(loader, uri); + Introspector result = parse.getEntity(); + String expected = "{\"interface-name\":\"key1\"}"; + + String topEntity = "l-interface"; + String entity = "l-interface"; + + testSet(result.marshal(false), parse, expected, topEntity, entity, version); + + } + + /** + * Test set. + * + * @param json the json + * @param parse the parse + * @param expected the expected + * @param topEntity the top entity + * @param entity the entity + * @param version the version + */ + public void testSet(String json, URIToObject parse, String expected, String topEntity, String entity, Version version) { + assertEquals("blah", expected, json); + + assertEquals("top entity", topEntity, parse.getTopEntityName()); + + assertEquals("entity", entity, parse.getEntityName()); + + assertEquals("entity object", entity, parse.getEntity().getDbName()); + + assertEquals("parent list object", 1, parse.getParentList().size()); + + assertEquals("object version", version, parse.getObjectVersion()); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToRelationshipObjectTest.java b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToRelationshipObjectTest.java new file mode 100644 index 00000000..8ecc5459 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/parsers/uri/URIToRelationshipObjectTest.java @@ -0,0 +1,163 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.parsers.uri; + +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertTrue; + +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; + + +public class URIToRelationshipObjectTest { + + private Version latest = AAIProperties.LATEST; + private Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, latest); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + /** + * Configure. + */ + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + /** + * Uri. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws URISyntaxException + * @throws MalformedURLException the malformed URL exception + */ + @Test + public void uri() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException { + URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri); + Introspector result = parse.getResult(); + String expected = "\\{\"related-to\":\"l-interface\",\"related-link\":\".*?:8443/aai/" + latest + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"mycloudregionowner\"\\},\\{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"mycloudregionid\"\\},\\{\"relationship-key\":\"tenant.tenant-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"vserver.vserver-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"l-interface.interface-name\",\"relationship-value\":\"key3\"\\}\\]\\}"; + assertTrue("blah", result.marshal(false).matches(expected)); + + } + + /** + * Uri no version. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws URISyntaxException + * @throws MalformedURLException the malformed URL exception + */ + @Test + public void uriNoVersion() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException { + URI uri = UriBuilder.fromPath("/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri); + Introspector result = parse.getResult(); + String expected = "\\{\"related-to\":\"l-interface\",\"related-link\":\".*?:8443/aai/" + latest + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"cloud-region.cloud-owner\",\"relationship-value\":\"mycloudregionowner\"\\},\\{\"relationship-key\":\"cloud-region.cloud-region-id\",\"relationship-value\":\"mycloudregionid\"\\},\\{\"relationship-key\":\"tenant.tenant-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"vserver.vserver-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"l-interface.interface-name\",\"relationship-value\":\"key3\"\\}\\]\\}"; + assertTrue("blah", result.marshal(false).matches(expected)); + + + } + + /** + * Double key relationship. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws URISyntaxException + * @throws MalformedURLException the malformed URL exception + */ + @Test + public void doubleKeyRelationship() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException { + URI uri = UriBuilder.fromPath("/aai/" + latest + "/cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3/").build(); + URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri); + Introspector result = parse.getResult(); + String expected = "\\{\"related-to\":\"ctag-pool\",\"related-link\":\".*?:8443/aai/" + latest + "/cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3\",\"relationship-data\":\\[\\{\"relationship-key\":\"complex.physical-location-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"ctag-pool.target-pe\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"ctag-pool.availability-zone-name\",\"relationship-value\":\"key3\"\\}\\]\\}"; + assertTrue("blah", result.marshal(false).matches(expected)); + + } + + /** + * Uri with non string key. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + * @throws URISyntaxException + * @throws MalformedURLException the malformed URL exception + */ + @Test + public void uriWithNonStringKey() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException, URISyntaxException { + URI uri = UriBuilder.fromPath("/aai/" + latest + "/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/144").build(); + URIToRelationshipObject parse = new URIToRelationshipObject(loader, uri); + Introspector result = parse.getResult(); + String expected = "\\{\"related-to\":\"cvlan-tag\",\"related-link\":\".*?:8443/aai/" + latest + "/network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/144\",\"relationship-data\":\\[\\{\"relationship-key\":\"vce.vnf-id\",\"relationship-value\":\"key1\"\\},\\{\"relationship-key\":\"port-group.interface-id\",\"relationship-value\":\"key2\"\\},\\{\"relationship-key\":\"cvlan-tag.cvlan-tag\",\"relationship-value\":\"144\"\\}\\]\\}"; + assertTrue("blah", result.marshal(false).matches(expected)); + } + /** + * Bad URI. + * + * @throws JAXBException the JAXB exception + * @throws AAIException the AAI exception + * @throws IllegalArgumentException the illegal argument exception + * @throws UnsupportedEncodingException the unsupported encoding exception + */ + @Test + public void badURI() throws JAXBException, AAIException, IllegalArgumentException, UnsupportedEncodingException { + URI uri = UriBuilder.fromPath("/aai/" + loader.getVersion() + "/cloud-infrastructure/cloud-regions/cloud-region/mycloudregionowner/mycloudregionid/tenants/tenant/key1/vservers/vserver/key2/l-interadsfaces/l-interface/key3").build(); + + thrown.expect(AAIException.class); + thrown.expect(hasProperty("code", is("AAI_3000"))); + + URIToObject parse = new URIToObject(loader, uri); + + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/query/builder/TraversalQueryTest.java b/aai-core/src/test/java/org/openecomp/aai/query/builder/TraversalQueryTest.java new file mode 100644 index 00000000..0a2d6541 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/query/builder/TraversalQueryTest.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.query.builder; + +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mock; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; + +public class TraversalQueryTest { + + public static Loader loader; + @Mock public GraphTraversalSource g; + @BeforeClass + public static void configure() throws NoSuchFieldException, SecurityException, Exception { + + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); + loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST); + } + + @Test + public void unionQuery() { + TraversalQuery tQ = new TraversalQuery(loader, g); + TraversalQuery tQ2 = new TraversalQuery(loader, g); + TraversalQuery tQ3 = new TraversalQuery(loader, g); + tQ.union( + tQ2.getVerticesByProperty("test1", "value1"), + tQ3.getVerticesByIndexedProperty("test2", "value2")); + + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start() + .union(__.has("test1", "value1"),__.has("test2", "value2")); + + assertEquals("they are equal", expected, tQ.getQuery()); + + } + + @Test + public void traversalClones() throws UnsupportedEncodingException, AAIException, URISyntaxException { + TraversalQuery tQ = new TraversalQuery(loader, g); + Introspector test = loader.introspectorFromName("test-object"); + QueryBuilder builder = tQ.createQueryFromURI(new URI("network/test-objects/test-object/key1")).getQueryBuilder(); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("vnf-id", "key1").has("aai-node-type", "test-object"); + GraphTraversal<Vertex, Vertex> containerExpected = __.<Vertex>start().has("aai-node-type", "test-object"); + + assertEquals("query object", expected.toString(), builder.getQuery().toString()); + assertEquals("container query object", containerExpected.toString(), builder.getContainerQuery().getQuery().toString()); + + } + + @Test + public void nestedTraversalClones() throws UnsupportedEncodingException, AAIException, URISyntaxException { + + TraversalQuery tQ = new TraversalQuery(loader, g); + QueryBuilder builder = tQ.createQueryFromURI(new URI("network/generic-vnfs/generic-vnf/key1/l-interfaces/l-interface/key2")).getQueryBuilder(); + GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("vnf-id", "key1").has("aai-node-type", "generic-vnf").out("hasLInterface").has(AAIProperties.NODE_TYPE, "l-interface").has("interface-name", "key2"); + GraphTraversal<Vertex, Vertex> containerExpected = __.<Vertex>start().has("vnf-id", "key1").has("aai-node-type", "generic-vnf").out("hasLInterface").has(AAIProperties.NODE_TYPE, "l-interface"); + + assertEquals("query object", expected.toString(), builder.getQuery().toString()); + assertEquals("container query object", containerExpected.toString(), builder.getContainerQuery().getQuery().toString()); + + } + + + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java new file mode 100644 index 00000000..3f73b7c7 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/db/DbAliasTest.java @@ -0,0 +1,138 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.openecomp.aai.dbmap.DBConnectionType; +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.introspection.Introspector; +import org.openecomp.aai.introspection.Loader; +import org.openecomp.aai.introspection.LoaderFactory; +import org.openecomp.aai.introspection.ModelType; +import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.parsers.query.QueryParser; +import org.openecomp.aai.schema.enums.PropertyMetadata; +import org.openecomp.aai.serialization.engines.QueryStyle; +import org.openecomp.aai.serialization.engines.TitanDBEngine; +import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanTransaction; + +import java.util.Collections; + +public class DbAliasTest { + + + + private TitanGraph graph; + private final Version version = Version.v9; + private final ModelType introspectorFactoryType = ModelType.MOXY; + private final QueryStyle queryStyle = QueryStyle.TRAVERSAL; + private final DBConnectionType type = DBConnectionType.REALTIME; + private Loader loader; + private TransactionalGraphEngine dbEngine; + @Before + public void setup() throws NoSuchFieldException, SecurityException, Exception { + graph = TitanFactory.build().set("storage.backend","inmemory").open(); + System.setProperty("AJSC_HOME", "./src/test/resources/"); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); + dbEngine = new TitanDBEngine( + queryStyle, + type, + loader); + } + + @After + public void tearDown() { + graph.tx().rollback(); + graph.close(); + } + + @Test + public void checkOnWrite() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException { + final String property = "persona-model-customization-id"; + String dbPropertyName = property; + TransactionalGraphEngine spy = spy(this.dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + QueryParser uriQuery = spy.getQueryBuilder().createQueryFromURI(new URI("network/generic-vnfs/generic-vnf/key1")); + Introspector obj = loader.introspectorFromName("generic-vnf"); + Vertex v = g.addVertex(); + Object id = v.id(); + obj.setValue("vnf-id", "key1"); + obj.setValue(property, "hello"); + serializer.serializeToDb(obj, v, uriQuery, "", ""); + g.commit(); + v = graph.traversal().V(id).next(); + Map<PropertyMetadata, String> map = obj.getPropertyMetadata(property); + if (map.containsKey(PropertyMetadata.DB_ALIAS)) { + dbPropertyName = map.get(PropertyMetadata.DB_ALIAS); + } + + assertEquals("dbAlias is ", "model-customization-id", dbPropertyName); + assertEquals("dbAlias property exists", "hello", v.property(dbPropertyName).orElse("")); + assertEquals("model property does not", "missing", v.property(property).orElse("missing")); + + } + + @Test + public void checkOnRead() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, NoSuchMethodException, InterruptedException, MalformedURLException { + final String property = "persona-model-customization-id"; + + TransactionalGraphEngine spy = spy(dbEngine); + TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); + Vertex v = graph.traversal().addV("vnf-id", "key1", "model-customization-id", "hello").next(); + graph.tx().commit(); + TitanTransaction g = graph.newTransaction(); + GraphTraversalSource traversal = g.traversal(); + when(spy.asAdmin()).thenReturn(adminSpy); + when(adminSpy.getTraversalSource()).thenReturn(traversal); + DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); + Introspector obj = loader.introspectorFromName("generic-vnf"); + serializer.dbToObject(Collections.singletonList(v), obj, 0, true, "false"); + + assertEquals("dbAlias property exists", "hello", obj.getValue(property)); + + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java new file mode 100644 index 00000000..9411e319 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/db/EdgeRulesTest.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.db; + +import static org.junit.Assert.assertEquals; + +import java.util.Map; + +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.junit.Test; + +import org.openecomp.aai.exceptions.AAIException; +import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException; + +public class EdgeRulesTest { + + + + + @Test + public void verifyOutDirection() throws AAIException, NoEdgeRuleFoundException { + EdgeRules rules = EdgeRules.getInstance(); + EdgeRule rule = rules.getEdgeRule(EdgeType.TREE, "cloud-region", "flavor"); + + assertEquals("out direction", rule.getDirection(), Direction.OUT); + } + + @Test + public void verifyOutFlippedDirection() throws AAIException, NoEdgeRuleFoundException { + EdgeRules rules = EdgeRules.getInstance(); + EdgeRule rule = rules.getEdgeRule(EdgeType.TREE, "flavor", "cloud-region"); + + assertEquals("in direction", rule.getDirection(), Direction.IN); + } + + @Test + public void verifyInDirection() throws AAIException, NoEdgeRuleFoundException { + EdgeRules rules = EdgeRules.getInstance(); + EdgeRule rule = rules.getEdgeRule(EdgeType.COUSIN, "model-ver", "model-element"); + + assertEquals("in direction", rule.getDirection(), Direction.IN); + } + + @Test + public void verifyInFlippedDirection() throws AAIException, NoEdgeRuleFoundException { + EdgeRules rules = EdgeRules.getInstance(); + EdgeRule rule = rules.getEdgeRule(EdgeType.COUSIN, "model-element", "model-ver"); + + assertEquals("out direction", rule.getDirection(), Direction.OUT); + } + @Test + public void verifyMultipleGet() throws AAIException { + EdgeRules rules = EdgeRules.getInstance(); + Map<String, EdgeRule> ruleMap = rules.getEdgeRules("model-element", "model-ver"); + assertEquals("has isA rule", "isA", ruleMap.get("isA").getLabel()); + assertEquals("has startsWith rule", "startsWith", ruleMap.get("startsWith").getLabel()); + } + + @Test + public void verifyMultipleGetSingleRule() throws AAIException { + EdgeRules rules = EdgeRules.getInstance(); + Map<String, EdgeRule> ruleMap = rules.getEdgeRules("availability-zone", "complex"); + assertEquals("has groupsResourcesIn rule", "groupsResourcesIn", ruleMap.get("groupsResourcesIn").getLabel()); + } +} diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/queryformats/QueryFormatTestHelper.java b/aai-core/src/test/java/org/openecomp/aai/serialization/queryformats/QueryFormatTestHelper.java new file mode 100644 index 00000000..d6a45662 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/queryformats/QueryFormatTestHelper.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.queryformats; + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.io.IoCore; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import org.openecomp.aai.db.props.AAIProperties; +import org.openecomp.aai.serialization.queryformats.exceptions.AAIFormatVertexException; +import org.openecomp.aai.serialization.queryformats.utils.UrlBuilder; + +public class QueryFormatTestHelper { + + + public static final String testResources = "src/test/resources/org/openecomp/aai/serialization/queryformats/"; + public static final String graphsonResources = "src/test/resources/org/openecomp/aai/serialization/queryformats/graphson/"; + + + public static void mockPathed(UrlBuilder mock) throws AAIFormatVertexException { + Answer<String> answer = new Answer<String>() { + public String answer(InvocationOnMock invocation) throws Throwable { + Vertex v = invocation.getArgumentAt(0, Vertex.class); + + return v.<String>property(AAIProperties.AAI_URI).orElse("urimissing"); + } + }; + when(mock.pathed(isA(Vertex.class))).thenAnswer(answer); + + } + + public static Graph loadGraphson(String fileName) throws IOException { + final Graph graph = TinkerGraph.open(); + graph.io(IoCore.graphson()).readGraph(QueryFormatTestHelper.graphsonResources + fileName); + + return graph; + } + + public static void setFinalStatic(Field field, Object newValue) throws Exception { + field.setAccessible(true); + // remove final modifier from field + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + field.set(null, newValue); + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java b/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java new file mode 100644 index 00000000..18fa7db3 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/serialization/tinkerpop/TreeBackedVertexTest.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.serialization.tinkerpop; + +import static org.junit.Assert.assertEquals; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.junit.BeforeClass; +import org.junit.Test; + +import org.openecomp.aai.serialization.engines.query.GraphTraversalQueryEngine; + +public class TreeBackedVertexTest { + + + private static Graph graph = TinkerGraph.open(); + private static Object startKey = null; + private static Tree<Element> tree = null; + private static Tree<Element> treeDepth1 = null; + private static Tree<Element> treeDepth0NodeOnly = null; + @BeforeClass + public static void configure() { + GraphTraversalSource g = graph.traversal(); + + startKey = g.addV(T.label, "vserver").as("v1").property("test", "hello") + .addV(T.label, "vserver").as("v2") + .addV(T.label, "interface").property("name", "interface 1").as("v7").addInE("hasChild", "v2").property("isParent", true) + .addV(T.label, "pserver").property("name", "pserver 1").as("v4").addOutE("runsOn", "v1").property("isParent", false) + .addV(T.label, "interface").property("name", "interface 2").as("v3").addInE("hasChild", "v1").property("isParent", true) + .addV(T.label, "address").property("name", "address 1").addInE("hasChild", "v3").property("isParent", true) + .addV(T.label, "address").property("name", "address 2").addInE("hasChild", "v3").property("isParent", true) + .addV(T.label, "complex").property("name", "complex 1").addInE("locatedIn", "v4").property("isParent", false) + .addV(T.label, "interface").property("name", "interface 3").addInE("hasChild", "v4").property("isParent", true) + .addV(T.label, "subnet").property("name", "subnet 1").as("v5").addInE("in", "v3").property("isParent", false) + .addV(T.label, "address").property("name", "address 3").as("v6").addInE("hasChild", "v5").property("isParent", true) + .select("v1").next(); + + tree = new GraphTraversalQueryEngine(g).findSubGraph((Vertex)startKey); + treeDepth1 = new GraphTraversalQueryEngine(g).findSubGraph((Vertex)startKey, 1, false); + treeDepth0NodeOnly = new GraphTraversalQueryEngine(g).findSubGraph((Vertex)startKey, 0, true); + } + @Test + public void oneHopViaEdges() { + + //BulkSet set = (BulkSet)result; + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + + + assertEquals("locate child", v.edges(Direction.OUT).next().inVertex().property("name").orElse(""), "interface 2"); + assertEquals("locate cousin", v.edges(Direction.IN).next().outVertex().property("name").orElse(""), "pserver 1"); + + + } + + @Test + public void oneHopViaVertices() { + + //BulkSet set = (BulkSet)result; + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + + + assertEquals("locate child", "interface 2", v.vertices(Direction.OUT).next().property("name").orElse("")); + assertEquals("locate cousin", "pserver 1", v.vertices(Direction.IN).next().property("name").orElse("")); + + } + + @Test + public void twoHopCousinViaVertices() { + + //BulkSet set = (BulkSet)result; + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + + + assertEquals("locate child", "subnet 1", v.vertices(Direction.OUT).next().vertices(Direction.OUT, "in").next().property("name").orElse("")); + + } + + @Test + public void walkVerticesRestrictedDepth() { + + //BulkSet set = (BulkSet)result; + TreeBackedVertex v = new TreeBackedVertex((Vertex)treeDepth1.getObjectsAtDepth(1).iterator().next(), treeDepth1); + + + assertEquals("nothing returned", false, v.vertices(Direction.OUT).next() + .vertices(Direction.OUT, "hasChild").hasNext()); + + } + + @Test + public void walkVertices() { + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + assertEquals("locate child", "address 2", v.vertices(Direction.OUT).next() + .vertices(Direction.OUT, "hasChild").next().property("name").orElse("")); + } + + @Test + public void walkEdges() { + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + + assertEquals("locate child", "address 2", v.edges(Direction.OUT).next().inVertex() + .edges(Direction.OUT, "hasChild").next().inVertex().property("name").orElse("")); + } + + @Test + public void noEdgesFoudWithLabelVertices() { + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + + assertEquals("missing hello label", false , v.vertices(Direction.OUT, "hello").hasNext()); + } + + @Test + public void noEdgesFoudWithLabelEdges() { + TreeBackedVertex v = new TreeBackedVertex((Vertex)tree.getObjectsAtDepth(1).iterator().next(), tree); + + assertEquals("missing hello label", false , v.edges(Direction.OUT, "hello").hasNext()); + } + + @Test + public void depthZeroNodeOnly() { + TreeBackedVertex v = new TreeBackedVertex((Vertex)treeDepth0NodeOnly.getObjectsAtDepth(1).iterator().next(), treeDepth0NodeOnly); + assertEquals("no edges returned", false, v.edges(Direction.BOTH).hasNext()); + } + +} diff --git a/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java b/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java new file mode 100644 index 00000000..7017c354 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import ch.qos.logback.access.spi.IAccessEvent; +import org.openecomp.aai.logging.CNName; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.agent.PowerMockAgent; + +import javax.security.auth.x500.X500Principal; +import javax.servlet.http.HttpServletRequest; +import java.security.cert.X509Certificate; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +@PowerMockIgnore("javax.security.auth.x500.X500Principal") +@PrepareForTest({IAccessEvent.class, HttpServletRequest.class, X509Certificate.class}) +public class CNNameTest { + + static { + PowerMockAgent.initializeIfNeeded(); + } + + + IAccessEvent mockAccEvent; + HttpServletRequest mockHttpServletRequest; + CNName cnname; + X509Certificate cert; + + /** + * Initialize. + */ + @Before + public void initialize(){ + mockAccEvent = Mockito.mock(IAccessEvent.class); + mockHttpServletRequest = Mockito.mock(HttpServletRequest.class); + cert = Mockito.mock(X509Certificate.class); + } + + + /** + * Test 'convert' when there is no AccessConverter. + */ + @Test + public void testConvert_withoutAccessConverter(){ + cnname = getTestObj(false); + assertTrue("Conversion failed with no AccessConverter", "INACTIVE_HEADER_CONV".equals(cnname.convert(mockAccEvent))); + } + + /** + * Test 'convert' with no CipherSuite. + */ + @Test + public void testConvert_withNullCipherSuite(){ + setupForCipherSuite(null); + assertTrue("Conversion failed for a null CipherSuite", "-".equals(cnname.convert(mockAccEvent))); + } + + + /** + * Test 'convert' with a non-null CipherSuite. + */ + @Test + public void testConvert_withNotNullCipherSuite(){ + + setupForCipherSuite("StrRepOfAValidSuite"); + + final X500Principal principal = new X500Principal("CN=AAI, OU=DOX, O=BWS, C=CA"); + + Mockito.when(cert.getSubjectX500Principal()).thenReturn(principal); + + final X509Certificate[] certChain = {cert}; + + when(mockHttpServletRequest.getAttribute("javax.servlet.request.X509Certificate")).thenReturn(certChain); + + assertTrue("Conversion failed for a valid CipherSuite", principal.toString().equals(cnname.convert(mockAccEvent))); + } + + + /** + * Helper method to mock IAccessEvent and HttpServletRequest. + * + * @param suite CipherSuite to be used in current test + */ + private void setupForCipherSuite(String suite){ + cnname = getTestObj(true); + when(mockAccEvent.getRequest()).thenReturn(mockHttpServletRequest); + when(mockHttpServletRequest.getAttribute("javax.servlet.request.cipher_suite")).thenReturn(suite); + } + + + /** + * Helper method to create a CNName object with overridden 'start status' . + * + * @param instanceStarted Start status to be used + * @return CNName object to test + */ + private CNName getTestObj(final boolean instanceStarted){ + return new CNName(){ + @Override + public boolean isStarted(){ + return instanceStarted; + } + }; + } +} + + + diff --git a/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java b/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java new file mode 100644 index 00000000..9b42eb3d --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.aai.util; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +import org.openecomp.aai.logging.CNName; +import org.openecomp.aai.logging.CustomLogPatternLayout; + +public class CustomLogPatternLayoutTest { + + /** + * Test null when defaultConverterMap doesn't have corresponding entry. + */ + @Test + public void testNull(){ + String s = CustomLogPatternLayout.defaultConverterMap.get("z"); + assertFalse("Entry not found for key 'z'", CNName.class.getName().equals(s)); + } + + /** + * Test defaultConverterMap when valid entry exists. + */ + @Test + public void testEntryFor_Z(){ + CustomLogPatternLayout layout = new CustomLogPatternLayout(); + String s = CustomLogPatternLayout.defaultConverterMap.get("z"); + assertTrue("Entry not found for key 'z'", CNName.class.getName().equals(s)); + } + +} diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/aaiconfig.properties b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/aaiconfig.properties new file mode 100644 index 00000000..7c829496 --- /dev/null +++ b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/aaiconfig.properties @@ -0,0 +1,25 @@ +### +# ============LICENSE_START======================================================= +# org.openecomp.aai +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +# ============LICENSE_END========================================================= +### + +aai.server.url.base=https://baseurl:8443/aai/ +aai.resourceversion.enableflag=true +aai.logging.maxStackTraceEntries=10 +aai.default.api.version=v9 + diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties new file mode 100644 index 00000000..4e98d62c --- /dev/null +++ b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties @@ -0,0 +1,163 @@ +# Adding comment trying to trigger a build +#------------------------------------------------------------------------------- ---------- +#Key=Disposition:Category:Severity:Error Code:HTTP ResponseCode:RESTError Code:Error Message +#------------------------------------------------------------------------------- ---------- +# testing code, please don't change unless error utility source code changes +AAI_TESTING=5:2:WARN:0000:400:0001:Error code for testing + +# General success +AAI_0000=0:0:INFO:0000:200:0000:Success + +# health check success +AAI_0001=0:0:INFO:0001:200:0001:Success X-FromAppId=%1 X-TransactionId=%2 +AAI_0002=0:0:INFO:0002:200:0001:Successful health check + +# Success with additional info +AAI_0003=0:3:INFO:0003:202:0003:Success with additional info performing %1 on %2. Added %3 with key %4 +AAI_0004=0:3:INFO:0004:202:0003:Added prerequisite object to db + +#--- aairest: 3000-3299 +# svc errors +AAI_3000=5:2:INFO:3000:400:3000:Invalid input performing %1 on %2 +AAI_3001=5:6:INFO:3001:404:3001:Resource not found for %1 using id %2 +AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2 +AAI_3003=5:1:WARN:3003:400:3003:Failed to make edge to missing target node of type %3 with keys %4 performing %1 on %2 +AAI_3005=5:6:WARN:3005:404:3001:Node cannot be directly accessed for read, must be accessed via ancestor(s) +AAI_3006=5:6:WARN:3006:404:3001:Node cannot be directly accessed for write, must be accessed via ancestor(s) +AAI_3007=5:6:INFO:3007:410:3007:This version (%1) of the API is retired, please migrate to %2 +AAI_3008=5:6:ERROR:3008:400:3008:URI is not encoded in UTF-8 +AAI_3009=5:6:ERROR:3009:400:3002:Malformed URL +# pol errors +AAI_3100=5:1:WARN:3100:400:3100:Unsupported operation %1 +AAI_3101=5:1:WARN:3101:403:3101:Attempt by client %1 to execute API %2 +AAI_3102=5:1:WARN:3102:400:3102:Error parsing input performing %1 on %2 +AAI_3300=5:1:WARN:3300:403:3300:Unauthorized +AAI_3301=5:1:WARN:3301:401:3301:Stale credentials +AAI_3302=5:1:WARN:3302:401:3301:Not authenticated +AAI_3303=5:1:ERROR:3303:403:3300:Too many objects would be returned by this request, please refine your request and retry + +#--- aaigen: 4000-4099 +AAI_4000=5:4:ERROR:4000:500:3002:Internal Error +AAI_4001=5:4:FATAL:4001:500:3002:Configuration file not found +AAI_4002=5:4:FATAL:4002:500:3002:Error reading Configuration file +AAI_4003=5:4:ERROR:4003:500:3002:Error writing to log file +AAI_4004=5:4:FATAL:4004:500:3002:Error reading/parsing the error properties file +AAI_4005=5:4:FATAL:4005:500:3002:Missing or invalid configuration parameter +AAI_4006=5:4:FATAL:4006:500:3002:Unexpected error in service +AAI_4007=5:4:ERROR:4007:500:3102:Input parsing error +AAI_4008=5:4:ERROR:4008:500:3002:Output parsing error +AAI_4009=4:0:ERROR:4009:400:3000:Invalid X-FromAppId in header +AAI_4010=4:0:ERROR:4010:400:3000:Invalid X-TransactionId in header +AAI_4011=5:4:ERROR:4011:500:3002:Missing data for REST error response +AAI_4012=5:4:ERROR:4012:500:3002:Bad rule data in RestRules +AAI_4013=5:4:ERROR:4013:500:3002:Error connecting to AAI REST API +AAI_4014=4:0:ERROR:4014:400:3000:Invalid Accept header +AAI_4015=4:0:ERROR:4015:400:3000:You must provide at least one indexed property +AAI_4016=4:0:ERROR:4016:400:3000:The depth parameter must be a number or the string "all" +AAI_4017=5:2:INFO:4017:400:3000:Could not set property +AAI_4018=5:2:ERROR:4018:400:3000:Unable to convert the string to integer +#--- aaidbmap: 5101-5199 +AAI_5101=5:4:FATAL:5101:500:3002:Could not connect to database +AAI_5102=5:4:FATAL:5102:500:3002:Graph database is null after open +AAI_5103=5:4:ERROR:5103:500:3002:Unexpected error during commit +AAI_5104=5:4:ERROR:5104:500:3002:Unexpected error during rollback +AAI_5105=5:4:ERROR:5105:500:3002:Unexpected error reading/updating database +AAI_5106=5:4:WARN:5106:404:3001:Node not found +AAI_5107=5:2:WARN:5107:400:3000:Required information missing +AAI_5108=5:2:WARN:5108:200:0:Unexpected information in request being ignored + +#--- aaidbgen: 6101-6199 +AAI_6101=5:4:ERROR:6101:500:3002:null TitanGraph object passed +AAI_6102=5:4:WARN:6102:400:3000:Passed-in property is not valid for this nodeType +AAI_6103=5:4:WARN:6103:400:3000:Required Node-property not found in input data +AAI_6104=5:4:WARN:6104:400:3000:Required Node-property was passed with no data +AAI_6105=5:4:WARN:6105:400:3000:Node-Key-Property not defined in DbMaps +AAI_6106=5:4:WARN:6106:400:3000:Passed-in property is not valid for this edgeType +AAI_6107=5:4:WARN:6107:400:3000:Required Edge-property not found in input data +AAI_6108=5:4:WARN:6108:400:3000:Required Edge-property was passed with no data +AAI_6109=5:4:WARN:6109:400:3000:Bad dependent Node value +AAI_6110=5:4:ERROR:6110:400:3100:Node cannot be deleted +AAI_6111=5:4:ERROR:6111:400:3000:JSON processing error +AAI_6112=5:4:ERROR:6112:400:3000:More than one node found by getUniqueNode() +AAI_6114=5:4:INFO:6114:404:3001:Node Not Found +AAI_6115=5:4:ERROR:6115:400:3000:Unrecognized NodeType +AAI_6116=5:4:ERROR:6116:400:3000:Unrecognized Property +AAI_6117=5:4:ERROR:6117:400:3000:Uniqueness constraint violated +AAI_6118=5:4:ERROR:6118:400:3000:Required Field not passed. +AAI_6120=5:4:ERROR:6120:400:3000:Bad Parameter Passed +AAI_6121=5:4:ERROR:6121:400:3000:Problem with internal AAI reference data +AAI_6122=5:4:ERROR:6122:400:3000:Data Set not complete in DB for this request +AAI_6123=5:4:ERROR:6123:500:3000:Bad Data found by DataGrooming Tool - Investigate +AAI_6124=5:4:ERROR:6124:500:3000:File read/write error +AAI_6125=5:4:WARN:6125:500:3000:Problem Pulling Data Set +AAI_6126=5:4:ERROR:6126:400:3000:Edge cannot be deleted +AAI_6127=5:4:INFO:6127:404:3001:Edge Not Found +AAI_6128=5:4:INFO:6128:500:3000:Unexpected error +AAI_6129=5:4:INFO:6129:404:3003:Error making edge to target node +AAI_6130=5:4:WARN:6130:412:3000:Precondition Required +AAI_6131=5:4:WARN:6131:412:3000:Precondition Failed +AAI_6132=5:4:WARN:6132:400:3000:Bad Model Definition +AAI_6133=5:4:WARN:6133:400:3000:Bad Named Query Definition +AAI_6134=5:4:ERROR:6134:500:6134:Could not persist transaction to storage back end. Exhausted retry amount +AAI_6135=5:4:WARN:6135:412:3000:Resource version specified on create +AAI_6136=5:4:ERROR:6136:400:3000:Object cannot hold multiple items +AAI_6137=5:4:ERROR:6137:400:3000:Cannot perform writes on multiple vertices +AAI_6138=5:4:ERROR:6138:400:3000:Cannot delete multiple vertices +AAI_6139=5:4:ERROR:6139:404:3000:Attempted to add edge to vertex that does not exist +AAI_6140=5:4:ERROR:6140:400:3000:Edge multiplicity violated +AAI_6141=5:4:WARN:6141:400:3000:Please Refine Query +AAI_6142=5:4:INFO:6142:400:3000:Retrying transaction +AAI_6143=5:4:INFO:6143:400:3000:Ghost vertex found +AAI_6144=5:4:WARN:6144:400:3000:Cycle found in graph +AAI_6145=5:4:ERROR:6145:400:3000:Cannot create a nested/containment edge via relationship + +#--- aaicsvp: 7101-7199 +AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing +AAI_7102=5:4:ERROR:7102:500:3002:Error in cleanup temporary directory +#AAI_7103=4:2:ERROR:7103:500:3002:Unsupported user +AAI_7104=5:4:ERROR:7104:500:3002:Failed to create directory +AAI_7105=5:4:ERROR:7105:500:3002:Temporary directory exists +AAI_7106=5:4:ERROR:7106:500:3002:Cannot delete +AAI_7107=5:4:ERROR:7107:500:3002:Input file does not exist +AAI_7108=5:4:ERROR:7108:500:3002:Output file does not exist +AAI_7109=5:4:ERROR:7109:500:3002:Error closing file +AAI_7110=5:4:ERROR:7110:500:3002:Error loading/reading properties file +AAI_7111=5:4:ERROR:7111:500:3002:Error executing shell script +AAI_7112=5:4:ERROR:7112:500:3002:Error creating output file +AAI_7113=5:4:ERROR:7113:500:3002:Trailer record error +AAI_7114=5:4:ERROR:7114:500:3002:Input file error +AAI_7115=5:4:ERROR:7115:500:3002:Unexpected error +AAI_7116=5:4:ERROR:7116:500:3002:Request error +AAI_7117=5:4:ERROR:7117:500:3002:Error in get http client object +AAI_7118=5:4:ERROR:7118:500:3002:Script Error +AAI_7119=5:4:ERROR:7119:500:3002:Unknown host + +#--- aaisdnc: 7201-7299 +AAI_7202=5:4:ERROR:7202:500:3002:Error getting connection to odl +AAI_7203=5:4:ERROR:7203:500:3002:Unexpected error calling DataChangeNotification API +AAI_7204=5:4:ERROR:7204:500:3002:Error returned by DataChangeNotification API +AAI_7205=5:4:ERROR:7205:500:3002:Unexpected error running notifySDNCOnUpdate +AAI_7206=5:4:ERROR:7206:500:3002:Invalid data returned from ODL + +#--- NotificationEvent, using UEB space +AAI_7350=5:4:ERROR:7305:500:3002:Notification event creation failed + +#--- aairestctlr: 7401-7499 +AAI_7401=5:4:ERROR:7401:500:3002:Error connecting to AAI REST API +AAI_7402=5:4:ERROR:7402:500:3002:Unexpected error +AAI_7403=5:4:WARN:7403:400:3001:Request error +AAI_7404=5:4:INFO:7404:404:3001:Node not found + +#--- aaiauth: 9101-9199 +AAI_9101=5:0:WARN:9101:403:3300:User is not authorized to perform function +AAI_9102=5:0:WARN:9102:401:3301:Refresh credentials from source +AAI_9103=5:0:WARN:9103:403:3300:User not found +AAI_9104=5:0:WARN:9104:401:3302:Authentication error +AAI_9105=5:0:WARN:9105:403:3300:Authorization error +AAI_9106=5:0:WARN:9106:403:3300:Invalid AppId +#AAI_9107=5:0:WARN:9107:403:3300:No Username in Request +AAI_9107=5:0:WARN:9107:403:3300:SSL is not provided in request, please contact admin + +#--- aaiinstar: 9201-9299 +AAI_9201=5:4:ERROR:9201:500:3002:Unable to send notification +AAI_9202=5:4:ERROR:9202:500:3002:Unable to start a thread diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v10.xml b/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v10.xml new file mode 100644 index 00000000..d0f181a4 --- /dev/null +++ b/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v10.xml @@ -0,0 +1,6482 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.openecomp.org.v10" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.openecomp.aai.inventory/v10" /> + </xml-schema> + <java-types> + <java-type name="Inventory"> + <xml-root-element name="inventory" /> + <java-attributes> + <xml-element java-attribute="search" name="search" type="inventory.aai.openecomp.org.v10.Search" /> + <xml-element java-attribute="actions" name="actions" type="inventory.aai.openecomp.org.v10.Actions" /> + <xml-element java-attribute="cloudInfrastructure" name="cloud-infrastructure" type="inventory.aai.openecomp.org.v10.CloudInfrastructure" /> + <xml-element java-attribute="business" name="business" type="inventory.aai.openecomp.org.v10.Business" /> + <xml-element java-attribute="serviceDesignAndCreation" name="service-design-and-creation" type="inventory.aai.openecomp.org.v10.ServiceDesignAndCreation" /> + <xml-element java-attribute="network" name="network" type="inventory.aai.openecomp.org.v10.Network" /> + <xml-element java-attribute="aaiInternal" name="aai-internal" type="inventory.aai.openecomp.org.v10.AaiInternal" /> + <xml-element java-attribute="nodes" name="nodes" type="inventory.aai.openecomp.org.v10.Nodes" /> + </java-attributes> + </java-type> + <java-type name="Nodes"> + <xml-root-element name="nodes" /> + </java-type> + <java-type name="Search"> + <xml-root-element name="search" /> + <java-attributes> + <xml-element java-attribute="edgeTagQueryResult" name="edge-tag-query-result" type="inventory.aai.openecomp.org.v10.EdgeTagQueryResult" /> + <xml-element java-attribute="edgeTagQueryRequest" name="edge-tag-query-request" type="inventory.aai.openecomp.org.v10.EdgeTagQueryRequest" /> + <xml-element java-attribute="searchResults" name="search-results" type="inventory.aai.openecomp.org.v10.SearchResults" /> + <xml-element java-attribute="sdnZoneResponse" name="sdn-zone-response" type="inventory.aai.openecomp.org.v10.SdnZoneResponse" /> + </java-attributes> + </java-type> + <java-type name="EdgeTagQueryResult"> + <xml-root-element name="edge-tag-query-result" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v10.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + <java-type name="TaggedInventoryItemList"> + <xml-root-element name="tagged-inventory-item-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItem" name="inventory-item" type="inventory.aai.openecomp.org.v10.InventoryItem" /> + </java-attributes> + </java-type> + <java-type name="InventoryItem"> + <xml-root-element name="inventory-item" /> + <java-attributes> + <xml-element java-attribute="inventoryItemType" name="inventory-item-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="inventoryItemLink" name="inventory-item-link" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItemData" name="inventory-item-data" type="inventory.aai.openecomp.org.v10.InventoryItemData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v10.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + <java-type name="InventoryItemData"> + <xml-root-element name="inventory-item-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="EdgeTagQueryRequest"> + <xml-root-element name="edge-tag-query-request" /> + <java-attributes> + <xml-element java-attribute="edgeTag" name="edge-tag" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resultDetail" name="result-detail" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="startNodeType" name="start-node-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="startNodeFilter" name="start-node-filter" type="inventory.aai.openecomp.org.v10.StartNodeFilter" /> + <xml-element container-type="java.util.ArrayList" java-attribute="includeNodeFilter" name="include-node-filter" type="inventory.aai.openecomp.org.v10.IncludeNodeFilter" /> + <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilter" name="secondary-filter" type="inventory.aai.openecomp.org.v10.SecondaryFilter" /> + </java-attributes> + </java-type> + <java-type name="StartNodeFilter"> + <xml-root-element name="start-node-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="IncludeNodeFilter"> + <xml-root-element name="include-node-filter" /> + <java-attributes> + <xml-element java-attribute="includeNodeType" name="include-node-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="SecondaryFilter"> + <xml-root-element name="secondary-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="filterType" name="filter-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="SearchResults"> + <xml-root-element name="search-results" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="resultData" name="result-data" type="inventory.aai.openecomp.org.v10.ResultData" /> + </java-attributes> + </java-type> + <java-type name="ResultData"> + <xml-root-element name="result-data" /> + <java-attributes> + <xml-element java-attribute="resourceType" name="resource-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The specific type of node in the A&AI graph" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceLink" name="resource-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The URL to the specific resource" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="SdnZoneResponse"> + <xml-root-element name="sdn-zone-response" /> + <java-attributes> + <xml-element java-attribute="oamNetworks" name="oam-networks" type="inventory.aai.openecomp.org.v10.OamNetworks" /> + <xml-element container-type="java.util.ArrayList" java-attribute="azAndDvsSwitches" name="az-and-dvs-switches" type="inventory.aai.openecomp.org.v10.AzAndDvsSwitches" /> + </java-attributes> + </java-type> + <java-type name="AzAndDvsSwitches"> + <xml-root-element name="az-and-dvs-switches" /> + <java-attributes> + <xml-element java-attribute="dvsSwitches" name="dvs-switches" type="inventory.aai.openecomp.org.v10.DvsSwitches" /> + <xml-element java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v10.AvailabilityZone" /> + </java-attributes> + </java-type> + <java-type name="Actions"> + <xml-properties> + <xml-property name="description" value="APIs that are more action related than REST (e.g., notify, update)." /> + </xml-properties> + <xml-root-element name="actions" /> + <java-attributes> + <xml-element java-attribute="update" name="update" type="inventory.aai.openecomp.org.v10.Update" /> + <xml-element java-attribute="notify" name="notify" type="inventory.aai.openecomp.org.v10.Notify" /> + </java-attributes> + </java-type> + <java-type name="Update"> + <xml-properties> + <xml-property name="description" value="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team." /> + </xml-properties> + <xml-root-element name="update" /> + <java-attributes> + <xml-element java-attribute="updateNodeType" name="update-node-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="updateNodeKey" name="update-node-key" type="inventory.aai.openecomp.org.v10.UpdateNodeKey" /> + <xml-element java-attribute="updateNodeUri" name="update-node-uri" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="action" name="action" type="inventory.aai.openecomp.org.v10.Action" /> + </java-attributes> + </java-type> + <java-type name="Action"> + <xml-root-element name="action" /> + <java-attributes> + <xml-element java-attribute="actionType" name="action-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="actionData" name="action-data" type="inventory.aai.openecomp.org.v10.ActionData" /> + </java-attributes> + </java-type> + <java-type name="ActionData"> + <xml-root-element name="action-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="UpdateNodeKey"> + <xml-root-element name="update-node-key" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="Notify"> + <xml-root-element name="notify" /> + <java-attributes> + <xml-element java-attribute="eventId" name="event-id" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nodeType" name="node-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="eventTrigger" name="event-trigger" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="keyData" name="key-data" type="inventory.aai.openecomp.org.v10.KeyData" /> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="KeyData"> + <xml-root-element name="key-data" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="CloudInfrastructure"> + <xml-properties> + <xml-property name="description" value="Namespace for cloud infrastructure." /> + </xml-properties> + <xml-root-element name="cloud-infrastructure" /> + <java-attributes> + <xml-element java-attribute="complexes" name="complexes" type="inventory.aai.openecomp.org.v10.Complexes" /> + <xml-element java-attribute="cloudRegions" name="cloud-regions" type="inventory.aai.openecomp.org.v10.CloudRegions" /> + <xml-element java-attribute="networkProfiles" name="network-profiles" type="inventory.aai.openecomp.org.v10.NetworkProfiles" /> + <xml-element java-attribute="pservers" name="pservers" type="inventory.aai.openecomp.org.v10.Pservers" /> + <xml-element java-attribute="virtualDataCenters" name="virtual-data-centers" type="inventory.aai.openecomp.org.v10.VirtualDataCenters" /> + </java-attributes> + </java-type> + <java-type name="CloudRegions"> + <xml-root-element name="cloud-regions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cloudRegion" name="cloud-region" type="inventory.aai.openecomp.org.v10.CloudRegion" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="CloudRegion"> + <xml-root-element name="cloud-region" /> + <java-attributes> + <xml-element java-attribute="cloudOwner" name="cloud-owner" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifies the vendor and cloud name. First part of composite key should be formatted as vendor-cloudname" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionId" name="cloud-region-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifier used by the vendor for the region. Second part of composite key" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudType" name="cloud-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the cloud (e.g., openstack)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ownerDefinedType" name="owner-defined-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Cloud-owner defined type indicator (e.g., dcp, lcp)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionVersion" name="cloud-region-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudZone" name="cloud-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroups" name="volume-groups" type="inventory.aai.openecomp.org.v10.VolumeGroups" /> + <xml-element java-attribute="tenants" name="tenants" type="inventory.aai.openecomp.org.v10.Tenants" /> + <xml-element java-attribute="flavors" name="flavors" type="inventory.aai.openecomp.org.v10.Flavors" /> + <xml-element java-attribute="groupAssignments" name="group-assignments" type="inventory.aai.openecomp.org.v10.GroupAssignments" /> + <xml-element java-attribute="snapshots" name="snapshots" type="inventory.aai.openecomp.org.v10.Snapshots" /> + <xml-element java-attribute="images" name="images" type="inventory.aai.openecomp.org.v10.Images" /> + <xml-element java-attribute="dvsSwitches" name="dvs-switches" type="inventory.aai.openecomp.org.v10.DvsSwitches" /> + <xml-element java-attribute="oamNetworks" name="oam-networks" type="inventory.aai.openecomp.org.v10.OamNetworks" /> + <xml-element java-attribute="availabilityZones" name="availability-zones" type="inventory.aai.openecomp.org.v10.AvailabilityZones" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC." /> + <xml-property name="indexedProps" value="cloud-owner,cloud-region-id,cloud-type,owner-defined-type" /> + <xml-property name="nameProps" value="owner-defined-type" /> + <xml-property name="container" value="cloud-regions" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="VolumeGroups"> + <xml-properties> + <xml-property name="description" value="Collection of persistent block-level storage." /> + </xml-properties> + <xml-root-element name="volume-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volumeGroup" name="volume-group" type="inventory.aai.openecomp.org.v10.VolumeGroup" /> + </java-attributes> + </java-type> + <java-type name="VolumeGroup"> + <xml-root-element name="volume-group" /> + <java-attributes> + <xml-element java-attribute="volumeGroupId" name="volume-group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of volume-group." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroupName" name="volume-group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the volume group." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this volume-group" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this volume-group" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleModelCustomizationId" name="vf-module-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="helps relate the volume group to the vf-module whose components will require the volume group" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Persistent block-level storage." /> + <xml-property name="indexedProps" value="volume-group-name,vnf-type,heat-stack-id,volume-group-id" /> + <xml-property name="searchable" value="volume-group-id,volume-group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="volume-groups" /> + </xml-properties> + </java-type> + <java-type name="RelationshipList"> + <xml-root-element name="relationship-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relationship" name="relationship" type="inventory.aai.openecomp.org.v10.Relationship" /> + </java-attributes> + </java-type> + <java-type name="Relationship"> + <xml-root-element name="relationship" /> + <java-attributes> + <xml-element java-attribute="relatedTo" name="related-to" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate type of node." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relatedLink" name="related-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to the object in A&AI." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="relationshipData" name="relationship-data" type="inventory.aai.openecomp.org.v10.RelationshipData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedToProperty" name="related-to-property" type="inventory.aai.openecomp.org.v10.RelatedToProperty" /> + </java-attributes> + </java-type> + <java-type name="RelatedToProperty"> + <xml-root-element name="related-to-property" /> + <java-attributes> + <xml-element java-attribute="propertyKey" name="property-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Key part of a key/value pair" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value part of a key/value pair" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate an attribute." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="Complexes"> + <xml-properties> + <xml-property name="description" value="Collection of physical locations that can house cloud-regions." /> + </xml-properties> + <xml-root-element name="complexes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="complex" name="complex" type="inventory.aai.openecomp.org.v10.Complex" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="Complex"> + <xml-root-element name="complex" /> + <java-attributes> + <xml-element java-attribute="physicalLocationId" name="physical-location-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for physical location, e.g., CLLI" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dataCenterCode" name="data-center-code" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Data center code which can be an alternate way to identify a complex" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Gamma complex name for LCP instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalLocationType" name="physical-location-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type, e.g., central office, data center." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="street1" name="street1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="street2" name="street2" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="city" name="city" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="state" name="state" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="postalCode" name="postal-code" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="country" name="country" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="region" name="region" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="latitude" name="latitude" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="longitude" name="longitude" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elevation" name="elevation" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="lata" name="lata" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagPools" name="ctag-pools" type="inventory.aai.openecomp.org.v10.CtagPools" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical locations that can house cloud-regions." /> + <xml-property name="indexedProps" value="identity-url,data-center-code,complex-name,physical-location-id" /> + <xml-property name="searchable" value="physical-location-id,data-center-code,complex-name,street1,street2,postal-code" /> + <xml-property name="uniqueProps" value="physical-location-id" /> + <xml-property name="container" value="complexes" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="CtagPools"> + <xml-root-element name="ctag-pools" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagPool" name="ctag-pool" type="inventory.aai.openecomp.org.v10.CtagPool" /> + </java-attributes> + </java-type> + <java-type name="CtagPool"> + <xml-root-element name="ctag-pool" /> + <java-attributes> + <xml-element java-attribute="targetPe" name="target-pe" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="The Target provider edge router" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagPoolPurpose" name="ctag-pool-purpose" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Describes what the intended purpose of this pool is." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagValues" name="ctag-values" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Comma separated list of ctags" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="A collection of C tags (vlan tags) grouped for a specific purpose." /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="complex" /> + <xml-property name="container" value="ctag-pools" /> + </xml-properties> + </java-type> + <java-type name="Tenants"> + <xml-properties> + <xml-property name="description" value="Collection of openstack tenants." /> + </xml-properties> + <xml-root-element name="tenants" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tenant" name="tenant" type="inventory.aai.openecomp.org.v10.Tenant" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="Tenant"> + <xml-root-element name="tenant" /> + <java-attributes> + <xml-element java-attribute="tenantId" name="tenant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id relative to the cloud-region." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tenantName" name="tenant-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Readable name of tenant" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vservers" name="vservers" type="inventory.aai.openecomp.org.v10.Vservers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack tenant" /> + <xml-property name="nameProps" value="tenant-name" /> + <xml-property name="indexedProps" value="tenant-name,tenant-id" /> + <xml-property name="searchable" value="tenant-id,tenant-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="tenants" /> + </xml-properties> + </java-type> + <java-type name="Vservers"> + <xml-properties> + <xml-property name="description" value="Collection of virtual Servers, aka virtual machines or VMs." /> + </xml-properties> + <xml-root-element name="vservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vserver" name="vserver" type="inventory.aai.openecomp.org.v10.Vserver" /> + </java-attributes> + </java-type> + <java-type name="Vserver"> + <xml-root-element name="vserver" /> + <java-attributes> + <xml-element java-attribute="vserverId" name="vserver-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for this vserver relative to its tenant" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName" name="vserver-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vserver" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName2" name="vserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternative name of vserver" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverSelflink" name="vserver-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="Used to indicate whether closed loop function is enabled on this node" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumes" name="volumes" type="inventory.aai.openecomp.org.v10.Volumes" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Servers, aka virtual machine or VM." /> + <xml-property name="nameProps" value="vserver-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2" /> + <xml-property name="searchable" value="vserver-id,vserver-name,vserver-name2" /> + <xml-property name="dependentOn" value="tenant" /> + <xml-property name="container" value="vservers" /> + </xml-properties> + </java-type> + <java-type name="LInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of logical interfaces." /> + </xml-properties> + <xml-root-element name="l-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lInterface" name="l-interface" type="inventory.aai.openecomp.org.v10.LInterface" /> + </java-attributes> + </java-type> + <java-type name="LInterface"> + <xml-root-element name="l-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name given to the interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="E.g., CUSTOMER, UPLINK, etc." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6WanLinkIp" name="v6-wan-link-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="macaddr" name="macaddr" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="MAC address for the interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Human friendly text regarding this interface." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isPortMirrored" name="is-port-mirrored" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="boolean indicatating whether or not port is a mirrored." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlans" name="vlans" type="inventory.aai.openecomp.org.v10.Vlans" /> + <xml-element java-attribute="sriovVfs" name="sriov-vfs" type="inventory.aai.openecomp.org.v10.SriovVfs" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical interfaces, e.g., a vnic." /> + <xml-property name="indexedProps" value="macaddr,interface-id,interface-name,network-name" /> + <xml-property name="dependentOn" value="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface" /> + <xml-property name="container" value="l-interfaces" /> + </xml-properties> + </java-type> + <java-type name="SriovVfs"> + <xml-properties> + <xml-property name="description" value="Collection of SR-IOV Virtual Functions." /> + </xml-properties> + <xml-root-element name="sriov-vfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sriovVf" name="sriov-vf" type="inventory.aai.openecomp.org.v10.SriovVf" /> + </java-attributes> + </java-type> + <java-type name="SriovVf"> + <xml-root-element name="sriov-vf" /> + <java-attributes> + <xml-element java-attribute="pciId" name="pci-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="PCI ID used to identify the sriov-vf" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanFilter" name="vf-vlan-filter" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMacFilter" name="vf-mac-filter" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanStrip" name="vf-vlan-strip" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanAntiSpoofCheck" name="vf-vlan-anti-spoof-check" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMacAntiSpoofCheck" name="vf-mac-anti-spoof-check" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMirrors" name="vf-mirrors" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfBroadcastAllow" name="vf-broadcast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfUnknownMulticastAllow" name="vf-unknown-multicast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfUnknownUnicastAllow" name="vf-unknown-unicast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfInsertStag" name="vf-insert-stag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, instructs to insert outer tag after traffic comes out of VM." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfLinkStatus" name="vf-link-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This option is used to set the link status. Valid values as of 1607 are on, off, and auto." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="SR-IOV Virtual Function (not to be confused with virtual network function)" /> + <xml-property name="indexedProps" value="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="sriov-vfs" /> + </xml-properties> + </java-type> + <java-type name="L3InterfaceIpv4AddressList"> + <xml-root-element name="l3-interface-ipv4-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv4Address" name="l3-interface-ipv4-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv4PrefixLength" name="l3-interface-ipv4-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 32 for single address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv4 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + <java-type name="Vlans"> + <xml-root-element name="vlans" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vlan" name="vlan" type="inventory.aai.openecomp.org.v10.Vlan" /> + </java-attributes> + </java-type> + <java-type name="Vlan"> + <xml-root-element name="vlan" /> + <java-attributes> + <xml-element java-attribute="vlanInterface" name="vlan-interface" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String that identifies the interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanDescription" name="vlan-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to describe (the service associated with) the vlan" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="backdoorConnection" name="backdoor-connection" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether customer is going to use this VLAN for backdoor connection to another customer premise device." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnId" name="vpn-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This indicates the customers VPN ID associated with this vlan" /> + <xml-property name="dbAlias" value="vpn-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Definition of vlan" /> + <xml-property name="indexedProps" value="vlan-interface,vlan-id-inner,vpn-id" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="vlans" /> + </xml-properties> + </java-type> + <java-type name="L3InterfaceIpv6AddressList"> + <xml-root-element name="l3-interface-ipv6-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv6Address" name="l3-interface-ipv6-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv6PrefixLength" name="l3-interface-ipv6-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 128 for single address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv6 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + <java-type name="Volumes"> + <xml-properties> + <xml-property name="description" value="Collection of ephemeral Block storage volumes." /> + </xml-properties> + <xml-root-element name="volumes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volume" name="volume" type="inventory.aai.openecomp.org.v10.Volume" /> + </java-attributes> + </java-type> + <java-type name="Volume"> + <xml-root-element name="volume" /> + <java-attributes> + <xml-element java-attribute="volumeId" name="volume-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of block storage volume relative to the vserver." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeSelflink" name="volume-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Ephemeral Block storage volume." /> + <xml-property name="indexedProps" value="volume-id" /> + <xml-property name="dependentOn" value="vserver" /> + <xml-property name="container" value="volumes" /> + </xml-properties> + </java-type> + <java-type name="Flavors"> + <xml-properties> + <xml-property name="description" value="Collection of openstack flavors." /> + </xml-properties> + <xml-root-element name="flavors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="flavor" name="flavor" type="inventory.aai.openecomp.org.v10.Flavor" /> + </java-attributes> + </java-type> + <java-type name="Flavor"> + <xml-root-element name="flavor" /> + <java-attributes> + <xml-element java-attribute="flavorId" name="flavor-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Flavor id, expected to be unique across cloud-region." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorName" name="flavor-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Flavor name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorVcpus" name="flavor-vcpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of CPUs" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorRam" name="flavor-ram" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of memory" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisk" name="flavor-disk" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk space" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorEphemeral" name="flavor-ephemeral" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of ephemeral disk space" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSwap" name="flavor-swap" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="amount of swap space allocation" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorIsPublic" name="flavor-is-public" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="whether flavor is available to all users or private to the tenant it was created in." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSelflink" name="flavor-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisabled" name="flavor-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Boolean as to whether this flavor is no longer enabled" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack flavor." /> + <xml-property name="nameProps" value="flavor-name" /> + <xml-property name="indexedProps" value="flavor-name,flavor-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="flavors" /> + </xml-properties> + </java-type> + <java-type name="Snapshots"> + <xml-properties> + <xml-property name="description" value="Collection of openstack snapshots" /> + </xml-properties> + <xml-root-element name="snapshots" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="snapshot" name="snapshot" type="inventory.aai.openecomp.org.v10.Snapshot" /> + </java-attributes> + </java-type> + <java-type name="Snapshot"> + <xml-root-element name="snapshot" /> + <java-attributes> + <xml-element java-attribute="snapshotId" name="snapshot-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Snapshot id, this is the key UUID assoc associated in glance with the snapshots." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotName" name="snapshot-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Snapshot name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotArchitecture" name="snapshot-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsDistro" name="snapshot-os-distro" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsVersion" name="snapshot-os-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotSelflink" name="snapshot-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="prevSnapshotId" name="prev-snapshot-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field contains the UUID of the previous snapshot (if any)." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack snapshot" /> + <xml-property name="nameProps" value="snapshot-name" /> + <xml-property name="uniqueProps" value="snapshot-id" /> + <xml-property name="indexedProps" value="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="snapshots" /> + </xml-properties> + </java-type> + <java-type name="GroupAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack group assignments" /> + </xml-properties> + <xml-root-element name="group-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="groupAssignment" name="group-assignment" type="inventory.aai.openecomp.org.v10.GroupAssignment" /> + </java-attributes> + </java-type> + <java-type name="GroupAssignment"> + <xml-root-element name="group-assignment" /> + <java-attributes> + <xml-element java-attribute="groupId" name="group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Group id, expected to be unique across cloud-region." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupType" name="group-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group type - the type of group this instance refers to" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupName" name="group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name - name assigned to the group" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupDescription" name="group-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group description - description of the group" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack group-assignment used to store exclusivity groups (EG)." /> + <xml-property name="nameProps" value="group-name" /> + <xml-property name="indexedProps" value="group-id,group-type,group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="group-assignments" /> + </xml-properties> + </java-type> + <java-type name="Images"> + <xml-properties> + <xml-property name="description" value="Collectio of Openstack images." /> + </xml-properties> + <xml-root-element name="images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="image" name="image" type="inventory.aai.openecomp.org.v10.Image" /> + </java-attributes> + </java-type> + <java-type name="Image"> + <xml-root-element name="image" /> + <java-attributes> + <xml-element java-attribute="imageId" name="image-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Image id, expected to be unique across cloud region" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageName" name="image-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Image name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageArchitecture" name="image-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsDistro" name="image-os-distro" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsVersion" name="image-os-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageSelflink" name="image-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack image." /> + <xml-property name="nameProps" value="image-name" /> + <xml-property name="indexedProps" value="application,image-name,application-vendor,image-id,application-version" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="images" /> + </xml-properties> + </java-type> + <java-type name="Metadata"> + <xml-properties> + <xml-property name="description" value="Collection of metadatum (key/value pairs)" /> + </xml-properties> + <xml-root-element name="metadata" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="metadatum" name="metadatum" type="inventory.aai.openecomp.org.v10.Metadatum" /> + </java-attributes> + </java-type> + <java-type name="Metadatum"> + <xml-root-element name="metadatum" /> + <java-attributes> + <xml-element java-attribute="metaname" name="metaname" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="metaval" name="metaval" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Key/value pairs" /> + <xml-property name="indexedProps" value="metaname" /> + <xml-property name="dependentOn" value="tenant,image,service-instance,connector,model" /> + <xml-property name="container" value="metadata" /> + </xml-properties> + </java-type> + <java-type name="DvsSwitches"> + <xml-properties> + <xml-property name="description" value="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs." /> + </xml-properties> + <xml-root-element name="dvs-switches" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="dvsSwitch" name="dvs-switch" type="inventory.aai.openecomp.org.v10.DvsSwitch" /> + </java-attributes> + </java-type> + <java-type name="DvsSwitch"> + <xml-root-element name="dvs-switch" /> + <java-attributes> + <xml-element java-attribute="switchName" name="switch-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="DVS switch name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcenterUrl" name="vcenter-url" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL used to reach the vcenter" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. " /> + <xml-property name="indexedProps" value="vcenter-url,switch-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="dvs-switches" /> + </xml-properties> + </java-type> + <java-type name="NetworkProfiles"> + <xml-properties> + <xml-property name="description" value="Collection of network profiles" /> + </xml-properties> + <xml-root-element name="network-profiles" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="networkProfile" name="network-profile" type="inventory.aai.openecomp.org.v10.NetworkProfile" /> + </java-attributes> + </java-type> + <java-type name="NetworkProfile"> + <xml-root-element name="network-profile" /> + <java-attributes> + <xml-element java-attribute="nmProfileName" name="nm-profile-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique name of network profile." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="communityString" name="community-string" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encrypted SNMP community string" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Network profile populated by SDN-GP for SNMP" /> + <xml-property name="indexedProps" value="nm-profile-name" /> + <xml-property name="container" value="network-profiles" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="Pservers"> + <xml-properties> + <xml-property name="description" value="Collection of compute hosts." /> + </xml-properties> + <xml-root-element name="pservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pserver" name="pserver" type="inventory.aai.openecomp.org.v10.Pserver" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="Pserver"> + <xml-root-element name="pserver" /> + <java-attributes> + <xml-element java-attribute="hostname" name="hostname" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value from executing hostname on the compute node." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ptniiEquipName" name="ptnii-equip-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="PTNII name" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="numberOfCpus" name="number-of-cpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of cpus" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="diskInGigabytes" name="disk-in-gigabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk size, in GBs" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ramInMegabytes" name="ram-in-megabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="RAM size, in MBs" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="fqdn" name="fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Fully-qualified domain name" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverSelflink" name="pserver-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to configure device, also used for troubleshooting and is IP used for traps generated by device." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number, may be queried" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback0" name="ipaddress-v4-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 0 address" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback0" name="ipaddress-v6-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 0 address" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Aim" name="ipaddress-v4-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 AIM address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Aim" name="ipaddress-v6-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 AIM address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Oam" name="ipaddress-v6-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 OAM address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="invStatus" name="inv-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CANOPI's inventory status. Only set with values exactly as defined by CANOPI." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverId" name="pserver-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of Pserver" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="internetTopology" name="internet-topology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="internet topology of Pserver" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverName2" name="pserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="alternative pserver name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="purpose of pserver" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback10" name="ipaddress-v4-loopback-10" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 10 address" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback10" name="ipaddress-v6-loopback-10" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 10 address" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback300" name="ipaddress-v4-loopback-300" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 300 address" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback300" name="ipaddress-v6-loopback-300" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 300 address" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="createdDate" name="created-date" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Date the PServer was created (In SOT)" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="lastUpdatedDate" name="last-updated-date" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Date the PServer was last updated (in SOT)" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="lastUpdatedBy" name="last-updated-by" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="User that last updated the PServer (in SOT)" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="functionName" name="function-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Function name" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rackName" name="rack-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The name of the rack containing the Pserver" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="assetTag" name="asset-tag" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The PServer asset number" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="deploymentPhase" name="deployment-phase" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Deployment phase" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="locationName" name="location-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the PServer Location" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="locationId" name="location-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Id of the PServer Location" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentClli" name="equipment-clli" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The CLLI code for the PServer" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneTopologyId" name="zone-topology-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone topology Id" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneId" name="zone-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone Id" /> + <xml-property name="sourceOfTruthType" value="IDF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v10.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver." /> + <xml-property name="nameProps" value="pserver-name2" /> + <xml-property name="indexedProps" value="hostname,in-maint,pserver-id,pserver-name2,inv-status" /> + <xml-property name="searchable" value="hostname,pserver-name2,pserver-id,ipv4-oam-address" /> + <xml-property name="container" value="pservers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="PInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of physical interfaces." /> + </xml-properties> + <xml-root-element name="p-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pInterface" name="p-interface" type="inventory.aai.openecomp.org.v10.PInterface" /> + </java-attributes> + </java-type> + <java-type name="PInterface"> + <xml-root-element name="p-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the physical interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portDescription" name="port-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nature of the services and connectivity on this port." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentIdentifier" name="equipment-identifier" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CLEI or other specification for p-interface hardware." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role specification for p-interface hardware." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceType" name="interface-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the physical properties of the interface." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Physical interface (e.g., nic)" /> + <xml-property name="indexedProps" value="interface-name,prov-status" /> + <xml-property name="nameProps" value="prov-status" /> + <xml-property name="dependentOn" value="vpls-pe,pserver,pnf" /> + <xml-property name="container" value="p-interfaces" /> + </xml-properties> + </java-type> + <java-type name="LagInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregate interfaces." /> + </xml-properties> + <xml-root-element name="lag-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagInterface" name="lag-interface" type="inventory.aai.openecomp.org.v10.LagInterface" /> + </java-attributes> + </java-type> + <java-type name="LagInterface"> + <xml-root-element name="lag-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the link aggregate interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Human friendly text regarding this interface." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Link aggregate interface" /> + <xml-property name="indexedProps" value="interface-name,interface-id,interface-role" /> + <xml-property name="dependentOn" value="generic-vnf,pserver,vpe,vpls-pe,pnf" /> + <xml-property name="container" value="lag-interfaces" /> + </xml-properties> + </java-type> + <java-type name="OamNetworks"> + <xml-properties> + <xml-property name="description" value="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. " /> + </xml-properties> + <xml-root-element name="oam-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="oamNetwork" name="oam-network" type="inventory.aai.openecomp.org.v10.OamNetwork" /> + </java-attributes> + </java-type> + <java-type name="OamNetwork"> + <xml-root-element name="oam-network" /> + <java-attributes> + <xml-element java-attribute="networkUuid" name="network-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID of the network. Unique across a cloud-region" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cvlanTag" name="cvlan-tag" required="true" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="cvlan-id" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddress" name="ipv4-oam-gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for VNF firewall rule so customer cannot send customer traffic over this oam network" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddressPrefixLength" name="ipv4-oam-gateway-address-prefix-length" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Used for VNF firewall rule so customer cannot send customer traffic over this oam network" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="OAM network, to be deprecated shortly. Do not use for new purposes. " /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="cvlan-tag,network-uuid,network-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="oam-networks" /> + </xml-properties> + </java-type> + <java-type name="AvailabilityZones"> + <xml-properties> + <xml-property name="description" value="Collection of availability zones" /> + </xml-properties> + <xml-root-element name="availability-zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v10.AvailabilityZone" /> + </java-attributes> + </java-type> + <java-type name="AvailabilityZone"> + <xml-root-element name="availability-zone" /> + <java-attributes> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone. Unique across a cloud region" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="hypervisorType" name="hypervisor-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of hypervisor. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Availability zone, a collection of compute hosts/pservers" /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="availability-zones" /> + </xml-properties> + </java-type> + <java-type name="VirtualDataCenters"> + <xml-properties> + <xml-property name="description" value="Virtual organization of cloud infrastructure elements in a data center context" /> + </xml-properties> + <xml-root-element name="virtual-data-centers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="virtualDataCenter" name="virtual-data-center" type="inventory.aai.openecomp.org.v10.VirtualDataCenter" /> + </java-attributes> + </java-type> + <java-type name="VirtualDataCenter"> + <xml-root-element name="virtual-data-center" /> + <java-attributes> + <xml-element java-attribute="vdcId" name="vdc-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the vdc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdcName" name="vdc-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the virtual data center" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual organization of cloud infrastructure elements in a data center context" /> + <xml-property name="nameProps" value="vdc-name" /> + <xml-property name="indexedProps" value="vdc-name,vdc-id" /> + <xml-property name="container" value="virtual-data-centers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="Business"> + <xml-properties> + <xml-property name="description" value="Namespace for business related constructs" /> + </xml-properties> + <xml-root-element name="business" /> + <java-attributes> + <xml-element java-attribute="connectors" name="connectors" type="inventory.aai.openecomp.org.v10.Connectors" /> + <xml-element java-attribute="customers" name="customers" type="inventory.aai.openecomp.org.v10.Customers" /> + </java-attributes> + </java-type> + <java-type name="Connectors"> + <xml-properties> + <xml-property name="description" value="Collection of resource instances used to connect a variety of disparate inventory widgets" /> + </xml-properties> + <xml-root-element name="connectors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="connector" name="connector" type="inventory.aai.openecomp.org.v10.Connector" /> + </java-attributes> + </java-type> + <java-type name="Connector"> + <xml-root-element name="connector" /> + <java-attributes> + <xml-element java-attribute="resourceInstanceId" name="resource-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of resource instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of resource instances used to connect a variety of disparate inventory widgets" /> + <xml-property name="indexedProps" value="resource-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version" /> + <xml-property name="container" value="connectors" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + <java-type name="Customers"> + <xml-properties> + <xml-property name="description" value="Collection of customer identifiers to provide linkage back to BSS information." /> + </xml-properties> + <xml-root-element name="customers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="customer" name="customer" type="inventory.aai.openecomp.org.v10.Customer" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="Customer"> + <xml-root-element name="customer" /> + <java-attributes> + <xml-element java-attribute="globalCustomerId" name="global-customer-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Global customer id used across ECOMP to uniquely identify customer." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberName" name="subscriber-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber name, an alternate way to retrieve a customer." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberType" name="subscriber-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber type, a way to provide VID with only the INFRA customers." /> + <xml-property name="defaultValue" value="CUST" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSubscriptions" name="service-subscriptions" type="inventory.aai.openecomp.org.v10.ServiceSubscriptions" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="customer identifiers to provide linkage back to BSS information." /> + <xml-property name="nameProps" value="subscriber-name" /> + <xml-property name="indexedProps" value="subscriber-name,global-customer-id,subscriber-type" /> + <xml-property name="searchable" value="global-customer-id,subscriber-name" /> + <xml-property name="uniqueProps" value="global-customer-id" /> + <xml-property name="container" value="customers" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + <java-type name="ServiceSubscriptions"> + <xml-properties> + <xml-property name="description" value="Collection of objects that group service instances." /> + </xml-properties> + <xml-root-element name="service-subscriptions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceSubscription" name="service-subscription" type="inventory.aai.openecomp.org.v10.ServiceSubscription" /> + </java-attributes> + </java-type> + <java-type name="ServiceSubscription"> + <xml-root-element name="service-subscription" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value defined by orchestration to identify this service across ECOMP." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tempUbSubAccountId" name="temp-ub-sub-account-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This property will be deleted from A&AI in the near future. Only stop gap solution." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstances" name="service-instances" type="inventory.aai.openecomp.org.v10.ServiceInstances" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Object that group service instances." /> + <xml-property name="indexedProps" value="service-type" /> + <xml-property name="dependentOn" value="customer" /> + <xml-property name="container" value="service-subscriptions" /> + <xml-property name="crossEntityReference" value="service-instance,service-type" /> + </xml-properties> + </java-type> + <java-type name="ServiceInstances"> + <xml-properties> + <xml-property name="description" value="Collection of service instances" /> + </xml-properties> + <xml-root-element name="service-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceInstance" name="service-instance" type="inventory.aai.openecomp.org.v10.ServiceInstance" /> + </java-attributes> + </java-type> + <java-type name="ServiceInstance"> + <xml-root-element name="service-instance" /> + <java-attributes> + <xml-element java-attribute="serviceInstanceId" name="service-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Uniquely identifies this instance of a service" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceName" name="service-instance-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field will store a name assigned to the service-instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthTotal" name="bandwidth-total" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the total bandwidth to be used for this service." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vhnPortalUrl" name="vhn-portal-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL customers will use to access the vHN Portal." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operational status of the service-instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceLocationId" name="service-instance-location-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="An identifier that customers assign to the location where this service is being used." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this service." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + <xml-element java-attribute="allottedResources" name="allotted-resources" type="inventory.aai.openecomp.org.v10.AllottedResources" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Instance of a service" /> + <xml-property name="indexedProps" value="service-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status" /> + <xml-property name="nameProps" value="service-instance-name" /> + <xml-property name="searchable" value="service-instance-id,service-instance-name" /> + <xml-property name="uniqueProps" value="service-instance-id" /> + <xml-property name="dependentOn" value="service-subscription" /> + <xml-property name="container" value="service-instances" /> + </xml-properties> + </java-type> + <java-type name="ServiceDesignAndCreation"> + <xml-properties> + <xml-property name="description" value="Namespace for objects managed by ASDC" /> + </xml-properties> + <xml-root-element name="service-design-and-creation" /> + <java-attributes> + <xml-element java-attribute="vnfImages" name="vnf-images" type="inventory.aai.openecomp.org.v10.VnfImages" /> + <xml-element java-attribute="services" name="services" type="inventory.aai.openecomp.org.v10.Services" /> + <xml-element java-attribute="serviceCapabilities" name="service-capabilities" type="inventory.aai.openecomp.org.v10.ServiceCapabilities" /> + <xml-element java-attribute="models" name="models" type="inventory.aai.openecomp.org.v10.Models" /> + <xml-element java-attribute="namedQueries" name="named-queries" type="inventory.aai.openecomp.org.v10.NamedQueries" /> + </java-attributes> + </java-type> + <java-type name="VnfImages"> + <xml-properties> + <xml-property name="description" value="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge." /> + </xml-properties> + <xml-root-element name="vnf-images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfImage" name="vnf-image" type="inventory.aai.openecomp.org.v10.VnfImage" /> + </java-attributes> + </java-type> + <java-type name="VnfImage"> + <xml-root-element name="vnf-image" /> + <java-attributes> + <xml-element java-attribute="vnfImageUuid" name="vnf-image-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of this asset" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge." /> + <xml-property name="indexedProps" value="application,vnf-image-uuid,application-vendor,application-version" /> + <xml-property name="uniqueProps" value="vnf-image-uuid" /> + <xml-property name="container" value="vnf-images" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + <java-type name="Services"> + <xml-properties> + <xml-property name="description" value="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC." /> + </xml-properties> + <xml-root-element name="services" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="service" name="service" type="inventory.aai.openecomp.org.v10.Service" /> + </java-attributes> + </java-type> + <java-type name="Service"> + <xml-root-element name="service" /> + <java-attributes> + <xml-element java-attribute="serviceId" name="service-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceDescription" name="service-description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description of the service" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSelflink" name="service-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceVersion" name="service-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="service version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services." /> + <xml-property name="indexedProps" value="service-description,service-id" /> + <xml-property name="container" value="services" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + <java-type name="ServiceCapabilities"> + <xml-properties> + <xml-property name="description" value="Collection of service capabilities." /> + </xml-properties> + <xml-root-element name="service-capabilities" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceCapability" name="service-capability" type="inventory.aai.openecomp.org.v10.ServiceCapability" /> + </java-attributes> + </java-type> + <java-type name="ServiceCapability"> + <xml-root-element name="service-capability" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this." /> + <xml-property name="indexedProps" value="service-type,vnf-type" /> + <xml-property name="container" value="service-capabilities" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + <java-type name="Network"> + <xml-properties> + <xml-property name="description" value="Namespace for network inventory resources." /> + </xml-properties> + <xml-root-element name="network" /> + <java-attributes> + <xml-element java-attribute="logicalLinks" name="logical-links" type="inventory.aai.openecomp.org.v10.LogicalLinks" /> + <xml-element java-attribute="sitePairSets" name="site-pair-sets" type="inventory.aai.openecomp.org.v10.SitePairSets" /> + <xml-element java-attribute="vpnBindings" name="vpn-bindings" type="inventory.aai.openecomp.org.v10.VpnBindings" /> + <xml-element java-attribute="vplsPes" name="vpls-pes" type="inventory.aai.openecomp.org.v10.VplsPes" /> + <xml-element java-attribute="multicastConfigurations" name="multicast-configurations" type="inventory.aai.openecomp.org.v10.MulticastConfigurations" /> + <xml-element java-attribute="vces" name="vces" type="inventory.aai.openecomp.org.v10.Vces" /> + <xml-element java-attribute="vpes" name="vpes" type="inventory.aai.openecomp.org.v10.Vpes" /> + <xml-element java-attribute="vnfcs" name="vnfcs" type="inventory.aai.openecomp.org.v10.Vnfcs" /> + <xml-element java-attribute="l3Networks" name="l3-networks" type="inventory.aai.openecomp.org.v10.L3Networks" /> + <xml-element java-attribute="networkPolicies" name="network-policies" type="inventory.aai.openecomp.org.v10.NetworkPolicies" /> + <xml-element java-attribute="genericVnfs" name="generic-vnfs" type="inventory.aai.openecomp.org.v10.GenericVnfs" /> + <xml-element java-attribute="lagLinks" name="lag-links" type="inventory.aai.openecomp.org.v10.LagLinks" /> + <xml-element java-attribute="newvces" name="newvces" type="inventory.aai.openecomp.org.v10.Newvces" /> + <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.openecomp.org.v10.Pnfs" /> + <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.openecomp.org.v10.PhysicalLinks" /> + <xml-element java-attribute="ipsecConfigurations" name="ipsec-configurations" type="inventory.aai.openecomp.org.v10.IpsecConfigurations" /> + <xml-element java-attribute="routeTableReferences" name="route-table-references" type="inventory.aai.openecomp.org.v10.RouteTableReferences" /> + <xml-element java-attribute="instanceGroups" name="instance-groups" type="inventory.aai.openecomp.org.v10.InstanceGroups" /> + <xml-element java-attribute="zones" name="zones" type="inventory.aai.openecomp.org.v10.Zones" /> + </java-attributes> + </java-type> + <java-type name="LogicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of logical connections" /> + </xml-properties> + <xml-root-element name="logical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="logicalLink" name="logical-link" type="inventory.aai.openecomp.org.v10.LogicalLink" /> + </java-attributes> + </java-type> + <java-type name="LogicalLink"> + <xml-root-element name="logical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkType" name="link-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of logical link, e.g., evc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4, v6, or ds for dual stack" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingProtocol" name="routing-protocol" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="For example, static or BGP" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of operational status of the logical link." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkRole" name="link-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of the network use of the logical link." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkName2" name="link-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alias or alternate name (CLCI or D1 name)." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkId" name="link-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the logical-link, SDNC generates this." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit id" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Reason for this entity, role it is playing" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical links generally connect l-interfaces but are used to express logical connectivity between two points" /> + <xml-property name="indexedProps" value="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose" /> + <xml-property name="uniqueProps" value="link-id" /> + <xml-property name="container" value="logical-links" /> + <xml-property name="namespace" value="network" /> + <xml-property name="searchable" value="link-name" /> + </xml-properties> + </java-type> + <java-type name="SitePairSets"> + <xml-properties> + <xml-property name="description" value="Collection of sets of instances for probes related to generic-vnf" /> + </xml-properties> + <xml-root-element name="site-pair-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sitePairSet" name="site-pair-set" type="inventory.aai.openecomp.org.v10.SitePairSet" /> + </java-attributes> + </java-type> + <java-type name="SitePairSet"> + <xml-root-element name="site-pair-set" /> + <java-attributes> + <xml-element java-attribute="sitePairSetId" name="site-pair-set-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of site pair set." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingInstances" name="routing-instances" type="inventory.aai.openecomp.org.v10.RoutingInstances" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Set of instances for probes used to measure service level agreements" /> + <xml-property name="indexedProps" value="site-pair-set-id" /> + <xml-property name="uniqueProps" value="site-pair-set-id" /> + <xml-property name="container" value="site-pair-sets" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="RoutingInstances"> + <xml-properties> + <xml-property name="description" value="set of probes related to generic-vnf routing instance" /> + </xml-properties> + <xml-root-element name="routing-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routingInstance" name="routing-instance" type="inventory.aai.openecomp.org.v10.RoutingInstance" /> + </java-attributes> + </java-type> + <java-type name="RoutingInstance"> + <xml-root-element name="routing-instance" /> + <java-attributes> + <xml-element java-attribute="routingInstanceId" name="routing-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of routing instance" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rpmOwner" name="rpm-owner" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="rpm owner" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sitePairs" name="site-pairs" type="inventory.aai.openecomp.org.v10.SitePairs" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="routing-instance-id" /> + <xml-property name="uniqueProps" value="routing-instance-id" /> + <xml-property name="dependentOn" value="site-pair-set" /> + <xml-property name="container" value="routing-instances" /> + </xml-properties> + </java-type> + <java-type name="SitePairs"> + <xml-properties> + <xml-property name="description" value="probe within a set" /> + </xml-properties> + <xml-root-element name="site-pairs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sitePair" name="site-pair" type="inventory.aai.openecomp.org.v10.SitePair" /> + </java-attributes> + </java-type> + <java-type name="SitePair"> + <xml-root-element name="site-pair" /> + <java-attributes> + <xml-element java-attribute="sitePairId" name="site-pair-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique identifier of probe" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceIp" name="source-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prefix address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationIp" name="destination-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prefix address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version, v4, v6" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationHostname" name="destination-hostname" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Hostname of the destination equipment to which SLAs are measured against." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationEquipType" name="destination-equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The type of destinatination equipment. Could be Router, etc." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="classesOfService" name="classes-of-service" type="inventory.aai.openecomp.org.v10.ClassesOfService" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="site-pair-id" /> + <xml-property name="uniqueProps" value="site-pair-id" /> + <xml-property name="dependentOn" value="routing-instance" /> + <xml-property name="container" value="site-pairs" /> + </xml-properties> + </java-type> + <java-type name="ClassesOfService"> + <xml-properties> + <xml-property name="description" value="class-of-service of probe" /> + </xml-properties> + <xml-root-element name="classes-of-service" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="classOfService" name="class-of-service" type="inventory.aai.openecomp.org.v10.ClassOfService" /> + </java-attributes> + </java-type> + <java-type name="ClassOfService"> + <xml-root-element name="class-of-service" /> + <java-attributes> + <xml-element java-attribute="cos" name="cos" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique identifier of probe" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="probeId" name="probe-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of probe" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="probeType" name="probe-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type of probe" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="cos" /> + <xml-property name="dependentOn" value="site-pair" /> + <xml-property name="container" value="classes-of-service" /> + </xml-properties> + </java-type> + <java-type name="VpnBindings"> + <xml-root-element name="vpn-bindings" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpnBinding" name="vpn-binding" type="inventory.aai.openecomp.org.v10.VpnBinding" /> + </java-attributes> + </java-type> + <java-type name="VpnBinding"> + <xml-root-element name="vpn-binding" /> + <java-attributes> + <xml-element java-attribute="vpnId" name="vpn-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="VPN ID, globally unique within A&AI" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnName" name="vpn-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="VPN Name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnPlatform" name="vpn-platform" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the platform associated with the VPN example AVPN, Mobility" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnType" name="vpn-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the vpn, should be taken from enumerated/valid values" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeDistinguisher" name="route-distinguisher" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargets" name="route-targets" type="inventory.aai.openecomp.org.v10.RouteTargets" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList"> + <xml-properties> + <xml-property name="description" value="l3-networks relate to vpn-bindings" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPN binding" /> + <xml-property name="nameProps" value="vpn-name,vpn-type" /> + <xml-property name="indexedProps" value="vpn-name,vpn-id,vpn-type" /> + <xml-property name="searchable" value="vpn-id,vpn-name" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="container" value="vpn-bindings" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="VplsPes"> + <xml-properties> + <xml-property name="description" value="Collection of VPLS Provider Edge routers" /> + </xml-properties> + <xml-root-element name="vpls-pes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vplsPe" name="vpls-pe" type="inventory.aai.openecomp.org.v10.VplsPe" /> + </java-attributes> + </java-type> + <java-type name="VplsPe"> + <xml-root-element name="vpls-pe" /> + <java-attributes> + <xml-element java-attribute="equipmentName" name="equipment-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value, e.g., VPLS-PE." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Temporary location for stag to get to VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v10.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPLS Provider Edge routers." /> + <xml-property name="indexedProps" value="prov-status,equipment-name" /> + <xml-property name="container" value="vpls-pes" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="MulticastConfigurations"> + <xml-properties> + <xml-property name="description" value="multicast configuration of generic-vnf ip-address" /> + </xml-properties> + <xml-root-element name="multicast-configurations" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="multicastConfiguration" name="multicast-configuration" type="inventory.aai.openecomp.org.v10.MulticastConfiguration" /> + </java-attributes> + </java-type> + <java-type name="MulticastConfiguration"> + <xml-root-element name="multicast-configuration" /> + <java-attributes> + <xml-element java-attribute="multicastConfigurationId" name="multicast-configuration-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of multicast configuration." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="multicastProtocol" name="multicast-protocol" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="protocol of multicast configuration" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rpType" name="rp-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="rp type of multicast configuration" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="multicast-configuration-id" /> + <xml-property name="uniqueProps" value="multicast-configuration-id" /> + <xml-property name="container" value="multicast-configurations" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="Vces"> + <xml-properties> + <xml-property name="description" value="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated." /> + </xml-properties> + <xml-root-element name="vces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vce" name="vce" type="inventory.aai.openecomp.org.v10.Vce" /> + </java-attributes> + </java-type> + <java-type name="Vce"> + <xml-root-element name="vce" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network role being played by this VNF" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpeId" name="vpe-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID of VPE connected to this VCE." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6VceWanAddress" name="v6-vce-wan-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Valid v6 IP address for the WAN Link on this router. Implied length of /64." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Loopback0 address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - see child relationships" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroups" name="port-groups" type="inventory.aai.openecomp.org.v10.PortGroups" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v10.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v10.Entitlements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="vces" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + <java-type name="PortGroups"> + <xml-root-element name="port-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="portGroup" name="port-group" type="inventory.aai.openecomp.org.v10.PortGroup" /> + </java-attributes> + </java-type> + <java-type name="PortGroup"> + <xml-root-element name="port-group" /> + <java-attributes> + <xml-element java-attribute="interfaceId" name="interface-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkName" name="neutron-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network name of this Interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupId" name="port-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID for port group in vmware" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupName" name="port-group-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Likely to duplicate value of neutron network name" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="switchName" name="switch-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="DVS or standard switch name (should be non-null for port groups associated with DVS)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cvlanTags" name="cvlan-tags" type="inventory.aai.openecomp.org.v10.CvlanTags" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Used to capture the network interfaces of this VCE" /> + <xml-property name="nameProps" value="port-group-name" /> + <xml-property name="indexedProps" value="port-group-id,heat-stack-id,interface-id,interface-name,switch-name" /> + <xml-property name="dependentOn" value="vce" /> + <xml-property name="container" value="port-groups" /> + </xml-properties> + </java-type> + <java-type name="CvlanTags"> + <xml-root-element name="cvlan-tags" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cvlanTagEntry" name="cvlan-tag-entry" type="inventory.aai.openecomp.org.v10.CvlanTagEntry" /> + </java-attributes> + </java-type> + <java-type name="CvlanTagEntry"> + <xml-root-element name="cvlan-tag-entry" /> + <java-attributes> + <xml-element java-attribute="cvlanTag" name="cvlan-tag" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="See mis-na-virtualization-platform.yang" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="dependentOn" value="port-group" /> + <xml-property name="indexedProps" value="cvlan-tag" /> + <xml-property name="container" value="cvlan-tags" /> + </xml-properties> + </java-type> + <java-type name="Vpes"> + <xml-properties> + <xml-property name="description" value="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations." /> + </xml-properties> + <xml-root-element name="vpes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpe" name="vpe" type="inventory.aai.openecomp.org.v10.Vpe" /> + </java-attributes> + </java-type> + <java-type name="Vpe"> + <xml-root-element name="vpe" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use. See child relationships." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddressPrefixLength" name="ipv4-oam-gateway-address-prefix-length" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Prefix length for oam-address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddress" name="ipv4-oam-gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Gateway address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v4Loopback0IpAddress" name="v4-loopback0-ip-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Loopback0 address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Temporary location for stag to get to VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VPE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether vpe access uses SSH" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v10.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v10.Entitlements" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Relationship-list must include related to info for complex." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="vpes" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + <java-type name="Vnfcs"> + <xml-properties> + <xml-property name="description" value="virtual network components associated with a vserver from application controller." /> + </xml-properties> + <xml-root-element name="vnfcs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfc" name="vnfc" type="inventory.aai.openecomp.org.v10.Vnfc" /> + </java-attributes> + </java-type> + <java-type name="Vnfc"> + <xml-root-element name="vnfc" /> + <java-attributes> + <xml-element java-attribute="vnfcName" name="vnfc-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vnfc." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcFunctionCode" name="vnfc-function-code" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="function code" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcType" name="vnfc-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="prov status of this vnfc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by APP-C" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4OamVip" name="ipaddress-v4-oam-vip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Oam V4 vip address of this vnfc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupNotation" name="group-notation" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group notation of VNFC" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation" /> + <xml-property name="searchable" value="vnfc-name" /> + <xml-property name="container" value="vnfcs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="L3Networks"> + <xml-root-element name="l3-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="l3Network" name="l3-network" type="inventory.aai.openecomp.org.v10.L3Network" /> + </java-attributes> + </java-type> + <java-type name="L3Network"> + <xml-root-element name="l3-network" /> + <java-attributes> + <xml-element java-attribute="networkId" name="network-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Network ID, should be uuid. Unique across A&AI." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network, governed by some naming convention.." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkType" name="network-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the network - who defines these values?" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRole" name="network-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role the network plans - who defines these values?" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkTechnology" name="network-technology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network technology - who defines these values?" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBoundToVpn" name="is-bound-to-vpn" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="Set to true if bound to VPN" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRoleInstance" name="network-role-instance" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="network role instance" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailNetworkFqdn" name="contrail-network-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the network" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalNetworkName" name="physical-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the physical network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isProviderNetwork" name="is-provider-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="boolean indicatating whether or not network is a provider network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isSharedNetwork" name="is-shared-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="boolean indicatating whether or not network is a shared network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isExternalNetwork" name="is-external-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="boolean indicatating whether or not network is an external network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnets" name="subnets" type="inventory.aai.openecomp.org.v10.Subnets" /> + <xml-element java-attribute="ctagAssignments" name="ctag-assignments" type="inventory.aai.openecomp.org.v10.CtagAssignments" /> + <xml-element java-attribute="segmentationAssignments" name="segmentation-assignments" type="inventory.aai.openecomp.org.v10.SegmentationAssignments" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList"> + <xml-properties> + <xml-property name="description" value="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Generic network definition" /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="heat-stack-id,network-uuid,service-id,network-id,network-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-network-fqdn,network-role" /> + <xml-property name="searchable" value="network-id,network-name" /> + <xml-property name="uniqueProps" value="network-id" /> + <xml-property name="container" value="l3-networks" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="NetworkPolicies"> + <xml-root-element name="network-policies" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="networkPolicy" name="network-policy" type="inventory.aai.openecomp.org.v10.NetworkPolicy" /> + </java-attributes> + </java-type> + <java-type name="NetworkPolicy"> + <xml-root-element name="network-policy" /> + <java-attributes> + <xml-element java-attribute="networkPolicyId" name="network-policy-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID representing unique key to this instance" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkPolicyFqdn" name="network-policy-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the policy" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID for the openStack Heat instance" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="nameProps" value="network-policy-fqdn" /> + <xml-property name="indexedProps" value="network-policy-id,network-policy-fqdn" /> + <xml-property name="searchable" value="network-policy-id,network-policy-fqdn" /> + <xml-property name="uniqueProps" value="network-policy-id" /> + <xml-property name="container" value="network-policies" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="CtagAssignments"> + <xml-root-element name="ctag-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagAssignment" name="ctag-assignment" type="inventory.aai.openecomp.org.v10.CtagAssignment" /> + </java-attributes> + </java-type> + <java-type name="CtagAssignment"> + <xml-root-element name="ctag-assignment" /> + <java-attributes> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="id." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vlan-id-inner" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="ctag-assignments" /> + </xml-properties> + </java-type> + <java-type name="Subnets"> + <xml-root-element name="subnets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="subnet" name="subnet" type="inventory.aai.openecomp.org.v10.Subnet" /> + </java-attributes> + </java-type> + <java-type name="Subnet"> + <xml-root-element name="subnet" /> + <java-attributes> + <xml-element java-attribute="subnetId" name="subnet-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Subnet ID, should be UUID." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnetName" name="subnet-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the subnet." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of this subnet" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="gatewayAddress" name="gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="gateway ip address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkStartAddress" name="network-start-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="network start address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cidrMask" name="cidr-mask" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="cidr mask" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="dhcpEnabled" name="dhcp-enabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="dhcp enabled" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpStart" name="dhcp-start" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the start address reserved for use by dhcp" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpEnd" name="dhcp-end" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the last address reserved for use by dhcp" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="subnet-id,subnet-name" /> + <xml-property name="nameProps" value="subnet-name" /> + <xml-property name="uniqueProps" value="subnet-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="subnets" /> + </xml-properties> + </java-type> + <java-type name="GenericVnfs"> + <xml-properties> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + <xml-root-element name="generic-vnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="genericVnf" name="generic-vnf" type="inventory.aai.openecomp.org.v10.GenericVnf" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="GenericVnf"> + <xml-root-element name="generic-vnf" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + <xml-property name="suggestibleOnSearch" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, used by MSO." /> + <xml-property name="suggestibleOnSearch" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether generic-vnf access uses SSH" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementAssignmentGroupUuid" name="entitlement-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the Entitlement group used for licensing VNFs, OBSOLETE - See child relationships." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the specific entitlement resource. OBSOLETE - See child relationships." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseAssignmentGroupUuid" name="license-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the license assignment group. OBSOLETE - See child relationships." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKeyUuid" name="license-key-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the actual license resource. OBSOLETE - See child relationships." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="represents sub zone of the rr plane" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfType" name="nf-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Generic description of the type of NF" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfFunction" name="nf-function" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="English description of Network function that the specific VNF deployment is providing" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfRole" name="nf-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="role in the network that this model will be providing" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfNamingCode" name="nf-naming-code" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="string assigned to this model used for naming purposes" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + <xml-element java-attribute="vfModules" name="vf-modules" type="inventory.aai.openecomp.org.v10.VfModules" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v10.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v10.Entitlements" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,nf-type,nf-function,nf-naming-code,nf-role" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="generic-vnfs" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + <xml-property name="containsSuggestibleProps" value="true" /> + <xml-property name="suggestionAliases" value="VNFs" /> + </xml-properties> + </java-type> + <java-type name="VfModules"> + <xml-properties> + <xml-property name="description" value="Collection of vf-modules, a deployment unit of VNFCs" /> + </xml-properties> + <xml-root-element name="vf-modules" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vfModule" name="vf-module" type="inventory.aai.openecomp.org.v10.VfModule" /> + </java-attributes> + </java-type> + <java-type name="VfModule"> + <xml-root-element name="vf-module" /> + <java-attributes> + <xml-element java-attribute="vfModuleId" name="vf-module-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vf-module." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleName" name="vf-module-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vf-module" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration status of this vf-module, mastered by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBaseVfModule" name="is-base-vf-module" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="used to indicate whether or not this object is base vf module" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailServiceInstanceFqdn" name="contrail-service-instance-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the Contrail unique ID for a service-instance" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="moduleIndex" name="module-index" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="a deployment unit of VNFCs" /> + <xml-property name="indexedProps" value="vf-module-id,vf-module-name,heat-stack-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-service-instance-fqdn" /> + <xml-property name="searchable" value="vf-module-id,vf-module-name" /> + <xml-property name="dependentOn" value="generic-vnf" /> + <xml-property name="container" value="vf-modules" /> + </xml-properties> + </java-type> + <java-type name="LagLinks"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregation connections" /> + </xml-properties> + <xml-root-element name="lag-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagLink" name="lag-link" type="inventory.aai.openecomp.org.v10.LagLink" /> + </java-attributes> + </java-type> + <java-type name="LagLink"> + <xml-root-element name="lag-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Alphabetical concatenation of lag-interface names" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="LAG links can connect lag-interfaces" /> + <xml-property name="indexedProps" value="link-name" /> + <xml-property name="container" value="lag-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="Newvces"> + <xml-properties> + <xml-property name="description" value="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce." /> + </xml-properties> + <xml-root-element name="newvces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="newvce" name="newvce" type="inventory.aai.openecomp.org.v10.Newvce" /> + </java-attributes> + </java-type> + <java-type name="Newvce"> + <xml-root-element name="newvce" /> + <java-attributes> + <xml-element java-attribute="vnfId2" name="vnf-id2" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF, can't use same attribute name right now until we promote this new object" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value, e.g., VPE." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2" /> + <xml-property name="searchable" value="vnf-id2,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id2" /> + <xml-property name="container" value="newvces" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="Pnfs"> + <xml-properties> + <xml-property name="description" value="Collection of Physical Network Functions." /> + </xml-properties> + <xml-root-element name="pnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pnf" name="pnf" type="inventory.aai.openecomp.org.v10.Pnf" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="Pnf"> + <xml-root-element name="pnf" /> + <java-attributes> + <xml-element java-attribute="pnfName" name="pnf-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique name of Physical Network Function." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2" name="pnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="name of Physical Network Function." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2Source" name="pnf-name2-source" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="source of name2" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfId" name="pnf-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="id of pnf" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Oam" name="ipaddress-v4-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ipv4-oam-address with new naming convention for IP addresses" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="swVersion" name="sw-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="sw-version is the version of SW for the hosted application on the PNF." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="frameId" name="frame-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of the physical frame (relay rack) where pnf is installed." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number of the device" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback0" name="ipaddress-v4-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 0 address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback0" name="ipaddress-v6-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 0 address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Aim" name="ipaddress-v4-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 AIM address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Aim" name="ipaddress-v6-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 AIM address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Oam" name="ipaddress-v6-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 OAM address" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="invStatus" name="inv-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CANOPI's inventory status. Only set with values exactly as defined by CANOPI." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfRole" name="nf-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nf Role is the role performed by this instance in the network." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v10.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="PNF represents a physical network function. typically equipment used in the D1 world." /> + <xml-property name="indexedProps" value="pnf-name,orchestration-status,inv-status" /> + <xml-property name="searchable" value="pnf-name" /> + <xml-property name="uniqueProps" value="pnf-name" /> + <xml-property name="container" value="pnfs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="PhysicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + </xml-properties> + <xml-root-element name="physical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="physicalLink" name="physical-link" type="inventory.aai.openecomp.org.v10.PhysicalLink" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="PhysicalLink"> + <xml-root-element name="physical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit it" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dualMode" name="dual-mode" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Dual access mode (e.g., primary, secondary" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="To provide information on who manages this circuit. A&AI or 3rd party transport provider" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceProviderName" name="service-provider-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the service Provider on this link." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + <xml-property name="indexedProps" value="circuit-id,link-name" /> + <xml-property name="alternateKeys1" value="circuit-id" /> + <xml-property name="container" value="physical-links" /> + <xml-property name="namespace" value="network" /> + <xml-property name="searchable" value="link-name,circuit-id" /> + </xml-properties> + </java-type> + <java-type name="VigServers"> + <xml-root-element name="vig-servers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vigServer" name="vig-server" type="inventory.aai.openecomp.org.v10.VigServer" /> + </java-attributes> + </java-type> + <java-type name="VigServer"> + <xml-root-element name="vig-server" /> + <java-attributes> + <xml-element java-attribute="vigAddressType" name="vig-address-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="indicates whether the VIG is for AVPN or INTERNET" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="ipaddressV4Vig" name="ipaddress-v4-vig" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 IP of the vig server" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="ipaddressV6Vig" name="ipaddress-v6-vig" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 IP of the vig server" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607" /> + <xml-property name="indexedProps" value="vig-address-type" /> + <xml-property name="dependentOn" value="ipsec-configuration" /> + <xml-property name="container" value="vig-servers" /> + </xml-properties> + </java-type> + <java-type name="IpsecConfigurations"> + <xml-root-element name="ipsec-configurations" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ipsecConfiguration" name="ipsec-configuration" type="inventory.aai.openecomp.org.v10.IpsecConfiguration" /> + </java-attributes> + </java-type> + <java-type name="IpsecConfiguration"> + <xml-root-element name="ipsec-configuration" /> + <java-attributes> + <xml-element java-attribute="ipsecConfigurationId" name="ipsec-configuration-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID of this configuration" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedVigAddressType" name="requested-vig-address-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicate the type of VIG server like AVPN, INTERNET, BOTH" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedEncryptionStrength" name="requested-encryption-strength" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedDmzType" name="requested-dmz-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="can offer a shared DMZ or a DMZ specific to a customer" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sharedDmzNetworkAddress" name="shared-dmz-network-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network address of shared DMZ" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedCustomerName" name="requested-customer-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="If the DMZ is a custom DMZ, this field will indicate the customer information" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikeVersion" name="ike-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="can be 1 or 2" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1Authentication" name="ikev1-authentication" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contains values like md5, sha1, sha256, sha384" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1Encryption" name="ikev1-encryption" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1DhGroup" name="ikev1-dh-group" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1AmGroupId" name="ikev1-am-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name defined in VIG for clients using aggressive mode" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1AmPassword" name="ikev1-am-password" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="pre-shared key for the above group name " /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1SaLifetime" name="ikev1-sa-lifetime" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Lifetime for IKEv1 SA" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecAuthentication" name="ipsec-authentication" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="md5, sha1, sha256, sha384" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecEncryption" name="ipsec-encryption" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecSaLifetime" name="ipsec-sa-lifetime" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Life time for IPSec SA" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecPfs" name="ipsec-pfs" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="enable PFS or not" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="xauthUserId" name="xauth-userid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="user ID for xAuth, sm-user, nmteHostName" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="xauthUserPassword" name="xauth-user-password" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encrypted using the Juniper $9$ algorithm" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dpdInterval" name="dpd-interval" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The time between DPD probe" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dpdFrequency" name="dpd-frequency" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Maximum number of DPD before claiming the tunnel is down" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="vigServers" name="vig-servers" type="inventory.aai.openecomp.org.v10.VigServers" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C" /> + <xml-property name="indexedProps" value="ipsec-configuration-id" /> + <xml-property name="uniqueProps" value="ipsec-configuration-id" /> + <xml-property name="container" value="ipsec-configurations" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="NotificationEvent"> + <xml-root-element name="notification-event" /> + <java-attributes> + <xml-element java-attribute="cambriaPartition" name="cambria.partition" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="eventHeader" name="event-header" type="inventory.aai.openecomp.org.v10.NotificationEventHeader" /> + <xml-any-element java-attribute="entity" /> + </java-attributes> + </java-type> + <java-type name="NotificationEventHeader"> + <xml-root-element name="notification-event-header" /> + <java-attributes> + <xml-element java-attribute="id" name="id" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="timestamp" name="timestamp" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceName" name="source-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="domain" name="domain" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sequenceNumber" name="sequence-number" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="severity" name="severity" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="eventType" name="event-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="version" name="version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="action" name="action" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entityType" name="entity-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="topEntityType" name="top-entity-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entityLink" name="entity-link" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="status" name="status" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="AaiInternal"> + <xml-root-element name="aai-internal" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="reservedPropNames" name="reserved-prop-names" type="inventory.aai.openecomp.org.v10.ReservedPropNames" /> + <xml-element container-type="java.util.ArrayList" java-attribute="edgePropNames" name="edge-prop-names" type="inventory.aai.openecomp.org.v10.EdgePropNames" /> + </java-attributes> + </java-type> + <java-type name="ReservedPropNames"> + <xml-properties> + <xml-property name="description" value="Internal map to define some reserved properties of a vertex" /> + <xml-property name="uniqueProps" value="aai-unique-key" /> + <xml-property name="indexedProps" value="aai-unique-key,source-of-truth,aai-node-type,aai-uri" /> + </xml-properties> + <xml-root-element name="reserved-prop-names" /> + <java-attributes> + <xml-element java-attribute="lastModSourceOfTruth" name="last-mod-source-of-truth" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="aaiNodeType" name="aai-node-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="aaiCreatedTs" name="aai-created-ts" type="java.lang.Long"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="aaiUniqueKey" name="aai-unique-key" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="aaiLastModTs" name="aai-last-mod-ts" type="java.lang.Long"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceOfTruth" name="source-of-truth" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="aaiUri" name="aai-uri" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="EdgePropNames"> + <!-- NOTE that the names of these properties are not consistent and are in mixed case and hyphen case for now --> + <xml-properties> + <xml-property name="description" value="Internal map to define the properties of an edge and interpret the map EdgeRules" /> + <xml-property name="edgeInfo" value="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV" /> + </xml-properties> + <xml-root-element name="edge-prop-names" /> + <java-attributes> + <xml-element java-attribute="edgeLabel" name="edgeLabel" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="direction" name="direction" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="multiplicityRule" name="multiplicityRule" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isParent" name="isParent" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="usesResource" name="usesResource" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="hasDelTarget" name="hasDelTarget" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="SVC-INFRA" name="SVC-INFRA" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="SVC-INFRA-REV" name="SVC-INFRA-REV" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="Models"> + <xml-properties> + <xml-property name="description" value="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models" /> + </xml-properties> + <xml-root-element name="models" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="model" name="model" type="inventory.aai.openecomp.org.v10.Model" /> + </java-attributes> + </java-type> + <java-type name="Model"> + <xml-root-element name="model" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version" /> + <xml-property name="nameProps" value="model-type" /> + <xml-property name="indexedProps" value="model-invariant-id,model-type" /> + <xml-property name="uniqueProps" value="model-invariant-id" /> + <xml-property name="container" value="models" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v10.ModelVers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="ModelVers"> + <xml-root-element name="model-vers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelVer" name="model-ver" type="inventory.aai.openecomp.org.v10.ModelVer" /> + </java-attributes> + </java-type> + <java-type name="ModelVer"> + <xml-root-element name="model-ver" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models" /> + <xml-property name="nameProps" value="model-name" /> + <xml-property name="indexedProps" value="model-version-id,model-name,model-version" /> + <xml-property name="uniqueProps" value="model-version-id" /> + <xml-property name="container" value="model-vers" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelVersionId" name="model-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v10.ModelElements" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="ModelElements"> + <xml-root-element name="model-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelElement" name="model-element" type="inventory.aai.openecomp.org.v10.ModelElement" /> + </java-attributes> + </java-type> + <java-type name="ModelElement"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model." /> + <xml-property name="uniqueProps" value="model-element-uuid" /> + <xml-property name="indexedProps" value="model-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-elements" /> + </xml-properties> + <xml-root-element name="model-element" /> + <java-attributes> + <xml-element java-attribute="modelElementUuid" name="model-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="newDataDelFlag" name="new-data-del-flag" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates whether this element was created as part of instantiation from this model" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cardinality" name="cardinality" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="How many of this type of element are required/allowed" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="linkagePoints" name="linkage-points" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v10.ModelElements"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelConstraints" name="model-constraints" type="inventory.aai.openecomp.org.v10.ModelConstraints"> + <xml-properties> + <xml-property name="description" value="Describes new constraints on this model element that are not part of that model's definition" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="ModelConstraints"> + <xml-root-element name="model-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelConstraint" name="model-constraint" type="inventory.aai.openecomp.org.v10.ModelConstraint" /> + </java-attributes> + </java-type> + <java-type name="ModelConstraint"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="model-constraint-uuid" /> + <xml-property name="indexedProps" value="model-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-constraints" /> + </xml-properties> + <xml-root-element name="model-constraint" /> + <java-attributes> + <xml-element java-attribute="modelConstraintUuid" name="model-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constrainedElementSetUuidToReplace" name="constrained-element-set-uuid-to-replace" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constrainedElementSets" name="constrained-element-sets" type="inventory.aai.openecomp.org.v10.ConstrainedElementSets" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="ConstrainedElementSets"> + <xml-root-element name="constrained-element-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="constrainedElementSet" name="constrained-element-set" type="inventory.aai.openecomp.org.v10.ConstrainedElementSet" /> + </java-attributes> + </java-type> + <java-type name="ConstrainedElementSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="constrained-element-set-uuid" /> + <xml-property name="indexedProps" value="constrained-element-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="constrained-element-sets" /> + </xml-properties> + <xml-root-element name="constrained-element-set" /> + <java-attributes> + <xml-element java-attribute="constrainedElementSetUuid" name="constrained-element-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="checkType" name="check-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elementChoiceSets" name="element-choice-sets" type="inventory.aai.openecomp.org.v10.ElementChoiceSets" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="ElementChoiceSets"> + <xml-root-element name="element-choice-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="elementChoiceSet" name="element-choice-set" type="inventory.aai.openecomp.org.v10.ElementChoiceSet" /> + </java-attributes> + </java-type> + <java-type name="ElementChoiceSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="element-choice-set-uuid" /> + <xml-property name="indexedProps" value="element-choice-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="element-choice-sets" /> + </xml-properties> + <xml-root-element name="element-choice-set" /> + <java-attributes> + <xml-element java-attribute="elementChoiceSetUuid" name="element-choice-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elementChoiceSetName" name="element-choice-set-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cardinality" name="cardinality" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v10.ModelElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="NamedQueries"> + <xml-root-element name="named-queries" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v10.NamedQuery" /> + </java-attributes> + </java-type> + <java-type name="NamedQuery"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="nameProps" value="named-query-name" /> + <xml-property name="uniqueProps" value="named-query-uuid" /> + <xml-property name="indexedProps" value="named-query-uuid,named-query-name" /> + <xml-property name="container" value="named-queries" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="named-query" /> + <java-attributes> + <xml-element java-attribute="namedQueryUuid" name="named-query-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="namedQueryName" name="named-query-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="namedQueryVersion" name="named-query-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="requiredInputParams" name="required-input-param" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + <xml-element-wrapper name="required-input-params" /> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v10.NamedQueryElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="NamedQueryElements"> + <xml-root-element name="named-query-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQueryElement" name="named-query-element" type="inventory.aai.openecomp.org.v10.NamedQueryElement" /> + </java-attributes> + </java-type> + <java-type name="NamedQueryElement"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="named-query-element-uuid" /> + <xml-property name="indexedProps" value="named-query-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="named-query-elements" /> + </xml-properties> + <xml-root-element name="named-query-element" /> + <java-attributes> + <xml-element java-attribute="namedQueryElementUuid" name="named-query-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyLimitDesc" name="property-limit-desc" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="doNotOutput" name="do-not-output" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v10.NamedQueryElements" /> + <xml-element java-attribute="relatedLookups" name="related-lookups" type="inventory.aai.openecomp.org.v10.RelatedLookups" /> + <xml-element java-attribute="propertyConstraints" name="property-constraints" type="inventory.aai.openecomp.org.v10.PropertyConstraints" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="RelatedLookups"> + <xml-root-element name="related-lookups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedLookup" name="related-lookup" type="inventory.aai.openecomp.org.v10.RelatedLookup" /> + </java-attributes> + </java-type> + <java-type name="RelatedLookup"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="related-lookup-uuid" /> + <xml-property name="indexedProps" value="related-lookup-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="related-lookups" /> + </xml-properties> + <xml-root-element name="related-lookup" /> + <java-attributes> + <xml-element java-attribute="relatedLookupUuid" name="related-lookup-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceNodeType" name="source-node-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceNodeProperty" name="source-node-property" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="targetNodeType" name="target-node-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="targetNodeProperty" name="target-node-property" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="PropertyConstraints"> + <xml-root-element name="property-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyConstraint" name="property-constraint" type="inventory.aai.openecomp.org.v10.PropertyConstraint" /> + </java-attributes> + </java-type> + <java-type name="PropertyConstraint"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="property-constraint-uuid" /> + <xml-property name="indexedProps" value="property-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="property-constraints" /> + </xml-properties> + <xml-root-element name="property-constraint" /> + <java-attributes> + <xml-element java-attribute="propertyConstraintUuid" name="property-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyName" name="property-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="ModelAndNamedQuerySearch"> + <xml-properties> + <xml-property name="description" value="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="model-and-named-query-search" /> + <java-attributes> + <xml-element java-attribute="queryParameters" name="query-parameters" type="inventory.aai.openecomp.org.v10.QueryParameters" /> + <xml-element java-attribute="instanceFilters" name="instance-filters" type="inventory.aai.openecomp.org.v10.InstanceFilters" /> + <xml-element java-attribute="secondaryFilts" name="secondary-filts" type="inventory.aai.openecomp.org.v10.SecondaryFilts" /> + <xml-element java-attribute="topNodeType" name="top-node-type" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="secondaryFilterCutPoint" name="secondary-filter-cut-point" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="QueryParameters"> + <xml-properties> + <xml-property name="description" value="QueryParameters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="query-parameters" /> + <java-attributes> + <xml-element java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v10.NamedQuery" /> + <xml-element java-attribute="model" name="model" type="inventory.aai.openecomp.org.v10.OverloadedModel" /> + </java-attributes> + </java-type> + <java-type name="OverloadedModel"> + <xml-root-element name="overloaded-model" /> + <xml-properties> + <xml-property name="description" value="Allows for legacy POST of old-style and new-style models" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelNameVersionId" name="model-name-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelId" name="model-id" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Invariant unique ID which does not change from version to version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v10.ModelVers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + <java-type name="InstanceFilters"> + <xml-properties> + <xml-property name="description" value="InstanceFilters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="instance-filters" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceFilter" name="instance-filter" type="inventory.aai.openecomp.org.v10.InstanceFilter" /> + </java-attributes> + </java-type> + <java-type name="InstanceFilter"> + <xml-properties> + <xml-property name="description" value="InstanceFilter for performing a named-query or model query" /> + <xml-property name="container" value="instance-filters" /> + </xml-properties> + <xml-root-element name="instance-filter" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + <java-type name="SecondaryFilts"> + <xml-properties> + <xml-property name="description" value="SecondaryFilts for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="secondary-filts" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilt" name="secondary-filt" type="inventory.aai.openecomp.org.v10.SecondaryFilt" /> + </java-attributes> + </java-type> + <java-type name="SecondaryFilt"> + <xml-properties> + <xml-property name="description" value="SecondaryFilt for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="secondary-filt" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + <java-type name="Properties"> + <xml-properties> + <xml-property name="description" value="Property holder for query properties or instance properties" /> + </xml-properties> + <xml-root-element name="properties" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="ResponseList"> + <xml-properties> + <xml-property name="description" value="Response container for the results of a named-query or model query" /> + </xml-properties> + <xml-root-element name="response-list" /> + <java-attributes> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v10.InventoryResponseItems" /> + </java-attributes> + </java-type> + <java-type name="InventoryResponseItems"> + <xml-properties> + <xml-property name="description" value="Container for inventory items in response list" /> + <xml-property name="container" value="response-list" /> + </xml-properties> + <xml-root-element name="inventory-response-items" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryResponseItem" name="inventory-response-item" type="inventory.aai.openecomp.org.v10.InventoryResponseItem" /> + </java-attributes> + </java-type> + <java-type name="InventoryResponseItem"> + <xml-properties> + <xml-property name="description" value="Inventory item for response list" /> + <xml-property name="container" value="inventory-response-items" /> + </xml-properties> + <xml-root-element name="inventory-response-item" /> + <java-attributes> + <xml-element java-attribute="modelName" name="model-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-any-element java-attribute="item" /> + <xml-element java-attribute="extraProperties" name="extra-properties" type="inventory.aai.openecomp.org.v10.ExtraProperties" /> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v10.InventoryResponseItems" /> + </java-attributes> + </java-type> + <java-type name="ExtraProperties"> + <xml-properties> + <xml-property name="description" value="Extra properties for inventory item for response list" /> + </xml-properties> + <xml-root-element name="extra-properties" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="extraProperty" name="extra-property" type="inventory.aai.openecomp.org.v10.ExtraProperty" /> + </java-attributes> + </java-type> + <java-type name="ExtraProperty"> + <xml-root-element name="extra-property" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String"> + <xml-properties> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-any-element java-attribute="propertyValue" lax="true" name="property-value" /> + </java-attributes> + </java-type> + <java-type name="RouteTableReferences"> + <xml-properties> + <xml-property name="description" value="Collection of openstack route table references" /> + </xml-properties> + <xml-root-element name="route-table-references" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routeTableReference" name="route-table-reference" type="inventory.aai.openecomp.org.v10.RouteTableReference" /> + </java-attributes> + </java-type> + <java-type name="RouteTableReference"> + <xml-root-element name="route-table-reference" /> + <java-attributes> + <xml-element java-attribute="routeTableReferenceId" name="route-table-reference-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTableReferenceFqdn" name="route-table-reference-fqdn" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="FQDN entry in the route table." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack route table reference." /> + <xml-property name="nameProps" value="route-table-reference-fqdn" /> + <xml-property name="uniqueProps" value="route-table-reference-id" /> + <xml-property name="indexedProps" value="route-table-reference-id,route-table-reference-fqdn" /> + <xml-property name="container" value="route-table-references" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="InstanceGroups"> + <xml-properties> + <xml-property name="description" value="Collection of openstack route table references" /> + </xml-properties> + <xml-root-element name="instance-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceGroup" name="instance-group" type="inventory.aai.openecomp.org.v10.InstanceGroup" /> + </java-attributes> + </java-type> + <java-type name="InstanceGroup"> + <xml-root-element name="instance-group" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Instance Group ID, UUID assigned to this instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="description" name="description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Descriptive text to help identify the usage of this instance-group" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="type" name="type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Only valid value today is lower case ha for high availability" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subType" name="sub-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General mechanism for grouping instances" /> + <xml-property name="nameProps" value="description" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id,description,type,sub-type" /> + <xml-property name="container" value="instance-groups" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="SegmentationAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack segmentation assignments" /> + </xml-properties> + <xml-root-element name="segmentation-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="segmentationAssignment" name="segmentation-assignment" type="inventory.aai.openecomp.org.v10.SegmentationAssignment" /> + </java-attributes> + </java-type> + <java-type name="SegmentationAssignment"> + <xml-root-element name="segmentation-assignment" /> + <java-attributes> + <xml-element java-attribute="segmentationId" name="segmentation-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack segmentation assignment." /> + <xml-property name="indexedProps" value="segmentation-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="segmentation-assignments" /> + </xml-properties> + </java-type> + <java-type name="AllottedResources"> + <xml-properties> + <xml-property name="description" value="This object is used to store slices of services being offered" /> + </xml-properties> + <xml-root-element name="allotted-resources" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="allottedResource" name="allotted-resource" type="inventory.aai.openecomp.org.v10.AllottedResource" /> + </java-attributes> + </java-type> + <java-type name="AllottedResource"> + <xml-root-element name="allotted-resource" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Allotted Resource id UUID assigned to this instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The descriptive information assigned to this allotted resource instance" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Link back to more information in the controller" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="type" name="type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Generic description of the type of allotted resource." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="role" name="role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="role in the network that this resource will be providing." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tunnelXconnects" name="tunnel-xconnects" type="inventory.aai.openecomp.org.v10.TunnelXconnects" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Represents a slice or partial piece of a resource that gets separately allotted" /> + <xml-property name="nameProps" value="description" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id,model-invariant-id,model-version-id,type,role" /> + <xml-property name="dependentOn" value="service-instance" /> + <xml-property name="container" value="allotted-resources" /> + <!-- <xml-property name="namespace" value="network" /> --> + </xml-properties> + </java-type> + <java-type name="TunnelXconnects"> + <xml-properties> + <xml-property name="description" value="This object is used to store the specific tunnel cross connect aspects of an allotted resource" /> + </xml-properties> + <xml-root-element name="tunnel-xconnects" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tunnelXconnect" name="tunnel-xconnect" type="inventory.aai.openecomp.org.v10.TunnelXconnect" /> + </java-attributes> + </java-type> + <java-type name="TunnelXconnect"> + <xml-root-element name="tunnel-xconnect" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Allotted Resource id UUID assigned to this instance." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN uplink bandwidth for WAN1" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN downlink bandwidth for WAN1" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN uplink bandwidth for WAN2" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN downlink bandwidth for WAN2" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id" /> + <xml-property name="dependentOn" value="allotted-resource" /> + <xml-property name="container" value="tunnel-xconnects" /> + <!-- <xml-property name="namespace" value="network" /> --> + </xml-properties> + </java-type> + <java-type name="Entitlements"> + <xml-properties> + <xml-property name="description" value="Entitlements, keyed by group-uuid and resource-uuid, related to license management" /> + </xml-properties> + <xml-root-element name="entitlements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="entitlement" name="entitlement" type="inventory.aai.openecomp.org.v10.Entitlement" /> + </java-attributes> + </java-type> + <java-type name="Entitlement"> + <xml-root-element name="entitlement" /> + <java-attributes> + <xml-element java-attribute="groupUuid" name="group-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID for the entitlement group the resource comes from, should be uuid." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceUuid" name="resource-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of an entitlement resource. " /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Metadata for entitlement group." /> + <xml-property name="indexedProps" value="group-uuid,resource-uuid" /> + <xml-property name="dependentOn" value="generic-vnf,vce,vpe" /> + <xml-property name="container" value="entitlements" /> + </xml-properties> + </java-type> + <java-type name="Licenses"> + <xml-properties> + <xml-property name="description" value="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management" /> + </xml-properties> + <xml-root-element name="licenses" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="license" name="license" type="inventory.aai.openecomp.org.v10.License" /> + </java-attributes> + </java-type> + <java-type name="License"> + <xml-root-element name="license" /> + <java-attributes> + <xml-element java-attribute="groupUuid" name="group-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID for the license group the resource belongs to, should be uuid." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceUuid" name="resource-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of a license resource. " /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Metadata for license group." /> + <xml-property name="indexedProps" value="group-uuid,resource-uuid" /> + <xml-property name="dependentOn" value="generic-vnf,vce,vpe" /> + <xml-property name="container" value="licenses" /> + </xml-properties> + </java-type> + <java-type name="Vnf"> + <xml-root-element name="vnf" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Abstract vnf class" /> + <xml-property name="indexedProps" value="vnf-id" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="inheritors" value="vce,vpe,generic-vnf" /> + <xml-property name="abstract" value="true" /> + </xml-properties> + </java-type> + <java-type name="Zones"> + <xml-properties> + <xml-property name="description" value="Collection of zones" /> + </xml-properties> + <xml-root-element name="zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="zone" name="zone" type="inventory.aai.openecomp.org.v10.Zone" /> + </java-attributes> + </java-type> + <java-type name="Zone"> + <xml-root-element name="zone" /> + <java-attributes> + <xml-element java-attribute="zoneId" name="zone-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Code assigned by AIC to the zone" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneName" name="zone-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="English name associated with the zone" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="designType" name="design-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Design of zone [Medium/Large…]" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneContext" name="zone-context" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Context of zone [production/test]" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="status" name="status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Status of a zone." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="A zone is a grouping of assets in a location homing to the same connections into the CBB" /> + <xml-property name="nameProps" value="zone-name" /> + <xml-property name="indexedProps" value="zone-id,design-type,zone-context" /> + <xml-property name="uniqueProps" value="zone-id" /> + <xml-property name="container" value="zones" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="RouteTargets"> + <xml-properties> + <xml-property name="description" value="Collection of route target information" /> + </xml-properties> + <xml-root-element name="route-targets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routeTarget" name="route-target" type="inventory.aai.openecomp.org.v10.RouteTarget" /> + </java-attributes> + </java-type> + <java-type name="RouteTarget"> + <xml-root-element name="route-target" /> + <java-attributes> + <xml-element java-attribute="globalRouteTarget" name="global-route-target" required="true" xml-key="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Number used to identify an RT, globally unique in the network" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargetRole" name="route-target-role" required="true" xml-key="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this route target" /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + <xml-property name="sourceOfTruthType" value="aai" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Route target information" /> + <xml-property name="container" value="route-targets" /> + <xml-property name="dependentOn" value="vpn-binding" /> + </xml-properties> + </java-type> + </java-types> +</xml-bindings> diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v8.xml b/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v8.xml new file mode 100644 index 00000000..3ed2ea53 --- /dev/null +++ b/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v8.xml @@ -0,0 +1,3076 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.openecomp.org.v8" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.openecomp.aai.inventory/v8" /> + </xml-schema> + <java-types> + <java-type name="Inventory"> + <xml-root-element name="inventory" /> + <java-attributes> + <xml-element java-attribute="search" name="search" type="inventory.aai.openecomp.org.v8.Search" /> + <xml-element java-attribute="actions" name="actions" type="inventory.aai.openecomp.org.v8.Actions" /> + <xml-element java-attribute="cloudInfrastructure" name="cloud-infrastructure" type="inventory.aai.openecomp.org.v8.CloudInfrastructure" /> + <xml-element java-attribute="business" name="business" type="inventory.aai.openecomp.org.v8.Business" /> + <xml-element java-attribute="serviceDesignAndCreation" name="service-design-and-creation" type="inventory.aai.openecomp.org.v8.ServiceDesignAndCreation" /> + <xml-element java-attribute="network" name="network" type="inventory.aai.openecomp.org.v8.Network" /> + <xml-element java-attribute="aaiInternal" name="aai-internal" type="inventory.aai.openecomp.org.v8.AaiInternal" /> + </java-attributes> + </java-type> + + <java-type name="Search"> + <xml-root-element name="search" /> + <java-attributes> + <xml-element java-attribute="searchResults" name="search-results" type="inventory.aai.openecomp.org.v8.SearchResults" /> + </java-attributes> + </java-type> + + + <java-type name="TaggedInventoryItemList"> + <xml-root-element name="tagged-inventory-item-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItem" name="inventory-item" type="inventory.aai.openecomp.org.v8.InventoryItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItem"> + <xml-root-element name="inventory-item" /> + <java-attributes> + <xml-element java-attribute="inventoryItemType" name="inventory-item-type" type="java.lang.String" /> + <xml-element java-attribute="inventoryItemLink" name="inventory-item-link" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItemData" name="inventory-item-data" type="inventory.aai.openecomp.org.v8.InventoryItemData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v8.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItemData"> + <xml-root-element name="inventory-item-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + + <java-type name="StartNodeFilter"> + <xml-root-element name="start-node-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="IncludeNodeFilter"> + <xml-root-element name="include-node-filter" /> + <java-attributes> + <xml-element java-attribute="includeNodeType" name="include-node-type" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilter"> + <xml-root-element name="secondary-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="filterType" name="filter-type" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SearchResults"> + <xml-root-element name="search-results" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="resultData" name="result-data" type="inventory.aai.openecomp.org.v8.ResultData" /> + </java-attributes> + </java-type> + + <java-type name="ResultData"> + <xml-root-element name="result-data" /> + <java-attributes> + <xml-element java-attribute="resourceType" name="resource-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The specific type of node in the AAI graph" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceLink" name="resource-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The URL to the specific resource" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="Actions"> + <xml-properties> + <xml-property name="description" value="APIs that are more action related than REST (e.g., notify, update)." /> + </xml-properties> + <xml-root-element name="actions" /> + <java-attributes> + <xml-element java-attribute="update" name="update" type="inventory.aai.openecomp.org.v8.Update" /> + <xml-element java-attribute="notify" name="notify" type="inventory.aai.openecomp.org.v8.Notify" /> + </java-attributes> + </java-type> + + <java-type name="Update"> + <xml-properties> + <xml-property name="description" value="Serves a PATCH like function. Does not enforce concurrency control." /> + </xml-properties> + <xml-root-element name="update" /> + <java-attributes> + <xml-element java-attribute="updateNodeType" name="update-node-type" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="updateNodeKey" name="update-node-key" type="inventory.aai.openecomp.org.v8.UpdateNodeKey" /> + <xml-element java-attribute="updateNodeUri" name="update-node-uri" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="action" name="action" type="inventory.aai.openecomp.org.v8.Action" /> + </java-attributes> + </java-type> + + <java-type name="Action"> + <xml-root-element name="action" /> + <java-attributes> + <xml-element java-attribute="actionType" name="action-type" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="actionData" name="action-data" type="inventory.aai.openecomp.org.v8.ActionData" /> + </java-attributes> + </java-type> + + <java-type name="ActionData"> + <xml-root-element name="action-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="UpdateNodeKey"> + <xml-root-element name="update-node-key" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Notify"> + <xml-root-element name="notify" /> + <java-attributes> + <xml-element java-attribute="eventId" name="event-id" required="true" type="java.lang.String" /> + <xml-element java-attribute="nodeType" name="node-type" type="java.lang.String" /> + <xml-element java-attribute="eventTrigger" name="event-trigger" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="keyData" name="key-data" type="inventory.aai.openecomp.org.v8.KeyData" /> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="KeyData"> + <xml-root-element name="key-data" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="CloudInfrastructure"> + <xml-properties> + <xml-property name="description" value="Namespace for cloud infrastructure." /> + </xml-properties> + <xml-root-element name="cloud-infrastructure" /> + <java-attributes> + <xml-element java-attribute="cloudRegions" name="cloud-regions" type="inventory.aai.openecomp.org.v8.CloudRegions" /> + <xml-element java-attribute="pservers" name="pservers" type="inventory.aai.openecomp.org.v8.Pservers" /> + </java-attributes> + </java-type> + + <java-type name="CloudRegions"> + <xml-root-element name="cloud-regions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cloudRegion" name="cloud-region" type="inventory.aai.openecomp.org.v8.CloudRegion" /> + </java-attributes> + </java-type> + + <java-type name="CloudRegion"> + <xml-root-element name="cloud-region" /> + <java-attributes> + <xml-element java-attribute="cloudOwner" name="cloud-owner" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifies the vendor and cloud name. First part of composite key should be formatted as vendor-cloudname" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionId" name="cloud-region-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifier used by the vendor for the region. Second part of composite key" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudType" name="cloud-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the cloud (e.g., openstack)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ownerDefinedType" name="owner-defined-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Cloud-owner defined type indicator" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionVersion" name="cloud-region-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Software version employed at the site" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudZone" name="cloud-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone where the cloud is homed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="complex name for cloud-region instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroups" name="volume-groups" type="inventory.aai.openecomp.org.v8.VolumeGroups" /> + <xml-element java-attribute="tenants" name="tenants" type="inventory.aai.openecomp.org.v8.Tenants" /> + <xml-element java-attribute="flavors" name="flavors" type="inventory.aai.openecomp.org.v8.Flavors" /> + <xml-element java-attribute="groupAssignments" name="group-assignments" type="inventory.aai.openecomp.org.v8.GroupAssignments" /> + <xml-element java-attribute="snapshots" name="snapshots" type="inventory.aai.openecomp.org.v8.Snapshots" /> + <xml-element java-attribute="images" name="images" type="inventory.aai.openecomp.org.v8.Images" /> + <xml-element java-attribute="availabilityZones" name="availability-zones" type="inventory.aai.openecomp.org.v8.AvailabilityZones" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="cloud-region designates an installation of a cloud cluster or region or instantiation. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname." /> + <xml-property name="indexedProps" value="cloud-owner,cloud-region-id,cloud-type,owner-defined-type" /> + <xml-property name="nameProps" value="owner-defined-type" /> + <xml-property name="container" value="cloud-regions" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="VolumeGroups"> + <xml-properties> + <xml-property name="description" value="Collection of persistent block-level storage." /> + </xml-properties> + <xml-root-element name="volume-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volumeGroup" name="volume-group" type="inventory.aai.openecomp.org.v8.VolumeGroup" /> + </java-attributes> + </java-type> + + <java-type name="VolumeGroup"> + <xml-root-element name="volume-group" /> + <java-attributes> + <xml-element java-attribute="volumeGroupId" name="volume-group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of volume-group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroupName" name="volume-group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the volume group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the SDC resource. This field has been overloaded and clients should expect changes to occur in the future to this field as SDC matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Persistent block-level storage." /> + <xml-property name="indexedProps" value="volume-group-name,vnf-type,heat-stack-id,volume-group-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="volume-groups" /> + </xml-properties> + </java-type> + + <java-type name="RelationshipList"> + <xml-root-element name="relationship-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relationship" name="relationship" type="inventory.aai.openecomp.org.v8.Relationship" /> + </java-attributes> + </java-type> + + <java-type name="Relationship"> + <xml-root-element name="relationship" /> + <java-attributes> + <xml-element java-attribute="relatedTo" name="related-to" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by AAI to indicate type of node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relatedLink" name="related-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to the object in AAI." /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="relationshipData" name="relationship-data" type="inventory.aai.openecomp.org.v8.RelationshipData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedToProperty" name="related-to-property" type="inventory.aai.openecomp.org.v8.RelatedToProperty" /> + </java-attributes> + </java-type> + + <java-type name="RelatedToProperty"> + <xml-root-element name="related-to-property" /> + <java-attributes> + <xml-element java-attribute="propertyKey" name="property-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Key part of a key/value pair" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value part of a key/value pair" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by AAI to indicate an attribute." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="Tenants"> + <xml-properties> + <xml-property name="description" value="Collection of openstack tenants." /> + </xml-properties> + <xml-root-element name="tenants" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tenant" name="tenant" type="inventory.aai.openecomp.org.v8.Tenant" /> + </java-attributes> + </java-type> + + <java-type name="Tenant"> + <xml-root-element name="tenant" /> + <java-attributes> + <xml-element java-attribute="tenantId" name="tenant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id relative to the cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tenantName" name="tenant-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Readable name of tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vservers" name="vservers" type="inventory.aai.openecomp.org.v8.Vservers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack tenant" /> + <xml-property name="nameProps" value="tenant-name" /> + <xml-property name="indexedProps" value="tenant-name,tenant-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="tenants" /> + </xml-properties> + </java-type> + + <java-type name="Vservers"> + <xml-properties> + <xml-property name="description" value="Collection of virtual Servers, aka virtual machines or VMs." /> + </xml-properties> + <xml-root-element name="vservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vserver" name="vserver" type="inventory.aai.openecomp.org.v8.Vserver" /> + </java-attributes> + </java-type> + + <java-type name="Vserver"> + <xml-root-element name="vserver" /> + <java-attributes> + <xml-element java-attribute="vserverId" name="vserver-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for this vserver relative to its tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName" name="vserver-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName2" name="vserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternative name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverSelflink" name="vserver-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumes" name="volumes" type="inventory.aai.openecomp.org.v8.Volumes" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Servers, aka virtual machine or VM." /> + <xml-property name="nameProps" value="vserver-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2" /> + <xml-property name="searchable" value="vserver-name,vserver-id,vserver-name2" /> + <xml-property name="dependentOn" value="tenant" /> + <xml-property name="container" value="vservers" /> + </xml-properties> + </java-type> + + <java-type name="LInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of logical interfaces." /> + </xml-properties> + <xml-root-element name="l-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lInterface" name="l-interface" type="inventory.aai.openecomp.org.v8.LInterface" /> + </java-attributes> + </java-type> + + <java-type name="LInterface"> + <xml-root-element name="l-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name given to the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="E.g., CUSTOMER, UPLINK, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6WanLinkIp" name="v6-wan-link-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="macaddr" name="macaddr" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="MAC address for the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether AAI should be managing this interface of not. Could have value like CUSTOMER" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlans" name="vlans" type="inventory.aai.openecomp.org.v8.Vlans" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical interfaces, e.g., a vnic." /> + <xml-property name="indexedProps" value="macaddr,interface-id,interface-name,network-name" /> + <xml-property name="dependentOn" value="generic-vnf,p-interface,vserver,lag-interface" /> + <xml-property name="container" value="l-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv4AddressList"> + <xml-root-element name="l3-interface-ipv4-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv4Address" name="l3-interface-ipv4-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv4PrefixLength" name="l3-interface-ipv4-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 32 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv4 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Vlans"> + <xml-root-element name="vlans" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vlan" name="vlan" type="inventory.aai.openecomp.org.v8.Vlan" /> + </java-attributes> + </java-type> + + <java-type name="Vlan"> + <xml-root-element name="vlan" /> + <java-attributes> + <xml-element java-attribute="vlanInterface" name="vlan-interface" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String that identifies the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanDescription" name="vlan-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to describe (the service associated with) the vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="backdoorConnection" name="backdoor-connection" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether customer is going to use this VLAN for backdoor connection to another customer premise device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnId" name="vpn-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This indicates the customers VPN ID associated with this vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Definition of vlan" /> + <xml-property name="indexedProps" value="vlan-interface,vlan-id-inner,vpn-id" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="vlans" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv6AddressList"> + <xml-root-element name="l3-interface-ipv6-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv6Address" name="l3-interface-ipv6-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv6PrefixLength" name="l3-interface-ipv6-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 128 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv6 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Volumes"> + <xml-properties> + <xml-property name="description" value="Collection of ephemeral Block storage volumes." /> + </xml-properties> + <xml-root-element name="volumes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volume" name="volume" type="inventory.aai.openecomp.org.v8.Volume" /> + </java-attributes> + </java-type> + + <java-type name="Volume"> + <xml-root-element name="volume" /> + <java-attributes> + <xml-element java-attribute="volumeId" name="volume-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of block storage volume relative to the vserver." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeSelflink" name="volume-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Ephemeral Block storage volume." /> + <xml-property name="indexedProps" value="volume-id" /> + <xml-property name="dependentOn" value="vserver" /> + <xml-property name="container" value="volumes" /> + </xml-properties> + </java-type> + + <java-type name="Flavors"> + <xml-properties> + <xml-property name="description" value="Collection of openstack flavors." /> + </xml-properties> + <xml-root-element name="flavors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="flavor" name="flavor" type="inventory.aai.openecomp.org.v8.Flavor" /> + </java-attributes> + </java-type> + + <java-type name="Flavor"> + <xml-root-element name="flavor" /> + <java-attributes> + <xml-element java-attribute="flavorId" name="flavor-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Flavor id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorName" name="flavor-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Flavor name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorVcpus" name="flavor-vcpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of CPUs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorRam" name="flavor-ram" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of memory" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisk" name="flavor-disk" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorEphemeral" name="flavor-ephemeral" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of ephemeral disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSwap" name="flavor-swap" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="amount of swap space allocation" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorIsPublic" name="flavor-is-public" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="whether flavor is available to all users or private to the tenant it was created in." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSelflink" name="flavor-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisabled" name="flavor-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Boolean as to whether this flavor is no longer enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack flavor." /> + <xml-property name="nameProps" value="flavor-name" /> + <xml-property name="indexedProps" value="flavor-name,flavor-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="flavors" /> + </xml-properties> + </java-type> + + <java-type name="Snapshots"> + <xml-properties> + <xml-property name="description" value="Collection of openstack snapshots" /> + </xml-properties> + <xml-root-element name="snapshots" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="snapshot" name="snapshot" type="inventory.aai.openecomp.org.v8.Snapshot" /> + </java-attributes> + </java-type> + + <java-type name="Snapshot"> + <xml-root-element name="snapshot" /> + <java-attributes> + <xml-element java-attribute="snapshotId" name="snapshot-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Snapshot id, this is the key UUID assoc associated in glance with the snapshots." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotName" name="snapshot-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Snapshot name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotArchitecture" name="snapshot-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsDistro" name="snapshot-os-distro" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsVersion" name="snapshot-os-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotSelflink" name="snapshot-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="prevSnapshotId" name="prev-snapshot-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field contains the UUID of the previous snapshot (if any)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack snapshot" /> + <xml-property name="nameProps" value="snapshot-name" /> + <xml-property name="uniqueProps" value="snapshot-id" /> + <xml-property name="indexedProps" value="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="snapshots" /> + </xml-properties> + </java-type> + + <java-type name="GroupAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack group assignments" /> + </xml-properties> + <xml-root-element name="group-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="groupAssignment" name="group-assignment" type="inventory.aai.openecomp.org.v8.GroupAssignment" /> + </java-attributes> + </java-type> + + <java-type name="GroupAssignment"> + <xml-root-element name="group-assignment" /> + <java-attributes> + <xml-element java-attribute="groupId" name="group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Group id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupType" name="group-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group type - the type of group this instance refers to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupName" name="group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name - name assigned to the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupDescription" name="group-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group description - description of the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack group-assignment used to store exclusivity groups (EG)." /> + <xml-property name="nameProps" value="group-name" /> + <xml-property name="indexedProps" value="group-id,group-type,group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="group-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Images"> + <xml-properties> + <xml-property name="description" value="Collectio of Openstack images." /> + </xml-properties> + <xml-root-element name="images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="image" name="image" type="inventory.aai.openecomp.org.v8.Image" /> + </java-attributes> + </java-type> + + <java-type name="Image"> + <xml-root-element name="image" /> + <java-attributes> + <xml-element java-attribute="imageId" name="image-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Image id, expected to be unique across cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageName" name="image-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Image name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageArchitecture" name="image-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsDistro" name="image-os-distro" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsVersion" name="image-os-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageSelflink" name="image-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v8.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack image." /> + <xml-property name="nameProps" value="image-name" /> + <xml-property name="indexedProps" value="application,image-name,application-vendor,image-id,application-version" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="images" /> + </xml-properties> + </java-type> + + <java-type name="Metadata"> + <xml-properties> + <xml-property name="description" value="Collection of metadatum (key/value pairs)" /> + </xml-properties> + <xml-root-element name="metadata" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="metadatum" name="metadatum" type="inventory.aai.openecomp.org.v8.Metadatum" /> + </java-attributes> + </java-type> + + <java-type name="Metadatum"> + <xml-root-element name="metadatum" /> + <java-attributes> + <xml-element java-attribute="metaname" name="metaname" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="metaval" name="metaval" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Key/value pairs" /> + <xml-property name="indexedProps" value="metaname" /> + <xml-property name="dependentOn" value="tenant,image,service-instance,model" /> + <xml-property name="container" value="metadata" /> + </xml-properties> + </java-type> + + <java-type name="Pservers"> + <xml-properties> + <xml-property name="description" value="Collection of compute hosts." /> + </xml-properties> + <xml-root-element name="pservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pserver" name="pserver" type="inventory.aai.openecomp.org.v8.Pserver" /> + </java-attributes> + </java-type> + + <java-type name="Pserver"> + <xml-root-element name="pserver" /> + <java-attributes> + <xml-element java-attribute="hostname" name="hostname" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value from executing hostname on the compute node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ptniiEquipName" name="ptnii-equip-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="PTNII name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="numberOfCpus" name="number-of-cpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of cpus" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="diskInGigabytes" name="disk-in-gigabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk size, in GBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ramInMegabytes" name="ram-in-megabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="RAM size, in MBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="fqdn" name="fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Fully-qualified domain name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverSelflink" name="pserver-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to configure device, also used for troubleshooting and is IP used for traps generated by device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number, may be queried" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverId" name="pserver-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of Pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="internetTopology" name="internet-topology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="internet topology of Pserver" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverName2" name="pserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="alternative pserver name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="purpose of pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v8.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v8.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver." /> + <xml-property name="nameProps" value="pserver-name2" /> + <xml-property name="indexedProps" value="hostname,in-maint,pserver-id,pserver-name2" /> + <xml-property name="searchable" value="hostname,pserver-name2,pserver-id,ipv4-oam-address" /> + <xml-property name="container" value="pservers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="PInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of physical interfaces." /> + </xml-properties> + <xml-root-element name="p-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pInterface" name="p-interface" type="inventory.aai.openecomp.org.v8.PInterface" /> + </java-attributes> + </java-type> + + <java-type name="PInterface"> + <xml-root-element name="p-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the physical interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portDescription" name="port-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nature of the services and connectivity on this port." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentIdentifier" name="equipment-identifier" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CLEI or other specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceType" name="interface-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the physical properties of the interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Physical interface (e.g., nic)" /> + <xml-property name="indexedProps" value="interface-name" /> + <xml-property name="dependentOn" value="pserver,pnf" /> + <xml-property name="container" value="p-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="LagInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregate interfaces." /> + </xml-properties> + <xml-root-element name="lag-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagInterface" name="lag-interface" type="inventory.aai.openecomp.org.v8.LagInterface" /> + </java-attributes> + </java-type> + + <java-type name="LagInterface"> + <xml-root-element name="lag-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the link aggregate interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Link aggregate interface" /> + <xml-property name="indexedProps" value="interface-name" /> + <xml-property name="dependentOn" value="generic-vnf,pserver,pnf" /> + <xml-property name="container" value="lag-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="AvailabilityZones"> + <xml-properties> + <xml-property name="description" value="Collection of availability zones" /> + </xml-properties> + <xml-root-element name="availability-zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v8.AvailabilityZone" /> + </java-attributes> + </java-type> + + <java-type name="AvailabilityZone"> + <xml-root-element name="availability-zone" /> + <java-attributes> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone. Unique across a cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="hypervisorType" name="hypervisor-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of hypervisor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Availability zone, a collection of compute hosts/pservers" /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="availability-zones" /> + </xml-properties> + </java-type> + + <java-type name="Business"> + <xml-properties> + <xml-property name="description" value="Namespace for business related constructs" /> + </xml-properties> + <xml-root-element name="business" /> + <java-attributes> + <xml-element java-attribute="customers" name="customers" type="inventory.aai.openecomp.org.v8.Customers" /> + </java-attributes> + </java-type> + + <java-type name="Customers"> + <xml-properties> + <xml-property name="description" value="Collection of customer identifiers to provide linkage back to BSS information." /> + </xml-properties> + <xml-root-element name="customers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="customer" name="customer" type="inventory.aai.openecomp.org.v8.Customer" /> + </java-attributes> + </java-type> + + <java-type name="Customer"> + <xml-root-element name="customer" /> + <java-attributes> + <xml-element java-attribute="globalCustomerId" name="global-customer-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Global customer id used across OpenECOMP to uniquely identify customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberName" name="subscriber-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber name, an alternate way to retrieve a customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberType" name="subscriber-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber type, a way to provide VID with only the INFRA customers." /> + <xml-property name="defaultValue" value="CUST" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSubscriptions" name="service-subscriptions" type="inventory.aai.openecomp.org.v8.ServiceSubscriptions" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="customer identifiers to provide linkage back to BSS information." /> + <xml-property name="nameProps" value="subscriber-name" /> + <xml-property name="indexedProps" value="subscriber-name,global-customer-id,subscriber-type" /> + <xml-property name="searchable" value="subscriber-name,global-customer-id" /> + <xml-property name="uniqueProps" value="global-customer-id,subscriber-name" /> + <xml-property name="alternateKeys1" value="subscriber-name" /> + <xml-property name="container" value="customers" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + + <java-type name="ServiceSubscriptions"> + <xml-properties> + <xml-property name="description" value="Collection of objects that group service instances." /> + </xml-properties> + <xml-root-element name="service-subscriptions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceSubscription" name="service-subscription" type="inventory.aai.openecomp.org.v8.ServiceSubscription" /> + </java-attributes> + </java-type> + + <java-type name="ServiceSubscription"> + <xml-root-element name="service-subscription" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value defined by orchestration to identify this service across OpenECOMP." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tempUbSubAccountId" name="temp-ub-sub-account-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This property will be deleted from AAI in the near future. Only stop gap solution." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstances" name="service-instances" type="inventory.aai.openecomp.org.v8.ServiceInstances"> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Object that group service instances." /> + <xml-property name="indexedProps" value="service-type" /> + <xml-property name="dependentOn" value="customer" /> + <xml-property name="container" value="service-subscriptions" /> + </xml-properties> + </java-type> + + <java-type name="ServiceInstances"> + <xml-properties> + <xml-property name="description" value="Collection of service instances" /> + </xml-properties> + <xml-root-element name="service-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceInstance" name="service-instance" type="inventory.aai.openecomp.org.v8.ServiceInstance" /> + </java-attributes> + </java-type> + + <java-type name="ServiceInstance"> + <xml-root-element name="service-instance" /> + <java-attributes> + <xml-element java-attribute="serviceInstanceId" name="service-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Uniquely identifies this instance of a service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceName" name="service-instance-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field will store a name assigned to the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthTotal" name="bandwidth-total" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the total bandwidth to be used for this service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vhnPortalUrl" name="vhn-portal-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL customers will use to access the vHN Portal." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operational status of the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceLocationId" name="service-instance-location-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="An identifier that customers assign to the location where this service is being used." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v8.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Instance of a service" /> + <xml-property name="indexedProps" value="service-instance-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id" /> + <xml-property name="nameProps" value="service-instance-name" /> + <xml-property name="searchable" value="service-instance-id" /> + <xml-property name="uniqueProps" value="service-instance-id" /> + <xml-property name="dependentOn" value="service-subscription" /> + <xml-property name="container" value="service-instances" /> + </xml-properties> + </java-type> + + <java-type name="ServiceDesignAndCreation"> + <xml-properties> + <xml-property name="description" value="Namespace for objects managed by SDC" /> + </xml-properties> + <xml-root-element name="service-design-and-creation" /> + <java-attributes> + <xml-element java-attribute="services" name="services" type="inventory.aai.openecomp.org.v8.Services" /> + <xml-element java-attribute="models" name="models" type="inventory.aai.openecomp.org.v8.Models" /> + <xml-element java-attribute="namedQueries" name="named-queries" type="inventory.aai.openecomp.org.v8.NamedQueries" /> + </java-attributes> + </java-type> + + <java-type name="Network"> + <xml-properties> + <xml-property name="description" value="Namespace for network inventory resources." /> + </xml-properties> + <xml-root-element name="network" /> + <java-attributes> + <xml-element java-attribute="logicalLinks" name="logical-links" type="inventory.aai.openecomp.org.v8.LogicalLinks" /> + <xml-element java-attribute="vnfcs" name="vnfcs" type="inventory.aai.openecomp.org.v8.Vnfcs" /> + <xml-element java-attribute="l3Networks" name="l3-networks" type="inventory.aai.openecomp.org.v8.L3Networks" /> + <xml-element java-attribute="genericVnfs" name="generic-vnfs" type="inventory.aai.openecomp.org.v8.GenericVnfs" /> + <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.openecomp.org.v8.Pnfs" /> + <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.openecomp.org.v8.PhysicalLinks" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of logical connections" /> + </xml-properties> + <xml-root-element name="logical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="logicalLink" name="logical-link" type="inventory.aai.openecomp.org.v8.LogicalLink" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLink"> + <xml-root-element name="logical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkType" name="link-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of logical link, e.g., evc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4, v6, or ds for dual stack (should be ip-version)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingProtocol" name="routing-protocol" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="For example, static or BGP" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of operational status of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkRole" name="link-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of the network use of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkName2" name="link-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alias or alternate name (CLCI or D1 name)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkId" name="link-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the logical-link, SDNC generates this." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical links generally connect l-interfaces but are used to express logical connectivity between two points" /> + <xml-property name="indexedProps" value="link-name,persona-model-id,persona-model-version,widget-model-id,widget-model-version,link-id" /> + <xml-property name="uniqueProps" value="link-id" /> + <xml-property name="container" value="logical-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Vnfcs"> + <xml-properties> + <xml-property name="description" value="virtual network components associated with a vserver from application controller." /> + </xml-properties> + <xml-root-element name="vnfcs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfc" name="vnfc" type="inventory.aai.openecomp.org.v8.Vnfc" /> + </java-attributes> + </java-type> + + <java-type name="Vnfc"> + <xml-root-element name="vnfc" /> + <java-attributes> + <xml-element java-attribute="vnfcName" name="vnfc-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vnfc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcFunctionCode" name="vnfc-function-code" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="function code" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcType" name="vnfc-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="prov status of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by APP-C" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4OamVip" name="ipaddress-v4-oam-vip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Oam V4 vip address of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupNotation" name="group-notation" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group notation of VNFC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation" /> + <xml-property name="container" value="vnfcs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="L3Networks"> + <xml-root-element name="l3-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="l3Network" name="l3-network" type="inventory.aai.openecomp.org.v8.L3Network" /> + </java-attributes> + </java-type> + + <java-type name="L3Network"> + <xml-root-element name="l3-network" /> + <java-attributes> + <xml-element java-attribute="networkId" name="network-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Network ID, should be uuid. Unique across AAI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network, governed by some naming convention.." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkType" name="network-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the network - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRole" name="network-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role the network plans - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkTechnology" name="network-technology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network technology - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBoundToVpn" name="is-bound-to-vpn" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Set to true if bound to VPN" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from SDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRoleInstance" name="network-role-instance" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="network role instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailNetworkFqdn" name="contrail-network-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalNetworkName" name="physical-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the physical network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isProviderNetwork" name="is-provider-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a provider network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isSharedNetwork" name="is-shared-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a shared network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isExternalNetwork" name="is-external-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is an external network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnets" name="subnets" type="inventory.aai.openecomp.org.v8.Subnets" /> + <xml-element java-attribute="ctagAssignments" name="ctag-assignments" type="inventory.aai.openecomp.org.v8.CtagAssignments" /> + <xml-element java-attribute="segmentationAssignments" name="segmentation-assignments" type="inventory.aai.openecomp.org.v8.SegmentationAssignments" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" > + <xml-properties> + <xml-property name="description" value="Relates to tenant (or is it a child of tenant)" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Generic network definition" /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="heat-stack-id,network-uuid,service-id,network-id,network-name,persona-model-id,persona-model-version,widget-model-id,widget-model-version,contrail-network-fqdn" /> + <xml-property name="uniqueProps" value="network-id" /> + <xml-property name="container" value="l3-networks" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="CtagAssignments"> + <xml-root-element name="ctag-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagAssignment" name="ctag-assignment" type="inventory.aai.openecomp.org.v8.CtagAssignment" /> + </java-attributes> + </java-type> + + <java-type name="CtagAssignment"> + <xml-root-element name="ctag-assignment" /> + <java-attributes> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="id." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vlan-id-inner" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="ctag-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Subnets"> + <xml-root-element name="subnets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="subnet" name="subnet" type="inventory.aai.openecomp.org.v8.Subnet" /> + </java-attributes> + </java-type> + + <java-type name="Subnet"> + <xml-root-element name="subnet" /> + <java-attributes> + <xml-element java-attribute="subnetId" name="subnet-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Subnet ID, should be UUID." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnetName" name="subnet-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the subnet." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of this subnet" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="gatewayAddress" name="gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="gateway ip address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkStartAddress" name="network-start-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="network start address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cidrMask" name="cidr-mask" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="cidr mask" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="dhcpEnabled" name="dhcp-enabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="dhcp enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpStart" name="dhcp-start" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the start address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpEnd" name="dhcp-end" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the last address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="subnet-id,subnet-name" /> + <xml-property name="nameProps" value="subnet-name" /> + <xml-property name="uniqueProps" value="subnet-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="subnets" /> + </xml-properties> + </java-type> + + <java-type name="GenericVnfs"> + <xml-properties> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + <xml-root-element name="generic-vnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="genericVnf" name="generic-vnf" type="inventory.aai.openecomp.org.v8.GenericVnf" /> + </java-attributes> + </java-type> + + <java-type name="GenericVnf"> + <xml-root-element name="generic-vnf" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the SDC resource. This field has been overloaded and clients should expect changes to occur in the future to this field as SDC matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from SDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="License key" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, used by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vcpu, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vmemory, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vdisk, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the generic-vnf operation" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether generic-vnf access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementAssignmentGroupUuid" name="entitlement-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the Entitlement group used for licensing VNFs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the specific entitlement resource" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseAssignmentGroupUuid" name="license-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the license assignment group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKeyUuid" name="license-key-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the actual license resource" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="represents sub zone of the rr plane" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v8.LagInterfaces" /> + <xml-element java-attribute="vfModules" name="vf-modules" type="inventory.aai.openecomp.org.v8.VfModules" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="generic-vnfs" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="VfModules"> + <xml-properties> + <xml-property name="description" value="Collection of vf-modules, a deployment unit of VNFCs" /> + </xml-properties> + <xml-root-element name="vf-modules" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vfModule" name="vf-module" type="inventory.aai.openecomp.org.v8.VfModule" /> + </java-attributes> + </java-type> + + <java-type name="VfModule"> + <xml-root-element name="vf-module" /> + <java-attributes> + <xml-element java-attribute="vfModuleId" name="vf-module-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vf-module." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleName" name="vf-module-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vf-module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration status of this vf-module, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBaseVfModule" name="is-base-vf-module" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is base vf module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailServiceInstanceFqdn" name="contrail-service-instance-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the Contrail unique ID for a service-instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="a deployment unit of VNFCs" /> + <xml-property name="indexedProps" value="vf-module-id,vf-module-name,heat-stack-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,contrail-service-instance-fqdn" /> + <xml-property name="dependentOn" value="generic-vnf" /> + <xml-property name="container" value="vf-modules" /> + </xml-properties> + </java-type> + + <java-type name="Pnfs"> + <xml-properties> + <xml-property name="description" value="Collection of Physical Network Functions." /> + </xml-properties> + <xml-root-element name="pnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pnf" name="pnf" type="inventory.aai.openecomp.org.v8.Pnf" /> + </java-attributes> + </java-type> + + <java-type name="Pnf"> + <xml-root-element name="pnf" /> + <java-attributes> + <xml-element java-attribute="pnfName" name="pnf-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2" name="pnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2Source" name="pnf-name2-source" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="source of name2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfId" name="pnf-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="id of pnf" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Oam" name="ipaddress-v4-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ipv4-oam-address with new naming convention for IP addresses" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="swVersion" name="sw-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="sw-version is the version of SW for the hosted application on the PNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration-status is the status of orchestration on the PNF." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="frameId" name="frame-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of the physical frame (relay rack) where pnf is installed." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v8.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v8.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="PNF represents a physical network function." /> + <xml-property name="indexedProps" value="pnf-name,orchestration-status" /> + <xml-property name="uniqueProps" value="pnf-name" /> + <xml-property name="container" value="pnfs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="PhysicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + </xml-properties> + <xml-root-element name="physical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="physicalLink" name="physical-link" type="inventory.aai.openecomp.org.v8.PhysicalLink" /> + </java-attributes> + </java-type> + + <java-type name="PhysicalLink"> + <xml-root-element name="physical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit it" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dualMode" name="dual-mode" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Dual access mode (e.g., primary, secondary" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="To provide information on who manages this circuit. AAI or 3rd party transport provider" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceProviderName" name="service-provider-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the service Provider on this link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + <xml-property name="indexedProps" value="circuit-id,link-name" /> + <xml-property name="alternateKeys1" value="circuit-id" /> + <xml-property name="container" value="physical-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="NotificationEvent"> + <xml-root-element name="notification-event" /> + <java-attributes> + <xml-element java-attribute="cambriaPartition" name="cambria.partition" type="java.lang.String" /> + <xml-element java-attribute="eventHeader" name="event-header" type="inventory.aai.openecomp.org.v8.NotificationEventHeader" /> + <xml-any-element java-attribute="entity" /> + </java-attributes> + </java-type> + <java-type name="NotificationEventHeader"> + <xml-root-element name="notification-event-header" /> + <java-attributes> + <xml-element java-attribute="id" name="id" type="java.lang.String" /> + <xml-element java-attribute="timestamp" name="timestamp" type="java.lang.String" /> + <xml-element java-attribute="sourceName" name="source-name" type="java.lang.String" /> + <xml-element java-attribute="domain" name="domain" type="java.lang.String" /> + <xml-element java-attribute="sequenceNumber" name="sequence-number" type="java.lang.String" /> + <xml-element java-attribute="severity" name="severity" type="java.lang.String" /> + <xml-element java-attribute="eventType" name="event-type" type="java.lang.String" /> + <xml-element java-attribute="version" name="version" type="java.lang.String" /> + <xml-element java-attribute="action" name="action" type="java.lang.String" /> + <xml-element java-attribute="entityType" name="entity-type" type="java.lang.String" /> + <xml-element java-attribute="topEntityType" name="top-entity-type" type="java.lang.String" /> + <xml-element java-attribute="entityLink" name="entity-link" type="java.lang.String" /> + <xml-element java-attribute="status" name="status" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="AaiInternal"> + <xml-root-element name="aai-internal" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="reservedPropNames" name="reserved-prop-names" type="inventory.aai.openecomp.org.v8.ReservedPropNames" /> + <xml-element container-type="java.util.ArrayList" java-attribute="edgePropNames" name="edge-prop-names" type="inventory.aai.openecomp.org.v8.EdgePropNames" /> + </java-attributes> + </java-type> + + <java-type name="ReservedPropNames"> + <xml-properties> + <xml-property name="description" value="Internal map to define some reserved properties of a vertex" /> + <xml-property name="uniqueProps" value="aai-unique-key" /> + <xml-property name="indexedProps" value="aai-unique-key,source-of-truth,aai-node-type" /> + </xml-properties> + <xml-root-element name="reserved-prop-names" /> + <java-attributes> + <xml-element java-attribute="lastModSourceOfTruth" name="last-mod-source-of-truth" type="java.lang.String" /> + <xml-element java-attribute="aaiNodeType" name="aai-node-type" type="java.lang.String" /> + <xml-element java-attribute="aaiCreatedTs" name="aai-created-ts" type="java.lang.Long" /> + <xml-element java-attribute="aaiUniqueKey" name="aai-unique-key" type="java.lang.String" /> + <xml-element java-attribute="aaiLastModTs" name="aai-last-mod-ts" type="java.lang.Long" /> + <xml-element java-attribute="sourceOfTruth" name="source-of-truth" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="EdgePropNames"> + <!-- NOTE that the names of these properties are not consistent and are in mixed case and hyphen case for now --> + <xml-properties> + <xml-property name="description" value="Internal map to define the properties of an edge and interpret the map EdgeRules" /> + <xml-property name="edgeInfo" value="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV" /> + </xml-properties> + <xml-root-element name="edge-prop-names" /> + <java-attributes> + <xml-element java-attribute="edgeLabel" name="edgeLabel" type="java.lang.String" /> + <xml-element java-attribute="direction" name="direction" type="java.lang.String" /> + <xml-element java-attribute="multiplicityRule" name="multiplicityRule" type="java.lang.String" /> + <xml-element java-attribute="isParent" name="isParent" type="java.lang.Boolean" /> + <xml-element java-attribute="usesResource" name="usesResource" type="java.lang.Boolean" /> + <xml-element java-attribute="hasDelTarget" name="hasDelTarget" type="java.lang.Boolean" /> + <xml-element java-attribute="SVC-INFRA" name="SVC-INFRA" type="java.lang.String" /> + <xml-element java-attribute="SVC-INFRA-REV" name="SVC-INFRA-REV" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Services"> + <xml-properties> + <xml-property name="description" value="Collection of service model definitions. Likely to be deprecated in favor of models from SDC."/> + </xml-properties> + <xml-root-element name="services" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="service" name="service" type="inventory.aai.openecomp.org.v8.Service" /> + </java-attributes> + </java-type> + + <java-type name="Service"> + <xml-root-element name="service" /> + <java-attributes> + <xml-element java-attribute="serviceId" name="service-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceDescription" name="service-description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description of the service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSelflink" name="service-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceVersion" name="service-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="service version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Stand-in for service model definitions. Likely to be deprecated in favor of models from SDC." /> + <xml-property name="indexedProps" value="service-description,service-id" /> + <xml-property name="container" value="services" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="Models"> + <xml-properties> + <xml-property name="description" value="Collection of subgraph definitions provided by SDC to describe the inventory assets and their connections related to SDC models" /> + </xml-properties> + <xml-root-element name="models" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="model" name="model" type="inventory.aai.openecomp.org.v8.Model" /> + </java-attributes> + </java-type> + + <java-type name="Model"> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by SDC to describe an inventory asset and its connections related to SDC models" /> + <xml-property name="nameProps" value="model-name,model-type" /> + <xml-property name="indexedProps" value="model-name-version-id,model-type,model-name,model-id,model-version" /> + <xml-property name="alternateKeys1" value="model-id,model-version" /> + <xml-property name="uniqueProps" value="model-name-version-id" /> + <xml-property name="container" value="models" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="model" /> + <java-attributes> + <xml-element java-attribute="modelNameVersionId" name="model-name-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in SDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelId" name="model-id" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Invariant unique ID which does not change from version to version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v8.ModelElements" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v8.Metadata" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelElements"> + <xml-root-element name="model-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelElement" name="model-element" type="inventory.aai.openecomp.org.v8.ModelElement" /> + </java-attributes> + </java-type> + + <java-type name="ModelElement"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model." /> + <xml-property name="uniqueProps" value="model-element-uuid" /> + <xml-property name="indexedProps" value="model-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-elements" /> + </xml-properties> + <xml-root-element name="model-element" /> + <java-attributes> + <xml-element java-attribute="modelElementUuid" name="model-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="newDataDelFlag" name="new-data-del-flag" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates whether this element was created as part of instantiation from this model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cardinality" name="cardinality" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="How many of this type of element are required/allowed" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="linkagePoints" name="linkage-point" type="java.lang.String"> + <xml-element-wrapper name="linkage-points" /> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v8.ModelElements"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelConstraints" name="model-constraints" type="inventory.aai.openecomp.org.v8.ModelConstraints"> + <xml-properties> + <xml-property name="description" value="Describes new constraints on this model element that are not part of that model's definition" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraints"> + <xml-root-element name="model-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelConstraint" name="model-constraint" type="inventory.aai.openecomp.org.v8.ModelConstraint" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraint"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="model-constraint-uuid" /> + <xml-property name="indexedProps" value="model-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-constraints" /> + </xml-properties> + <xml-root-element name="model-constraint" /> + <java-attributes> + <xml-element java-attribute="modelConstraintUuid" name="model-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constrainedElementSetUuidToReplace" name="constrained-element-set-uuid-to-replace" required="true" type="java.lang.String" /> + <xml-element java-attribute="constrainedElementSets" name="constrained-element-sets" type="inventory.aai.openecomp.org.v8.ConstrainedElementSets" /> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSets"> + <xml-root-element name="constrained-element-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="constrainedElementSet" name="constrained-element-set" type="inventory.aai.openecomp.org.v8.ConstrainedElementSet" /> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="constrained-element-set-uuid" /> + <xml-property name="indexedProps" value="constrained-element-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="constrained-element-sets" /> + </xml-properties> + <xml-root-element name="constrained-element-set" /> + <java-attributes> + <xml-element java-attribute="constrainedElementSetUuid" name="constrained-element-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="checkType" name="check-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="elementChoiceSets" name="element-choice-sets" type="inventory.aai.openecomp.org.v8.ElementChoiceSets" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSets"> + <xml-root-element name="element-choice-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="elementChoiceSet" name="element-choice-set" type="inventory.aai.openecomp.org.v8.ElementChoiceSet" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="element-choice-set-uuid" /> + <xml-property name="indexedProps" value="element-choice-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="element-choice-sets" /> + </xml-properties> + <xml-root-element name="element-choice-set" /> + <java-attributes> + <xml-element java-attribute="elementChoiceSetUuid" name="element-choice-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elementChoiceSetName" name="element-choice-set-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="cardinality" name="cardinality" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v8.ModelElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueries"> + <xml-root-element name="named-queries" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v8.NamedQuery" /> + </java-attributes> + </java-type> + + <java-type name="NamedQuery"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="nameProps" value="named-query-name" /> + <xml-property name="uniqueProps" value="named-query-uuid" /> + <xml-property name="indexedProps" value="named-query-uuid,named-query-name" /> + <xml-property name="container" value="named-queries" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="named-query" /> + <java-attributes> + <xml-element java-attribute="namedQueryUuid" name="named-query-uuid" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="namedQueryName" name="named-query-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="namedQueryVersion" name="named-query-version" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="requiredInputParams" name="required-input-param" type="java.lang.String"> + <xml-element-wrapper name="required-input-params" /> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v8.NamedQueryElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElements"> + <xml-root-element name="named-query-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQueryElement" name="named-query-element" type="inventory.aai.openecomp.org.v8.NamedQueryElement" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElement"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="named-query-element-uuid" /> + <xml-property name="indexedProps" value="named-query-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="named-query-elements" /> + </xml-properties> + <xml-root-element name="named-query-element" /> + <java-attributes> + <xml-element java-attribute="namedQueryElementUuid" name="named-query-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="propertyLimitDesc" name="property-limit-desc" type="java.lang.String" /> + <xml-element java-attribute="doNotOutput" name="do-not-output" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v8.NamedQueryElements" /> + <xml-element java-attribute="relatedLookups" name="related-lookups" type="inventory.aai.openecomp.org.v8.RelatedLookups" /> + <xml-element java-attribute="propertyConstraints" name="property-constraints" type="inventory.aai.openecomp.org.v8.PropertyConstraints" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookups"> + <xml-root-element name="related-lookups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedLookup" name="related-lookup" type="inventory.aai.openecomp.org.v8.RelatedLookup" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookup"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="related-lookup-uuid" /> + <xml-property name="indexedProps" value="related-lookup-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="related-lookups" /> + </xml-properties> + <xml-root-element name="related-lookup" /> + <java-attributes> + <xml-element java-attribute="relatedLookupUuid" name="related-lookup-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceNodeType" name="source-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="sourceNodeProperty" name="source-node-property" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeType" name="target-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeProperty" name="target-node-property" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraints"> + <xml-root-element name="property-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyConstraint" name="property-constraint" type="inventory.aai.openecomp.org.v8.PropertyConstraint" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraint"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="property-constraint-uuid" /> + <xml-property name="indexedProps" value="property-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="property-constraints" /> + </xml-properties> + <xml-root-element name="property-constraint" /> + <java-attributes> + <xml-element java-attribute="propertyConstraintUuid" name="property-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="property-name" name="property-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="property-value" name="property-value" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ModelAndNamedQuerySearch"> + <xml-properties> + <xml-property name="description" value="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="model-and-named-query-search" /> + <java-attributes> + <xml-element java-attribute="queryParameters" name="query-parameters" type="inventory.aai.openecomp.org.v8.QueryParameters" /> + <xml-element java-attribute="instanceFilters" name="instance-filters" type="inventory.aai.openecomp.org.v8.InstanceFilters" /> + <xml-element java-attribute="topNodeType" name="top-node-type" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="QueryParameters"> + <xml-properties> + <xml-property name="description" value="QueryParameters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="query-parameters" /> + <java-attributes> + <xml-element java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v8.NamedQuery" /> + <xml-element java-attribute="model" name="model" type="inventory.aai.openecomp.org.v8.Model" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilters"> + <xml-properties> + <xml-property name="description" value="InstanceFilters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="instance-filters" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceFilter" name="instance-filter" type="inventory.aai.openecomp.org.v8.InstanceFilter" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilter"> + <xml-properties> + <xml-property name="description" value="InstanceFilter for performing a named-query or model query" /> + <xml-property name="container" value="instance-filters" /> + </xml-properties> + <xml-root-element name="instance-filter" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + + <java-type name="Properties"> + <xml-properties> + <xml-property name="description" value="Property holder for query properties or instance properties" /> + </xml-properties> + <xml-root-element name="properties" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ResponseList"> + <xml-properties> + <xml-property name="description" value="Response container for the results of a named-query or model query" /> + </xml-properties> + <xml-root-element name="response-list" /> + <java-attributes> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v8.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItems"> + <xml-properties> + <xml-property name="description" value="Container for inventory items in response list" /> + <xml-property name="container" value="response-list" /> + </xml-properties> + <xml-root-element name="inventory-response-items" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryResponseItem" name="inventory-response-item" type="inventory.aai.openecomp.org.v8.InventoryResponseItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItem"> + <xml-properties> + <xml-property name="description" value="Inventory item for response list" /> + <xml-property name="container" value="inventory-response-items" /> + </xml-properties> + <xml-root-element name="inventory-response-item" /> + <java-attributes> + <xml-element java-attribute="modelName" name="model-name" type="java.lang.String" /> + <xml-any-element java-attribute="item" /> + <xml-element java-attribute="extraProperties" name="extra-properties" type="inventory.aai.openecomp.org.v8.ExtraProperties" /> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v8.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperties"> + <xml-properties> + <xml-property name="description" value="Extra properties for inventory item for response list" /> + </xml-properties> + <xml-root-element name="extra-properties" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="extraProperty" name="extra-property" type="inventory.aai.openecomp.org.v8.ExtraProperty" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperty"> + <xml-root-element name="extra-property" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-any-element java-attribute="propertyValue" lax="true" name="property-value" /> + </java-attributes> + </java-type> + + <java-type name="SegmentationAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack segmentation assignments" /> + </xml-properties> + <xml-root-element name="segmentation-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="segmentationAssignment" name="segmentation-assignment" type="inventory.aai.openecomp.org.v8.SegmentationAssignment" /> + </java-attributes> + </java-type> + + <java-type name="SegmentationAssignment"> + <xml-root-element name="segmentation-assignment" /> + <java-attributes> + <xml-element java-attribute="segmentationId" name="segmentation-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack segmentation assignment." /> + <xml-property name="indexedProps" value="segmentation-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="segmentation-assignments" /> + </xml-properties> + </java-type> + + </java-types> +</xml-bindings> diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v9.xml b/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v9.xml new file mode 100644 index 00000000..dc04bdcd --- /dev/null +++ b/aai-core/src/test/resources/bundleconfig-local/etc/oxm/aai_oxm_v9.xml @@ -0,0 +1,5453 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.openecomp.org.v9" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.openecomp.aai.inventory/v9" /> + </xml-schema> + <java-types> + <java-type name="Inventory"> + <xml-root-element name="inventory" /> + <java-attributes> + <xml-element java-attribute="search" name="search" type="inventory.aai.openecomp.org.v9.Search" /> + <xml-element java-attribute="actions" name="actions" type="inventory.aai.openecomp.org.v9.Actions" /> + <xml-element java-attribute="cloudInfrastructure" name="cloud-infrastructure" type="inventory.aai.openecomp.org.v9.CloudInfrastructure" /> + <xml-element java-attribute="business" name="business" type="inventory.aai.openecomp.org.v9.Business" /> + <xml-element java-attribute="serviceDesignAndCreation" name="service-design-and-creation" type="inventory.aai.openecomp.org.v9.ServiceDesignAndCreation" /> + <xml-element java-attribute="network" name="network" type="inventory.aai.openecomp.org.v9.Network" /> + <xml-element java-attribute="aaiInternal" name="aai-internal" type="inventory.aai.openecomp.org.v9.AaiInternal" /> + <xml-element java-attribute="nodes" name="nodes" type="inventory.aai.openecomp.org.v9.Nodes"/> + </java-attributes> + </java-type> + + <java-type name="Nodes"> + <xml-root-element name="nodes" /> + </java-type> + <java-type name="Search"> + <xml-root-element name="search" /> + <java-attributes> + <xml-element java-attribute="edgeTagQueryResult" name="edge-tag-query-result" type="inventory.aai.openecomp.org.v9.EdgeTagQueryResult" /> + <xml-element java-attribute="edgeTagQueryRequest" name="edge-tag-query-request" type="inventory.aai.openecomp.org.v9.EdgeTagQueryRequest" /> + <xml-element java-attribute="searchResults" name="search-results" type="inventory.aai.openecomp.org.v9.SearchResults" /> + <xml-element java-attribute="sdnZoneResponse" name="sdn-zone-response" type="inventory.aai.openecomp.org.v9.SdnZoneResponse" /> + </java-attributes> + </java-type> + + <java-type name="EdgeTagQueryResult"> + <xml-root-element name="edge-tag-query-result" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v9.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + + <java-type name="TaggedInventoryItemList"> + <xml-root-element name="tagged-inventory-item-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItem" name="inventory-item" type="inventory.aai.openecomp.org.v9.InventoryItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItem"> + <xml-root-element name="inventory-item" /> + <java-attributes> + <xml-element java-attribute="inventoryItemType" name="inventory-item-type" type="java.lang.String" /> + <xml-element java-attribute="inventoryItemLink" name="inventory-item-link" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItemData" name="inventory-item-data" type="inventory.aai.openecomp.org.v9.InventoryItemData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v9.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItemData"> + <xml-root-element name="inventory-item-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="EdgeTagQueryRequest"> + <xml-root-element name="edge-tag-query-request" /> + <java-attributes> + <xml-element java-attribute="edgeTag" name="edge-tag" type="java.lang.String" /> + <xml-element java-attribute="resultDetail" name="result-detail" type="java.lang.String" /> + <xml-element java-attribute="startNodeType" name="start-node-type" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="startNodeFilter" name="start-node-filter" type="inventory.aai.openecomp.org.v9.StartNodeFilter" /> + <xml-element container-type="java.util.ArrayList" java-attribute="includeNodeFilter" name="include-node-filter" type="inventory.aai.openecomp.org.v9.IncludeNodeFilter" /> + <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilter" name="secondary-filter" type="inventory.aai.openecomp.org.v9.SecondaryFilter" /> + </java-attributes> + </java-type> + + <java-type name="StartNodeFilter"> + <xml-root-element name="start-node-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="IncludeNodeFilter"> + <xml-root-element name="include-node-filter" /> + <java-attributes> + <xml-element java-attribute="includeNodeType" name="include-node-type" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilter"> + <xml-root-element name="secondary-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="filterType" name="filter-type" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SearchResults"> + <xml-root-element name="search-results" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="resultData" name="result-data" type="inventory.aai.openecomp.org.v9.ResultData" /> + </java-attributes> + </java-type> + + <java-type name="ResultData"> + <xml-root-element name="result-data" /> + <java-attributes> + <xml-element java-attribute="resourceType" name="resource-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The specific type of node in the A&AI graph" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceLink" name="resource-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The URL to the specific resource" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="SdnZoneResponse"> + <xml-root-element name="sdn-zone-response" /> + <java-attributes> + <xml-element java-attribute="oamNetworks" name="oam-networks" type="inventory.aai.openecomp.org.v9.OamNetworks" /> + <xml-element container-type="java.util.ArrayList" java-attribute="azAndDvsSwitches" name="az-and-dvs-switches" type="inventory.aai.openecomp.org.v9.AzAndDvsSwitches" /> + </java-attributes> + </java-type> + + <java-type name="AzAndDvsSwitches"> + <xml-root-element name="az-and-dvs-switches" /> + <java-attributes> + <xml-element java-attribute="dvsSwitches" name="dvs-switches" type="inventory.aai.openecomp.org.v9.DvsSwitches" /> + <xml-element java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v9.AvailabilityZone" /> + </java-attributes> + </java-type> + + <java-type name="Actions"> + <xml-properties> + <xml-property name="description" value="APIs that are more action related than REST (e.g., notify, update)." /> + </xml-properties> + <xml-root-element name="actions" /> + <java-attributes> + <xml-element java-attribute="update" name="update" type="inventory.aai.openecomp.org.v9.Update" /> + <xml-element java-attribute="notify" name="notify" type="inventory.aai.openecomp.org.v9.Notify" /> + </java-attributes> + </java-type> + + <java-type name="Update"> + <xml-properties> + <xml-property name="description" value="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team." /> + </xml-properties> + <xml-root-element name="update" /> + <java-attributes> + <xml-element java-attribute="updateNodeType" name="update-node-type" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="updateNodeKey" name="update-node-key" type="inventory.aai.openecomp.org.v9.UpdateNodeKey" /> + <xml-element java-attribute="updateNodeUri" name="update-node-uri" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="action" name="action" type="inventory.aai.openecomp.org.v9.Action" /> + </java-attributes> + </java-type> + + <java-type name="Action"> + <xml-root-element name="action" /> + <java-attributes> + <xml-element java-attribute="actionType" name="action-type" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="actionData" name="action-data" type="inventory.aai.openecomp.org.v9.ActionData" /> + </java-attributes> + </java-type> + + <java-type name="ActionData"> + <xml-root-element name="action-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="UpdateNodeKey"> + <xml-root-element name="update-node-key" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Notify"> + <xml-root-element name="notify" /> + <java-attributes> + <xml-element java-attribute="eventId" name="event-id" required="true" type="java.lang.String" /> + <xml-element java-attribute="nodeType" name="node-type" type="java.lang.String" /> + <xml-element java-attribute="eventTrigger" name="event-trigger" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="keyData" name="key-data" type="inventory.aai.openecomp.org.v9.KeyData" /> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="KeyData"> + <xml-root-element name="key-data" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="CloudInfrastructure"> + <xml-properties> + <xml-property name="description" value="Namespace for cloud infrastructure." /> + </xml-properties> + <xml-root-element name="cloud-infrastructure" /> + <java-attributes> + <xml-element java-attribute="complexes" name="complexes" type="inventory.aai.openecomp.org.v9.Complexes" /> + <xml-element java-attribute="cloudRegions" name="cloud-regions" type="inventory.aai.openecomp.org.v9.CloudRegions" /> + <xml-element java-attribute="networkProfiles" name="network-profiles" type="inventory.aai.openecomp.org.v9.NetworkProfiles" /> + <xml-element java-attribute="pservers" name="pservers" type="inventory.aai.openecomp.org.v9.Pservers" /> + <xml-element java-attribute="virtualDataCenters" name="virtual-data-centers" type="inventory.aai.openecomp.org.v9.VirtualDataCenters" /> + </java-attributes> + </java-type> + + <java-type name="CloudRegions"> + <xml-root-element name="cloud-regions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cloudRegion" name="cloud-region" type="inventory.aai.openecomp.org.v9.CloudRegion" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="CloudRegion"> + <xml-root-element name="cloud-region" /> + <java-attributes> + <xml-element java-attribute="cloudOwner" name="cloud-owner" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifies the vendor and cloud name. First part of composite key should be formatted as vendor-cloudname" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionId" name="cloud-region-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifier used by the vendor for the region. Second part of composite key" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudType" name="cloud-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the cloud (e.g., openstack)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ownerDefinedType" name="owner-defined-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Cloud-owner defined type indicator (e.g., dcp, lcp)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionVersion" name="cloud-region-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudZone" name="cloud-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroups" name="volume-groups" type="inventory.aai.openecomp.org.v9.VolumeGroups" /> + <xml-element java-attribute="tenants" name="tenants" type="inventory.aai.openecomp.org.v9.Tenants" /> + <xml-element java-attribute="flavors" name="flavors" type="inventory.aai.openecomp.org.v9.Flavors" /> + <xml-element java-attribute="groupAssignments" name="group-assignments" type="inventory.aai.openecomp.org.v9.GroupAssignments" /> + <xml-element java-attribute="snapshots" name="snapshots" type="inventory.aai.openecomp.org.v9.Snapshots" /> + <xml-element java-attribute="images" name="images" type="inventory.aai.openecomp.org.v9.Images" /> + <xml-element java-attribute="dvsSwitches" name="dvs-switches" type="inventory.aai.openecomp.org.v9.DvsSwitches" /> + <xml-element java-attribute="oamNetworks" name="oam-networks" type="inventory.aai.openecomp.org.v9.OamNetworks" /> + <xml-element java-attribute="availabilityZones" name="availability-zones" type="inventory.aai.openecomp.org.v9.AvailabilityZones" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC." /> + <xml-property name="indexedProps" value="cloud-owner,cloud-region-id,cloud-type,owner-defined-type" /> + <xml-property name="nameProps" value="owner-defined-type" /> + <xml-property name="container" value="cloud-regions" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="VolumeGroups"> + <xml-properties> + <xml-property name="description" value="Collection of persistent block-level storage." /> + </xml-properties> + <xml-root-element name="volume-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volumeGroup" name="volume-group" type="inventory.aai.openecomp.org.v9.VolumeGroup" /> + </java-attributes> + </java-type> + + <java-type name="VolumeGroup"> + <xml-root-element name="volume-group" /> + <java-attributes> + <xml-element java-attribute="volumeGroupId" name="volume-group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of volume-group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroupName" name="volume-group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the volume group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="dbAlias" value="model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModulePersonaModelCustomizationId" name="vf-module-persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="helps relate the volume group to the vf-module whose components will require the volume group" /> + <xml-property name="dbAlias" value="vf-module-model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Persistent block-level storage." /> + <xml-property name="indexedProps" value="volume-group-name,vnf-type,heat-stack-id,volume-group-id" /> + <xml-property name="searchable" value="volume-group-id,volume-group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="volume-groups" /> + </xml-properties> + </java-type> + + <java-type name="RelationshipList"> + <xml-root-element name="relationship-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relationship" name="relationship" type="inventory.aai.openecomp.org.v9.Relationship" /> + </java-attributes> + </java-type> + + <java-type name="Relationship"> + <xml-root-element name="relationship" /> + <java-attributes> + <xml-element java-attribute="relatedTo" name="related-to" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate type of node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relatedLink" name="related-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to the object in A&AI." /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="relationshipData" name="relationship-data" type="inventory.aai.openecomp.org.v9.RelationshipData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedToProperty" name="related-to-property" type="inventory.aai.openecomp.org.v9.RelatedToProperty" /> + </java-attributes> + </java-type> + + <java-type name="RelatedToProperty"> + <xml-root-element name="related-to-property" /> + <java-attributes> + <xml-element java-attribute="propertyKey" name="property-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Key part of a key/value pair" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value part of a key/value pair" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate an attribute." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="Complexes"> + <xml-properties> + <xml-property name="description" value="Collection of physical locations that can house cloud-regions." /> + </xml-properties> + <xml-root-element name="complexes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="complex" name="complex" type="inventory.aai.openecomp.org.v9.Complex" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Complex"> + <xml-root-element name="complex" /> + <java-attributes> + <xml-element java-attribute="physicalLocationId" name="physical-location-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for physical location, e.g., CLLI" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dataCenterCode" name="data-center-code" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Data center code which can be an alternate way to identify a complex" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Gamma complex name for LCP instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalLocationType" name="physical-location-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type, e.g., central office, data center." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="street1" name="street1" required="true" type="java.lang.String" /> + <xml-element java-attribute="street2" name="street2" type="java.lang.String" /> + <xml-element java-attribute="city" name="city" required="true" type="java.lang.String" /> + <xml-element java-attribute="state" name="state" type="java.lang.String" /> + <xml-element java-attribute="postalCode" name="postal-code" required="true" type="java.lang.String" /> + <xml-element java-attribute="country" name="country" required="true" type="java.lang.String" /> + <xml-element java-attribute="region" name="region" required="true" type="java.lang.String" /> + <xml-element java-attribute="latitude" name="latitude" type="java.lang.String" /> + <xml-element java-attribute="longitude" name="longitude" type="java.lang.String" /> + <xml-element java-attribute="elevation" name="elevation" type="java.lang.String" /> + <xml-element java-attribute="lata" name="lata" type="java.lang.String" /> + <xml-element java-attribute="ctagPools" name="ctag-pools" type="inventory.aai.openecomp.org.v9.CtagPools" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical locations that can house cloud-regions." /> + <xml-property name="indexedProps" value="identity-url,data-center-code,complex-name,physical-location-id" /> + <xml-property name="searchable" value="physical-location-id,data-center-code,complex-name,street1,street2,postal-code" /> + <xml-property name="uniqueProps" value="physical-location-id" /> + <xml-property name="container" value="complexes" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="CtagPools"> + <xml-root-element name="ctag-pools" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagPool" name="ctag-pool" type="inventory.aai.openecomp.org.v9.CtagPool" /> + </java-attributes> + </java-type> + + <java-type name="CtagPool"> + <xml-root-element name="ctag-pool" /> + <java-attributes> + <xml-element java-attribute="targetPe" name="target-pe" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="The Target provider edge router" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagPoolPurpose" name="ctag-pool-purpose" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Describes what the intended purpose of this pool is." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagValues" name="ctag-values" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Comma separated list of ctags" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="A collection of C tags (vlan tags) grouped for a specific purpose." /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="complex" /> + <xml-property name="container" value="ctag-pools" /> + </xml-properties> + </java-type> + + <java-type name="Tenants"> + <xml-properties> + <xml-property name="description" value="Collection of openstack tenants." /> + </xml-properties> + <xml-root-element name="tenants" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tenant" name="tenant" type="inventory.aai.openecomp.org.v9.Tenant" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Tenant"> + <xml-root-element name="tenant" /> + <java-attributes> + <xml-element java-attribute="tenantId" name="tenant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id relative to the cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tenantName" name="tenant-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Readable name of tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vservers" name="vservers" type="inventory.aai.openecomp.org.v9.Vservers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack tenant" /> + <xml-property name="nameProps" value="tenant-name" /> + <xml-property name="indexedProps" value="tenant-name,tenant-id" /> + <xml-property name="searchable" value="tenant-id,tenant-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="tenants" /> + </xml-properties> + </java-type> + + <java-type name="Vservers"> + <xml-properties> + <xml-property name="description" value="Collection of virtual Servers, aka virtual machines or VMs." /> + </xml-properties> + <xml-root-element name="vservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vserver" name="vserver" type="inventory.aai.openecomp.org.v9.Vserver" /> + </java-attributes> + </java-type> + + <java-type name="Vserver"> + <xml-root-element name="vserver" /> + <java-attributes> + <xml-element java-attribute="vserverId" name="vserver-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for this vserver relative to its tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName" name="vserver-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName2" name="vserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternative name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverSelflink" name="vserver-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumes" name="volumes" type="inventory.aai.openecomp.org.v9.Volumes" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v9.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Servers, aka virtual machine or VM." /> + <xml-property name="nameProps" value="vserver-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2" /> + <xml-property name="searchable" value="vserver-id,vserver-name,vserver-name2" /> + <xml-property name="dependentOn" value="tenant" /> + <xml-property name="container" value="vservers" /> + </xml-properties> + </java-type> + + <java-type name="LInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of logical interfaces." /> + </xml-properties> + <xml-root-element name="l-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lInterface" name="l-interface" type="inventory.aai.openecomp.org.v9.LInterface" /> + </java-attributes> + </java-type> + + <java-type name="LInterface"> + <xml-root-element name="l-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name given to the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="E.g., CUSTOMER, UPLINK, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6WanLinkIp" name="v6-wan-link-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="macaddr" name="macaddr" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="MAC address for the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Human friendly text regarding this interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlans" name="vlans" type="inventory.aai.openecomp.org.v9.Vlans" /> + <xml-element java-attribute="sriovVfs" name="sriov-vfs" type="inventory.aai.openecomp.org.v9.SriovVfs" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v9.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v9.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical interfaces, e.g., a vnic." /> + <xml-property name="indexedProps" value="macaddr,interface-id,interface-name,network-name" /> + <xml-property name="dependentOn" value="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface" /> + <xml-property name="container" value="l-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="SriovVfs"> + <xml-properties> + <xml-property name="description" value="Collection of SR-IOV Virtual Functions." /> + </xml-properties> + <xml-root-element name="sriov-vfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sriovVf" name="sriov-vf" type="inventory.aai.openecomp.org.v9.SriovVf" /> + </java-attributes> + </java-type> + <java-type name="SriovVf"> + <xml-root-element name="sriov-vf" /> + <java-attributes> + <xml-element java-attribute="pciId" name="pci-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="PCI ID used to identify the sriov-vf" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanFilter" name="vf-vlan-filter" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMacFilter" name="vf-mac-filter" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanStrip" name="vf-vlan-strip" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanAntiSpoofCheck" name="vf-vlan-anti-spoof-check" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMacAntiSpoofCheck" name="vf-mac-anti-spoof-check" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMirrors" name="vf-mirrors" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfBroadcastAllow" name="vf-broadcast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfUnknownMulticastAllow" name="vf-unknown-multicast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfUnknownUnicastAllow" name="vf-unknown-unicast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfInsertStag" name="vf-insert-stag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, instructs to insert outer tag after traffic comes out of VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfLinkStatus" name="vf-link-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This option is used to set the link status. Valid values as of 1607 are on, off, and auto." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="SR-IOV Virtual Function (not to be confused with virtual network function)" /> + <xml-property name="indexedProps" value="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="sriov-vfs" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv4AddressList"> + <xml-root-element name="l3-interface-ipv4-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv4Address" name="l3-interface-ipv4-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv4PrefixLength" name="l3-interface-ipv4-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 32 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv4 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Vlans"> + <xml-root-element name="vlans" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vlan" name="vlan" type="inventory.aai.openecomp.org.v9.Vlan" /> + </java-attributes> + </java-type> + + <java-type name="Vlan"> + <xml-root-element name="vlan" /> + <java-attributes> + <xml-element java-attribute="vlanInterface" name="vlan-interface" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String that identifies the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanDescription" name="vlan-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to describe (the service associated with) the vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="backdoorConnection" name="backdoor-connection" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether customer is going to use this VLAN for backdoor connection to another customer premise device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnId" name="vpn-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This indicates the customers VPN ID associated with this vlan" /> + <xml-property name="dbAlias" value="vpn-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v9.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v9.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Definition of vlan" /> + <xml-property name="indexedProps" value="vlan-interface,vlan-id-inner,vpn-id" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="vlans" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv6AddressList"> + <xml-root-element name="l3-interface-ipv6-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv6Address" name="l3-interface-ipv6-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv6PrefixLength" name="l3-interface-ipv6-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 128 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv6 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Volumes"> + <xml-properties> + <xml-property name="description" value="Collection of ephemeral Block storage volumes." /> + </xml-properties> + <xml-root-element name="volumes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volume" name="volume" type="inventory.aai.openecomp.org.v9.Volume" /> + </java-attributes> + </java-type> + + <java-type name="Volume"> + <xml-root-element name="volume" /> + <java-attributes> + <xml-element java-attribute="volumeId" name="volume-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of block storage volume relative to the vserver." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeSelflink" name="volume-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Ephemeral Block storage volume." /> + <xml-property name="indexedProps" value="volume-id" /> + <xml-property name="dependentOn" value="vserver" /> + <xml-property name="container" value="volumes" /> + </xml-properties> + </java-type> + + <java-type name="Flavors"> + <xml-properties> + <xml-property name="description" value="Collection of openstack flavors." /> + </xml-properties> + <xml-root-element name="flavors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="flavor" name="flavor" type="inventory.aai.openecomp.org.v9.Flavor" /> + </java-attributes> + </java-type> + + <java-type name="Flavor"> + <xml-root-element name="flavor" /> + <java-attributes> + <xml-element java-attribute="flavorId" name="flavor-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Flavor id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorName" name="flavor-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Flavor name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorVcpus" name="flavor-vcpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of CPUs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorRam" name="flavor-ram" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of memory" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisk" name="flavor-disk" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorEphemeral" name="flavor-ephemeral" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of ephemeral disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSwap" name="flavor-swap" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="amount of swap space allocation" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorIsPublic" name="flavor-is-public" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="whether flavor is available to all users or private to the tenant it was created in." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSelflink" name="flavor-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisabled" name="flavor-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Boolean as to whether this flavor is no longer enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack flavor." /> + <xml-property name="nameProps" value="flavor-name" /> + <xml-property name="indexedProps" value="flavor-name,flavor-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="flavors" /> + </xml-properties> + </java-type> + + <java-type name="Snapshots"> + <xml-properties> + <xml-property name="description" value="Collection of openstack snapshots" /> + </xml-properties> + <xml-root-element name="snapshots" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="snapshot" name="snapshot" type="inventory.aai.openecomp.org.v9.Snapshot" /> + </java-attributes> + </java-type> + + <java-type name="Snapshot"> + <xml-root-element name="snapshot" /> + <java-attributes> + <xml-element java-attribute="snapshotId" name="snapshot-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Snapshot id, this is the key UUID assoc associated in glance with the snapshots." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotName" name="snapshot-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Snapshot name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotArchitecture" name="snapshot-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsDistro" name="snapshot-os-distro" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsVersion" name="snapshot-os-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotSelflink" name="snapshot-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="prevSnapshotId" name="prev-snapshot-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field contains the UUID of the previous snapshot (if any)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack snapshot" /> + <xml-property name="nameProps" value="snapshot-name" /> + <xml-property name="uniqueProps" value="snapshot-id" /> + <xml-property name="indexedProps" value="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="snapshots" /> + </xml-properties> + </java-type> + + <java-type name="GroupAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack group assignments" /> + </xml-properties> + <xml-root-element name="group-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="groupAssignment" name="group-assignment" type="inventory.aai.openecomp.org.v9.GroupAssignment" /> + </java-attributes> + </java-type> + + <java-type name="GroupAssignment"> + <xml-root-element name="group-assignment" /> + <java-attributes> + <xml-element java-attribute="groupId" name="group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Group id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupType" name="group-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group type - the type of group this instance refers to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupName" name="group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name - name assigned to the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupDescription" name="group-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group description - description of the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack group-assignment used to store exclusivity groups (EG)." /> + <xml-property name="nameProps" value="group-name" /> + <xml-property name="indexedProps" value="group-id,group-type,group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="group-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Images"> + <xml-properties> + <xml-property name="description" value="Collectio of Openstack images." /> + </xml-properties> + <xml-root-element name="images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="image" name="image" type="inventory.aai.openecomp.org.v9.Image" /> + </java-attributes> + </java-type> + + <java-type name="Image"> + <xml-root-element name="image" /> + <java-attributes> + <xml-element java-attribute="imageId" name="image-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Image id, expected to be unique across cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageName" name="image-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Image name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageArchitecture" name="image-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsDistro" name="image-os-distro" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsVersion" name="image-os-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageSelflink" name="image-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v9.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack image." /> + <xml-property name="nameProps" value="image-name" /> + <xml-property name="indexedProps" value="application,image-name,application-vendor,image-id,application-version" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="images" /> + </xml-properties> + </java-type> + + <java-type name="Metadata"> + <xml-properties> + <xml-property name="description" value="Collection of metadatum (key/value pairs)" /> + </xml-properties> + <xml-root-element name="metadata" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="metadatum" name="metadatum" type="inventory.aai.openecomp.org.v9.Metadatum" /> + </java-attributes> + </java-type> + + <java-type name="Metadatum"> + <xml-root-element name="metadatum" /> + <java-attributes> + <xml-element java-attribute="metaname" name="metaname" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="metaval" name="metaval" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Key/value pairs" /> + <xml-property name="indexedProps" value="metaname" /> + <xml-property name="dependentOn" value="tenant,image,service-instance,connector,model" /> + <xml-property name="container" value="metadata" /> + </xml-properties> + </java-type> + + <java-type name="DvsSwitches"> + <xml-properties> + <xml-property name="description" value="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs." /> + </xml-properties> + <xml-root-element name="dvs-switches" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="dvsSwitch" name="dvs-switch" type="inventory.aai.openecomp.org.v9.DvsSwitch" /> + </java-attributes> + </java-type> + + <java-type name="DvsSwitch"> + <xml-root-element name="dvs-switch" /> + <java-attributes> + <xml-element java-attribute="switchName" name="switch-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="DVS switch name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcenterUrl" name="vcenter-url" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL used to reach the vcenter" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. " /> + <xml-property name="indexedProps" value="vcenter-url,switch-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="dvs-switches" /> + </xml-properties> + </java-type> + + <java-type name="NetworkProfiles"> + <xml-properties> + <xml-property name="description" value="Collection of network profiles" /> + </xml-properties> + <xml-root-element name="network-profiles" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="networkProfile" name="network-profile" type="inventory.aai.openecomp.org.v9.NetworkProfile" /> + </java-attributes> + </java-type> + + <java-type name="NetworkProfile"> + <xml-root-element name="network-profile" /> + <java-attributes> + <xml-element java-attribute="nmProfileName" name="nm-profile-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique name of network profile." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="communityString" name="community-string" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encrypted SNMP community string" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Network profile populated by SDN-GP for SNMP" /> + <xml-property name="indexedProps" value="nm-profile-name" /> + <xml-property name="container" value="network-profiles" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="Pservers"> + <xml-properties> + <xml-property name="description" value="Collection of compute hosts." /> + </xml-properties> + <xml-root-element name="pservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pserver" name="pserver" type="inventory.aai.openecomp.org.v9.Pserver" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Pserver"> + <xml-root-element name="pserver" /> + <java-attributes> + <xml-element java-attribute="hostname" name="hostname" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value from executing hostname on the compute node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ptniiEquipName" name="ptnii-equip-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="PTNII name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="numberOfCpus" name="number-of-cpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of cpus" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="diskInGigabytes" name="disk-in-gigabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk size, in GBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ramInMegabytes" name="ram-in-megabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="RAM size, in MBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="fqdn" name="fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Fully-qualified domain name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverSelflink" name="pserver-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to configure device, also used for troubleshooting and is IP used for traps generated by device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number, may be queried" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback0" name="ipaddress-v4-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback0" name="ipaddress-v6-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Aim" name="ipaddress-v4-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Aim" name="ipaddress-v6-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Oam" name="ipaddress-v6-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 OAM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="invStatus" name="inv-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CANOPI's inventory status. Only set with values exactly as defined by CANOPI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverId" name="pserver-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of Pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="internetTopology" name="internet-topology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="internet topology of Pserver" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverName2" name="pserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="alternative pserver name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="purpose of pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v9.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v9.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver." /> + <xml-property name="nameProps" value="pserver-name2" /> + <xml-property name="indexedProps" value="hostname,in-maint,pserver-id,pserver-name2,inv-status" /> + <xml-property name="searchable" value="hostname,pserver-name2,pserver-id,ipv4-oam-address" /> + <xml-property name="container" value="pservers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="PInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of physical interfaces." /> + </xml-properties> + <xml-root-element name="p-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pInterface" name="p-interface" type="inventory.aai.openecomp.org.v9.PInterface" /> + </java-attributes> + </java-type> + + <java-type name="PInterface"> + <xml-root-element name="p-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the physical interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portDescription" name="port-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nature of the services and connectivity on this port." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentIdentifier" name="equipment-identifier" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CLEI or other specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceType" name="interface-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the physical properties of the interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v9.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Physical interface (e.g., nic)" /> + <xml-property name="indexedProps" value="interface-name,prov-status" /> + <xml-property name="nameProps" value="prov-status" /> + <xml-property name="dependentOn" value="vpls-pe,pserver,pnf" /> + <xml-property name="container" value="p-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="LagInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregate interfaces." /> + </xml-properties> + <xml-root-element name="lag-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagInterface" name="lag-interface" type="inventory.aai.openecomp.org.v9.LagInterface" /> + </java-attributes> + </java-type> + + <java-type name="LagInterface"> + <xml-root-element name="lag-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the link aggregate interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Human friendly text regarding this interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v9.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Link aggregate interface" /> + <xml-property name="indexedProps" value="interface-name,interface-id,interface-role" /> + <xml-property name="dependentOn" value="generic-vnf,pserver,vpe,vpls-pe,pnf" /> + <xml-property name="container" value="lag-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="OamNetworks"> + <xml-properties> + <xml-property name="description" value="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. " /> + </xml-properties> + <xml-root-element name="oam-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="oamNetwork" name="oam-network" type="inventory.aai.openecomp.org.v9.OamNetwork" /> + </java-attributes> + </java-type> + + <java-type name="OamNetwork"> + <xml-root-element name="oam-network" /> + <java-attributes> + <xml-element java-attribute="networkUuid" name="network-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID of the network. Unique across a cloud-region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cvlanTag" name="cvlan-tag" required="true" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="cvlan-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddress" name="ipv4-oam-gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for VNF firewall rule so customer cannot send customer traffic over this oam network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddressPrefixLength" name="ipv4-oam-gateway-address-prefix-length" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Used for VNF firewall rule so customer cannot send customer traffic over this oam network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="OAM network, to be deprecated shortly. Do not use for new purposes. " /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="cvlan-tag,network-uuid,network-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="oam-networks" /> + </xml-properties> + </java-type> + + <java-type name="AvailabilityZones"> + <xml-properties> + <xml-property name="description" value="Collection of availability zones" /> + </xml-properties> + <xml-root-element name="availability-zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v9.AvailabilityZone" /> + </java-attributes> + </java-type> + + <java-type name="AvailabilityZone"> + <xml-root-element name="availability-zone" /> + <java-attributes> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone. Unique across a cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="hypervisorType" name="hypervisor-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of hypervisor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Availability zone, a collection of compute hosts/pservers" /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="availability-zones" /> + </xml-properties> + </java-type> + + <java-type name="VirtualDataCenters"> + <xml-properties> + <xml-property name="description" value="Virtual organization of cloud infrastructure elements in a data center context" /> + </xml-properties> + <xml-root-element name="virtual-data-centers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="virtualDataCenter" name="virtual-data-center" type="inventory.aai.openecomp.org.v9.VirtualDataCenter" /> + </java-attributes> + </java-type> + + <java-type name="VirtualDataCenter"> + <xml-root-element name="virtual-data-center" /> + <java-attributes> + <xml-element java-attribute="vdcId" name="vdc-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the vdc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdcName" name="vdc-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the virtual data center" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual organization of cloud infrastructure elements in a data center context" /> + <xml-property name="nameProps" value="vdc-name" /> + <xml-property name="indexedProps" value="vdc-name,vdc-id" /> + <xml-property name="container" value="virtual-data-centers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + + + + <java-type name="Business"> + <xml-properties> + <xml-property name="description" value="Namespace for business related constructs" /> + </xml-properties> + <xml-root-element name="business" /> + <java-attributes> + <xml-element java-attribute="connectors" name="connectors" type="inventory.aai.openecomp.org.v9.Connectors" /> + <xml-element java-attribute="customers" name="customers" type="inventory.aai.openecomp.org.v9.Customers" /> + </java-attributes> + </java-type> + + <java-type name="Connectors"> + <xml-properties> + <xml-property name="description" value="Collection of resource instances used to connect a variety of disparate inventory widgets" /> + </xml-properties> + <xml-root-element name="connectors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="connector" name="connector" type="inventory.aai.openecomp.org.v9.Connector" /> + </java-attributes> + </java-type> + + <java-type name="Connector"> + <xml-root-element name="connector" /> + <java-attributes> + <xml-element java-attribute="resourceInstanceId" name="resource-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of resource instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v9.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of resource instances used to connect a variety of disparate inventory widgets" /> + <xml-property name="indexedProps" value="resource-instance-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version" /> + <xml-property name="container" value="connectors" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + + <java-type name="Customers"> + <xml-properties> + <xml-property name="description" value="Collection of customer identifiers to provide linkage back to BSS information." /> + </xml-properties> + <xml-root-element name="customers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="customer" name="customer" type="inventory.aai.openecomp.org.v9.Customer" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Customer"> + <xml-root-element name="customer" /> + <java-attributes> + <xml-element java-attribute="globalCustomerId" name="global-customer-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Global customer id used across ECOMP to uniquely identify customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberName" name="subscriber-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber name, an alternate way to retrieve a customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberType" name="subscriber-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber type, a way to provide VID with only the INFRA customers." /> + <xml-property name="defaultValue" value="CUST" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSubscriptions" name="service-subscriptions" type="inventory.aai.openecomp.org.v9.ServiceSubscriptions" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="customer identifiers to provide linkage back to BSS information." /> + <xml-property name="nameProps" value="subscriber-name" /> + <xml-property name="indexedProps" value="subscriber-name,global-customer-id,subscriber-type" /> + <xml-property name="searchable" value="global-customer-id,subscriber-name" /> + <xml-property name="uniqueProps" value="global-customer-id" /> + <xml-property name="container" value="customers" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + + <java-type name="ServiceSubscriptions"> + <xml-properties> + <xml-property name="description" value="Collection of objects that group service instances." /> + </xml-properties> + <xml-root-element name="service-subscriptions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceSubscription" name="service-subscription" type="inventory.aai.openecomp.org.v9.ServiceSubscription" /> + </java-attributes> + </java-type> + + <java-type name="ServiceSubscription"> + <xml-root-element name="service-subscription" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value defined by orchestration to identify this service across ECOMP." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tempUbSubAccountId" name="temp-ub-sub-account-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This property will be deleted from A&AI in the near future. Only stop gap solution." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstances" name="service-instances" type="inventory.aai.openecomp.org.v9.ServiceInstances"> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Object that group service instances." /> + <xml-property name="indexedProps" value="service-type" /> + <xml-property name="dependentOn" value="customer" /> + <xml-property name="container" value="service-subscriptions" /> + <xml-property name="crossEntityReference" value="service-instance,service-type" /> + </xml-properties> + </java-type> + + <java-type name="ServiceInstances"> + <xml-properties> + <xml-property name="description" value="Collection of service instances" /> + </xml-properties> + <xml-root-element name="service-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceInstance" name="service-instance" type="inventory.aai.openecomp.org.v9.ServiceInstance" /> + </java-attributes> + </java-type> + + <java-type name="ServiceInstance"> + <xml-root-element name="service-instance" /> + <java-attributes> + <xml-element java-attribute="serviceInstanceId" name="service-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Uniquely identifies this instance of a service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceName" name="service-instance-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field will store a name assigned to the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthTotal" name="bandwidth-total" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the total bandwidth to be used for this service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vhnPortalUrl" name="vhn-portal-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL customers will use to access the vHN Portal." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operational status of the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceLocationId" name="service-instance-location-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="An identifier that customers assign to the location where this service is being used." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v9.Metadata" /> + <xml-element java-attribute="allottedResources" name="allotted-resources" type="inventory.aai.openecomp.org.v9.AllottedResources" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Instance of a service" /> + <xml-property name="indexedProps" value="service-instance-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status" /> + <xml-property name="nameProps" value="service-instance-name" /> + <xml-property name="searchable" value="service-instance-id,service-instance-name" /> + <xml-property name="uniqueProps" value="service-instance-id" /> + <xml-property name="dependentOn" value="service-subscription" /> + <xml-property name="container" value="service-instances" /> + </xml-properties> + </java-type> + + <java-type name="ServiceDesignAndCreation"> + <xml-properties> + <xml-property name="description" value="Namespace for objects managed by ASDC" /> + </xml-properties> + <xml-root-element name="service-design-and-creation" /> + <java-attributes> + <xml-element java-attribute="vnfImages" name="vnf-images" type="inventory.aai.openecomp.org.v9.VnfImages" /> + <xml-element java-attribute="services" name="services" type="inventory.aai.openecomp.org.v9.Services" /> + <xml-element java-attribute="serviceCapabilities" name="service-capabilities" type="inventory.aai.openecomp.org.v9.ServiceCapabilities" /> + <xml-element java-attribute="models" name="models" type="inventory.aai.openecomp.org.v9.Models" /> + <xml-element java-attribute="namedQueries" name="named-queries" type="inventory.aai.openecomp.org.v9.NamedQueries" /> + </java-attributes> + </java-type> + + <java-type name="VnfImages"> + <xml-properties> + <xml-property name="description" value="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge." /> + </xml-properties> + <xml-root-element name="vnf-images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfImage" name="vnf-image" type="inventory.aai.openecomp.org.v9.VnfImage" /> + </java-attributes> + </java-type> + + <java-type name="VnfImage"> + <xml-root-element name="vnf-image" /> + <java-attributes> + <xml-element java-attribute="vnfImageUuid" name="vnf-image-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of this asset" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge." /> + <xml-property name="indexedProps" value="application,vnf-image-uuid,application-vendor,application-version" /> + <xml-property name="uniqueProps" value="vnf-image-uuid" /> + <xml-property name="container" value="vnf-images" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="Services"> + <xml-properties> + <xml-property name="description" value="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC." /> + </xml-properties> + <xml-root-element name="services" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="service" name="service" type="inventory.aai.openecomp.org.v9.Service" /> + </java-attributes> + </java-type> + + <java-type name="Service"> + <xml-root-element name="service" /> + <java-attributes> + <xml-element java-attribute="serviceId" name="service-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceDescription" name="service-description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description of the service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSelflink" name="service-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceVersion" name="service-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="service version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services." /> + <xml-property name="indexedProps" value="service-description,service-id" /> + <xml-property name="container" value="services" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="ServiceCapabilities"> + <xml-properties> + <xml-property name="description" value="Collection of service capabilities." /> + </xml-properties> + <xml-root-element name="service-capabilities" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceCapability" name="service-capability" type="inventory.aai.openecomp.org.v9.ServiceCapability" /> + </java-attributes> + </java-type> + + <java-type name="ServiceCapability"> + <xml-root-element name="service-capability" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this." /> + <xml-property name="indexedProps" value="service-type,vnf-type" /> + <xml-property name="container" value="service-capabilities" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="Network"> + <xml-properties> + <xml-property name="description" value="Namespace for network inventory resources." /> + </xml-properties> + <xml-root-element name="network" /> + <java-attributes> + <xml-element java-attribute="logicalLinks" name="logical-links" type="inventory.aai.openecomp.org.v9.LogicalLinks" /> + <xml-element java-attribute="sitePairSets" name="site-pair-sets" type="inventory.aai.openecomp.org.v9.SitePairSets" /> + <xml-element java-attribute="vpnBindings" name="vpn-bindings" type="inventory.aai.openecomp.org.v9.VpnBindings" /> + <xml-element java-attribute="vplsPes" name="vpls-pes" type="inventory.aai.openecomp.org.v9.VplsPes" /> + <xml-element java-attribute="multicastConfigurations" name="multicast-configurations" type="inventory.aai.openecomp.org.v9.MulticastConfigurations" /> + <xml-element java-attribute="vces" name="vces" type="inventory.aai.openecomp.org.v9.Vces" /> + <xml-element java-attribute="vpes" name="vpes" type="inventory.aai.openecomp.org.v9.Vpes" /> + <xml-element java-attribute="vnfcs" name="vnfcs" type="inventory.aai.openecomp.org.v9.Vnfcs" /> + <xml-element java-attribute="l3Networks" name="l3-networks" type="inventory.aai.openecomp.org.v9.L3Networks" /> + <xml-element java-attribute="networkPolicies" name="network-policies" type="inventory.aai.openecomp.org.v9.NetworkPolicies" /> + <xml-element java-attribute="genericVnfs" name="generic-vnfs" type="inventory.aai.openecomp.org.v9.GenericVnfs" /> + <xml-element java-attribute="lagLinks" name="lag-links" type="inventory.aai.openecomp.org.v9.LagLinks" /> + <xml-element java-attribute="newvces" name="newvces" type="inventory.aai.openecomp.org.v9.Newvces" /> + <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.openecomp.org.v9.Pnfs" /> + <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.openecomp.org.v9.PhysicalLinks" /> + <xml-element java-attribute="ipsecConfigurations" name="ipsec-configurations" type="inventory.aai.openecomp.org.v9.IpsecConfigurations" /> + <xml-element java-attribute="routeTableReferences" name="route-table-references" type="inventory.aai.openecomp.org.v9.RouteTableReferences" /> + <xml-element java-attribute="instanceGroups" name="instance-groups" type="inventory.aai.openecomp.org.v9.InstanceGroups" /> + <xml-element java-attribute="zones" name="zones" type="inventory.aai.openecomp.org.v9.Zones" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of logical connections" /> + </xml-properties> + <xml-root-element name="logical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="logicalLink" name="logical-link" type="inventory.aai.openecomp.org.v9.LogicalLink" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLink"> + <xml-root-element name="logical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkType" name="link-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of logical link, e.g., evc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4, v6, or ds for dual stack" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingProtocol" name="routing-protocol" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="For example, static or BGP" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of operational status of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkRole" name="link-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of the network use of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkName2" name="link-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alias or alternate name (CLCI or D1 name)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkId" name="link-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the logical-link, SDNC generates this." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Reason for this entity, role it is playing" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical links generally connect l-interfaces but are used to express logical connectivity between two points" /> + <xml-property name="indexedProps" value="link-name,persona-model-id,persona-model-version,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose" /> + <xml-property name="uniqueProps" value="link-id" /> + <xml-property name="container" value="logical-links" /> + <xml-property name="namespace" value="network" /> + <xml-property name="searchable" value="link-name" /> + </xml-properties> + </java-type> + + <java-type name="SitePairSets"> + <xml-properties> + <xml-property name="description" value="Collection of sets of instances for probes related to generic-vnf" /> + </xml-properties> + <xml-root-element name="site-pair-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sitePairSet" name="site-pair-set" type="inventory.aai.openecomp.org.v9.SitePairSet" /> + </java-attributes> + </java-type> + + <java-type name="SitePairSet"> + <xml-root-element name="site-pair-set" /> + <java-attributes> + <xml-element java-attribute="sitePairSetId" name="site-pair-set-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of site pair set." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingInstances" name="routing-instances" type="inventory.aai.openecomp.org.v9.RoutingInstances" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Set of instances for probes used to measure service level agreements" /> + <xml-property name="indexedProps" value="site-pair-set-id" /> + <xml-property name="uniqueProps" value="site-pair-set-id" /> + <xml-property name="container" value="site-pair-sets" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="RoutingInstances"> + <xml-properties> + <xml-property name="description" value="set of probes related to generic-vnf routing instance" /> + </xml-properties> + <xml-root-element name="routing-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routingInstance" name="routing-instance" type="inventory.aai.openecomp.org.v9.RoutingInstance" /> + </java-attributes> + </java-type> + + <java-type name="RoutingInstance"> + <xml-root-element name="routing-instance" /> + <java-attributes> + <xml-element java-attribute="routingInstanceId" name="routing-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of routing instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rpmOwner" name="rpm-owner" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="rpm owner" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sitePairs" name="site-pairs" type="inventory.aai.openecomp.org.v9.SitePairs" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="routing-instance-id" /> + <xml-property name="uniqueProps" value="routing-instance-id" /> + <xml-property name="dependentOn" value="site-pair-set" /> + <xml-property name="container" value="routing-instances" /> + </xml-properties> + </java-type> + + <java-type name="SitePairs"> + <xml-properties> + <xml-property name="description" value="probe within a set" /> + </xml-properties> + <xml-root-element name="site-pairs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sitePair" name="site-pair" type="inventory.aai.openecomp.org.v9.SitePair" /> + </java-attributes> + </java-type> + + <java-type name="SitePair"> + <xml-root-element name="site-pair" /> + <java-attributes> + <xml-element java-attribute="sitePairId" name="site-pair-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique identifier of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceIp" name="source-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prefix address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationIp" name="destination-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prefix address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version, v4, v6" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationHostname" name="destination-hostname" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Hostname of the destination equipment to which SLAs are measured against." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationEquipType" name="destination-equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The type of destinatination equipment. Could be Router, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="classesOfService" name="classes-of-service" type="inventory.aai.openecomp.org.v9.ClassesOfService" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="site-pair-id" /> + <xml-property name="uniqueProps" value="site-pair-id" /> + <xml-property name="dependentOn" value="routing-instance" /> + <xml-property name="container" value="site-pairs" /> + </xml-properties> + </java-type> + + <java-type name="ClassesOfService"> + <xml-properties> + <xml-property name="description" value="class-of-service of probe" /> + </xml-properties> + <xml-root-element name="classes-of-service" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="classOfService" name="class-of-service" type="inventory.aai.openecomp.org.v9.ClassOfService" /> + </java-attributes> + </java-type> + + <java-type name="ClassOfService"> + <xml-root-element name="class-of-service" /> + <java-attributes> + <xml-element java-attribute="cos" name="cos" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique identifier of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="probeId" name="probe-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="probeType" name="probe-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="cos" /> + <xml-property name="dependentOn" value="site-pair" /> + <xml-property name="container" value="classes-of-service" /> + </xml-properties> + </java-type> + + <java-type name="VpnBindings"> + <xml-root-element name="vpn-bindings" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpnBinding" name="vpn-binding" type="inventory.aai.openecomp.org.v9.VpnBinding" /> + </java-attributes> + </java-type> + + <java-type name="VpnBinding"> + <xml-root-element name="vpn-binding" /> + <java-attributes> + <xml-element java-attribute="vpnId" name="vpn-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="VPN ID, globally unique within A&AI" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnName" name="vpn-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="VPN Name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="globalRouteTarget" name="global-route-target" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Number used to identify a VPN, globally unique in the network" /> + <xml-property name="dataLink" value="./route-targets/route-target/{global-route-target}/{route-target-role}" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnPlatform" name="vpn-platform" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the platform associated with the VPN example AVPN, Mobility" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnType" name="vpn-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the vpn, should be taken from enumerated/valid values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeDistinguisher" name="route-distinguisher" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargetRole" name="route-target-role" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this route target" /> + <xml-property name="dataLink" value="./route-targets/route-target/{global-route-target}/{route-target-role}" /> + <xml-property name="defaultValue" value="BOTH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList"> + <xml-properties> + <xml-property name="description" value="l3-networks relate to vpn-bindings" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPN binding" /> + <xml-property name="nameProps" value="vpn-name,vpn-type" /> + <xml-property name="indexedProps" value="vpn-name,vpn-id,global-route-target,vpn-type" /> + <xml-property name="searchable" value="vpn-id,vpn-name" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="container" value="vpn-bindings" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="VplsPes"> + <xml-properties> + <xml-property name="description" value="Collection of VPLS Provider Edge routers" /> + </xml-properties> + <xml-root-element name="vpls-pes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vplsPe" name="vpls-pe" type="inventory.aai.openecomp.org.v9.VplsPe" /> + </java-attributes> + </java-type> + + <java-type name="VplsPe"> + <xml-root-element name="vpls-pe" /> + <java-attributes> + <xml-element java-attribute="equipmentName" name="equipment-name" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value, e.g., VPLS-PE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Temporary location for stag to get to VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v9.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v9.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPLS Provider Edge routers." /> + <xml-property name="indexedProps" value="prov-status,equipment-name" /> + <xml-property name="container" value="vpls-pes" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="MulticastConfigurations"> + <xml-properties> + <xml-property name="description" value="multicast configuration of generic-vnf ip-address" /> + </xml-properties> + <xml-root-element name="multicast-configurations" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="multicastConfiguration" name="multicast-configuration" type="inventory.aai.openecomp.org.v9.MulticastConfiguration" /> + </java-attributes> + </java-type> + + <java-type name="MulticastConfiguration"> + <xml-root-element name="multicast-configuration" /> + <java-attributes> + <xml-element java-attribute="multicastConfigurationId" name="multicast-configuration-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of multicast configuration." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="multicastProtocol" name="multicast-protocol" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="protocol of multicast configuration" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rpType" name="rp-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="rp type of multicast configuration" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="multicast-configuration-id" /> + <xml-property name="uniqueProps" value="multicast-configuration-id" /> + <xml-property name="container" value="multicast-configurations" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Vces"> + <xml-properties> + <xml-property name="description" value="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated." /> + </xml-properties> + <xml-root-element name="vces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vce" name="vce" type="inventory.aai.openecomp.org.v9.Vce" /> + </java-attributes> + </java-type> + + <java-type name="Vce"> + <xml-root-element name="vce" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network role being played by this VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpeId" name="vpe-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID of VPE connected to this VCE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6VceWanAddress" name="v6-vce-wan-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Valid v6 IP address for the WAN Link on this router. Implied length of /64." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - see child relationships" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroups" name="port-groups" type="inventory.aai.openecomp.org.v9.PortGroups" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v9.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v9.Entitlements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="vces" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="PortGroups"> + <xml-root-element name="port-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="portGroup" name="port-group" type="inventory.aai.openecomp.org.v9.PortGroup" /> + </java-attributes> + </java-type> + + <java-type name="PortGroup"> + <xml-root-element name="port-group" /> + <java-attributes> + <xml-element java-attribute="interfaceId" name="interface-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkName" name="neutron-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network name of this Interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupId" name="port-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID for port group in vmware" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupName" name="port-group-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Likely to duplicate value of neutron network name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="switchName" name="switch-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="DVS or standard switch name (should be non-null for port groups associated with DVS)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cvlanTags" name="cvlan-tags" type="inventory.aai.openecomp.org.v9.CvlanTags" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Used to capture the network interfaces of this VCE" /> + <xml-property name="nameProps" value="port-group-name" /> + <xml-property name="indexedProps" value="port-group-id,heat-stack-id,interface-id,interface-name,switch-name" /> + <xml-property name="dependentOn" value="vce" /> + <xml-property name="container" value="port-groups" /> + </xml-properties> + </java-type> + + <java-type name="CvlanTags"> + <xml-root-element name="cvlan-tags" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cvlanTagEntry" name="cvlan-tag-entry" type="inventory.aai.openecomp.org.v9.CvlanTagEntry" /> + </java-attributes> + </java-type> + + <java-type name="CvlanTagEntry"> + <xml-root-element name="cvlan-tag-entry" /> + <java-attributes> + <xml-element java-attribute="cvlanTag" name="cvlan-tag" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="See mis-na-virtualization-platform.yang" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="dependentOn" value="port-group" /> + <xml-property name="indexedProps" value="cvlan-tag" /> + <xml-property name="container" value="cvlan-tags" /> + </xml-properties> + </java-type> + + <java-type name="Vpes"> + <xml-properties> + <xml-property name="description" value="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations." /> + </xml-properties> + <xml-root-element name="vpes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpe" name="vpe" type="inventory.aai.openecomp.org.v9.Vpe" /> + </java-attributes> + </java-type> + + <java-type name="Vpe"> + <xml-root-element name="vpe" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use. See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddressPrefixLength" name="ipv4-oam-gateway-address-prefix-length" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Prefix length for oam-address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddress" name="ipv4-oam-gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Gateway address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v4Loopback0IpAddress" name="v4-loopback0-ip-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Temporary location for stag to get to VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VPE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether vpe access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v9.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v9.LagInterfaces" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v9.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v9.Entitlements" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Relationship-list must include related to info for complex." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="vpes" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="Vnfcs"> + <xml-properties> + <xml-property name="description" value="virtual network components associated with a vserver from application controller." /> + </xml-properties> + <xml-root-element name="vnfcs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfc" name="vnfc" type="inventory.aai.openecomp.org.v9.Vnfc" /> + </java-attributes> + </java-type> + + <java-type name="Vnfc"> + <xml-root-element name="vnfc" /> + <java-attributes> + <xml-element java-attribute="vnfcName" name="vnfc-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vnfc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcFunctionCode" name="vnfc-function-code" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="function code" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcType" name="vnfc-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="prov status of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by APP-C" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4OamVip" name="ipaddress-v4-oam-vip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Oam V4 vip address of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupNotation" name="group-notation" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group notation of VNFC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation" /> + <xml-property name="searchable" value="vnfc-name" /> + <xml-property name="container" value="vnfcs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="L3Networks"> + <xml-root-element name="l3-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="l3Network" name="l3-network" type="inventory.aai.openecomp.org.v9.L3Network" /> + </java-attributes> + </java-type> + + <java-type name="L3Network"> + <xml-root-element name="l3-network" /> + <java-attributes> + <xml-element java-attribute="networkId" name="network-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Network ID, should be uuid. Unique across A&AI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network, governed by some naming convention.." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkType" name="network-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the network - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRole" name="network-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role the network plans - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkTechnology" name="network-technology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network technology - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBoundToVpn" name="is-bound-to-vpn" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Set to true if bound to VPN" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRoleInstance" name="network-role-instance" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="network role instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailNetworkFqdn" name="contrail-network-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="dbAlias" value="model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalNetworkName" name="physical-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the physical network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isProviderNetwork" name="is-provider-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a provider network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isSharedNetwork" name="is-shared-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a shared network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isExternalNetwork" name="is-external-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is an external network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnets" name="subnets" type="inventory.aai.openecomp.org.v9.Subnets" /> + <xml-element java-attribute="ctagAssignments" name="ctag-assignments" type="inventory.aai.openecomp.org.v9.CtagAssignments" /> + <xml-element java-attribute="segmentationAssignments" name="segmentation-assignments" type="inventory.aai.openecomp.org.v9.SegmentationAssignments" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" > + <xml-properties> + <xml-property name="description" value="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Generic network definition" /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="heat-stack-id,network-uuid,service-id,network-id,network-name,persona-model-id,persona-model-version,widget-model-id,widget-model-version,contrail-network-fqdn,network-role" /> + <xml-property name="searchable" value="network-id,network-name" /> + <xml-property name="uniqueProps" value="network-id" /> + <xml-property name="container" value="l3-networks" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="NetworkPolicies"> + <xml-root-element name="network-policies" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="networkPolicy" name="network-policy" type="inventory.aai.openecomp.org.v9.NetworkPolicy" /> + </java-attributes> + </java-type> + <java-type name="NetworkPolicy"> + <xml-root-element name="network-policy" /> + <java-attributes> + <xml-element java-attribute="networkPolicyId" name="network-policy-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID representing unique key to this instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkPolicyFqdn" name="network-policy-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the policy" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID for the openStack Heat instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="nameProps" value="network-policy-fqdn" /> + <xml-property name="indexedProps" value="network-policy-id,network-policy-fqdn" /> + <xml-property name="searchable" value="network-policy-id,network-policy-fqdn" /> + <xml-property name="uniqueProps" value="network-policy-id" /> + <xml-property name="container" value="network-policies" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="CtagAssignments"> + <xml-root-element name="ctag-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagAssignment" name="ctag-assignment" type="inventory.aai.openecomp.org.v9.CtagAssignment" /> + </java-attributes> + </java-type> + + <java-type name="CtagAssignment"> + <xml-root-element name="ctag-assignment" /> + <java-attributes> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="id." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vlan-id-inner" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="ctag-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Subnets"> + <xml-root-element name="subnets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="subnet" name="subnet" type="inventory.aai.openecomp.org.v9.Subnet" /> + </java-attributes> + </java-type> + + <java-type name="Subnet"> + <xml-root-element name="subnet" /> + <java-attributes> + <xml-element java-attribute="subnetId" name="subnet-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Subnet ID, should be UUID." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnetName" name="subnet-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the subnet." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of this subnet" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="gatewayAddress" name="gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="gateway ip address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkStartAddress" name="network-start-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="network start address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cidrMask" name="cidr-mask" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="cidr mask" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="dhcpEnabled" name="dhcp-enabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="dhcp enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpStart" name="dhcp-start" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the start address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpEnd" name="dhcp-end" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the last address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="subnet-id,subnet-name" /> + <xml-property name="nameProps" value="subnet-name" /> + <xml-property name="uniqueProps" value="subnet-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="subnets" /> + </xml-properties> + </java-type> + + <java-type name="GenericVnfs"> + <xml-properties> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + <xml-root-element name="generic-vnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="genericVnf" name="generic-vnf" type="inventory.aai.openecomp.org.v9.GenericVnf" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="GenericVnf"> + <xml-root-element name="generic-vnf" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, used by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether generic-vnf access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="dbAlias" value="model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="represents sub zone of the rr plane" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v9.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v9.LagInterfaces" /> + <xml-element java-attribute="vfModules" name="vf-modules" type="inventory.aai.openecomp.org.v9.VfModules" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v9.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v9.Entitlements" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="generic-vnfs" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="VfModules"> + <xml-properties> + <xml-property name="description" value="Collection of vf-modules, a deployment unit of VNFCs" /> + </xml-properties> + <xml-root-element name="vf-modules" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vfModule" name="vf-module" type="inventory.aai.openecomp.org.v9.VfModule" /> + </java-attributes> + </java-type> + + <java-type name="VfModule"> + <xml-root-element name="vf-module" /> + <java-attributes> + <xml-element java-attribute="vfModuleId" name="vf-module-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vf-module." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleName" name="vf-module-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vf-module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration status of this vf-module, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBaseVfModule" name="is-base-vf-module" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is base vf module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="dbAlias" value="model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailServiceInstanceFqdn" name="contrail-service-instance-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the Contrail unique ID for a service-instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="moduleIndex" name="module-index" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="a deployment unit of VNFCs" /> + <xml-property name="indexedProps" value="vf-module-id,vf-module-name,heat-stack-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,contrail-service-instance-fqdn" /> + <xml-property name="searchable" value="vf-module-id,vf-module-name" /> + <xml-property name="dependentOn" value="generic-vnf" /> + <xml-property name="container" value="vf-modules" /> + </xml-properties> + </java-type> + + + <java-type name="LagLinks"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregation connections" /> + </xml-properties> + <xml-root-element name="lag-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagLink" name="lag-link" type="inventory.aai.openecomp.org.v9.LagLink" /> + </java-attributes> + </java-type> + + <java-type name="LagLink"> + <xml-root-element name="lag-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Alphabetical concatenation of lag-interface names" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="LAG links can connect lag-interfaces" /> + <xml-property name="indexedProps" value="link-name" /> + <xml-property name="container" value="lag-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Newvces"> + <xml-properties> + <xml-property name="description" value="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce." /> + </xml-properties> + <xml-root-element name="newvces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="newvce" name="newvce" type="inventory.aai.openecomp.org.v9.Newvce" /> + </java-attributes> + </java-type> + + <java-type name="Newvce"> + <xml-root-element name="newvce" /> + <java-attributes> + <xml-element java-attribute="vnfId2" name="vnf-id2" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF, can't use same attribute name right now until we promote this new object" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value, e.g., VPE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v9.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2" /> + <xml-property name="searchable" value="vnf-id2,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id2" /> + <xml-property name="container" value="newvces" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Pnfs"> + <xml-properties> + <xml-property name="description" value="Collection of Physical Network Functions." /> + </xml-properties> + <xml-root-element name="pnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pnf" name="pnf" type="inventory.aai.openecomp.org.v9.Pnf" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Pnf"> + <xml-root-element name="pnf" /> + <java-attributes> + <xml-element java-attribute="pnfName" name="pnf-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2" name="pnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2Source" name="pnf-name2-source" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="source of name2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfId" name="pnf-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="id of pnf" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Oam" name="ipaddress-v4-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ipv4-oam-address with new naming convention for IP addresses" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="swVersion" name="sw-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="sw-version is the version of SW for the hosted application on the PNF." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="frameId" name="frame-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of the physical frame (relay rack) where pnf is installed." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number of the device" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback0" name="ipaddress-v4-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback0" name="ipaddress-v6-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Aim" name="ipaddress-v4-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Aim" name="ipaddress-v6-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Oam" name="ipaddress-v6-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 OAM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="invStatus" name="inv-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CANOPI's inventory status. Only set with values exactly as defined by CANOPI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfRole" name="nf-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nf Role is the role performed by this instance in the network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v9.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v9.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="PNF represents a physical network function. typically equipment used in the D1 world." /> + <xml-property name="indexedProps" value="pnf-name,orchestration-status,inv-status" /> + <xml-property name="searchable" value="pnf-name" /> + <xml-property name="uniqueProps" value="pnf-name" /> + <xml-property name="container" value="pnfs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="PhysicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + </xml-properties> + <xml-root-element name="physical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="physicalLink" name="physical-link" type="inventory.aai.openecomp.org.v9.PhysicalLink" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="PhysicalLink"> + <xml-root-element name="physical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit it" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dualMode" name="dual-mode" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Dual access mode (e.g., primary, secondary" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="To provide information on who manages this circuit. A&AI or 3rd party transport provider" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceProviderName" name="service-provider-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the service Provider on this link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + <xml-property name="indexedProps" value="circuit-id,link-name" /> + <xml-property name="alternateKeys1" value="circuit-id" /> + <xml-property name="container" value="physical-links" /> + <xml-property name="namespace" value="network" /> + <xml-property name="searchable" value="link-name,circuit-id" /> + </xml-properties> + </java-type> + + <java-type name="VigServers"> + <xml-root-element name="vig-servers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vigServer" name="vig-server" type="inventory.aai.openecomp.org.v9.VigServer" /> + </java-attributes> + </java-type> + + <java-type name="VigServer"> + <xml-root-element name="vig-server" /> + <java-attributes> + <xml-element java-attribute="vigAddressType" name="vig-address-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="indicates whether the VIG is for AVPN or INTERNET" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="ipaddressV4Vig" name="ipaddress-v4-vig" type="java.lang.String" > + <xml-properties> + <xml-property name="description" value="v4 IP of the vig server" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="ipaddressV6Vig" name="ipaddress-v6-vig" type="java.lang.String" > + <xml-properties> + <xml-property name="description" value="v6 IP of the vig server" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607" /> + <xml-property name="indexedProps" value="vig-address-type" /> + <xml-property name="dependentOn" value="ipsec-configuration" /> + <xml-property name="container" value="vig-servers" /> + </xml-properties> + </java-type> + + <java-type name="IpsecConfigurations"> + <xml-root-element name="ipsec-configurations" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ipsecConfiguration" name="ipsec-configuration" type="inventory.aai.openecomp.org.v9.IpsecConfiguration" /> + </java-attributes> + </java-type> + + <java-type name="IpsecConfiguration"> + <xml-root-element name="ipsec-configuration" /> + <java-attributes> + <xml-element java-attribute="ipsecConfigurationId" name="ipsec-configuration-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID of this configuration" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedVigAddressType" name="requested-vig-address-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicate the type of VIG server like AVPN, INTERNET, BOTH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedEncryptionStrength" name="requested-encryption-strength" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedDmzType" name="requested-dmz-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="can offer a shared DMZ or a DMZ specific to a customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sharedDmzNetworkAddress" name="shared-dmz-network-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network address of shared DMZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedCustomerName" name="requested-customer-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="If the DMZ is a custom DMZ, this field will indicate the customer information" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikeVersion" name="ike-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="can be 1 or 2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1Authentication" name="ikev1-authentication" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contains values like md5, sha1, sha256, sha384" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1Encryption" name="ikev1-encryption" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1DhGroup" name="ikev1-dh-group" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1AmGroupId" name="ikev1-am-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name defined in VIG for clients using aggressive mode" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1AmPassword" name="ikev1-am-password" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="pre-shared key for the above group name " /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1SaLifetime" name="ikev1-sa-lifetime" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Lifetime for IKEv1 SA" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecAuthentication" name="ipsec-authentication" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="md5, sha1, sha256, sha384" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecEncryption" name="ipsec-encryption" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecSaLifetime" name="ipsec-sa-lifetime" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Life time for IPSec SA" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecPfs" name="ipsec-pfs" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="enable PFS or not" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="xauthUserId" name="xauth-userid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="user ID for xAuth, sm-user, nmteHostName" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="xauthUserPassword" name="xauth-user-password" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encrypted using the Juniper $9$ algorithm" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dpdInterval" name="dpd-interval" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The time between DPD probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dpdFrequency" name="dpd-frequency" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Maximum number of DPD before claiming the tunnel is down" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + <xml-element java-attribute="vigServers" name="vig-servers" type="inventory.aai.openecomp.org.v9.VigServers" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C" /> + <xml-property name="indexedProps" value="ipsec-configuration-id" /> + <xml-property name="uniqueProps" value="ipsec-configuration-id" /> + <xml-property name="container" value="ipsec-configurations" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + + <java-type name="NotificationEvent"> + <xml-root-element name="notification-event" /> + <java-attributes> + <xml-element java-attribute="cambriaPartition" name="cambria.partition" type="java.lang.String" /> + <xml-element java-attribute="eventHeader" name="event-header" type="inventory.aai.openecomp.org.v9.NotificationEventHeader" /> + <xml-any-element java-attribute="entity" /> + </java-attributes> + </java-type> + <java-type name="NotificationEventHeader"> + <xml-root-element name="notification-event-header" /> + <java-attributes> + <xml-element java-attribute="id" name="id" type="java.lang.String" /> + <xml-element java-attribute="timestamp" name="timestamp" type="java.lang.String" /> + <xml-element java-attribute="sourceName" name="source-name" type="java.lang.String" /> + <xml-element java-attribute="domain" name="domain" type="java.lang.String" /> + <xml-element java-attribute="sequenceNumber" name="sequence-number" type="java.lang.String" /> + <xml-element java-attribute="severity" name="severity" type="java.lang.String" /> + <xml-element java-attribute="eventType" name="event-type" type="java.lang.String" /> + <xml-element java-attribute="version" name="version" type="java.lang.String" /> + <xml-element java-attribute="action" name="action" type="java.lang.String" /> + <xml-element java-attribute="entityType" name="entity-type" type="java.lang.String" /> + <xml-element java-attribute="topEntityType" name="top-entity-type" type="java.lang.String" /> + <xml-element java-attribute="entityLink" name="entity-link" type="java.lang.String" /> + <xml-element java-attribute="status" name="status" type="java.lang.String" /> + </java-attributes> + </java-type> + <java-type name="AaiInternal"> + <xml-root-element name="aai-internal" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="reservedPropNames" name="reserved-prop-names" type="inventory.aai.openecomp.org.v9.ReservedPropNames" /> + <xml-element container-type="java.util.ArrayList" java-attribute="edgePropNames" name="edge-prop-names" type="inventory.aai.openecomp.org.v9.EdgePropNames" /> + </java-attributes> + </java-type> + <java-type name="ReservedPropNames"> + <xml-properties> + <xml-property name="description" value="Internal map to define some reserved properties of a vertex" /> + <xml-property name="uniqueProps" value="aai-unique-key" /> + <xml-property name="indexedProps" value="aai-unique-key,source-of-truth,aai-node-type,aai-uri" /> + </xml-properties> + <xml-root-element name="reserved-prop-names" /> + <java-attributes> + <xml-element java-attribute="lastModSourceOfTruth" name="last-mod-source-of-truth" type="java.lang.String" /> + <xml-element java-attribute="aaiNodeType" name="aai-node-type" type="java.lang.String" /> + <xml-element java-attribute="aaiCreatedTs" name="aai-created-ts" type="java.lang.Long" /> + <xml-element java-attribute="aaiUniqueKey" name="aai-unique-key" type="java.lang.String" /> + <xml-element java-attribute="aaiLastModTs" name="aai-last-mod-ts" type="java.lang.Long" /> + <xml-element java-attribute="sourceOfTruth" name="source-of-truth" type="java.lang.String" /> + <xml-element java-attribute="aaiUri" name="aai-uri" type="java.lang.String" /> + </java-attributes> + </java-type> + <java-type name="EdgePropNames"> + <!-- NOTE that the names of these properties are not consistent and are in mixed case and hyphen case for now --> + <xml-properties> + <xml-property name="description" value="Internal map to define the properties of an edge and interpret the map EdgeRules" /> + <xml-property name="edgeInfo" value="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV" /> + </xml-properties> + <xml-root-element name="edge-prop-names" /> + <java-attributes> + <xml-element java-attribute="edgeLabel" name="edgeLabel" type="java.lang.String" /> + <xml-element java-attribute="direction" name="direction" type="java.lang.String" /> + <xml-element java-attribute="multiplicityRule" name="multiplicityRule" type="java.lang.String" /> + <xml-element java-attribute="isParent" name="isParent" type="java.lang.Boolean" /> + <xml-element java-attribute="usesResource" name="usesResource" type="java.lang.Boolean" /> + <xml-element java-attribute="hasDelTarget" name="hasDelTarget" type="java.lang.Boolean" /> + <xml-element java-attribute="SVC-INFRA" name="SVC-INFRA" type="java.lang.Boolean" /> + <xml-element java-attribute="SVC-INFRA-REV" name="SVC-INFRA-REV" type="java.lang.Boolean" /> + </java-attributes> + </java-type> + + <java-type name="Models"> + <xml-properties> + <xml-property name="description" value="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models" /> + </xml-properties> + <xml-root-element name="models" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="model" name="model" type="inventory.aai.openecomp.org.v9.Model" /> + </java-attributes> + </java-type> + + <java-type name="Model"> + <xml-root-element name="model" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version" /> + <xml-property name="nameProps" value="model-type" /> + <xml-property name="indexedProps" value="model-invariant-id,model-type" /> + <xml-property name="uniqueProps" value="model-invariant-id" /> + <xml-property name="container" value="models" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v9.ModelVers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + + <java-type name="ModelVers"> + <xml-root-element name="model-vers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelVer" name="model-ver" type="inventory.aai.openecomp.org.v9.ModelVer" /> + </java-attributes> + </java-type> + + <java-type name="ModelVer"> + <xml-root-element name="model-ver" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models" /> + <xml-property name="nameProps" value="model-name" /> + <xml-property name="indexedProps" value="model-version-id,model-name,model-version" /> + <xml-property name="uniqueProps" value="model-version-id" /> + <xml-property name="container" value="model-vers" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelVersionId" name="model-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v9.ModelElements" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v9.Metadata" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelElements"> + <xml-root-element name="model-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelElement" name="model-element" type="inventory.aai.openecomp.org.v9.ModelElement" /> + </java-attributes> + </java-type> + + <java-type name="ModelElement"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model." /> + <xml-property name="uniqueProps" value="model-element-uuid" /> + <xml-property name="indexedProps" value="model-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-elements" /> + </xml-properties> + <xml-root-element name="model-element" /> + <java-attributes> + <xml-element java-attribute="modelElementUuid" name="model-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="newDataDelFlag" name="new-data-del-flag" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates whether this element was created as part of instantiation from this model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cardinality" name="cardinality" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="How many of this type of element are required/allowed" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="linkagePoints" name="linkage-points" type="java.lang.String" > + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v9.ModelElements"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelConstraints" name="model-constraints" type="inventory.aai.openecomp.org.v9.ModelConstraints"> + <xml-properties> + <xml-property name="description" value="Describes new constraints on this model element that are not part of that model's definition" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraints"> + <xml-root-element name="model-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelConstraint" name="model-constraint" type="inventory.aai.openecomp.org.v9.ModelConstraint" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraint"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="model-constraint-uuid" /> + <xml-property name="indexedProps" value="model-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-constraints" /> + </xml-properties> + <xml-root-element name="model-constraint" /> + <java-attributes> + <xml-element java-attribute="modelConstraintUuid" name="model-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constrainedElementSetUuidToReplace" name="constrained-element-set-uuid-to-replace" required="true" type="java.lang.String" /> + <xml-element java-attribute="constrainedElementSets" name="constrained-element-sets" type="inventory.aai.openecomp.org.v9.ConstrainedElementSets" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSets"> + <xml-root-element name="constrained-element-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="constrainedElementSet" name="constrained-element-set" type="inventory.aai.openecomp.org.v9.ConstrainedElementSet" /> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="constrained-element-set-uuid" /> + <xml-property name="indexedProps" value="constrained-element-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="constrained-element-sets" /> + </xml-properties> + <xml-root-element name="constrained-element-set" /> + <java-attributes> + <xml-element java-attribute="constrainedElementSetUuid" name="constrained-element-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="checkType" name="check-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="elementChoiceSets" name="element-choice-sets" type="inventory.aai.openecomp.org.v9.ElementChoiceSets" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSets"> + <xml-root-element name="element-choice-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="elementChoiceSet" name="element-choice-set" type="inventory.aai.openecomp.org.v9.ElementChoiceSet" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="element-choice-set-uuid" /> + <xml-property name="indexedProps" value="element-choice-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="element-choice-sets" /> + </xml-properties> + <xml-root-element name="element-choice-set" /> + <java-attributes> + <xml-element java-attribute="elementChoiceSetUuid" name="element-choice-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elementChoiceSetName" name="element-choice-set-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="cardinality" name="cardinality" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v9.ModelElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueries"> + <xml-root-element name="named-queries" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v9.NamedQuery" /> + </java-attributes> + </java-type> + + <java-type name="NamedQuery"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="nameProps" value="named-query-name" /> + <xml-property name="uniqueProps" value="named-query-uuid" /> + <xml-property name="indexedProps" value="named-query-uuid,named-query-name" /> + <xml-property name="container" value="named-queries" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="named-query" /> + <java-attributes> + <xml-element java-attribute="namedQueryUuid" name="named-query-uuid" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="namedQueryName" name="named-query-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="namedQueryVersion" name="named-query-version" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="requiredInputParams" name="required-input-param" type="java.lang.String" > + <xml-element-wrapper name="required-input-params" /> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v9.NamedQueryElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElements"> + <xml-root-element name="named-query-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQueryElement" name="named-query-element" type="inventory.aai.openecomp.org.v9.NamedQueryElement" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElement"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="named-query-element-uuid" /> + <xml-property name="indexedProps" value="named-query-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="named-query-elements" /> + </xml-properties> + <xml-root-element name="named-query-element" /> + <java-attributes> + <xml-element java-attribute="namedQueryElementUuid" name="named-query-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="propertyLimitDesc" name="property-limit-desc" type="java.lang.String" /> + <xml-element java-attribute="doNotOutput" name="do-not-output" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v9.NamedQueryElements" /> + <xml-element java-attribute="relatedLookups" name="related-lookups" type="inventory.aai.openecomp.org.v9.RelatedLookups" /> + <xml-element java-attribute="propertyConstraints" name="property-constraints" type="inventory.aai.openecomp.org.v9.PropertyConstraints" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookups"> + <xml-root-element name="related-lookups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedLookup" name="related-lookup" type="inventory.aai.openecomp.org.v9.RelatedLookup" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookup"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="related-lookup-uuid" /> + <xml-property name="indexedProps" value="related-lookup-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="related-lookups" /> + </xml-properties> + <xml-root-element name="related-lookup" /> + <java-attributes> + <xml-element java-attribute="relatedLookupUuid" name="related-lookup-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceNodeType" name="source-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="sourceNodeProperty" name="source-node-property" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeType" name="target-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeProperty" name="target-node-property" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraints"> + <xml-root-element name="property-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyConstraint" name="property-constraint" type="inventory.aai.openecomp.org.v9.PropertyConstraint" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraint"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="property-constraint-uuid" /> + <xml-property name="indexedProps" value="property-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="property-constraints" /> + </xml-properties> + <xml-root-element name="property-constraint" /> + <java-attributes> + <xml-element java-attribute="propertyConstraintUuid" name="property-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="propertyName" name="property-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ModelAndNamedQuerySearch"> + <xml-properties> + <xml-property name="description" value="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="model-and-named-query-search" /> + <java-attributes> + <xml-element java-attribute="queryParameters" name="query-parameters" type="inventory.aai.openecomp.org.v9.QueryParameters" /> + <xml-element java-attribute="instanceFilters" name="instance-filters" type="inventory.aai.openecomp.org.v9.InstanceFilters" /> + <xml-element java-attribute="secondaryFilts" name="secondary-filts" type="inventory.aai.openecomp.org.v9.SecondaryFilts" /> + <xml-element java-attribute="topNodeType" name="top-node-type" type="java.lang.String" /> + <xml-element java-attribute="secondaryFilterCutPoint" name="secondary-filter-cut-point" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="QueryParameters"> + <xml-properties> + <xml-property name="description" value="QueryParameters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="query-parameters" /> + <java-attributes> + <xml-element java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v9.NamedQuery" /> + <xml-element java-attribute="model" name="model" type="inventory.aai.openecomp.org.v9.OverloadedModel" /> + </java-attributes> + </java-type> + + <java-type name="OverloadedModel"> + <xml-root-element name="overloaded-model" /> + <xml-properties> + <xml-property name="description" value="Allows for legacy POST of old-style and new-style models" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelNameVersionId" name="model-name-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelId" name="model-id" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Invariant unique ID which does not change from version to version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v9.ModelVers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilters"> + <xml-properties> + <xml-property name="description" value="InstanceFilters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="instance-filters" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceFilter" name="instance-filter" type="inventory.aai.openecomp.org.v9.InstanceFilter" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilter"> + <xml-properties> + <xml-property name="description" value="InstanceFilter for performing a named-query or model query" /> + <xml-property name="container" value="instance-filters" /> + </xml-properties> + <xml-root-element name="instance-filter" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilts"> + <xml-properties> + <xml-property name="description" value="SecondaryFilts for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="secondary-filts" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilt" name="secondary-filt" type="inventory.aai.openecomp.org.v9.SecondaryFilt" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilt"> + <xml-properties> + <xml-property name="description" value="SecondaryFilt for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="secondary-filt" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + + <java-type name="Properties"> + <xml-properties> + <xml-property name="description" value="Property holder for query properties or instance properties" /> + </xml-properties> + <xml-root-element name="properties" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ResponseList"> + <xml-properties> + <xml-property name="description" value="Response container for the results of a named-query or model query" /> + </xml-properties> + <xml-root-element name="response-list" /> + <java-attributes> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v9.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItems"> + <xml-properties> + <xml-property name="description" value="Container for inventory items in response list" /> + <xml-property name="container" value="response-list" /> + </xml-properties> + <xml-root-element name="inventory-response-items" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryResponseItem" name="inventory-response-item" type="inventory.aai.openecomp.org.v9.InventoryResponseItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItem"> + <xml-properties> + <xml-property name="description" value="Inventory item for response list" /> + <xml-property name="container" value="inventory-response-items" /> + </xml-properties> + <xml-root-element name="inventory-response-item" /> + <java-attributes> + <xml-element java-attribute="modelName" name="model-name" type="java.lang.String" /> + <xml-any-element java-attribute="item" /> + <xml-element java-attribute="extraProperties" name="extra-properties" type="inventory.aai.openecomp.org.v9.ExtraProperties" /> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v9.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperties"> + <xml-properties> + <xml-property name="description" value="Extra properties for inventory item for response list" /> + </xml-properties> + <xml-root-element name="extra-properties" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="extraProperty" name="extra-property" type="inventory.aai.openecomp.org.v9.ExtraProperty" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperty"> + <xml-root-element name="extra-property" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-any-element java-attribute="propertyValue" lax="true" name="property-value" /> + </java-attributes> + </java-type> + + <java-type name="RouteTableReferences"> + <xml-properties> + <xml-property name="description" value="Collection of openstack route table references" /> + </xml-properties> + <xml-root-element name="route-table-references" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routeTableReference" name="route-table-reference" type="inventory.aai.openecomp.org.v9.RouteTableReference" /> + </java-attributes> + </java-type> + + <java-type name="RouteTableReference"> + <xml-root-element name="route-table-reference" /> + <java-attributes> + <xml-element java-attribute="routeTableReferenceId" name="route-table-reference-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTableReferenceFqdn" name="route-table-reference-fqdn" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="FQDN entry in the route table." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="Openstack route table reference." /> + <xml-property name="nameProps" value="route-table-reference-fqdn" /> + <xml-property name="uniqueProps" value="route-table-reference-id" /> + <xml-property name="indexedProps" value="route-table-reference-id,route-table-reference-fqdn" /> + <xml-property name="container" value="route-table-references" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="InstanceGroups"> + <xml-properties> + <xml-property name="description" value="Collection of openstack route table references" /> + </xml-properties> + <xml-root-element name="instance-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceGroup" name="instance-group" type="inventory.aai.openecomp.org.v9.InstanceGroup" /> + </java-attributes> + </java-type> + + <java-type name="InstanceGroup"> + <xml-root-element name="instance-group" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Instance Group ID, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="description" name="description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Descriptive text to help identify the usage of this instance-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="type" name="type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Only valid value today is lower case ha for high availability" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subType" name="sub-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="General mechanism for grouping instances" /> + <xml-property name="nameProps" value="description" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id,description,type,sub-type" /> + <xml-property name="container" value="instance-groups" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + + <java-type name="SegmentationAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack segmentation assignments" /> + </xml-properties> + <xml-root-element name="segmentation-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="segmentationAssignment" name="segmentation-assignment" type="inventory.aai.openecomp.org.v9.SegmentationAssignment" /> + </java-attributes> + </java-type> + + <java-type name="SegmentationAssignment"> + <xml-root-element name="segmentation-assignment" /> + <java-attributes> + <xml-element java-attribute="segmentationId" name="segmentation-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack segmentation assignment." /> + <xml-property name="indexedProps" value="segmentation-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="segmentation-assignments" /> + </xml-properties> + </java-type> + + <java-type name="AllottedResources"> + <xml-properties> + <xml-property name="description" value="This object is used to store slices of services being offered" /> + </xml-properties> + <xml-root-element name="allotted-resources" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="allottedResource" name="allotted-resource" type="inventory.aai.openecomp.org.v9.AllottedResource" /> + </java-attributes> + </java-type> + + <java-type name="AllottedResource"> + <xml-root-element name="allotted-resource" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Allotted Resource id UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The descriptive information assigned to this allotted resource instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Link back to more information in the controller" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="dbAlias" value="model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tunnelXconnects" name="tunnel-xconnects" type="inventory.aai.openecomp.org.v9.TunnelXconnects" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="Represents a slice or partial piece of a resource that gets separately allotted" /> + <xml-property name="nameProps" value="description" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id,persona-model-id,persona-model-version" /> + <xml-property name="dependentOn" value="service-instance" /> + <xml-property name="container" value="allotted-resources" /> + <!-- <xml-property name="namespace" value="network" /> --> + </xml-properties> + </java-type> + + <java-type name="TunnelXconnects"> + <xml-properties> + <xml-property name="description" value="This object is used to store the specific tunnel cross connect aspects of an allotted resource" /> + </xml-properties> + <xml-root-element name="tunnel-xconnects" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tunnelXconnect" name="tunnel-xconnect" type="inventory.aai.openecomp.org.v9.TunnelXconnect" /> + </java-attributes> + </java-type> + + <java-type name="TunnelXconnect"> + <xml-root-element name="tunnel-xconnect" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Allotted Resource id UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN uplink bandwidth for WAN1" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN downlink bandwidth for WAN1" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN uplink bandwidth for WAN2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN downlink bandwidth for WAN2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id" /> + <xml-property name="dependentOn" value="allotted-resource" /> + <xml-property name="container" value="tunnel-xconnects" /> + <!-- <xml-property name="namespace" value="network" /> --> + </xml-properties> + </java-type> + + <java-type name="Entitlements"> + <xml-properties> + <xml-property name="description" value="Entitlements, keyed by group-uuid and resource-uuid, related to license management" /> + </xml-properties> + <xml-root-element name="entitlements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="entitlement" name="entitlement" type="inventory.aai.openecomp.org.v9.Entitlement" /> + </java-attributes> + </java-type> + + <java-type name="Entitlement"> + <xml-root-element name="entitlement" /> + <java-attributes> + <xml-element java-attribute="groupUuid" name="group-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID for the entitlement group the resource comes from, should be uuid." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceUuid" name="resource-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of an entitlement resource. " /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Metadata for entitlement group." /> + <xml-property name="indexedProps" value="group-uuid,resource-uuid" /> + <xml-property name="dependentOn" value="generic-vnf,vce,vpe" /> + <xml-property name="container" value="entitlements" /> + </xml-properties> + </java-type> + + + <java-type name="Licenses"> + <xml-properties> + <xml-property name="description" value="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management" /> + </xml-properties> + <xml-root-element name="licenses" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="license" name="license" type="inventory.aai.openecomp.org.v9.License" /> + </java-attributes> + </java-type> + + <java-type name="License"> + <xml-root-element name="license" /> + <java-attributes> + <xml-element java-attribute="groupUuid" name="group-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID for the license group the resource belongs to, should be uuid." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceUuid" name="resource-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of a license resource. " /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Metadata for license group." /> + <xml-property name="indexedProps" value="group-uuid,resource-uuid" /> + <xml-property name="dependentOn" value="generic-vnf,vce,vpe" /> + <xml-property name="container" value="licenses" /> + </xml-properties> + </java-type> + + <java-type name="Vnf"> + <xml-root-element name="vnf"/> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Abstract vnf class" /> + <xml-property name="indexedProps" value="vnf-id" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="inheritors" value="vce,vpe,generic-vnf" /> + <xml-property name="abstract" value="true" /> + </xml-properties> + </java-type> + + <java-type name="Zones"> + <xml-properties> + <xml-property name="description" value="Collection of zones" /> + </xml-properties> + <xml-root-element name="zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="zone" name="zone" type="inventory.aai.openecomp.org.v9.Zone" /> + </java-attributes> + </java-type> + + <java-type name="Zone"> + <xml-root-element name="zone" /> + <java-attributes> + <xml-element java-attribute="zoneId" name="zone-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Code assigned by AIC to the zone" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneName" name="zone-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="English name associated with the zone" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="designType" name="design-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Design of zone [Medium/Large…]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneContext" name="zone-context" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Context of zone [production/test]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="status" name="status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Status of a zone." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="A zone is a grouping of assets in a location homing to the same connections into the CBB" /> + <xml-property name="nameProps" value="zone-name" /> + <xml-property name="indexedProps" value="zone-id,design-type,zone-context" /> + <xml-property name="uniqueProps" value="zone-id" /> + <xml-property name="container" value="zones" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + </java-types> +</xml-bindings> diff --git a/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v10.xml b/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v10.xml new file mode 100644 index 00000000..e63d273f --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v10.xml @@ -0,0 +1,5933 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.openecomp.org.v10" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.openecomp.aai.inventory/v10" /> + </xml-schema> + <java-types> + <java-type name="Inventory"> + <xml-root-element name="inventory" /> + <java-attributes> + <xml-element java-attribute="search" name="search" type="inventory.aai.openecomp.org.v10.Search" /> + <xml-element java-attribute="actions" name="actions" type="inventory.aai.openecomp.org.v10.Actions" /> + <xml-element java-attribute="cloudInfrastructure" name="cloud-infrastructure" type="inventory.aai.openecomp.org.v10.CloudInfrastructure" /> + <xml-element java-attribute="business" name="business" type="inventory.aai.openecomp.org.v10.Business" /> + <xml-element java-attribute="serviceDesignAndCreation" name="service-design-and-creation" type="inventory.aai.openecomp.org.v10.ServiceDesignAndCreation" /> + <xml-element java-attribute="network" name="network" type="inventory.aai.openecomp.org.v10.Network" /> + <xml-element java-attribute="aaiInternal" name="aai-internal" type="inventory.aai.openecomp.org.v10.AaiInternal" /> + <xml-element java-attribute="nodes" name="nodes" type="inventory.aai.openecomp.org.v10.Nodes"/> + </java-attributes> + </java-type> + + <java-type name="Nodes"> + <xml-root-element name="nodes" /> + </java-type> + <java-type name="Search"> + <xml-root-element name="search" /> + <java-attributes> + <xml-element java-attribute="edgeTagQueryResult" name="edge-tag-query-result" type="inventory.aai.openecomp.org.v10.EdgeTagQueryResult" /> + <xml-element java-attribute="edgeTagQueryRequest" name="edge-tag-query-request" type="inventory.aai.openecomp.org.v10.EdgeTagQueryRequest" /> + <xml-element java-attribute="searchResults" name="search-results" type="inventory.aai.openecomp.org.v10.SearchResults" /> + <xml-element java-attribute="sdnZoneResponse" name="sdn-zone-response" type="inventory.aai.openecomp.org.v10.SdnZoneResponse" /> + </java-attributes> + </java-type> + + <java-type name="EdgeTagQueryResult"> + <xml-root-element name="edge-tag-query-result" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v10.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + + <java-type name="TaggedInventoryItemList"> + <xml-root-element name="tagged-inventory-item-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItem" name="inventory-item" type="inventory.aai.openecomp.org.v10.InventoryItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItem"> + <xml-root-element name="inventory-item" /> + <java-attributes> + <xml-element java-attribute="inventoryItemType" name="inventory-item-type" type="java.lang.String" /> + <xml-element java-attribute="inventoryItemLink" name="inventory-item-link" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItemData" name="inventory-item-data" type="inventory.aai.openecomp.org.v10.InventoryItemData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v10.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItemData"> + <xml-root-element name="inventory-item-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="EdgeTagQueryRequest"> + <xml-root-element name="edge-tag-query-request" /> + <java-attributes> + <xml-element java-attribute="edgeTag" name="edge-tag" type="java.lang.String" /> + <xml-element java-attribute="resultDetail" name="result-detail" type="java.lang.String" /> + <xml-element java-attribute="startNodeType" name="start-node-type" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="startNodeFilter" name="start-node-filter" type="inventory.aai.openecomp.org.v10.StartNodeFilter" /> + <xml-element container-type="java.util.ArrayList" java-attribute="includeNodeFilter" name="include-node-filter" type="inventory.aai.openecomp.org.v10.IncludeNodeFilter" /> + <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilter" name="secondary-filter" type="inventory.aai.openecomp.org.v10.SecondaryFilter" /> + </java-attributes> + </java-type> + + <java-type name="StartNodeFilter"> + <xml-root-element name="start-node-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="IncludeNodeFilter"> + <xml-root-element name="include-node-filter" /> + <java-attributes> + <xml-element java-attribute="includeNodeType" name="include-node-type" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilter"> + <xml-root-element name="secondary-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="filterType" name="filter-type" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SearchResults"> + <xml-root-element name="search-results" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="resultData" name="result-data" type="inventory.aai.openecomp.org.v10.ResultData" /> + </java-attributes> + </java-type> + + <java-type name="ResultData"> + <xml-root-element name="result-data" /> + <java-attributes> + <xml-element java-attribute="resourceType" name="resource-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The specific type of node in the A&AI graph" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceLink" name="resource-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The URL to the specific resource" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="SdnZoneResponse"> + <xml-root-element name="sdn-zone-response" /> + <java-attributes> + <xml-element java-attribute="oamNetworks" name="oam-networks" type="inventory.aai.openecomp.org.v10.OamNetworks" /> + <xml-element container-type="java.util.ArrayList" java-attribute="azAndDvsSwitches" name="az-and-dvs-switches" type="inventory.aai.openecomp.org.v10.AzAndDvsSwitches" /> + </java-attributes> + </java-type> + + <java-type name="AzAndDvsSwitches"> + <xml-root-element name="az-and-dvs-switches" /> + <java-attributes> + <xml-element java-attribute="dvsSwitches" name="dvs-switches" type="inventory.aai.openecomp.org.v10.DvsSwitches" /> + <xml-element java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v10.AvailabilityZone" /> + </java-attributes> + </java-type> + + <java-type name="Actions"> + <xml-properties> + <xml-property name="description" value="APIs that are more action related than REST (e.g., notify, update)." /> + </xml-properties> + <xml-root-element name="actions" /> + <java-attributes> + <xml-element java-attribute="update" name="update" type="inventory.aai.openecomp.org.v10.Update" /> + <xml-element java-attribute="notify" name="notify" type="inventory.aai.openecomp.org.v10.Notify" /> + </java-attributes> + </java-type> + + <java-type name="Update"> + <xml-properties> + <xml-property name="description" value="Serves a PATCH like function. Does not enforce concurrency control. Clear each usage with AAI team." /> + </xml-properties> + <xml-root-element name="update" /> + <java-attributes> + <xml-element java-attribute="updateNodeType" name="update-node-type" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="updateNodeKey" name="update-node-key" type="inventory.aai.openecomp.org.v10.UpdateNodeKey" /> + <xml-element java-attribute="updateNodeUri" name="update-node-uri" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="action" name="action" type="inventory.aai.openecomp.org.v10.Action" /> + </java-attributes> + </java-type> + + <java-type name="Action"> + <xml-root-element name="action" /> + <java-attributes> + <xml-element java-attribute="actionType" name="action-type" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="actionData" name="action-data" type="inventory.aai.openecomp.org.v10.ActionData" /> + </java-attributes> + </java-type> + + <java-type name="ActionData"> + <xml-root-element name="action-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="UpdateNodeKey"> + <xml-root-element name="update-node-key" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Notify"> + <xml-root-element name="notify" /> + <java-attributes> + <xml-element java-attribute="eventId" name="event-id" required="true" type="java.lang.String" /> + <xml-element java-attribute="nodeType" name="node-type" type="java.lang.String" /> + <xml-element java-attribute="eventTrigger" name="event-trigger" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="keyData" name="key-data" type="inventory.aai.openecomp.org.v10.KeyData" /> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="KeyData"> + <xml-root-element name="key-data" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="CloudInfrastructure"> + <xml-properties> + <xml-property name="description" value="Namespace for cloud infrastructure." /> + </xml-properties> + <xml-root-element name="cloud-infrastructure" /> + <java-attributes> + <xml-element java-attribute="complexes" name="complexes" type="inventory.aai.openecomp.org.v10.Complexes" /> + <xml-element java-attribute="cloudRegions" name="cloud-regions" type="inventory.aai.openecomp.org.v10.CloudRegions" /> + <xml-element java-attribute="networkProfiles" name="network-profiles" type="inventory.aai.openecomp.org.v10.NetworkProfiles" /> + <xml-element java-attribute="pservers" name="pservers" type="inventory.aai.openecomp.org.v10.Pservers" /> + <xml-element java-attribute="virtualDataCenters" name="virtual-data-centers" type="inventory.aai.openecomp.org.v10.VirtualDataCenters" /> + </java-attributes> + </java-type> + + <java-type name="CloudRegions"> + <xml-root-element name="cloud-regions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cloudRegion" name="cloud-region" type="inventory.aai.openecomp.org.v10.CloudRegion" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="CloudRegion"> + <xml-root-element name="cloud-region" /> + <java-attributes> + <xml-element java-attribute="cloudOwner" name="cloud-owner" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifies the vendor and cloud name. First part of composite key should be formatted as vendor-cloudname" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionId" name="cloud-region-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifier used by the vendor for the region. Second part of composite key" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudType" name="cloud-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the cloud (e.g., openstack)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ownerDefinedType" name="owner-defined-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Cloud-owner defined type indicator (e.g., dcp, lcp)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionVersion" name="cloud-region-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Software version employed at the site. NOTE - THIS FIELD IS NOT KEPT UP TO DATE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudZone" name="cloud-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone where the cloud is homed. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroups" name="volume-groups" type="inventory.aai.openecomp.org.v10.VolumeGroups" /> + <xml-element java-attribute="tenants" name="tenants" type="inventory.aai.openecomp.org.v10.Tenants" /> + <xml-element java-attribute="flavors" name="flavors" type="inventory.aai.openecomp.org.v10.Flavors" /> + <xml-element java-attribute="groupAssignments" name="group-assignments" type="inventory.aai.openecomp.org.v10.GroupAssignments" /> + <xml-element java-attribute="snapshots" name="snapshots" type="inventory.aai.openecomp.org.v10.Snapshots" /> + <xml-element java-attribute="images" name="images" type="inventory.aai.openecomp.org.v10.Images" /> + <xml-element java-attribute="dvsSwitches" name="dvs-switches" type="inventory.aai.openecomp.org.v10.DvsSwitches" /> + <xml-element java-attribute="oamNetworks" name="oam-networks" type="inventory.aai.openecomp.org.v10.OamNetworks" /> + <xml-element java-attribute="availabilityZones" name="availability-zones" type="inventory.aai.openecomp.org.v10.AvailabilityZones" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="cloud-region designates an installation of a cloud cluster or region or instantiation. In AT&Ts AIC cloud, this could be an LCP or DCP. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname and we will use att-aic for AT&T's AIC." /> + <xml-property name="indexedProps" value="cloud-owner,cloud-region-id,cloud-type,owner-defined-type" /> + <xml-property name="nameProps" value="owner-defined-type" /> + <xml-property name="container" value="cloud-regions" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="VolumeGroups"> + <xml-properties> + <xml-property name="description" value="Collection of persistent block-level storage." /> + </xml-properties> + <xml-root-element name="volume-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volumeGroup" name="volume-group" type="inventory.aai.openecomp.org.v10.VolumeGroup" /> + </java-attributes> + </java-type> + + <java-type name="VolumeGroup"> + <xml-root-element name="volume-group" /> + <java-attributes> + <xml-element java-attribute="volumeGroupId" name="volume-group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of volume-group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroupName" name="volume-group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the volume group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleModelCustomizationId" name="vf-module-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="helps relate the volume group to the vf-module whose components will require the volume group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Persistent block-level storage." /> + <xml-property name="indexedProps" value="volume-group-name,vnf-type,heat-stack-id,volume-group-id" /> + <xml-property name="searchable" value="volume-group-id,volume-group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="volume-groups" /> + </xml-properties> + </java-type> + + <java-type name="RelationshipList"> + <xml-root-element name="relationship-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relationship" name="relationship" type="inventory.aai.openecomp.org.v10.Relationship" /> + </java-attributes> + </java-type> + + <java-type name="Relationship"> + <xml-root-element name="relationship" /> + <java-attributes> + <xml-element java-attribute="relatedTo" name="related-to" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate type of node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relatedLink" name="related-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to the object in A&AI." /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="relationshipData" name="relationship-data" type="inventory.aai.openecomp.org.v10.RelationshipData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedToProperty" name="related-to-property" type="inventory.aai.openecomp.org.v10.RelatedToProperty" /> + </java-attributes> + </java-type> + + <java-type name="RelatedToProperty"> + <xml-root-element name="related-to-property" /> + <java-attributes> + <xml-element java-attribute="propertyKey" name="property-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Key part of a key/value pair" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value part of a key/value pair" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate an attribute." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="Complexes"> + <xml-properties> + <xml-property name="description" value="Collection of physical locations that can house cloud-regions." /> + </xml-properties> + <xml-root-element name="complexes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="complex" name="complex" type="inventory.aai.openecomp.org.v10.Complex" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Complex"> + <xml-root-element name="complex" /> + <java-attributes> + <xml-element java-attribute="physicalLocationId" name="physical-location-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for physical location, e.g., CLLI" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dataCenterCode" name="data-center-code" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Data center code which can be an alternate way to identify a complex" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Gamma complex name for LCP instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalLocationType" name="physical-location-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type, e.g., central office, data center." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="street1" name="street1" required="true" type="java.lang.String" /> + <xml-element java-attribute="street2" name="street2" type="java.lang.String" /> + <xml-element java-attribute="city" name="city" required="true" type="java.lang.String" /> + <xml-element java-attribute="state" name="state" type="java.lang.String" /> + <xml-element java-attribute="postalCode" name="postal-code" required="true" type="java.lang.String" /> + <xml-element java-attribute="country" name="country" required="true" type="java.lang.String" /> + <xml-element java-attribute="region" name="region" required="true" type="java.lang.String" /> + <xml-element java-attribute="latitude" name="latitude" type="java.lang.String" /> + <xml-element java-attribute="longitude" name="longitude" type="java.lang.String" /> + <xml-element java-attribute="elevation" name="elevation" type="java.lang.String" /> + <xml-element java-attribute="lata" name="lata" type="java.lang.String" /> + <xml-element java-attribute="ctagPools" name="ctag-pools" type="inventory.aai.openecomp.org.v10.CtagPools" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical locations that can house cloud-regions." /> + <xml-property name="indexedProps" value="identity-url,data-center-code,complex-name,physical-location-id" /> + <xml-property name="searchable" value="physical-location-id,data-center-code,complex-name,street1,street2,postal-code" /> + <xml-property name="uniqueProps" value="physical-location-id" /> + <xml-property name="container" value="complexes" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="CtagPools"> + <xml-root-element name="ctag-pools" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagPool" name="ctag-pool" type="inventory.aai.openecomp.org.v10.CtagPool" /> + </java-attributes> + </java-type> + + <java-type name="CtagPool"> + <xml-root-element name="ctag-pool" /> + <java-attributes> + <xml-element java-attribute="targetPe" name="target-pe" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="The Target provider edge router" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagPoolPurpose" name="ctag-pool-purpose" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Describes what the intended purpose of this pool is." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ctagValues" name="ctag-values" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Comma separated list of ctags" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="A collection of C tags (vlan tags) grouped for a specific purpose." /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="complex" /> + <xml-property name="container" value="ctag-pools" /> + </xml-properties> + </java-type> + + <java-type name="Tenants"> + <xml-properties> + <xml-property name="description" value="Collection of openstack tenants." /> + </xml-properties> + <xml-root-element name="tenants" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tenant" name="tenant" type="inventory.aai.openecomp.org.v10.Tenant" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Tenant"> + <xml-root-element name="tenant" /> + <java-attributes> + <xml-element java-attribute="tenantId" name="tenant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id relative to the cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tenantName" name="tenant-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Readable name of tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vservers" name="vservers" type="inventory.aai.openecomp.org.v10.Vservers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack tenant" /> + <xml-property name="nameProps" value="tenant-name" /> + <xml-property name="indexedProps" value="tenant-name,tenant-id" /> + <xml-property name="searchable" value="tenant-id,tenant-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="tenants" /> + </xml-properties> + </java-type> + + <java-type name="Vservers"> + <xml-properties> + <xml-property name="description" value="Collection of virtual Servers, aka virtual machines or VMs." /> + </xml-properties> + <xml-root-element name="vservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vserver" name="vserver" type="inventory.aai.openecomp.org.v10.Vserver" /> + </java-attributes> + </java-type> + + <java-type name="Vserver"> + <xml-root-element name="vserver" /> + <java-attributes> + <xml-element java-attribute="vserverId" name="vserver-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for this vserver relative to its tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName" name="vserver-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName2" name="vserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternative name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverSelflink" name="vserver-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumes" name="volumes" type="inventory.aai.openecomp.org.v10.Volumes" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Servers, aka virtual machine or VM." /> + <xml-property name="nameProps" value="vserver-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2" /> + <xml-property name="searchable" value="vserver-id,vserver-name,vserver-name2" /> + <xml-property name="dependentOn" value="tenant" /> + <xml-property name="container" value="vservers" /> + </xml-properties> + </java-type> + + <java-type name="LInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of logical interfaces." /> + </xml-properties> + <xml-root-element name="l-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lInterface" name="l-interface" type="inventory.aai.openecomp.org.v10.LInterface" /> + </java-attributes> + </java-type> + + <java-type name="LInterface"> + <xml-root-element name="l-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name given to the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="E.g., CUSTOMER, UPLINK, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6WanLinkIp" name="v6-wan-link-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="macaddr" name="macaddr" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="MAC address for the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether A&AI should be managing this interface of not. Could have value like CUSTOMER" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Human friendly text regarding this interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isPortMirrored" name="is-port-mirrored" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not port is a mirrored." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlans" name="vlans" type="inventory.aai.openecomp.org.v10.Vlans" /> + <xml-element java-attribute="sriovVfs" name="sriov-vfs" type="inventory.aai.openecomp.org.v10.SriovVfs" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical interfaces, e.g., a vnic." /> + <xml-property name="indexedProps" value="macaddr,interface-id,interface-name,network-name" /> + <xml-property name="dependentOn" value="generic-vnf,newvce,vpe,p-interface,vserver,lag-interface" /> + <xml-property name="container" value="l-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="SriovVfs"> + <xml-properties> + <xml-property name="description" value="Collection of SR-IOV Virtual Functions." /> + </xml-properties> + <xml-root-element name="sriov-vfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sriovVf" name="sriov-vf" type="inventory.aai.openecomp.org.v10.SriovVf" /> + </java-attributes> + </java-type> + <java-type name="SriovVf"> + <xml-root-element name="sriov-vf" /> + <java-attributes> + <xml-element java-attribute="pciId" name="pci-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="PCI ID used to identify the sriov-vf" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanFilter" name="vf-vlan-filter" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This metadata provides option to specify list of VLAN filters applied on VF to pass the traffic to VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMacFilter" name="vf-mac-filter" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="When MAC filters are specified, VF-agent service configures VFs to do MAC level filtering before the traffic is passed to VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanStrip" name="vf-vlan-strip" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="When this field is set to true, VF will configured to strip the outer TAG before the traffic is passed to VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfVlanAntiSpoofCheck" name="vf-vlan-anti-spoof-check" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option ensures anti VLAN spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMacAntiSpoofCheck" name="vf-mac-anti-spoof-check" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option ensures anti MAC spoof checks are done at the VF level to comply with security. The disable check will also be honored per the VNF needs for trusted VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfMirrors" name="vf-mirrors" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This option defines the set of Mirror objects which essentially mirrors the traffic from source to set of collector VNF Ports." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfBroadcastAllow" name="vf-broadcast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows all broadcast traffic to reach the VM" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfUnknownMulticastAllow" name="vf-unknown-multicast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows unknown multicast traffic to reach the VM" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfUnknownUnicastAllow" name="vf-unknown-unicast-allow" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, sets the VF in promiscuous mode and allows unknown unicast traffic to reach the VM" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfInsertStag" name="vf-insert-stag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="This option, if set to true, instructs to insert outer tag after traffic comes out of VM." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfLinkStatus" name="vf-link-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This option is used to set the link status. Valid values as of 1607 are on, off, and auto." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="SR-IOV Virtual Function (not to be confused with virtual network function)" /> + <xml-property name="indexedProps" value="pci-id,vf-vlan-filter,vf-mac-filter,vf-vlan-strip,neutron-network-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="sriov-vfs" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv4AddressList"> + <xml-root-element name="l3-interface-ipv4-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv4Address" name="l3-interface-ipv4-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv4PrefixLength" name="l3-interface-ipv4-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 32 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv4 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Vlans"> + <xml-root-element name="vlans" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vlan" name="vlan" type="inventory.aai.openecomp.org.v10.Vlan" /> + </java-attributes> + </java-type> + + <java-type name="Vlan"> + <xml-root-element name="vlan" /> + <java-attributes> + <xml-element java-attribute="vlanInterface" name="vlan-interface" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String that identifies the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanDescription" name="vlan-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to describe (the service associated with) the vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="backdoorConnection" name="backdoor-connection" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether customer is going to use this VLAN for backdoor connection to another customer premise device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnId" name="vpn-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This indicates the customers VPN ID associated with this vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Status of a vnf's vlan interface, on which the customer circuit resides, mastered by SDN-C." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v10.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Definition of vlan" /> + <xml-property name="indexedProps" value="vlan-interface,vlan-id-inner,vpn-id" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="vlans" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv6AddressList"> + <xml-root-element name="l3-interface-ipv6-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv6Address" name="l3-interface-ipv6-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv6PrefixLength" name="l3-interface-ipv6-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 128 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv6 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Volumes"> + <xml-properties> + <xml-property name="description" value="Collection of ephemeral Block storage volumes." /> + </xml-properties> + <xml-root-element name="volumes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volume" name="volume" type="inventory.aai.openecomp.org.v10.Volume" /> + </java-attributes> + </java-type> + + <java-type name="Volume"> + <xml-root-element name="volume" /> + <java-attributes> + <xml-element java-attribute="volumeId" name="volume-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of block storage volume relative to the vserver." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeSelflink" name="volume-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Ephemeral Block storage volume." /> + <xml-property name="indexedProps" value="volume-id" /> + <xml-property name="dependentOn" value="vserver" /> + <xml-property name="container" value="volumes" /> + </xml-properties> + </java-type> + + <java-type name="Flavors"> + <xml-properties> + <xml-property name="description" value="Collection of openstack flavors." /> + </xml-properties> + <xml-root-element name="flavors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="flavor" name="flavor" type="inventory.aai.openecomp.org.v10.Flavor" /> + </java-attributes> + </java-type> + + <java-type name="Flavor"> + <xml-root-element name="flavor" /> + <java-attributes> + <xml-element java-attribute="flavorId" name="flavor-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Flavor id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorName" name="flavor-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Flavor name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorVcpus" name="flavor-vcpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of CPUs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorRam" name="flavor-ram" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of memory" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisk" name="flavor-disk" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorEphemeral" name="flavor-ephemeral" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of ephemeral disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSwap" name="flavor-swap" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="amount of swap space allocation" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorIsPublic" name="flavor-is-public" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="whether flavor is available to all users or private to the tenant it was created in." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSelflink" name="flavor-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisabled" name="flavor-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Boolean as to whether this flavor is no longer enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack flavor." /> + <xml-property name="nameProps" value="flavor-name" /> + <xml-property name="indexedProps" value="flavor-name,flavor-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="flavors" /> + </xml-properties> + </java-type> + + <java-type name="Snapshots"> + <xml-properties> + <xml-property name="description" value="Collection of openstack snapshots" /> + </xml-properties> + <xml-root-element name="snapshots" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="snapshot" name="snapshot" type="inventory.aai.openecomp.org.v10.Snapshot" /> + </java-attributes> + </java-type> + + <java-type name="Snapshot"> + <xml-root-element name="snapshot" /> + <java-attributes> + <xml-element java-attribute="snapshotId" name="snapshot-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Snapshot id, this is the key UUID assoc associated in glance with the snapshots." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotName" name="snapshot-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Snapshot name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotArchitecture" name="snapshot-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsDistro" name="snapshot-os-distro" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsVersion" name="snapshot-os-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotSelflink" name="snapshot-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="prevSnapshotId" name="prev-snapshot-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field contains the UUID of the previous snapshot (if any)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack snapshot" /> + <xml-property name="nameProps" value="snapshot-name" /> + <xml-property name="uniqueProps" value="snapshot-id" /> + <xml-property name="indexedProps" value="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="snapshots" /> + </xml-properties> + </java-type> + + <java-type name="GroupAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack group assignments" /> + </xml-properties> + <xml-root-element name="group-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="groupAssignment" name="group-assignment" type="inventory.aai.openecomp.org.v10.GroupAssignment" /> + </java-attributes> + </java-type> + + <java-type name="GroupAssignment"> + <xml-root-element name="group-assignment" /> + <java-attributes> + <xml-element java-attribute="groupId" name="group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Group id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupType" name="group-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group type - the type of group this instance refers to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupName" name="group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name - name assigned to the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupDescription" name="group-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group description - description of the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack group-assignment used to store exclusivity groups (EG)." /> + <xml-property name="nameProps" value="group-name" /> + <xml-property name="indexedProps" value="group-id,group-type,group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="group-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Images"> + <xml-properties> + <xml-property name="description" value="Collectio of Openstack images." /> + </xml-properties> + <xml-root-element name="images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="image" name="image" type="inventory.aai.openecomp.org.v10.Image" /> + </java-attributes> + </java-type> + + <java-type name="Image"> + <xml-root-element name="image" /> + <java-attributes> + <xml-element java-attribute="imageId" name="image-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Image id, expected to be unique across cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageName" name="image-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Image name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageArchitecture" name="image-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsDistro" name="image-os-distro" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsVersion" name="image-os-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageSelflink" name="image-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack image." /> + <xml-property name="nameProps" value="image-name" /> + <xml-property name="indexedProps" value="application,image-name,application-vendor,image-id,application-version" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="images" /> + </xml-properties> + </java-type> + + <java-type name="Metadata"> + <xml-properties> + <xml-property name="description" value="Collection of metadatum (key/value pairs)" /> + </xml-properties> + <xml-root-element name="metadata" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="metadatum" name="metadatum" type="inventory.aai.openecomp.org.v10.Metadatum" /> + </java-attributes> + </java-type> + + <java-type name="Metadatum"> + <xml-root-element name="metadatum" /> + <java-attributes> + <xml-element java-attribute="metaname" name="metaname" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="metaval" name="metaval" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Key/value pairs" /> + <xml-property name="indexedProps" value="metaname" /> + <xml-property name="dependentOn" value="tenant,image,service-instance,connector,model" /> + <xml-property name="container" value="metadata" /> + </xml-properties> + </java-type> + + <java-type name="DvsSwitches"> + <xml-properties> + <xml-property name="description" value="Collection of digital virtual switch metadata used for vmWare VCEs and VPEs." /> + </xml-properties> + <xml-root-element name="dvs-switches" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="dvsSwitch" name="dvs-switch" type="inventory.aai.openecomp.org.v10.DvsSwitch" /> + </java-attributes> + </java-type> + + <java-type name="DvsSwitch"> + <xml-root-element name="dvs-switch" /> + <java-attributes> + <xml-element java-attribute="switchName" name="switch-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="DVS switch name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcenterUrl" name="vcenter-url" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL used to reach the vcenter" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Digital virtual switch metadata, used by SDN-C to configure VCEs. A&AI needs to receive this data from the PO deployment team and administer it using the provisioningTool.sh into A&AI. " /> + <xml-property name="indexedProps" value="vcenter-url,switch-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="dvs-switches" /> + </xml-properties> + </java-type> + + <java-type name="NetworkProfiles"> + <xml-properties> + <xml-property name="description" value="Collection of network profiles" /> + </xml-properties> + <xml-root-element name="network-profiles" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="networkProfile" name="network-profile" type="inventory.aai.openecomp.org.v10.NetworkProfile" /> + </java-attributes> + </java-type> + + <java-type name="NetworkProfile"> + <xml-root-element name="network-profile" /> + <java-attributes> + <xml-element java-attribute="nmProfileName" name="nm-profile-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique name of network profile." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="communityString" name="community-string" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encrypted SNMP community string" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Network profile populated by SDN-GP for SNMP" /> + <xml-property name="indexedProps" value="nm-profile-name" /> + <xml-property name="container" value="network-profiles" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="Pservers"> + <xml-properties> + <xml-property name="description" value="Collection of compute hosts." /> + </xml-properties> + <xml-root-element name="pservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pserver" name="pserver" type="inventory.aai.openecomp.org.v10.Pserver" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Pserver"> + <xml-root-element name="pserver" /> + <java-attributes> + <xml-element java-attribute="hostname" name="hostname" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value from executing hostname on the compute node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ptniiEquipName" name="ptnii-equip-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="PTNII name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="numberOfCpus" name="number-of-cpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of cpus" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="diskInGigabytes" name="disk-in-gigabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk size, in GBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ramInMegabytes" name="ram-in-megabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="RAM size, in MBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="fqdn" name="fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Fully-qualified domain name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverSelflink" name="pserver-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to configure device, also used for troubleshooting and is IP used for traps generated by device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number, may be queried" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback0" name="ipaddress-v4-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback0" name="ipaddress-v6-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Aim" name="ipaddress-v4-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Aim" name="ipaddress-v6-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Oam" name="ipaddress-v6-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 OAM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="invStatus" name="inv-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CANOPI's inventory status. Only set with values exactly as defined by CANOPI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverId" name="pserver-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of Pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="internetTopology" name="internet-topology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="internet topology of Pserver" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverName2" name="pserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="alternative pserver name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="purpose of pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v10.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver." /> + <xml-property name="nameProps" value="pserver-name2" /> + <xml-property name="indexedProps" value="hostname,in-maint,pserver-id,pserver-name2,inv-status" /> + <xml-property name="searchable" value="hostname,pserver-name2,pserver-id,ipv4-oam-address" /> + <xml-property name="container" value="pservers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="PInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of physical interfaces." /> + </xml-properties> + <xml-root-element name="p-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pInterface" name="p-interface" type="inventory.aai.openecomp.org.v10.PInterface" /> + </java-attributes> + </java-type> + + <java-type name="PInterface"> + <xml-root-element name="p-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the physical interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portDescription" name="port-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nature of the services and connectivity on this port." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentIdentifier" name="equipment-identifier" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CLEI or other specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceType" name="interface-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the physical properties of the interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Physical interface (e.g., nic)" /> + <xml-property name="indexedProps" value="interface-name,prov-status" /> + <xml-property name="nameProps" value="prov-status" /> + <xml-property name="dependentOn" value="vpls-pe,pserver,pnf" /> + <xml-property name="container" value="p-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="LagInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregate interfaces." /> + </xml-properties> + <xml-root-element name="lag-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagInterface" name="lag-interface" type="inventory.aai.openecomp.org.v10.LagInterface" /> + </java-attributes> + </java-type> + + <java-type name="LagInterface"> + <xml-root-element name="lag-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the link aggregate interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceDescription" name="interface-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Human friendly text regarding this interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" java-attribute="inMaint" name="in-maint" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Link aggregate interface" /> + <xml-property name="indexedProps" value="interface-name,interface-id,interface-role" /> + <xml-property name="dependentOn" value="generic-vnf,pserver,vpe,vpls-pe,pnf" /> + <xml-property name="container" value="lag-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="OamNetworks"> + <xml-properties> + <xml-property name="description" value="Collection of OAM networks, to be deprecated shortly. Do not use for new purposes. " /> + </xml-properties> + <xml-root-element name="oam-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="oamNetwork" name="oam-network" type="inventory.aai.openecomp.org.v10.OamNetwork" /> + </java-attributes> + </java-type> + + <java-type name="OamNetwork"> + <xml-root-element name="oam-network" /> + <java-attributes> + <xml-element java-attribute="networkUuid" name="network-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID of the network. Unique across a cloud-region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cvlanTag" name="cvlan-tag" required="true" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="cvlan-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddress" name="ipv4-oam-gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for VNF firewall rule so customer cannot send customer traffic over this oam network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddressPrefixLength" name="ipv4-oam-gateway-address-prefix-length" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Used for VNF firewall rule so customer cannot send customer traffic over this oam network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="OAM network, to be deprecated shortly. Do not use for new purposes. " /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="cvlan-tag,network-uuid,network-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="oam-networks" /> + </xml-properties> + </java-type> + + <java-type name="AvailabilityZones"> + <xml-properties> + <xml-property name="description" value="Collection of availability zones" /> + </xml-properties> + <xml-root-element name="availability-zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v10.AvailabilityZone" /> + </java-attributes> + </java-type> + + <java-type name="AvailabilityZone"> + <xml-root-element name="availability-zone" /> + <java-attributes> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone. Unique across a cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="hypervisorType" name="hypervisor-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of hypervisor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Availability zone, a collection of compute hosts/pservers" /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="availability-zones" /> + </xml-properties> + </java-type> + + <java-type name="VirtualDataCenters"> + <xml-properties> + <xml-property name="description" value="Virtual organization of cloud infrastructure elements in a data center context" /> + </xml-properties> + <xml-root-element name="virtual-data-centers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="virtualDataCenter" name="virtual-data-center" type="inventory.aai.openecomp.org.v10.VirtualDataCenter" /> + </java-attributes> + </java-type> + + <java-type name="VirtualDataCenter"> + <xml-root-element name="virtual-data-center" /> + <java-attributes> + <xml-element java-attribute="vdcId" name="vdc-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the vdc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdcName" name="vdc-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the virtual data center" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual organization of cloud infrastructure elements in a data center context" /> + <xml-property name="nameProps" value="vdc-name" /> + <xml-property name="indexedProps" value="vdc-name,vdc-id" /> + <xml-property name="container" value="virtual-data-centers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + + + + <java-type name="Business"> + <xml-properties> + <xml-property name="description" value="Namespace for business related constructs" /> + </xml-properties> + <xml-root-element name="business" /> + <java-attributes> + <xml-element java-attribute="connectors" name="connectors" type="inventory.aai.openecomp.org.v10.Connectors" /> + <xml-element java-attribute="customers" name="customers" type="inventory.aai.openecomp.org.v10.Customers" /> + </java-attributes> + </java-type> + + <java-type name="Connectors"> + <xml-properties> + <xml-property name="description" value="Collection of resource instances used to connect a variety of disparate inventory widgets" /> + </xml-properties> + <xml-root-element name="connectors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="connector" name="connector" type="inventory.aai.openecomp.org.v10.Connector" /> + </java-attributes> + </java-type> + + <java-type name="Connector"> + <xml-root-element name="connector" /> + <java-attributes> + <xml-element java-attribute="resourceInstanceId" name="resource-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of resource instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of resource instances used to connect a variety of disparate inventory widgets" /> + <xml-property name="indexedProps" value="resource-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version" /> + <xml-property name="container" value="connectors" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + + <java-type name="Customers"> + <xml-properties> + <xml-property name="description" value="Collection of customer identifiers to provide linkage back to BSS information." /> + </xml-properties> + <xml-root-element name="customers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="customer" name="customer" type="inventory.aai.openecomp.org.v10.Customer" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Customer"> + <xml-root-element name="customer" /> + <java-attributes> + <xml-element java-attribute="globalCustomerId" name="global-customer-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Global customer id used across ECOMP to uniquely identify customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberName" name="subscriber-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber name, an alternate way to retrieve a customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberType" name="subscriber-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber type, a way to provide VID with only the INFRA customers." /> + <xml-property name="defaultValue" value="CUST" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSubscriptions" name="service-subscriptions" type="inventory.aai.openecomp.org.v10.ServiceSubscriptions" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="customer identifiers to provide linkage back to BSS information." /> + <xml-property name="nameProps" value="subscriber-name" /> + <xml-property name="indexedProps" value="subscriber-name,global-customer-id,subscriber-type" /> + <xml-property name="searchable" value="global-customer-id,subscriber-name" /> + <xml-property name="uniqueProps" value="global-customer-id" /> + <xml-property name="container" value="customers" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + + <java-type name="ServiceSubscriptions"> + <xml-properties> + <xml-property name="description" value="Collection of objects that group service instances." /> + </xml-properties> + <xml-root-element name="service-subscriptions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceSubscription" name="service-subscription" type="inventory.aai.openecomp.org.v10.ServiceSubscription" /> + </java-attributes> + </java-type> + + <java-type name="ServiceSubscription"> + <xml-root-element name="service-subscription" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value defined by orchestration to identify this service across ECOMP." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tempUbSubAccountId" name="temp-ub-sub-account-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This property will be deleted from A&AI in the near future. Only stop gap solution." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstances" name="service-instances" type="inventory.aai.openecomp.org.v10.ServiceInstances"> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Object that group service instances." /> + <xml-property name="indexedProps" value="service-type" /> + <xml-property name="dependentOn" value="customer" /> + <xml-property name="container" value="service-subscriptions" /> + <xml-property name="crossEntityReference" value="service-instance,service-type" /> + </xml-properties> + </java-type> + + <java-type name="ServiceInstances"> + <xml-properties> + <xml-property name="description" value="Collection of service instances" /> + </xml-properties> + <xml-root-element name="service-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceInstance" name="service-instance" type="inventory.aai.openecomp.org.v10.ServiceInstance" /> + </java-attributes> + </java-type> + + <java-type name="ServiceInstance"> + <xml-root-element name="service-instance" /> + <java-attributes> + <xml-element java-attribute="serviceInstanceId" name="service-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Uniquely identifies this instance of a service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceName" name="service-instance-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field will store a name assigned to the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthTotal" name="bandwidth-total" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the total bandwidth to be used for this service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vhnPortalUrl" name="vhn-portal-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL customers will use to access the vHN Portal." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operational status of the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceLocationId" name="service-instance-location-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="An identifier that customers assign to the location where this service is being used." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + <xml-element java-attribute="allottedResources" name="allotted-resources" type="inventory.aai.openecomp.org.v10.AllottedResources" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Instance of a service" /> + <xml-property name="indexedProps" value="service-instance-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id,orchestration-status" /> + <xml-property name="nameProps" value="service-instance-name" /> + <xml-property name="searchable" value="service-instance-id,service-instance-name" /> + <xml-property name="uniqueProps" value="service-instance-id" /> + <xml-property name="dependentOn" value="service-subscription" /> + <xml-property name="container" value="service-instances" /> + </xml-properties> + </java-type> + + <java-type name="ServiceDesignAndCreation"> + <xml-properties> + <xml-property name="description" value="Namespace for objects managed by ASDC" /> + </xml-properties> + <xml-root-element name="service-design-and-creation" /> + <java-attributes> + <xml-element java-attribute="vnfImages" name="vnf-images" type="inventory.aai.openecomp.org.v10.VnfImages" /> + <xml-element java-attribute="services" name="services" type="inventory.aai.openecomp.org.v10.Services" /> + <xml-element java-attribute="serviceCapabilities" name="service-capabilities" type="inventory.aai.openecomp.org.v10.ServiceCapabilities" /> + <xml-element java-attribute="models" name="models" type="inventory.aai.openecomp.org.v10.Models" /> + <xml-element java-attribute="namedQueries" name="named-queries" type="inventory.aai.openecomp.org.v10.NamedQueries" /> + </java-attributes> + </java-type> + + <java-type name="VnfImages"> + <xml-properties> + <xml-property name="description" value="Collection of image objects that pertain to a VNF that doesn't have associated vservers. This is a kludge." /> + </xml-properties> + <xml-root-element name="vnf-images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfImage" name="vnf-image" type="inventory.aai.openecomp.org.v10.VnfImage" /> + </java-attributes> + </java-type> + + <java-type name="VnfImage"> + <xml-root-element name="vnf-image" /> + <java-attributes> + <xml-element java-attribute="vnfImageUuid" name="vnf-image-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of this asset" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Image object that pertain to a VNF that doesn't have associated vservers. This is a kludge." /> + <xml-property name="indexedProps" value="application,vnf-image-uuid,application-vendor,application-version" /> + <xml-property name="uniqueProps" value="vnf-image-uuid" /> + <xml-property name="container" value="vnf-images" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="Services"> + <xml-properties> + <xml-property name="description" value="Collection of service model definitions. Likely to be deprecated in favor of models from ASDC." /> + </xml-properties> + <xml-root-element name="services" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="service" name="service" type="inventory.aai.openecomp.org.v10.Service" /> + </java-attributes> + </java-type> + + <java-type name="Service"> + <xml-root-element name="service" /> + <java-attributes> + <xml-element java-attribute="serviceId" name="service-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceDescription" name="service-description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description of the service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSelflink" name="service-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceVersion" name="service-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="service version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Stand-in for service model definitions. Likely to be deprecated in favor of models from ASDC. Does not strictly map to ASDC services." /> + <xml-property name="indexedProps" value="service-description,service-id" /> + <xml-property name="container" value="services" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="ServiceCapabilities"> + <xml-properties> + <xml-property name="description" value="Collection of service capabilities." /> + </xml-properties> + <xml-root-element name="service-capabilities" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceCapability" name="service-capability" type="inventory.aai.openecomp.org.v10.ServiceCapability" /> + </java-attributes> + </java-type> + + <java-type name="ServiceCapability"> + <xml-root-element name="service-capability" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Early definition of server/resource pairings, likely to be replaced by models. No new use should be made of this." /> + <xml-property name="indexedProps" value="service-type,vnf-type" /> + <xml-property name="container" value="service-capabilities" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="Network"> + <xml-properties> + <xml-property name="description" value="Namespace for network inventory resources." /> + </xml-properties> + <xml-root-element name="network" /> + <java-attributes> + <xml-element java-attribute="logicalLinks" name="logical-links" type="inventory.aai.openecomp.org.v10.LogicalLinks" /> + <xml-element java-attribute="sitePairSets" name="site-pair-sets" type="inventory.aai.openecomp.org.v10.SitePairSets" /> + <xml-element java-attribute="vpnBindings" name="vpn-bindings" type="inventory.aai.openecomp.org.v10.VpnBindings" /> + <xml-element java-attribute="vplsPes" name="vpls-pes" type="inventory.aai.openecomp.org.v10.VplsPes" /> + <xml-element java-attribute="multicastConfigurations" name="multicast-configurations" type="inventory.aai.openecomp.org.v10.MulticastConfigurations" /> + <xml-element java-attribute="vces" name="vces" type="inventory.aai.openecomp.org.v10.Vces" /> + <xml-element java-attribute="vpes" name="vpes" type="inventory.aai.openecomp.org.v10.Vpes" /> + <xml-element java-attribute="vnfcs" name="vnfcs" type="inventory.aai.openecomp.org.v10.Vnfcs" /> + <xml-element java-attribute="l3Networks" name="l3-networks" type="inventory.aai.openecomp.org.v10.L3Networks" /> + <xml-element java-attribute="networkPolicies" name="network-policies" type="inventory.aai.openecomp.org.v10.NetworkPolicies" /> + <xml-element java-attribute="genericVnfs" name="generic-vnfs" type="inventory.aai.openecomp.org.v10.GenericVnfs" /> + <xml-element java-attribute="lagLinks" name="lag-links" type="inventory.aai.openecomp.org.v10.LagLinks" /> + <xml-element java-attribute="newvces" name="newvces" type="inventory.aai.openecomp.org.v10.Newvces" /> + <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.openecomp.org.v10.Pnfs" /> + <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.openecomp.org.v10.PhysicalLinks" /> + <xml-element java-attribute="ipsecConfigurations" name="ipsec-configurations" type="inventory.aai.openecomp.org.v10.IpsecConfigurations" /> + <xml-element java-attribute="routeTableReferences" name="route-table-references" type="inventory.aai.openecomp.org.v10.RouteTableReferences" /> + <xml-element java-attribute="instanceGroups" name="instance-groups" type="inventory.aai.openecomp.org.v10.InstanceGroups" /> + <xml-element java-attribute="zones" name="zones" type="inventory.aai.openecomp.org.v10.Zones" /> + <xml-element java-attribute="testObjects" name="test-objects" + type="inventory.aai.openecomp.org.v10.TestObjects" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of logical connections" /> + </xml-properties> + <xml-root-element name="logical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="logicalLink" name="logical-link" type="inventory.aai.openecomp.org.v10.LogicalLink" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLink"> + <xml-root-element name="logical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkType" name="link-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of logical link, e.g., evc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4, v6, or ds for dual stack" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingProtocol" name="routing-protocol" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="For example, static or BGP" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of operational status of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkRole" name="link-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of the network use of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkName2" name="link-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alias or alternate name (CLCI or D1 name)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkId" name="link-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the logical-link, SDNC generates this." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Reason for this entity, role it is playing" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical links generally connect l-interfaces but are used to express logical connectivity between two points" /> + <xml-property name="indexedProps" value="link-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,link-id,prov-status,circuit-id,purpose" /> + <xml-property name="uniqueProps" value="link-id" /> + <xml-property name="container" value="logical-links" /> + <xml-property name="namespace" value="network" /> + <xml-property name="searchable" value="link-name" /> + </xml-properties> + </java-type> + + <java-type name="SitePairSets"> + <xml-properties> + <xml-property name="description" value="Collection of sets of instances for probes related to generic-vnf" /> + </xml-properties> + <xml-root-element name="site-pair-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sitePairSet" name="site-pair-set" type="inventory.aai.openecomp.org.v10.SitePairSet" /> + </java-attributes> + </java-type> + + <java-type name="SitePairSet"> + <xml-root-element name="site-pair-set" /> + <java-attributes> + <xml-element java-attribute="sitePairSetId" name="site-pair-set-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of site pair set." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingInstances" name="routing-instances" type="inventory.aai.openecomp.org.v10.RoutingInstances" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Set of instances for probes used to measure service level agreements" /> + <xml-property name="indexedProps" value="site-pair-set-id" /> + <xml-property name="uniqueProps" value="site-pair-set-id" /> + <xml-property name="container" value="site-pair-sets" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="RoutingInstances"> + <xml-properties> + <xml-property name="description" value="set of probes related to generic-vnf routing instance" /> + </xml-properties> + <xml-root-element name="routing-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routingInstance" name="routing-instance" type="inventory.aai.openecomp.org.v10.RoutingInstance" /> + </java-attributes> + </java-type> + + <java-type name="RoutingInstance"> + <xml-root-element name="routing-instance" /> + <java-attributes> + <xml-element java-attribute="routingInstanceId" name="routing-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of routing instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rpmOwner" name="rpm-owner" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="rpm owner" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sitePairs" name="site-pairs" type="inventory.aai.openecomp.org.v10.SitePairs" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="routing-instance-id" /> + <xml-property name="uniqueProps" value="routing-instance-id" /> + <xml-property name="dependentOn" value="site-pair-set" /> + <xml-property name="container" value="routing-instances" /> + </xml-properties> + </java-type> + + <java-type name="SitePairs"> + <xml-properties> + <xml-property name="description" value="probe within a set" /> + </xml-properties> + <xml-root-element name="site-pairs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="sitePair" name="site-pair" type="inventory.aai.openecomp.org.v10.SitePair" /> + </java-attributes> + </java-type> + + <java-type name="SitePair"> + <xml-root-element name="site-pair" /> + <java-attributes> + <xml-element java-attribute="sitePairId" name="site-pair-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique identifier of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceIp" name="source-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prefix address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationIp" name="destination-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prefix address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version, v4, v6" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationHostname" name="destination-hostname" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Hostname of the destination equipment to which SLAs are measured against." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="destinationEquipType" name="destination-equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The type of destinatination equipment. Could be Router, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="classesOfService" name="classes-of-service" type="inventory.aai.openecomp.org.v10.ClassesOfService" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="site-pair-id" /> + <xml-property name="uniqueProps" value="site-pair-id" /> + <xml-property name="dependentOn" value="routing-instance" /> + <xml-property name="container" value="site-pairs" /> + </xml-properties> + </java-type> + + <java-type name="ClassesOfService"> + <xml-properties> + <xml-property name="description" value="class-of-service of probe" /> + </xml-properties> + <xml-root-element name="classes-of-service" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="classOfService" name="class-of-service" type="inventory.aai.openecomp.org.v10.ClassOfService" /> + </java-attributes> + </java-type> + + <java-type name="ClassOfService"> + <xml-root-element name="class-of-service" /> + <java-attributes> + <xml-element java-attribute="cos" name="cos" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique identifier of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="probeId" name="probe-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="probeType" name="probe-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type of probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="cos" /> + <xml-property name="dependentOn" value="site-pair" /> + <xml-property name="container" value="classes-of-service" /> + </xml-properties> + </java-type> + + <java-type name="VpnBindings"> + <xml-root-element name="vpn-bindings" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpnBinding" name="vpn-binding" type="inventory.aai.openecomp.org.v10.VpnBinding" /> + </java-attributes> + </java-type> + + <java-type name="VpnBinding"> + <xml-root-element name="vpn-binding" /> + <java-attributes> + <xml-element java-attribute="vpnId" name="vpn-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="VPN ID, globally unique within A&AI" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnName" name="vpn-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="VPN Name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="globalRouteTarget" name="global-route-target" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Number used to identify a VPN, globally unique in the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnPlatform" name="vpn-platform" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the platform associated with the VPN example AVPN, Mobility" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnType" name="vpn-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the vpn, should be taken from enumerated/valid values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeDistinguisher" name="route-distinguisher" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargetRole" name="route-target-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this route target" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargets" name="route-targets" type="inventory.aai.openecomp.org.v10.RouteTargets" /> + + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList"> + <xml-properties> + <xml-property name="description" value="l3-networks relate to vpn-bindings" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPN binding" /> + <xml-property name="nameProps" value="vpn-name,vpn-type" /> + <xml-property name="indexedProps" value="vpn-name,vpn-id,global-route-target,vpn-type" /> + <xml-property name="searchable" value="vpn-id,vpn-name" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="container" value="vpn-bindings" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="RouteTargets"> + <xml-properties> + <xml-property name="description" value="Collection of route target information" /> + </xml-properties> + <xml-root-element name="route-targets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routeTarget" name="route-target" type="inventory.aai.openecomp.org.v10.RouteTarget" /> + </java-attributes> + </java-type> + <java-type name="RouteTarget"> + <xml-root-element name="route-target" /> + <java-attributes> + <xml-element java-attribute="globalRouteTarget" name="global-route-target" required="true" xml-key="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Number used to identify an RT, globally unique in the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargetRole" name="route-target-role" required="true" xml-key="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this route target" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Route target information" /> + <xml-property name="container" value="route-targets" /> + <xml-property name="canBeLinked" value="true" /> + </xml-properties> + </java-type> + <java-type name="VplsPes"> + <xml-properties> + <xml-property name="description" value="Collection of VPLS Provider Edge routers" /> + </xml-properties> + <xml-root-element name="vpls-pes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vplsPe" name="vpls-pe" type="inventory.aai.openecomp.org.v10.VplsPe" /> + </java-attributes> + </java-type> + + <java-type name="VplsPe"> + <xml-root-element name="vpls-pe" /> + <java-attributes> + <xml-element java-attribute="equipmentName" name="equipment-name" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value, e.g., VPLS-PE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Temporary location for stag to get to VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v10.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPLS Provider Edge routers." /> + <xml-property name="indexedProps" value="prov-status,equipment-name" /> + <xml-property name="container" value="vpls-pes" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="MulticastConfigurations"> + <xml-properties> + <xml-property name="description" value="multicast configuration of generic-vnf ip-address" /> + </xml-properties> + <xml-root-element name="multicast-configurations" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="multicastConfiguration" name="multicast-configuration" type="inventory.aai.openecomp.org.v10.MulticastConfiguration" /> + </java-attributes> + </java-type> + + <java-type name="MulticastConfiguration"> + <xml-root-element name="multicast-configuration" /> + <java-attributes> + <xml-element java-attribute="multicastConfigurationId" name="multicast-configuration-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of multicast configuration." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="multicastProtocol" name="multicast-protocol" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="protocol of multicast configuration" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="rpType" name="rp-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="rp type of multicast configuration" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="multicast-configuration-id" /> + <xml-property name="uniqueProps" value="multicast-configuration-id" /> + <xml-property name="container" value="multicast-configurations" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Vces"> + <xml-properties> + <xml-property name="description" value="Collection of Virtual Customer Edge Routers, used specifically for Gamma. This object is deprecated." /> + </xml-properties> + <xml-root-element name="vces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vce" name="vce" type="inventory.aai.openecomp.org.v10.Vce" /> + </java-attributes> + </java-type> + + <java-type name="Vce"> + <xml-root-element name="vce" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not strictly map to ASDC services, SOON TO BE DEPRECATED." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network role being played by this VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpeId" name="vpe-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID of VPE connected to this VCE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6VceWanAddress" name="v6-vce-wan-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Valid v6 IP address for the WAN Link on this router. Implied length of /64." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vce, also used for troubleshooting and is IP used for traps generated by VCE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - see child relationships" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroups" name="port-groups" type="inventory.aai.openecomp.org.v10.PortGroups" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v10.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v10.Entitlements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Customer Edge Router, used specifically for Gamma. This object is deprecated." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,interface-name,regional-resource-zone,vpe-id,prov-status,service-id" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="vces" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="PortGroups"> + <xml-root-element name="port-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="portGroup" name="port-group" type="inventory.aai.openecomp.org.v10.PortGroup" /> + </java-attributes> + </java-type> + + <java-type name="PortGroup"> + <xml-root-element name="port-group" /> + <java-attributes> + <xml-element java-attribute="interfaceId" name="interface-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkName" name="neutron-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network name of this Interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupId" name="port-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID for port group in vmware" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupName" name="port-group-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Likely to duplicate value of neutron network name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="switchName" name="switch-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="DVS or standard switch name (should be non-null for port groups associated with DVS)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cvlanTags" name="cvlan-tags" type="inventory.aai.openecomp.org.v10.CvlanTags" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Used to capture the network interfaces of this VCE" /> + <xml-property name="nameProps" value="port-group-name" /> + <xml-property name="indexedProps" value="port-group-id,heat-stack-id,interface-id,interface-name,switch-name" /> + <xml-property name="dependentOn" value="vce" /> + <xml-property name="container" value="port-groups" /> + </xml-properties> + </java-type> + + <java-type name="CvlanTags"> + <xml-root-element name="cvlan-tags" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cvlanTagEntry" name="cvlan-tag-entry" type="inventory.aai.openecomp.org.v10.CvlanTagEntry" /> + </java-attributes> + </java-type> + + <java-type name="CvlanTagEntry"> + <xml-root-element name="cvlan-tag-entry" /> + <java-attributes> + <xml-element java-attribute="cvlanTag" name="cvlan-tag" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="See mis-na-virtualization-platform.yang" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="dependentOn" value="port-group" /> + <xml-property name="indexedProps" value="cvlan-tag" /> + <xml-property name="container" value="cvlan-tags" /> + </xml-properties> + </java-type> + + <java-type name="Vpes"> + <xml-properties> + <xml-property name="description" value="Virtual provider edge router. In 1504, A&AI will populate this object through an M&P and tool provided to operations." /> + </xml-properties> + <xml-root-element name="vpes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpe" name="vpe" type="inventory.aai.openecomp.org.v10.Vpe" /> + </java-attributes> + </java-type> + + <java-type name="Vpe"> + <xml-root-element name="vpe" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service. Does not map strictly to ASDC services. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use. See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddressPrefixLength" name="ipv4-oam-gateway-address-prefix-length" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Prefix length for oam-address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamGatewayAddress" name="ipv4-oam-gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Gateway address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v4Loopback0IpAddress" name="v4-loopback0-ip-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Temporary location for stag to get to VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VPE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the vpe operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether vpe access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v10.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v10.Entitlements" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Relationship-list must include related to info for complex." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,vnf-id,regional-resource-zone,prov-status,service-id" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="vpes" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="Vnfcs"> + <xml-properties> + <xml-property name="description" value="virtual network components associated with a vserver from application controller." /> + </xml-properties> + <xml-root-element name="vnfcs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfc" name="vnfc" type="inventory.aai.openecomp.org.v10.Vnfc" /> + </java-attributes> + </java-type> + + <java-type name="Vnfc"> + <xml-root-element name="vnfc" /> + <java-attributes> + <xml-element java-attribute="vnfcName" name="vnfc-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vnfc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcFunctionCode" name="vnfc-function-code" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="function code" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcType" name="vnfc-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="prov status of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by APP-C" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4OamVip" name="ipaddress-v4-oam-vip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Oam V4 vip address of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupNotation" name="group-notation" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group notation of VNFC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation" /> + <xml-property name="searchable" value="vnfc-name" /> + <xml-property name="container" value="vnfcs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="L3Networks"> + <xml-root-element name="l3-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="l3Network" name="l3-network" type="inventory.aai.openecomp.org.v10.L3Network" /> + </java-attributes> + </java-type> + + <java-type name="L3Network"> + <xml-root-element name="l3-network" /> + <java-attributes> + <xml-element java-attribute="networkId" name="network-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Network ID, should be uuid. Unique across A&AI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network, governed by some naming convention.." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkType" name="network-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the network - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRole" name="network-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role the network plans - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkTechnology" name="network-technology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network technology - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBoundToVpn" name="is-bound-to-vpn" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Set to true if bound to VPN" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from ASDC. Does not strictly map to ASDC services. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRoleInstance" name="network-role-instance" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="network role instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailNetworkFqdn" name="contrail-network-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalNetworkName" name="physical-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the physical network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isProviderNetwork" name="is-provider-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a provider network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isSharedNetwork" name="is-shared-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a shared network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isExternalNetwork" name="is-external-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is an external network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnets" name="subnets" type="inventory.aai.openecomp.org.v10.Subnets" /> + <xml-element java-attribute="ctagAssignments" name="ctag-assignments" type="inventory.aai.openecomp.org.v10.CtagAssignments" /> + <xml-element java-attribute="segmentationAssignments" name="segmentation-assignments" type="inventory.aai.openecomp.org.v10.SegmentationAssignments" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" > + <xml-properties> + <xml-property name="description" value="Relates to tenant (or is it a child of tenant), complex, service, vpn-binding" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Generic network definition" /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="heat-stack-id,network-uuid,service-id,network-id,network-name,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-network-fqdn,network-role" /> + <xml-property name="searchable" value="network-id,network-name" /> + <xml-property name="uniqueProps" value="network-id" /> + <xml-property name="container" value="l3-networks" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="NetworkPolicies"> + <xml-root-element name="network-policies" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="networkPolicy" name="network-policy" type="inventory.aai.openecomp.org.v10.NetworkPolicy" /> + </java-attributes> + </java-type> + <java-type name="NetworkPolicy"> + <xml-root-element name="network-policy" /> + <java-attributes> + <xml-element java-attribute="networkPolicyId" name="network-policy-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID representing unique key to this instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkPolicyFqdn" name="network-policy-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the policy" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID for the openStack Heat instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="nameProps" value="network-policy-fqdn" /> + <xml-property name="indexedProps" value="network-policy-id,network-policy-fqdn" /> + <xml-property name="searchable" value="network-policy-id,network-policy-fqdn" /> + <xml-property name="uniqueProps" value="network-policy-id" /> + <xml-property name="container" value="network-policies" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="CtagAssignments"> + <xml-root-element name="ctag-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagAssignment" name="ctag-assignment" type="inventory.aai.openecomp.org.v10.CtagAssignment" /> + </java-attributes> + </java-type> + + <java-type name="CtagAssignment"> + <xml-root-element name="ctag-assignment" /> + <java-attributes> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="id." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vlan-id-inner" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="ctag-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Subnets"> + <xml-root-element name="subnets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="subnet" name="subnet" type="inventory.aai.openecomp.org.v10.Subnet" /> + </java-attributes> + </java-type> + + <java-type name="Subnet"> + <xml-root-element name="subnet" /> + <java-attributes> + <xml-element java-attribute="subnetId" name="subnet-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Subnet ID, should be UUID." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnetName" name="subnet-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the subnet." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of this subnet" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="gatewayAddress" name="gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="gateway ip address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkStartAddress" name="network-start-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="network start address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cidrMask" name="cidr-mask" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="cidr mask" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="dhcpEnabled" name="dhcp-enabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="dhcp enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpStart" name="dhcp-start" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the start address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpEnd" name="dhcp-end" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the last address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="subnet-id,subnet-name" /> + <xml-property name="nameProps" value="subnet-name" /> + <xml-property name="uniqueProps" value="subnet-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="subnets" /> + </xml-properties> + </java-type> + + <java-type name="GenericVnfs"> + <xml-properties> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + <xml-root-element name="generic-vnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="genericVnf" name="generic-vnf" type="inventory.aai.openecomp.org.v10.GenericVnf" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="GenericVnf"> + <xml-root-element name="generic-vnf" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, used by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether generic-vnf access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementAssignmentGroupUuid" name="entitlement-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the Entitlement group used for licensing VNFs, OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the specific entitlement resource. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseAssignmentGroupUuid" name="license-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the license assignment group. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKeyUuid" name="license-key-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the actual license resource. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="represents sub zone of the rr plane" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfType" name="nf-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Generic description of the type of NF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfFunction" name="nf-function" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="English description of Network function that the specific VNF deployment is providing" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfRole" name="nf-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="role in the network that this model will be providing" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfNamingCode" name="nf-naming-code" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="string assigned to this model used for naming purposes" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + <xml-element java-attribute="vfModules" name="vf-modules" type="inventory.aai.openecomp.org.v10.VfModules" /> + <xml-element java-attribute="licenses" name="licenses" type="inventory.aai.openecomp.org.v10.Licenses" /> + <xml-element java-attribute="entitlements" name="entitlements" type="inventory.aai.openecomp.org.v10.Entitlements" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,nf-type,nf-function,nf-naming-code,nf-role" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="generic-vnfs" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="VfModules"> + <xml-properties> + <xml-property name="description" value="Collection of vf-modules, a deployment unit of VNFCs" /> + </xml-properties> + <xml-root-element name="vf-modules" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vfModule" name="vf-module" type="inventory.aai.openecomp.org.v10.VfModule" /> + </java-attributes> + </java-type> + + <java-type name="VfModule"> + <xml-root-element name="vf-module" /> + <java-attributes> + <xml-element java-attribute="vfModuleId" name="vf-module-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vf-module." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleName" name="vf-module-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vf-module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration status of this vf-module, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBaseVfModule" name="is-base-vf-module" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is base vf module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailServiceInstanceFqdn" name="contrail-service-instance-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the Contrail unique ID for a service-instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="moduleIndex" name="module-index" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="the index will track the number of modules of a given type that have been deployed in a VNF, starting with 0, and always choosing the lowest available digit" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="a deployment unit of VNFCs" /> + <xml-property name="indexedProps" value="vf-module-id,vf-module-name,heat-stack-id,model-invariant-id,model-version-id,widget-model-id,widget-model-version,contrail-service-instance-fqdn" /> + <xml-property name="searchable" value="vf-module-id,vf-module-name" /> + <xml-property name="dependentOn" value="generic-vnf" /> + <xml-property name="container" value="vf-modules" /> + </xml-properties> + </java-type> + + + <java-type name="LagLinks"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregation connections" /> + </xml-properties> + <xml-root-element name="lag-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagLink" name="lag-link" type="inventory.aai.openecomp.org.v10.LagLink" /> + </java-attributes> + </java-type> + + <java-type name="LagLink"> + <xml-root-element name="lag-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Alphabetical concatenation of lag-interface names" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="LAG links can connect lag-interfaces" /> + <xml-property name="indexedProps" value="link-name" /> + <xml-property name="container" value="lag-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Newvces"> + <xml-properties> + <xml-property name="description" value="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce." /> + </xml-properties> + <xml-root-element name="newvces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="newvce" name="newvce" type="inventory.aai.openecomp.org.v10.Newvce" /> + </java-attributes> + </java-type> + + <java-type name="Newvce"> + <xml-root-element name="newvce" /> + <java-attributes> + <xml-element java-attribute="vnfId2" name="vnf-id2" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF, can't use same attribute name right now until we promote this new object" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this VNF by BAU Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure vpe, also used for troubleshooting and is IP used for traps generated by VPE (v4-loopback0-ip-address)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value, e.g., VPE." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v10.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="This object fills in the gaps from vce that were incorporated into generic-vnf. This object will be retired with vce." /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="vnf-name,vnf-name2,vnf-type,heat-stack-id,prov-status,vnf-id2" /> + <xml-property name="searchable" value="vnf-id2,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id2" /> + <xml-property name="container" value="newvces" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Pnfs"> + <xml-properties> + <xml-property name="description" value="Collection of Physical Network Functions." /> + </xml-properties> + <xml-root-element name="pnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pnf" name="pnf" type="inventory.aai.openecomp.org.v10.Pnf" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="Pnf"> + <xml-root-element name="pnf" /> + <java-attributes> + <xml-element java-attribute="pnfName" name="pnf-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2" name="pnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2Source" name="pnf-name2-source" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="source of name2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfId" name="pnf-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="id of pnf" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Oam" name="ipaddress-v4-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ipv4-oam-address with new naming convention for IP addresses" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="swVersion" name="sw-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="sw-version is the version of SW for the hosted application on the PNF." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="frameId" name="frame-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of the physical frame (relay rack) where pnf is installed." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number of the device" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Loopback0" name="ipaddress-v4-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Loopback0" name="ipaddress-v6-loopback-0" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 Loopback 0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Aim" name="ipaddress-v4-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV4 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Aim" name="ipaddress-v6-aim" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 AIM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV6Oam" name="ipaddress-v6-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="IPV6 OAM address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="invStatus" name="inv-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CANOPI's inventory status. Only set with values exactly as defined by CANOPI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Prov Status of this device (not under canopi control) Valid values [PREPROV/NVTPROV/PROV]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfRole" name="nf-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nf Role is the role performed by this instance in the network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v10.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v10.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="PNF represents a physical network function. typically equipment used in the D1 world." /> + <xml-property name="indexedProps" value="pnf-name,orchestration-status,inv-status" /> + <xml-property name="searchable" value="pnf-name" /> + <xml-property name="uniqueProps" value="pnf-name" /> + <xml-property name="container" value="pnfs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="PhysicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + </xml-properties> + <xml-root-element name="physical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="physicalLink" name="physical-link" type="inventory.aai.openecomp.org.v10.PhysicalLink" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + + <java-type name="PhysicalLink"> + <xml-root-element name="physical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit it" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dualMode" name="dual-mode" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Dual access mode (e.g., primary, secondary" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="To provide information on who manages this circuit. A&AI or 3rd party transport provider" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceProviderName" name="service-provider-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the service Provider on this link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + <xml-property name="indexedProps" value="circuit-id,link-name" /> + <xml-property name="alternateKeys1" value="circuit-id" /> + <xml-property name="container" value="physical-links" /> + <xml-property name="namespace" value="network" /> + <xml-property name="searchable" value="link-name,circuit-id" /> + </xml-properties> + </java-type> + + <java-type name="VigServers"> + <xml-root-element name="vig-servers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vigServer" name="vig-server" type="inventory.aai.openecomp.org.v10.VigServer" /> + </java-attributes> + </java-type> + + <java-type name="VigServer"> + <xml-root-element name="vig-server" /> + <java-attributes> + <xml-element java-attribute="vigAddressType" name="vig-address-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="indicates whether the VIG is for AVPN or INTERNET" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="ipaddressV4Vig" name="ipaddress-v4-vig" type="java.lang.String" > + <xml-properties> + <xml-property name="description" value="v4 IP of the vig server" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="ipaddressV6Vig" name="ipaddress-v6-vig" type="java.lang.String" > + <xml-properties> + <xml-property name="description" value="v6 IP of the vig server" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="vig-server contains information about a vig server used for IPSec-configuration. Populated by SDN-C from 1607" /> + <xml-property name="indexedProps" value="vig-address-type" /> + <xml-property name="dependentOn" value="ipsec-configuration" /> + <xml-property name="container" value="vig-servers" /> + </xml-properties> + </java-type> + + <java-type name="IpsecConfigurations"> + <xml-root-element name="ipsec-configurations" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ipsecConfiguration" name="ipsec-configuration" type="inventory.aai.openecomp.org.v10.IpsecConfiguration" /> + </java-attributes> + </java-type> + + <java-type name="IpsecConfiguration"> + <xml-root-element name="ipsec-configuration" /> + <java-attributes> + <xml-element java-attribute="ipsecConfigurationId" name="ipsec-configuration-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="UUID of this configuration" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedVigAddressType" name="requested-vig-address-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicate the type of VIG server like AVPN, INTERNET, BOTH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedEncryptionStrength" name="requested-encryption-strength" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encryption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedDmzType" name="requested-dmz-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="can offer a shared DMZ or a DMZ specific to a customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sharedDmzNetworkAddress" name="shared-dmz-network-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network address of shared DMZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="requestedCustomerName" name="requested-customer-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="If the DMZ is a custom DMZ, this field will indicate the customer information" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikeVersion" name="ike-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="can be 1 or 2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1Authentication" name="ikev1-authentication" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contains values like md5, sha1, sha256, sha384" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1Encryption" name="ikev1-encryption" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encyption values like 3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1DhGroup" name="ikev1-dh-group" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Diffie-Hellman group like DH-GROUP2, DH-GROUP5, DH-GROUP14" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1AmGroupId" name="ikev1-am-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name defined in VIG for clients using aggressive mode" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1AmPassword" name="ikev1-am-password" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="pre-shared key for the above group name " /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ikev1SaLifetime" name="ikev1-sa-lifetime" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Lifetime for IKEv1 SA" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecAuthentication" name="ipsec-authentication" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="md5, sha1, sha256, sha384" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecEncryption" name="ipsec-encryption" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="3des-cbc, des-cbc, aes-128-cbc, aes-192-cbc, aes-265-cbc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecSaLifetime" name="ipsec-sa-lifetime" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Life time for IPSec SA" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipsecPfs" name="ipsec-pfs" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="enable PFS or not" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="xauthUserId" name="xauth-userid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="user ID for xAuth, sm-user, ,nmteHostName" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="xauthUserPassword" name="xauth-user-password" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Encrypted using the Juniper $9$ algorithm" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dpdInterval" name="dpd-interval" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The time between DPD probe" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dpdFrequency" name="dpd-frequency" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Maximum number of DPD before claiming the tunnel is down" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + <xml-element java-attribute="vigServers" name="vig-servers" type="inventory.aai.openecomp.org.v10.VigServers" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPSec configuration node will contain various configuration data for the NMTE VNF. This node will have an edge to the generic-vnf (vnf type = TE). Starting 1607, this data will be populated by SDN-C" /> + <xml-property name="indexedProps" value="ipsec-configuration-id" /> + <xml-property name="uniqueProps" value="ipsec-configuration-id" /> + <xml-property name="container" value="ipsec-configurations" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + + <java-type name="NotificationEvent"> + <xml-root-element name="notification-event" /> + <java-attributes> + <xml-element java-attribute="cambriaPartition" name="cambria.partition" type="java.lang.String" /> + <xml-element java-attribute="eventHeader" name="event-header" type="inventory.aai.openecomp.org.v10.NotificationEventHeader" /> + <xml-any-element java-attribute="entity" /> + </java-attributes> + </java-type> + <java-type name="NotificationEventHeader"> + <xml-root-element name="notification-event-header" /> + <java-attributes> + <xml-element java-attribute="id" name="id" type="java.lang.String" /> + <xml-element java-attribute="timestamp" name="timestamp" type="java.lang.String" /> + <xml-element java-attribute="sourceName" name="source-name" type="java.lang.String" /> + <xml-element java-attribute="domain" name="domain" type="java.lang.String" /> + <xml-element java-attribute="sequenceNumber" name="sequence-number" type="java.lang.String" /> + <xml-element java-attribute="severity" name="severity" type="java.lang.String" /> + <xml-element java-attribute="eventType" name="event-type" type="java.lang.String" /> + <xml-element java-attribute="version" name="version" type="java.lang.String" /> + <xml-element java-attribute="action" name="action" type="java.lang.String" /> + <xml-element java-attribute="entityType" name="entity-type" type="java.lang.String" /> + <xml-element java-attribute="topEntityType" name="top-entity-type" type="java.lang.String" /> + <xml-element java-attribute="entityLink" name="entity-link" type="java.lang.String" /> + <xml-element java-attribute="status" name="status" type="java.lang.String" /> + </java-attributes> + </java-type> + <java-type name="AaiInternal"> + <xml-root-element name="aai-internal" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="reservedPropNames" name="reserved-prop-names" type="inventory.aai.openecomp.org.v10.ReservedPropNames" /> + <xml-element container-type="java.util.ArrayList" java-attribute="edgePropNames" name="edge-prop-names" type="inventory.aai.openecomp.org.v10.EdgePropNames" /> + </java-attributes> + </java-type> + <java-type name="ReservedPropNames"> + <xml-properties> + <xml-property name="description" value="Internal map to define some reserved properties of a vertex" /> + <xml-property name="uniqueProps" value="aai-unique-key" /> + <xml-property name="indexedProps" value="aai-unique-key,source-of-truth,aai-node-type,aai-uri" /> + </xml-properties> + <xml-root-element name="reserved-prop-names" /> + <java-attributes> + <xml-element java-attribute="lastModSourceOfTruth" name="last-mod-source-of-truth" type="java.lang.String" /> + <xml-element java-attribute="aaiNodeType" name="aai-node-type" type="java.lang.String" /> + <xml-element java-attribute="aaiCreatedTs" name="aai-created-ts" type="java.lang.Long" /> + <xml-element java-attribute="aaiUniqueKey" name="aai-unique-key" type="java.lang.String" /> + <xml-element java-attribute="aaiLastModTs" name="aai-last-mod-ts" type="java.lang.Long" /> + <xml-element java-attribute="sourceOfTruth" name="source-of-truth" type="java.lang.String" /> + <xml-element java-attribute="aaiUri" name="aai-uri" type="java.lang.String" /> + </java-attributes> + </java-type> + <java-type name="EdgePropNames"> + <!-- NOTE that the names of these properties are not consistent and are in mixed case and hyphen case for now --> + <xml-properties> + <xml-property name="description" value="Internal map to define the properties of an edge and interpret the map EdgeRules" /> + <xml-property name="edgeInfo" value="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV" /> + </xml-properties> + <xml-root-element name="edge-prop-names" /> + <java-attributes> + <xml-element java-attribute="edgeLabel" name="edgeLabel" type="java.lang.String" /> + <xml-element java-attribute="direction" name="direction" type="java.lang.String" /> + <xml-element java-attribute="multiplicityRule" name="multiplicityRule" type="java.lang.String" /> + <xml-element java-attribute="isParent" name="isParent" type="java.lang.Boolean" /> + <xml-element java-attribute="usesResource" name="usesResource" type="java.lang.Boolean" /> + <xml-element java-attribute="hasDelTarget" name="hasDelTarget" type="java.lang.Boolean" /> + <xml-element java-attribute="SVC-INFRA" name="SVC-INFRA" type="java.lang.String" /> + <xml-element java-attribute="SVC-INFRA-REV" name="SVC-INFRA-REV" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Models"> + <xml-properties> + <xml-property name="description" value="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models" /> + </xml-properties> + <xml-root-element name="models" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="model" name="model" type="inventory.aai.openecomp.org.v10.Model" /> + </java-attributes> + </java-type> + + <java-type name="Model"> + <xml-root-element name="model" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version" /> + <xml-property name="nameProps" value="model-type" /> + <xml-property name="indexedProps" value="model-invariant-id,model-type" /> + <xml-property name="uniqueProps" value="model-invariant-id" /> + <xml-property name="container" value="models" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v10.ModelVers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + + <java-type name="ModelVers"> + <xml-root-element name="model-vers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelVer" name="model-ver" type="inventory.aai.openecomp.org.v10.ModelVer" /> + </java-attributes> + </java-type> + + <java-type name="ModelVer"> + <xml-root-element name="model-ver" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models" /> + <xml-property name="nameProps" value="model-name" /> + <xml-property name="indexedProps" value="model-version-id,model-name,model-version" /> + <xml-property name="uniqueProps" value="model-version-id" /> + <xml-property name="container" value="model-vers" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelVersionId" name="model-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v10.ModelElements" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v10.Metadata" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelElements"> + <xml-root-element name="model-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelElement" name="model-element" type="inventory.aai.openecomp.org.v10.ModelElement" /> + </java-attributes> + </java-type> + + <java-type name="ModelElement"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model." /> + <xml-property name="uniqueProps" value="model-element-uuid" /> + <xml-property name="indexedProps" value="model-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-elements" /> + </xml-properties> + <xml-root-element name="model-element" /> + <java-attributes> + <xml-element java-attribute="modelElementUuid" name="model-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="newDataDelFlag" name="new-data-del-flag" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates whether this element was created as part of instantiation from this model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cardinality" name="cardinality" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="How many of this type of element are required/allowed" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="linkagePoints" name="linkage-points" type="java.lang.String" > + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v10.ModelElements"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelConstraints" name="model-constraints" type="inventory.aai.openecomp.org.v10.ModelConstraints"> + <xml-properties> + <xml-property name="description" value="Describes new constraints on this model element that are not part of that model's definition" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraints"> + <xml-root-element name="model-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelConstraint" name="model-constraint" type="inventory.aai.openecomp.org.v10.ModelConstraint" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraint"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="model-constraint-uuid" /> + <xml-property name="indexedProps" value="model-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-constraints" /> + </xml-properties> + <xml-root-element name="model-constraint" /> + <java-attributes> + <xml-element java-attribute="modelConstraintUuid" name="model-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constrainedElementSetUuidToReplace" name="constrained-element-set-uuid-to-replace" required="true" type="java.lang.String" /> + <xml-element java-attribute="constrainedElementSets" name="constrained-element-sets" type="inventory.aai.openecomp.org.v10.ConstrainedElementSets" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSets"> + <xml-root-element name="constrained-element-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="constrainedElementSet" name="constrained-element-set" type="inventory.aai.openecomp.org.v10.ConstrainedElementSet" /> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="constrained-element-set-uuid" /> + <xml-property name="indexedProps" value="constrained-element-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="constrained-element-sets" /> + </xml-properties> + <xml-root-element name="constrained-element-set" /> + <java-attributes> + <xml-element java-attribute="constrainedElementSetUuid" name="constrained-element-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="checkType" name="check-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="elementChoiceSets" name="element-choice-sets" type="inventory.aai.openecomp.org.v10.ElementChoiceSets" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSets"> + <xml-root-element name="element-choice-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="elementChoiceSet" name="element-choice-set" type="inventory.aai.openecomp.org.v10.ElementChoiceSet" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="element-choice-set-uuid" /> + <xml-property name="indexedProps" value="element-choice-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="element-choice-sets" /> + </xml-properties> + <xml-root-element name="element-choice-set" /> + <java-attributes> + <xml-element java-attribute="elementChoiceSetUuid" name="element-choice-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elementChoiceSetName" name="element-choice-set-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="cardinality" name="cardinality" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v10.ModelElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueries"> + <xml-root-element name="named-queries" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v10.NamedQuery" /> + </java-attributes> + </java-type> + + <java-type name="NamedQuery"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="nameProps" value="named-query-name" /> + <xml-property name="uniqueProps" value="named-query-uuid" /> + <xml-property name="indexedProps" value="named-query-uuid,named-query-name" /> + <xml-property name="container" value="named-queries" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="named-query" /> + <java-attributes> + <xml-element java-attribute="namedQueryUuid" name="named-query-uuid" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="namedQueryName" name="named-query-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="namedQueryVersion" name="named-query-version" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="requiredInputParams" name="required-input-param" type="java.lang.String" > + <xml-element-wrapper name="required-input-params" /> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v10.NamedQueryElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElements"> + <xml-root-element name="named-query-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQueryElement" name="named-query-element" type="inventory.aai.openecomp.org.v10.NamedQueryElement" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElement"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="named-query-element-uuid" /> + <xml-property name="indexedProps" value="named-query-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="named-query-elements" /> + </xml-properties> + <xml-root-element name="named-query-element" /> + <java-attributes> + <xml-element java-attribute="namedQueryElementUuid" name="named-query-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="propertyLimitDesc" name="property-limit-desc" type="java.lang.String" /> + <xml-element java-attribute="doNotOutput" name="do-not-output" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v10.NamedQueryElements" /> + <xml-element java-attribute="relatedLookups" name="related-lookups" type="inventory.aai.openecomp.org.v10.RelatedLookups" /> + <xml-element java-attribute="propertyConstraints" name="property-constraints" type="inventory.aai.openecomp.org.v10.PropertyConstraints" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookups"> + <xml-root-element name="related-lookups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedLookup" name="related-lookup" type="inventory.aai.openecomp.org.v10.RelatedLookup" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookup"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="related-lookup-uuid" /> + <xml-property name="indexedProps" value="related-lookup-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="related-lookups" /> + </xml-properties> + <xml-root-element name="related-lookup" /> + <java-attributes> + <xml-element java-attribute="relatedLookupUuid" name="related-lookup-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceNodeType" name="source-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="sourceNodeProperty" name="source-node-property" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeType" name="target-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeProperty" name="target-node-property" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraints"> + <xml-root-element name="property-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyConstraint" name="property-constraint" type="inventory.aai.openecomp.org.v10.PropertyConstraint" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraint"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="property-constraint-uuid" /> + <xml-property name="indexedProps" value="property-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="property-constraints" /> + </xml-properties> + <xml-root-element name="property-constraint" /> + <java-attributes> + <xml-element java-attribute="propertyConstraintUuid" name="property-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="propertyName" name="property-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ModelAndNamedQuerySearch"> + <xml-properties> + <xml-property name="description" value="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="model-and-named-query-search" /> + <java-attributes> + <xml-element java-attribute="queryParameters" name="query-parameters" type="inventory.aai.openecomp.org.v10.QueryParameters" /> + <xml-element java-attribute="instanceFilters" name="instance-filters" type="inventory.aai.openecomp.org.v10.InstanceFilters" /> + <xml-element java-attribute="secondaryFilts" name="secondary-filts" type="inventory.aai.openecomp.org.v10.SecondaryFilts" /> + <xml-element java-attribute="topNodeType" name="top-node-type" type="java.lang.String" /> + <xml-element java-attribute="secondaryFilterCutPoint" name="secondary-filter-cut-point" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="QueryParameters"> + <xml-properties> + <xml-property name="description" value="QueryParameters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="query-parameters" /> + <java-attributes> + <xml-element java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v10.NamedQuery" /> + <xml-element java-attribute="model" name="model" type="inventory.aai.openecomp.org.v10.OverloadedModel" /> + </java-attributes> + </java-type> + + <java-type name="OverloadedModel"> + <xml-root-element name="overloaded-model" /> + <xml-properties> + <xml-property name="description" value="Allows for legacy POST of old-style and new-style models" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelNameVersionId" name="model-name-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelId" name="model-id" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Invariant unique ID which does not change from version to version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v10.ModelVers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilters"> + <xml-properties> + <xml-property name="description" value="InstanceFilters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="instance-filters" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceFilter" name="instance-filter" type="inventory.aai.openecomp.org.v10.InstanceFilter" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilter"> + <xml-properties> + <xml-property name="description" value="InstanceFilter for performing a named-query or model query" /> + <xml-property name="container" value="instance-filters" /> + </xml-properties> + <xml-root-element name="instance-filter" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilts"> + <xml-properties> + <xml-property name="description" value="SecondaryFilts for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="secondary-filts" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="secondaryFilt" name="secondary-filt" type="inventory.aai.openecomp.org.v10.SecondaryFilt" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilt"> + <xml-properties> + <xml-property name="description" value="SecondaryFilt for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="secondary-filt" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + + <java-type name="Properties"> + <xml-properties> + <xml-property name="description" value="Property holder for query properties or instance properties" /> + </xml-properties> + <xml-root-element name="properties" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ResponseList"> + <xml-properties> + <xml-property name="description" value="Response container for the results of a named-query or model query" /> + </xml-properties> + <xml-root-element name="response-list" /> + <java-attributes> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v10.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItems"> + <xml-properties> + <xml-property name="description" value="Container for inventory items in response list" /> + <xml-property name="container" value="response-list" /> + </xml-properties> + <xml-root-element name="inventory-response-items" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryResponseItem" name="inventory-response-item" type="inventory.aai.openecomp.org.v10.InventoryResponseItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItem"> + <xml-properties> + <xml-property name="description" value="Inventory item for response list" /> + <xml-property name="container" value="inventory-response-items" /> + </xml-properties> + <xml-root-element name="inventory-response-item" /> + <java-attributes> + <xml-element java-attribute="modelName" name="model-name" type="java.lang.String" /> + <xml-any-element java-attribute="item" /> + <xml-element java-attribute="extraProperties" name="extra-properties" type="inventory.aai.openecomp.org.v10.ExtraProperties" /> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v10.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperties"> + <xml-properties> + <xml-property name="description" value="Extra properties for inventory item for response list" /> + </xml-properties> + <xml-root-element name="extra-properties" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="extraProperty" name="extra-property" type="inventory.aai.openecomp.org.v10.ExtraProperty" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperty"> + <xml-root-element name="extra-property" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-any-element java-attribute="propertyValue" lax="true" name="property-value" /> + </java-attributes> + </java-type> + + <java-type name="RouteTableReferences"> + <xml-properties> + <xml-property name="description" value="Collection of openstack route table references" /> + </xml-properties> + <xml-root-element name="route-table-references" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="routeTableReference" name="route-table-reference" type="inventory.aai.openecomp.org.v10.RouteTableReference" /> + </java-attributes> + </java-type> + + <java-type name="RouteTableReference"> + <xml-root-element name="route-table-reference" /> + <java-attributes> + <xml-element java-attribute="routeTableReferenceId" name="route-table-reference-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTableReferenceFqdn" name="route-table-reference-fqdn" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="FQDN entry in the route table." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="Openstack route table reference." /> + <xml-property name="nameProps" value="route-table-reference-fqdn" /> + <xml-property name="uniqueProps" value="route-table-reference-id" /> + <xml-property name="indexedProps" value="route-table-reference-id,route-table-reference-fqdn" /> + <xml-property name="container" value="route-table-references" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="InstanceGroups"> + <xml-properties> + <xml-property name="description" value="Collection of openstack route table references" /> + </xml-properties> + <xml-root-element name="instance-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceGroup" name="instance-group" type="inventory.aai.openecomp.org.v10.InstanceGroup" /> + </java-attributes> + </java-type> + + <java-type name="InstanceGroup"> + <xml-root-element name="instance-group" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Instance Group ID, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="description" name="description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Descriptive text to help identify the usage of this instance-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="type" name="type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Only valid value today is lower case ha for high availability" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subType" name="sub-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Valid values for ha type are [geo-activeactive, geo-activestandby, local-activeactive, local-activestandby]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="General mechanism for grouping instances" /> + <xml-property name="nameProps" value="description" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id,description,type,sub-type" /> + <xml-property name="container" value="instance-groups" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + + <java-type name="SegmentationAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack segmentation assignments" /> + </xml-properties> + <xml-root-element name="segmentation-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="segmentationAssignment" name="segmentation-assignment" type="inventory.aai.openecomp.org.v10.SegmentationAssignment" /> + </java-attributes> + </java-type> + + <java-type name="SegmentationAssignment"> + <xml-root-element name="segmentation-assignment" /> + <java-attributes> + <xml-element java-attribute="segmentationId" name="segmentation-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack segmentation assignment." /> + <xml-property name="indexedProps" value="segmentation-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="segmentation-assignments" /> + </xml-properties> + </java-type> + + <java-type name="AllottedResources"> + <xml-properties> + <xml-property name="description" value="This object is used to store slices of services being offered" /> + </xml-properties> + <xml-root-element name="allotted-resources" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="allottedResource" name="allotted-resource" type="inventory.aai.openecomp.org.v10.AllottedResource" /> + </java-attributes> + </java-type> + + <java-type name="AllottedResource"> + <xml-root-element name="allotted-resource" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Allotted Resource id UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The descriptive information assigned to this allotted resource instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Link back to more information in the controller" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="type" name="type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Generic description of the type of allotted resource." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="role" name="role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="role in the network that this resource will be providing." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tunnelXconnects" name="tunnel-xconnects" type="inventory.aai.openecomp.org.v10.TunnelXconnects" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="Represents a slice or partial piece of a resource that gets separately allotted" /> + <xml-property name="nameProps" value="description" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id,model-invariant-id,model-version-id,type,role" /> + <xml-property name="dependentOn" value="service-instance" /> + <xml-property name="container" value="allotted-resources" /> + <!-- <xml-property name="namespace" value="network" /> --> + </xml-properties> + </java-type> + + <java-type name="TunnelXconnects"> + <xml-properties> + <xml-property name="description" value="This object is used to store the specific tunnel cross connect aspects of an allotted resource" /> + </xml-properties> + <xml-root-element name="tunnel-xconnects" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tunnelXconnect" name="tunnel-xconnect" type="inventory.aai.openecomp.org.v10.TunnelXconnect" /> + </java-attributes> + </java-type> + + <java-type name="TunnelXconnect"> + <xml-root-element name="tunnel-xconnect" /> + <java-attributes> + <xml-element java-attribute="id" name="id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Allotted Resource id UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN uplink bandwidth for WAN1" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN downlink bandwidth for WAN1" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN uplink bandwidth for WAN2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The WAN downlink bandwidth for WAN2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + + <xml-properties> + <xml-property name="description" value="Represents the specifics of a tunnel cross connect piece of a resource that gets separately allotted" /> + <xml-property name="uniqueProps" value="id" /> + <xml-property name="indexedProps" value="id" /> + <xml-property name="dependentOn" value="allotted-resource" /> + <xml-property name="container" value="tunnel-xconnects" /> + <!-- <xml-property name="namespace" value="network" /> --> + </xml-properties> + </java-type> + + <java-type name="Entitlements"> + <xml-properties> + <xml-property name="description" value="Entitlements, keyed by group-uuid and resource-uuid, related to license management" /> + </xml-properties> + <xml-root-element name="entitlements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="entitlement" name="entitlement" type="inventory.aai.openecomp.org.v10.Entitlement" /> + </java-attributes> + </java-type> + + <java-type name="Entitlement"> + <xml-root-element name="entitlement" /> + <java-attributes> + <xml-element java-attribute="groupUuid" name="group-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID for the entitlement group the resource comes from, should be uuid." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceUuid" name="resource-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of an entitlement resource. " /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Metadata for entitlement group." /> + <xml-property name="indexedProps" value="group-uuid,resource-uuid" /> + <xml-property name="dependentOn" value="generic-vnf,vce,vpe" /> + <xml-property name="container" value="entitlements" /> + </xml-properties> + </java-type> + + + <java-type name="Licenses"> + <xml-properties> + <xml-property name="description" value="Licenses to be allocated across resources, keyed by group-uuid and resource-uuid, related to license management" /> + </xml-properties> + <xml-root-element name="licenses" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="license" name="license" type="inventory.aai.openecomp.org.v10.License" /> + </java-attributes> + </java-type> + + <java-type name="License"> + <xml-root-element name="license" /> + <java-attributes> + <xml-element java-attribute="groupUuid" name="group-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID for the license group the resource belongs to, should be uuid." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceUuid" name="resource-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of a license resource. " /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Metadata for license group." /> + <xml-property name="indexedProps" value="group-uuid,resource-uuid" /> + <xml-property name="dependentOn" value="generic-vnf,vce,vpe" /> + <xml-property name="container" value="licenses" /> + </xml-properties> + </java-type> + + <java-type name="Vnf"> + <xml-root-element name="vnf"/> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Abstract vnf class" /> + <xml-property name="indexedProps" value="vnf-id" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="inheritors" value="vce,vpe,generic-vnf" /> + <xml-property name="abstract" value="true" /> + </xml-properties> + </java-type> + + <java-type name="Zones"> + <xml-properties> + <xml-property name="description" value="Collection of zones" /> + </xml-properties> + <xml-root-element name="zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="zone" name="zone" type="inventory.aai.openecomp.org.v10.Zone" /> + </java-attributes> + </java-type> + + <java-type name="Zone"> + <xml-root-element name="zone" /> + <java-attributes> + <xml-element java-attribute="zoneId" name="zone-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Code assigned by AIC to the zone" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneName" name="zone-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="English name associated with the zone" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="designType" name="design-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Design of zone [Medium/Large…]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="zoneContext" name="zone-context" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Context of zone [production/test]" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="status" name="status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Status of a zone." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="A zone is a grouping of assets in a location homing to the same connections into the CBB" /> + <xml-property name="nameProps" value="zone-name" /> + <xml-property name="indexedProps" value="zone-id,design-type,zone-context" /> + <xml-property name="uniqueProps" value="zone-id" /> + <xml-property name="container" value="zones" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + <java-type name="TestObjects"> + <xml-properties> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + <xml-root-element name="test-objects" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" + java-attribute="testObject" name="test-object" + type="inventory.aai.openecomp.org.v10.TestObject" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + </xml-properties> + </java-type> + <java-type name="TestObject"> + <xml-root-element name="test-object" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" + required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" + value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" + required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" + required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Orchestration status of this VNF, used by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="identifier of managed by company or customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" + value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" + type="java.lang.Long"> + <xml-properties> + <xml-property name="description" + value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" + type="java.lang.Long"> + <xml-properties> + <xml-property name="description" + value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" + java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" + value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" + java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" + type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false" /> + <xml-property name="description" + value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="details regarding the generic-vnf operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" + type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" + value="indicates whether generic-vnf access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementAssignmentGroupUuid" + name="entitlement-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="UUID of the Entitlement group used for licensing VNFs, OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" + name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="UUID of the specific entitlement resource. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseAssignmentGroupUuid" + name="license-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="UUID of the license assignment group. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKeyUuid" name="license-key-uuid" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="UUID of the actual license resource. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="the ASDC model id for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="deployment" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVer" name="persona-model-ver" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dataCopy" + value="service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}#model-version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="notVisibleTestElement" + name="not-visible-test-element" type="java.lang.String"> + <xml-properties> + <xml-property name="visibility" value="internal" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelCustomizationId" name="model-customization-id" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" + name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="represents sub zone of the rr plane" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfType" name="nf-type" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="Generic description of the type of NF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfFunction" name="nf-function" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="English description of Network function that the specific VNF deployment is providing" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfRole" name="nf-role" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="role in the network that this model will be providing" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nfNamingCode" name="nf-naming-code" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" + value="string assigned to this model used for naming purposes" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" + type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="testObjects" name="test-objects" type="inventory.aai.openecomp.org.v10.TestObjects" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v10.RelationshipList" /> + + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" + value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,nf-type,nf-function,nf-naming-code,nf-role" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="test-objects" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + </java-types> +</xml-bindings> diff --git a/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v8.xml b/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v8.xml new file mode 100644 index 00000000..3ed2ea53 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v8.xml @@ -0,0 +1,3076 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.openecomp.org.v8" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.openecomp.aai.inventory/v8" /> + </xml-schema> + <java-types> + <java-type name="Inventory"> + <xml-root-element name="inventory" /> + <java-attributes> + <xml-element java-attribute="search" name="search" type="inventory.aai.openecomp.org.v8.Search" /> + <xml-element java-attribute="actions" name="actions" type="inventory.aai.openecomp.org.v8.Actions" /> + <xml-element java-attribute="cloudInfrastructure" name="cloud-infrastructure" type="inventory.aai.openecomp.org.v8.CloudInfrastructure" /> + <xml-element java-attribute="business" name="business" type="inventory.aai.openecomp.org.v8.Business" /> + <xml-element java-attribute="serviceDesignAndCreation" name="service-design-and-creation" type="inventory.aai.openecomp.org.v8.ServiceDesignAndCreation" /> + <xml-element java-attribute="network" name="network" type="inventory.aai.openecomp.org.v8.Network" /> + <xml-element java-attribute="aaiInternal" name="aai-internal" type="inventory.aai.openecomp.org.v8.AaiInternal" /> + </java-attributes> + </java-type> + + <java-type name="Search"> + <xml-root-element name="search" /> + <java-attributes> + <xml-element java-attribute="searchResults" name="search-results" type="inventory.aai.openecomp.org.v8.SearchResults" /> + </java-attributes> + </java-type> + + + <java-type name="TaggedInventoryItemList"> + <xml-root-element name="tagged-inventory-item-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItem" name="inventory-item" type="inventory.aai.openecomp.org.v8.InventoryItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItem"> + <xml-root-element name="inventory-item" /> + <java-attributes> + <xml-element java-attribute="inventoryItemType" name="inventory-item-type" type="java.lang.String" /> + <xml-element java-attribute="inventoryItemLink" name="inventory-item-link" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryItemData" name="inventory-item-data" type="inventory.aai.openecomp.org.v8.InventoryItemData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="taggedInventoryItemList" name="tagged-inventory-item-list" type="inventory.aai.openecomp.org.v8.TaggedInventoryItemList" /> + </java-attributes> + </java-type> + + <java-type name="InventoryItemData"> + <xml-root-element name="inventory-item-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + + <java-type name="StartNodeFilter"> + <xml-root-element name="start-node-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="IncludeNodeFilter"> + <xml-root-element name="include-node-filter" /> + <java-attributes> + <xml-element java-attribute="includeNodeType" name="include-node-type" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SecondaryFilter"> + <xml-root-element name="secondary-filter" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="filterType" name="filter-type" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="SearchResults"> + <xml-root-element name="search-results" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="resultData" name="result-data" type="inventory.aai.openecomp.org.v8.ResultData" /> + </java-attributes> + </java-type> + + <java-type name="ResultData"> + <xml-root-element name="result-data" /> + <java-attributes> + <xml-element java-attribute="resourceType" name="resource-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The specific type of node in the AAI graph" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceLink" name="resource-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The URL to the specific resource" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="Actions"> + <xml-properties> + <xml-property name="description" value="APIs that are more action related than REST (e.g., notify, update)." /> + </xml-properties> + <xml-root-element name="actions" /> + <java-attributes> + <xml-element java-attribute="update" name="update" type="inventory.aai.openecomp.org.v8.Update" /> + <xml-element java-attribute="notify" name="notify" type="inventory.aai.openecomp.org.v8.Notify" /> + </java-attributes> + </java-type> + + <java-type name="Update"> + <xml-properties> + <xml-property name="description" value="Serves a PATCH like function. Does not enforce concurrency control." /> + </xml-properties> + <xml-root-element name="update" /> + <java-attributes> + <xml-element java-attribute="updateNodeType" name="update-node-type" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="updateNodeKey" name="update-node-key" type="inventory.aai.openecomp.org.v8.UpdateNodeKey" /> + <xml-element java-attribute="updateNodeUri" name="update-node-uri" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="action" name="action" type="inventory.aai.openecomp.org.v8.Action" /> + </java-attributes> + </java-type> + + <java-type name="Action"> + <xml-root-element name="action" /> + <java-attributes> + <xml-element java-attribute="actionType" name="action-type" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="actionData" name="action-data" type="inventory.aai.openecomp.org.v8.ActionData" /> + </java-attributes> + </java-type> + + <java-type name="ActionData"> + <xml-root-element name="action-data" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="UpdateNodeKey"> + <xml-root-element name="update-node-key" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Notify"> + <xml-root-element name="notify" /> + <java-attributes> + <xml-element java-attribute="eventId" name="event-id" required="true" type="java.lang.String" /> + <xml-element java-attribute="nodeType" name="node-type" type="java.lang.String" /> + <xml-element java-attribute="eventTrigger" name="event-trigger" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="keyData" name="key-data" type="inventory.aai.openecomp.org.v8.KeyData" /> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="KeyData"> + <xml-root-element name="key-data" /> + <java-attributes> + <xml-element java-attribute="keyName" name="key-name" type="java.lang.String" /> + <xml-element java-attribute="keyValue" name="key-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="CloudInfrastructure"> + <xml-properties> + <xml-property name="description" value="Namespace for cloud infrastructure." /> + </xml-properties> + <xml-root-element name="cloud-infrastructure" /> + <java-attributes> + <xml-element java-attribute="cloudRegions" name="cloud-regions" type="inventory.aai.openecomp.org.v8.CloudRegions" /> + <xml-element java-attribute="pservers" name="pservers" type="inventory.aai.openecomp.org.v8.Pservers" /> + </java-attributes> + </java-type> + + <java-type name="CloudRegions"> + <xml-root-element name="cloud-regions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="cloudRegion" name="cloud-region" type="inventory.aai.openecomp.org.v8.CloudRegion" /> + </java-attributes> + </java-type> + + <java-type name="CloudRegion"> + <xml-root-element name="cloud-region" /> + <java-attributes> + <xml-element java-attribute="cloudOwner" name="cloud-owner" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifies the vendor and cloud name. First part of composite key should be formatted as vendor-cloudname" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionId" name="cloud-region-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Identifier used by the vendor for the region. Second part of composite key" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudType" name="cloud-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the cloud (e.g., openstack)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ownerDefinedType" name="owner-defined-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Cloud-owner defined type indicator" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudRegionVersion" name="cloud-region-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Software version employed at the site" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="identityUrl" name="identity-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL of the keystone identity service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cloudZone" name="cloud-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Zone where the cloud is homed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="complex name for cloud-region instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroups" name="volume-groups" type="inventory.aai.openecomp.org.v8.VolumeGroups" /> + <xml-element java-attribute="tenants" name="tenants" type="inventory.aai.openecomp.org.v8.Tenants" /> + <xml-element java-attribute="flavors" name="flavors" type="inventory.aai.openecomp.org.v8.Flavors" /> + <xml-element java-attribute="groupAssignments" name="group-assignments" type="inventory.aai.openecomp.org.v8.GroupAssignments" /> + <xml-element java-attribute="snapshots" name="snapshots" type="inventory.aai.openecomp.org.v8.Snapshots" /> + <xml-element java-attribute="images" name="images" type="inventory.aai.openecomp.org.v8.Images" /> + <xml-element java-attribute="availabilityZones" name="availability-zones" type="inventory.aai.openecomp.org.v8.AvailabilityZones" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="cloud-region designates an installation of a cloud cluster or region or instantiation. Cloud regions are uniquely identified by a composite key, cloud-owner + cloud-region-id. The format of the cloud-owner is vendor-cloudname." /> + <xml-property name="indexedProps" value="cloud-owner,cloud-region-id,cloud-type,owner-defined-type" /> + <xml-property name="nameProps" value="owner-defined-type" /> + <xml-property name="container" value="cloud-regions" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + <java-type name="VolumeGroups"> + <xml-properties> + <xml-property name="description" value="Collection of persistent block-level storage." /> + </xml-properties> + <xml-root-element name="volume-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volumeGroup" name="volume-group" type="inventory.aai.openecomp.org.v8.VolumeGroup" /> + </java-attributes> + </java-type> + + <java-type name="VolumeGroup"> + <xml-root-element name="volume-group" /> + <java-attributes> + <xml-element java-attribute="volumeGroupId" name="volume-group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of volume-group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeGroupName" name="volume-group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the volume group." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the SDC resource. This field has been overloaded and clients should expect changes to occur in the future to this field as SDC matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this volume-group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Persistent block-level storage." /> + <xml-property name="indexedProps" value="volume-group-name,vnf-type,heat-stack-id,volume-group-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="volume-groups" /> + </xml-properties> + </java-type> + + <java-type name="RelationshipList"> + <xml-root-element name="relationship-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relationship" name="relationship" type="inventory.aai.openecomp.org.v8.Relationship" /> + </java-attributes> + </java-type> + + <java-type name="Relationship"> + <xml-root-element name="relationship" /> + <java-attributes> + <xml-element java-attribute="relatedTo" name="related-to" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by AAI to indicate type of node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relatedLink" name="related-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to the object in AAI." /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="relationshipData" name="relationship-data" type="inventory.aai.openecomp.org.v8.RelationshipData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedToProperty" name="related-to-property" type="inventory.aai.openecomp.org.v8.RelatedToProperty" /> + </java-attributes> + </java-type> + + <java-type name="RelatedToProperty"> + <xml-root-element name="related-to-property" /> + <java-attributes> + <xml-element java-attribute="propertyKey" name="property-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Key part of a key/value pair" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value part of a key/value pair" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by AAI to indicate an attribute." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="Tenants"> + <xml-properties> + <xml-property name="description" value="Collection of openstack tenants." /> + </xml-properties> + <xml-root-element name="tenants" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="tenant" name="tenant" type="inventory.aai.openecomp.org.v8.Tenant" /> + </java-attributes> + </java-type> + + <java-type name="Tenant"> + <xml-root-element name="tenant" /> + <java-attributes> + <xml-element java-attribute="tenantId" name="tenant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id relative to the cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tenantName" name="tenant-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Readable name of tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vservers" name="vservers" type="inventory.aai.openecomp.org.v8.Vservers" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack tenant" /> + <xml-property name="nameProps" value="tenant-name" /> + <xml-property name="indexedProps" value="tenant-name,tenant-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="tenants" /> + </xml-properties> + </java-type> + + <java-type name="Vservers"> + <xml-properties> + <xml-property name="description" value="Collection of virtual Servers, aka virtual machines or VMs." /> + </xml-properties> + <xml-root-element name="vservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vserver" name="vserver" type="inventory.aai.openecomp.org.v8.Vserver" /> + </java-attributes> + </java-type> + + <java-type name="Vserver"> + <xml-root-element name="vserver" /> + <java-attributes> + <xml-element java-attribute="vserverId" name="vserver-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier for this vserver relative to its tenant" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName" name="vserver-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverName2" name="vserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternative name of vserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vserverSelflink" name="vserver-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumes" name="volumes" type="inventory.aai.openecomp.org.v8.Volumes" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Virtual Servers, aka virtual machine or VM." /> + <xml-property name="nameProps" value="vserver-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,prov-status,vserver-name,vserver-id,in-maint,vserver-name2" /> + <xml-property name="searchable" value="vserver-name,vserver-id,vserver-name2" /> + <xml-property name="dependentOn" value="tenant" /> + <xml-property name="container" value="vservers" /> + </xml-properties> + </java-type> + + <java-type name="LInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of logical interfaces." /> + </xml-properties> + <xml-root-element name="l-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lInterface" name="l-interface" type="inventory.aai.openecomp.org.v8.LInterface" /> + </java-attributes> + </java-type> + + <java-type name="LInterface"> + <xml-root-element name="l-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name given to the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="E.g., CUSTOMER, UPLINK, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="v6WanLinkIp" name="v6-wan-link-ip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Questionably placed - v6 ip addr of this interface (is in vr-lan-interface from Mary B." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceId" name="interface-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="macaddr" name="macaddr" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="MAC address for the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether AAI should be managing this interface of not. Could have value like CUSTOMER" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlans" name="vlans" type="inventory.aai.openecomp.org.v8.Vlans" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical interfaces, e.g., a vnic." /> + <xml-property name="indexedProps" value="macaddr,interface-id,interface-name,network-name" /> + <xml-property name="dependentOn" value="generic-vnf,p-interface,vserver,lag-interface" /> + <xml-property name="container" value="l-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv4AddressList"> + <xml-root-element name="l3-interface-ipv4-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv4Address" name="l3-interface-ipv4-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv4PrefixLength" name="l3-interface-ipv4-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 32 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv4 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv4-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Vlans"> + <xml-root-element name="vlans" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vlan" name="vlan" type="inventory.aai.openecomp.org.v8.Vlan" /> + </java-attributes> + </java-type> + + <java-type name="Vlan"> + <xml-root-element name="vlan" /> + <java-attributes> + <xml-element java-attribute="vlanInterface" name="vlan-interface" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="String that identifies the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanDescription" name="vlan-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to describe (the service associated with) the vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="backdoorConnection" name="backdoor-connection" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Whether customer is going to use this VLAN for backdoor connection to another customer premise device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnId" name="vpn-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This indicates the customers VPN ID associated with this vlan" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv4AddressList" name="l3-interface-ipv4-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv4AddressList" /> + <xml-element container-type="java.util.ArrayList" java-attribute="l3InterfaceIpv6AddressList" name="l3-interface-ipv6-address-list" type="inventory.aai.openecomp.org.v8.L3InterfaceIpv6AddressList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Definition of vlan" /> + <xml-property name="indexedProps" value="vlan-interface,vlan-id-inner,vpn-id" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="dependentOn" value="l-interface" /> + <xml-property name="container" value="vlans" /> + </xml-properties> + </java-type> + + <java-type name="L3InterfaceIpv6AddressList"> + <xml-root-element name="l3-interface-ipv6-address-list" /> + <java-attributes> + <xml-element java-attribute="l3InterfaceIpv6Address" name="l3-interface-ipv6-address" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="IP address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="l3InterfaceIpv6PrefixLength" name="l3-interface-ipv6-prefix-length" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Prefix length, 128 for single address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Inner VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vlanIdOuter" name="vlan-id-outer" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="Outer VLAN tag" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isFloating" name="is-floating" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Indicator of fixed or floating address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of the interface that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of subnet that address belongs to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="IPv6 Address Range" /> + <xml-property name="indexedProps" value="l3-interface-ipv6-address,vlan-id-inner,neutron-network-id,neutron-subnet-id" /> + <xml-property name="dependentOn" value="vlan,l-interface" /> + </xml-properties> + </java-type> + + <java-type name="Volumes"> + <xml-properties> + <xml-property name="description" value="Collection of ephemeral Block storage volumes." /> + </xml-properties> + <xml-root-element name="volumes" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="volume" name="volume" type="inventory.aai.openecomp.org.v8.Volume" /> + </java-attributes> + </java-type> + + <java-type name="Volume"> + <xml-root-element name="volume" /> + <java-attributes> + <xml-element java-attribute="volumeId" name="volume-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of block storage volume relative to the vserver." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="volumeSelflink" name="volume-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Ephemeral Block storage volume." /> + <xml-property name="indexedProps" value="volume-id" /> + <xml-property name="dependentOn" value="vserver" /> + <xml-property name="container" value="volumes" /> + </xml-properties> + </java-type> + + <java-type name="Flavors"> + <xml-properties> + <xml-property name="description" value="Collection of openstack flavors." /> + </xml-properties> + <xml-root-element name="flavors" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="flavor" name="flavor" type="inventory.aai.openecomp.org.v8.Flavor" /> + </java-attributes> + </java-type> + + <java-type name="Flavor"> + <xml-root-element name="flavor" /> + <java-attributes> + <xml-element java-attribute="flavorId" name="flavor-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Flavor id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorName" name="flavor-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Flavor name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorVcpus" name="flavor-vcpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of CPUs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorRam" name="flavor-ram" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of memory" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisk" name="flavor-disk" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorEphemeral" name="flavor-ephemeral" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Amount of ephemeral disk space" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSwap" name="flavor-swap" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="amount of swap space allocation" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorIsPublic" name="flavor-is-public" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="whether flavor is available to all users or private to the tenant it was created in." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorSelflink" name="flavor-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="flavorDisabled" name="flavor-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="Boolean as to whether this flavor is no longer enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack flavor." /> + <xml-property name="nameProps" value="flavor-name" /> + <xml-property name="indexedProps" value="flavor-name,flavor-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="flavors" /> + </xml-properties> + </java-type> + + <java-type name="Snapshots"> + <xml-properties> + <xml-property name="description" value="Collection of openstack snapshots" /> + </xml-properties> + <xml-root-element name="snapshots" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="snapshot" name="snapshot" type="inventory.aai.openecomp.org.v8.Snapshot" /> + </java-attributes> + </java-type> + + <java-type name="Snapshot"> + <xml-root-element name="snapshot" /> + <java-attributes> + <xml-element java-attribute="snapshotId" name="snapshot-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Snapshot id, this is the key UUID assoc associated in glance with the snapshots." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotName" name="snapshot-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Snapshot name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotArchitecture" name="snapshot-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsDistro" name="snapshot-os-distro" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotOsVersion" name="snapshot-os-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="snapshotSelflink" name="snapshot-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="prevSnapshotId" name="prev-snapshot-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field contains the UUID of the previous snapshot (if any)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack snapshot" /> + <xml-property name="nameProps" value="snapshot-name" /> + <xml-property name="uniqueProps" value="snapshot-id" /> + <xml-property name="indexedProps" value="application,snapshot-name,application-vendor,snapshot-id,application-version,prev-snapshot-id" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="snapshots" /> + </xml-properties> + </java-type> + + <java-type name="GroupAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack group assignments" /> + </xml-properties> + <xml-root-element name="group-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="groupAssignment" name="group-assignment" type="inventory.aai.openecomp.org.v8.GroupAssignment" /> + </java-attributes> + </java-type> + + <java-type name="GroupAssignment"> + <xml-root-element name="group-assignment" /> + <java-attributes> + <xml-element java-attribute="groupId" name="group-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Group id, expected to be unique across cloud-region." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupType" name="group-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group type - the type of group this instance refers to" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupName" name="group-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group name - name assigned to the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupDescription" name="group-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group description - description of the group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack group-assignment used to store exclusivity groups (EG)." /> + <xml-property name="nameProps" value="group-name" /> + <xml-property name="indexedProps" value="group-id,group-type,group-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="group-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Images"> + <xml-properties> + <xml-property name="description" value="Collectio of Openstack images." /> + </xml-properties> + <xml-root-element name="images" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="image" name="image" type="inventory.aai.openecomp.org.v8.Image" /> + </java-attributes> + </java-type> + + <java-type name="Image"> + <xml-root-element name="image" /> + <java-attributes> + <xml-element java-attribute="imageId" name="image-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Image id, expected to be unique across cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageName" name="image-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Image name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageArchitecture" name="image-architecture" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operating system architecture." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsDistro" name="image-os-distro" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The common name of the operating system distribution in lowercase" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageOsVersion" name="image-os-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The operating system version as specified by the distributor." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="application" name="application" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The application that the image instantiates." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVendor" name="application-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The vendor of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="applicationVersion" name="application-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="The version of the application." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="imageSelflink" name="image-selflink" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v8.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack image." /> + <xml-property name="nameProps" value="image-name" /> + <xml-property name="indexedProps" value="application,image-name,application-vendor,image-id,application-version" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="images" /> + </xml-properties> + </java-type> + + <java-type name="Metadata"> + <xml-properties> + <xml-property name="description" value="Collection of metadatum (key/value pairs)" /> + </xml-properties> + <xml-root-element name="metadata" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="metadatum" name="metadatum" type="inventory.aai.openecomp.org.v8.Metadatum" /> + </java-attributes> + </java-type> + + <java-type name="Metadatum"> + <xml-root-element name="metadatum" /> + <java-attributes> + <xml-element java-attribute="metaname" name="metaname" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="metaval" name="metaval" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Key/value pairs" /> + <xml-property name="indexedProps" value="metaname" /> + <xml-property name="dependentOn" value="tenant,image,service-instance,model" /> + <xml-property name="container" value="metadata" /> + </xml-properties> + </java-type> + + <java-type name="Pservers"> + <xml-properties> + <xml-property name="description" value="Collection of compute hosts." /> + </xml-properties> + <xml-root-element name="pservers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pserver" name="pserver" type="inventory.aai.openecomp.org.v8.Pserver" /> + </java-attributes> + </java-type> + + <java-type name="Pserver"> + <xml-root-element name="pserver" /> + <java-attributes> + <xml-element java-attribute="hostname" name="hostname" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value from executing hostname on the compute node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ptniiEquipName" name="ptnii-equip-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="PTNII name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="numberOfCpus" name="number-of-cpus" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Number of cpus" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="diskInGigabytes" name="disk-in-gigabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="Disk size, in GBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ramInMegabytes" name="ram-in-megabytes" type="java.lang.Integer"> + <xml-properties> + <xml-property name="description" value="RAM size, in MBs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="fqdn" name="fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Fully-qualified domain name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverSelflink" name="pserver-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to configure device, also used for troubleshooting and is IP used for traps generated by device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serialNumber" name="serial-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Serial number, may be queried" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverId" name="pserver-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of Pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="internetTopology" name="internet-topology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="internet topology of Pserver" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pserverName2" name="pserver-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="alternative pserver name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="purpose" name="purpose" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="purpose of pserver" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v8.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v8.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Compute host whose hostname must be unique and must exactly match what is sent as a relationship to a vserver." /> + <xml-property name="nameProps" value="pserver-name2" /> + <xml-property name="indexedProps" value="hostname,in-maint,pserver-id,pserver-name2" /> + <xml-property name="searchable" value="hostname,pserver-name2,pserver-id,ipv4-oam-address" /> + <xml-property name="container" value="pservers" /> + <xml-property name="namespace" value="cloud-infrastructure" /> + </xml-properties> + </java-type> + + <java-type name="PInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of physical interfaces." /> + </xml-properties> + <xml-root-element name="p-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pInterface" name="p-interface" type="inventory.aai.openecomp.org.v8.PInterface" /> + </java-attributes> + </java-type> + + <java-type name="PInterface"> + <xml-root-element name="p-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the physical interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portDescription" name="port-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Nature of the services and connectivity on this port." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentIdentifier" name="equipment-identifier" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="CLEI or other specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role specification for p-interface hardware." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceType" name="interface-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the physical properties of the interface." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Physical interface (e.g., nic)" /> + <xml-property name="indexedProps" value="interface-name" /> + <xml-property name="dependentOn" value="pserver,pnf" /> + <xml-property name="container" value="p-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="LagInterfaces"> + <xml-properties> + <xml-property name="description" value="Collection of link aggregate interfaces." /> + </xml-properties> + <xml-root-element name="lag-interfaces" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="lagInterface" name="lag-interface" type="inventory.aai.openecomp.org.v8.LagInterface" /> + </java-attributes> + </java-type> + + <java-type name="LagInterface"> + <xml-root-element name="lag-interface" /> + <java-attributes> + <xml-element java-attribute="interfaceName" name="interface-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name that identifies the link aggregate interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Link aggregate interface" /> + <xml-property name="indexedProps" value="interface-name" /> + <xml-property name="dependentOn" value="generic-vnf,pserver,pnf" /> + <xml-property name="container" value="lag-interfaces" /> + </xml-properties> + </java-type> + + <java-type name="AvailabilityZones"> + <xml-properties> + <xml-property name="description" value="Collection of availability zones" /> + </xml-properties> + <xml-root-element name="availability-zones" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="availabilityZone" name="availability-zone" type="inventory.aai.openecomp.org.v8.AvailabilityZone" /> + </java-attributes> + </java-type> + + <java-type name="AvailabilityZone"> + <xml-root-element name="availability-zone" /> + <java-attributes> + <xml-element java-attribute="availabilityZoneName" name="availability-zone-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Name of the availability zone. Unique across a cloud region" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="hypervisorType" name="hypervisor-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of hypervisor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="State that indicates whether the availability zone should be used, etc. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Availability zone, a collection of compute hosts/pservers" /> + <xml-property name="indexedProps" value="availability-zone-name" /> + <xml-property name="dependentOn" value="cloud-region" /> + <xml-property name="container" value="availability-zones" /> + </xml-properties> + </java-type> + + <java-type name="Business"> + <xml-properties> + <xml-property name="description" value="Namespace for business related constructs" /> + </xml-properties> + <xml-root-element name="business" /> + <java-attributes> + <xml-element java-attribute="customers" name="customers" type="inventory.aai.openecomp.org.v8.Customers" /> + </java-attributes> + </java-type> + + <java-type name="Customers"> + <xml-properties> + <xml-property name="description" value="Collection of customer identifiers to provide linkage back to BSS information." /> + </xml-properties> + <xml-root-element name="customers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="customer" name="customer" type="inventory.aai.openecomp.org.v8.Customer" /> + </java-attributes> + </java-type> + + <java-type name="Customer"> + <xml-root-element name="customer" /> + <java-attributes> + <xml-element java-attribute="globalCustomerId" name="global-customer-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Global customer id used across OpenECOMP to uniquely identify customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberName" name="subscriber-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber name, an alternate way to retrieve a customer." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subscriberType" name="subscriber-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Subscriber type, a way to provide VID with only the INFRA customers." /> + <xml-property name="defaultValue" value="CUST" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSubscriptions" name="service-subscriptions" type="inventory.aai.openecomp.org.v8.ServiceSubscriptions" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="customer identifiers to provide linkage back to BSS information." /> + <xml-property name="nameProps" value="subscriber-name" /> + <xml-property name="indexedProps" value="subscriber-name,global-customer-id,subscriber-type" /> + <xml-property name="searchable" value="subscriber-name,global-customer-id" /> + <xml-property name="uniqueProps" value="global-customer-id,subscriber-name" /> + <xml-property name="alternateKeys1" value="subscriber-name" /> + <xml-property name="container" value="customers" /> + <xml-property name="namespace" value="business" /> + </xml-properties> + </java-type> + + <java-type name="ServiceSubscriptions"> + <xml-properties> + <xml-property name="description" value="Collection of objects that group service instances." /> + </xml-properties> + <xml-root-element name="service-subscriptions" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceSubscription" name="service-subscription" type="inventory.aai.openecomp.org.v8.ServiceSubscription" /> + </java-attributes> + </java-type> + + <java-type name="ServiceSubscription"> + <xml-root-element name="service-subscription" /> + <java-attributes> + <xml-element java-attribute="serviceType" name="service-type" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Value defined by orchestration to identify this service across OpenECOMP." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="tempUbSubAccountId" name="temp-ub-sub-account-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This property will be deleted from AAI in the near future. Only stop gap solution." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstances" name="service-instances" type="inventory.aai.openecomp.org.v8.ServiceInstances"> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Object that group service instances." /> + <xml-property name="indexedProps" value="service-type" /> + <xml-property name="dependentOn" value="customer" /> + <xml-property name="container" value="service-subscriptions" /> + </xml-properties> + </java-type> + + <java-type name="ServiceInstances"> + <xml-properties> + <xml-property name="description" value="Collection of service instances" /> + </xml-properties> + <xml-root-element name="service-instances" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="serviceInstance" name="service-instance" type="inventory.aai.openecomp.org.v8.ServiceInstance" /> + </java-attributes> + </java-type> + + <java-type name="ServiceInstance"> + <xml-root-element name="service-instance" /> + <java-attributes> + <xml-element java-attribute="serviceInstanceId" name="service-instance-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Uniquely identifies this instance of a service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceName" name="service-instance-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="This field will store a name assigned to the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthTotal" name="bandwidth-total" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates the total bandwidth to be used for this service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan1" name="bandwidth-up-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan1" name="bandwidth-down-wan1" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN1 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthUpWan2" name="bandwidth-up-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the upstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="bandwidthDownWan2" name="bandwidth-down-wan2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="indicates the downstream bandwidth this service will use on the WAN2 port of the physical device." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vhnPortalUrl" name="vhn-portal-url" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL customers will use to access the vHN Portal." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Operational status of the service-instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceInstanceLocationId" name="service-instance-location-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="An identifier that customers assign to the location where this service is being used." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v8.Metadata" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Instance of a service" /> + <xml-property name="indexedProps" value="service-instance-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,service-instance-name,service-instance-location-id" /> + <xml-property name="nameProps" value="service-instance-name" /> + <xml-property name="searchable" value="service-instance-id" /> + <xml-property name="uniqueProps" value="service-instance-id" /> + <xml-property name="dependentOn" value="service-subscription" /> + <xml-property name="container" value="service-instances" /> + </xml-properties> + </java-type> + + <java-type name="ServiceDesignAndCreation"> + <xml-properties> + <xml-property name="description" value="Namespace for objects managed by SDC" /> + </xml-properties> + <xml-root-element name="service-design-and-creation" /> + <java-attributes> + <xml-element java-attribute="services" name="services" type="inventory.aai.openecomp.org.v8.Services" /> + <xml-element java-attribute="models" name="models" type="inventory.aai.openecomp.org.v8.Models" /> + <xml-element java-attribute="namedQueries" name="named-queries" type="inventory.aai.openecomp.org.v8.NamedQueries" /> + </java-attributes> + </java-type> + + <java-type name="Network"> + <xml-properties> + <xml-property name="description" value="Namespace for network inventory resources." /> + </xml-properties> + <xml-root-element name="network" /> + <java-attributes> + <xml-element java-attribute="logicalLinks" name="logical-links" type="inventory.aai.openecomp.org.v8.LogicalLinks" /> + <xml-element java-attribute="vnfcs" name="vnfcs" type="inventory.aai.openecomp.org.v8.Vnfcs" /> + <xml-element java-attribute="l3Networks" name="l3-networks" type="inventory.aai.openecomp.org.v8.L3Networks" /> + <xml-element java-attribute="genericVnfs" name="generic-vnfs" type="inventory.aai.openecomp.org.v8.GenericVnfs" /> + <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.openecomp.org.v8.Pnfs" /> + <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.openecomp.org.v8.PhysicalLinks" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of logical connections" /> + </xml-properties> + <xml-root-element name="logical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="logicalLink" name="logical-link" type="inventory.aai.openecomp.org.v8.LogicalLink" /> + </java-attributes> + </java-type> + + <java-type name="LogicalLink"> + <xml-root-element name="logical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., evc-name, or vnf-nameA_interface-nameA_vnf-nameZ_interface-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkType" name="link-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of logical link, e.g., evc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4, v6, or ds for dual stack (should be ip-version)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routingProtocol" name="routing-protocol" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="For example, static or BGP" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalStatus" name="operational-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of operational status of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkRole" name="link-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indication of the network use of the logical link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkName2" name="link-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alias or alternate name (CLCI or D1 name)." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="linkId" name="link-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the logical-link, SDNC generates this." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Logical links generally connect l-interfaces but are used to express logical connectivity between two points" /> + <xml-property name="indexedProps" value="link-name,persona-model-id,persona-model-version,widget-model-id,widget-model-version,link-id" /> + <xml-property name="uniqueProps" value="link-id" /> + <xml-property name="container" value="logical-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="Vnfcs"> + <xml-properties> + <xml-property name="description" value="virtual network components associated with a vserver from application controller." /> + </xml-properties> + <xml-root-element name="vnfcs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vnfc" name="vnfc" type="inventory.aai.openecomp.org.v8.Vnfc" /> + </java-attributes> + </java-type> + + <java-type name="Vnfc"> + <xml-root-element name="vnfc" /> + <java-attributes> + <xml-element java-attribute="vnfcName" name="vnfc-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vnfc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcFunctionCode" name="vnfc-function-code" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="function code" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfcType" name="vnfc-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="type" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="prov status of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by APP-C" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4OamVip" name="ipaddress-v4-oam-vip" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Oam V4 vip address of this vnfc" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true)" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="groupNotation" name="group-notation" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Group notation of VNFC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vnfc-name,prov-status,vnfc-type,vnfc-function-code,ipaddress-v4-oam-vip,in-maint,is-closed-loop-disabled,group-notation" /> + <xml-property name="container" value="vnfcs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="L3Networks"> + <xml-root-element name="l3-networks" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="l3Network" name="l3-network" type="inventory.aai.openecomp.org.v8.L3Network" /> + </java-attributes> + </java-type> + + <java-type name="L3Network"> + <xml-root-element name="l3-network" /> + <java-attributes> + <xml-element java-attribute="networkId" name="network-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Network ID, should be uuid. Unique across AAI." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkName" name="network-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the network, governed by some naming convention.." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkType" name="network-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the network - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRole" name="network-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role the network plans - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkTechnology" name="network-technology" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Network technology - who defines these values?" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBoundToVpn" name="is-bound-to-vpn" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Set to true if bound to VPN" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from SDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkRoleInstance" name="network-role-instance" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="network role instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailNetworkFqdn" name="contrail-network-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Contrail FQDN for the network" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="physicalNetworkName" name="physical-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the physical network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isProviderNetwork" name="is-provider-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a provider network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isSharedNetwork" name="is-shared-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is a shared network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="isExternalNetwork" name="is-external-network" required="true" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="boolean indicatating whether or not network is an external network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnets" name="subnets" type="inventory.aai.openecomp.org.v8.Subnets" /> + <xml-element java-attribute="ctagAssignments" name="ctag-assignments" type="inventory.aai.openecomp.org.v8.CtagAssignments" /> + <xml-element java-attribute="segmentationAssignments" name="segmentation-assignments" type="inventory.aai.openecomp.org.v8.SegmentationAssignments" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" > + <xml-properties> + <xml-property name="description" value="Relates to tenant (or is it a child of tenant)" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Generic network definition" /> + <xml-property name="nameProps" value="network-name" /> + <xml-property name="indexedProps" value="heat-stack-id,network-uuid,service-id,network-id,network-name,persona-model-id,persona-model-version,widget-model-id,widget-model-version,contrail-network-fqdn" /> + <xml-property name="uniqueProps" value="network-id" /> + <xml-property name="container" value="l3-networks" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="CtagAssignments"> + <xml-root-element name="ctag-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="ctagAssignment" name="ctag-assignment" type="inventory.aai.openecomp.org.v8.CtagAssignment" /> + </java-attributes> + </java-type> + + <java-type name="CtagAssignment"> + <xml-root-element name="ctag-assignment" /> + <java-attributes> + <xml-element java-attribute="vlanIdInner" name="vlan-id-inner" required="true" type="java.lang.Long" xml-key="true"> + <xml-properties> + <xml-property name="description" value="id." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="vlan-id-inner" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="ctag-assignments" /> + </xml-properties> + </java-type> + + <java-type name="Subnets"> + <xml-root-element name="subnets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="subnet" name="subnet" type="inventory.aai.openecomp.org.v8.Subnet" /> + </java-attributes> + </java-type> + + <java-type name="Subnet"> + <xml-root-element name="subnet" /> + <java-attributes> + <xml-element java-attribute="subnetId" name="subnet-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Subnet ID, should be UUID." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="subnetName" name="subnet-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name associated with the subnet." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronSubnetId" name="neutron-subnet-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron id of this subnet" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="gatewayAddress" name="gateway-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="gateway ip address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="networkStartAddress" name="network-start-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="network start address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cidrMask" name="cidr-mask" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="cidr mask" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipVersion" name="ip-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ip version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="dhcpEnabled" name="dhcp-enabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="dhcp enabled" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpStart" name="dhcp-start" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the start address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dhcpEnd" name="dhcp-end" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the last address reserved for use by dhcp" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="indexedProps" value="subnet-id,subnet-name" /> + <xml-property name="nameProps" value="subnet-name" /> + <xml-property name="uniqueProps" value="subnet-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="subnets" /> + </xml-properties> + </java-type> + + <java-type name="GenericVnfs"> + <xml-properties> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + <xml-root-element name="generic-vnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="genericVnf" name="generic-vnf" type="inventory.aai.openecomp.org.v8.GenericVnf" /> + </java-attributes> + </java-type> + + <java-type name="GenericVnf"> + <xml-root-element name="generic-vnf" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the SDC resource. This field has been overloaded and clients should expect changes to occur in the future to this field as SDC matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service from SDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="License key" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, used by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure generic-vnf, also used for troubleshooting and is IP used for traps generated by generic-vnf." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vcpu, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vmemory, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vdisk, used for VNFs with no vservers/flavors" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the generic-vnf operation" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether generic-vnf access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementAssignmentGroupUuid" name="entitlement-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the Entitlement group used for licensing VNFs" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the specific entitlement resource" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseAssignmentGroupUuid" name="license-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the license assignment group" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKeyUuid" name="license-key-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the actual license resource" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="represents sub zone of the rr plane" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="lInterfaces" name="l-interfaces" type="inventory.aai.openecomp.org.v8.LInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v8.LagInterfaces" /> + <xml-element java-attribute="vfModules" name="vf-modules" type="inventory.aai.openecomp.org.v8.VfModules" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="generic-vnfs" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="VfModules"> + <xml-properties> + <xml-property name="description" value="Collection of vf-modules, a deployment unit of VNFCs" /> + </xml-properties> + <xml-root-element name="vf-modules" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vfModule" name="vf-module" type="inventory.aai.openecomp.org.v8.VfModule" /> + </java-attributes> + </java-type> + + <java-type name="VfModule"> + <xml-root-element name="vf-module" /> + <java-attributes> + <xml-element java-attribute="vfModuleId" name="vf-module-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of vf-module." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vfModuleName" name="vf-module-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of vf-module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration status of this vf-module, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isBaseVfModule" name="is-base-vf-module" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is base vf module" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model id for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary widget model. This maps directly to the AAI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the SDC data dictionary version of the widget model.This maps directly to the AAI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="contrailServiceInstanceFqdn" name="contrail-service-instance-fqdn" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the Contrail unique ID for a service-instance" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="a deployment unit of VNFCs" /> + <xml-property name="indexedProps" value="vf-module-id,vf-module-name,heat-stack-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version,contrail-service-instance-fqdn" /> + <xml-property name="dependentOn" value="generic-vnf" /> + <xml-property name="container" value="vf-modules" /> + </xml-properties> + </java-type> + + <java-type name="Pnfs"> + <xml-properties> + <xml-property name="description" value="Collection of Physical Network Functions." /> + </xml-properties> + <xml-root-element name="pnfs" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="pnf" name="pnf" type="inventory.aai.openecomp.org.v8.Pnf" /> + </java-attributes> + </java-type> + + <java-type name="Pnf"> + <xml-root-element name="pnf" /> + <java-attributes> + <xml-element java-attribute="pnfName" name="pnf-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="unique name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2" name="pnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="name of Physical Network Function." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfName2Source" name="pnf-name2-source" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="source of name2" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="pnfId" name="pnf-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="id of pnf" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipType" name="equip-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment type. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipVendor" name="equip-vendor" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment vendor. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipModel" name="equip-model" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Equipment model. Source of truth should define valid values." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipaddressV4Oam" name="ipaddress-v4-oam" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ipv4-oam-address with new naming convention for IP addresses" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="swVersion" name="sw-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="sw-version is the version of SW for the hosted application on the PNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="orchestration-status is the status of orchestration on the PNF." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="Used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="frameId" name="frame-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="ID of the physical frame (relay rack) where pnf is installed." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + <xml-element java-attribute="pInterfaces" name="p-interfaces" type="inventory.aai.openecomp.org.v8.PInterfaces" /> + <xml-element java-attribute="lagInterfaces" name="lag-interfaces" type="inventory.aai.openecomp.org.v8.LagInterfaces" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="PNF represents a physical network function." /> + <xml-property name="indexedProps" value="pnf-name,orchestration-status" /> + <xml-property name="uniqueProps" value="pnf-name" /> + <xml-property name="container" value="pnfs" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="PhysicalLinks"> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + </xml-properties> + <xml-root-element name="physical-links" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="physicalLink" name="physical-link" type="inventory.aai.openecomp.org.v8.PhysicalLink" /> + </java-attributes> + </java-type> + + <java-type name="PhysicalLink"> + <xml-root-element name="physical-link" /> + <java-attributes> + <xml-element java-attribute="linkName" name="link-name" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="e.g., hostnameA_p-connection_nameA_hostnameZ+p_connection-nameZ" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedValue" name="speed-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the numeric part of the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="speedUnits" name="speed-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Captures the units corresponding to the speed" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="circuitId" name="circuit-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Circuit it" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="dualMode" name="dual-mode" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Dual access mode (e.g., primary, secondary" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="To provide information on who manages this circuit. AAI or 3rd party transport provider" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceProviderName" name="service-provider-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the service Provider on this link." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Collection of physical connections, typically between p-interfaces" /> + <xml-property name="indexedProps" value="circuit-id,link-name" /> + <xml-property name="alternateKeys1" value="circuit-id" /> + <xml-property name="container" value="physical-links" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + + <java-type name="NotificationEvent"> + <xml-root-element name="notification-event" /> + <java-attributes> + <xml-element java-attribute="cambriaPartition" name="cambria.partition" type="java.lang.String" /> + <xml-element java-attribute="eventHeader" name="event-header" type="inventory.aai.openecomp.org.v8.NotificationEventHeader" /> + <xml-any-element java-attribute="entity" /> + </java-attributes> + </java-type> + <java-type name="NotificationEventHeader"> + <xml-root-element name="notification-event-header" /> + <java-attributes> + <xml-element java-attribute="id" name="id" type="java.lang.String" /> + <xml-element java-attribute="timestamp" name="timestamp" type="java.lang.String" /> + <xml-element java-attribute="sourceName" name="source-name" type="java.lang.String" /> + <xml-element java-attribute="domain" name="domain" type="java.lang.String" /> + <xml-element java-attribute="sequenceNumber" name="sequence-number" type="java.lang.String" /> + <xml-element java-attribute="severity" name="severity" type="java.lang.String" /> + <xml-element java-attribute="eventType" name="event-type" type="java.lang.String" /> + <xml-element java-attribute="version" name="version" type="java.lang.String" /> + <xml-element java-attribute="action" name="action" type="java.lang.String" /> + <xml-element java-attribute="entityType" name="entity-type" type="java.lang.String" /> + <xml-element java-attribute="topEntityType" name="top-entity-type" type="java.lang.String" /> + <xml-element java-attribute="entityLink" name="entity-link" type="java.lang.String" /> + <xml-element java-attribute="status" name="status" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="AaiInternal"> + <xml-root-element name="aai-internal" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="reservedPropNames" name="reserved-prop-names" type="inventory.aai.openecomp.org.v8.ReservedPropNames" /> + <xml-element container-type="java.util.ArrayList" java-attribute="edgePropNames" name="edge-prop-names" type="inventory.aai.openecomp.org.v8.EdgePropNames" /> + </java-attributes> + </java-type> + + <java-type name="ReservedPropNames"> + <xml-properties> + <xml-property name="description" value="Internal map to define some reserved properties of a vertex" /> + <xml-property name="uniqueProps" value="aai-unique-key" /> + <xml-property name="indexedProps" value="aai-unique-key,source-of-truth,aai-node-type" /> + </xml-properties> + <xml-root-element name="reserved-prop-names" /> + <java-attributes> + <xml-element java-attribute="lastModSourceOfTruth" name="last-mod-source-of-truth" type="java.lang.String" /> + <xml-element java-attribute="aaiNodeType" name="aai-node-type" type="java.lang.String" /> + <xml-element java-attribute="aaiCreatedTs" name="aai-created-ts" type="java.lang.Long" /> + <xml-element java-attribute="aaiUniqueKey" name="aai-unique-key" type="java.lang.String" /> + <xml-element java-attribute="aaiLastModTs" name="aai-last-mod-ts" type="java.lang.Long" /> + <xml-element java-attribute="sourceOfTruth" name="source-of-truth" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="EdgePropNames"> + <!-- NOTE that the names of these properties are not consistent and are in mixed case and hyphen case for now --> + <xml-properties> + <xml-property name="description" value="Internal map to define the properties of an edge and interpret the map EdgeRules" /> + <xml-property name="edgeInfo" value="edgeLabel,direction,multiplicityRule,isParent,usesResource,hasDelTarget,SVC-INFRA,SVC-INFRA-REV" /> + </xml-properties> + <xml-root-element name="edge-prop-names" /> + <java-attributes> + <xml-element java-attribute="edgeLabel" name="edgeLabel" type="java.lang.String" /> + <xml-element java-attribute="direction" name="direction" type="java.lang.String" /> + <xml-element java-attribute="multiplicityRule" name="multiplicityRule" type="java.lang.String" /> + <xml-element java-attribute="isParent" name="isParent" type="java.lang.Boolean" /> + <xml-element java-attribute="usesResource" name="usesResource" type="java.lang.Boolean" /> + <xml-element java-attribute="hasDelTarget" name="hasDelTarget" type="java.lang.Boolean" /> + <xml-element java-attribute="SVC-INFRA" name="SVC-INFRA" type="java.lang.String" /> + <xml-element java-attribute="SVC-INFRA-REV" name="SVC-INFRA-REV" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="Services"> + <xml-properties> + <xml-property name="description" value="Collection of service model definitions. Likely to be deprecated in favor of models from SDC."/> + </xml-properties> + <xml-root-element name="services" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="service" name="service" type="inventory.aai.openecomp.org.v8.Service" /> + </java-attributes> + </java-type> + + <java-type name="Service"> + <xml-root-element name="service" /> + <java-attributes> + <xml-element java-attribute="serviceId" name="service-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="This gets defined by others to provide a unique ID for the service, we accept what is sent." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceDescription" name="service-description" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description of the service" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceSelflink" name="service-selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to endpoint where AAI can get more details" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceVersion" name="service-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="service version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Stand-in for service model definitions. Likely to be deprecated in favor of models from SDC." /> + <xml-property name="indexedProps" value="service-description,service-id" /> + <xml-property name="container" value="services" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + </java-type> + + <java-type name="Models"> + <xml-properties> + <xml-property name="description" value="Collection of subgraph definitions provided by SDC to describe the inventory assets and their connections related to SDC models" /> + </xml-properties> + <xml-root-element name="models" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="model" name="model" type="inventory.aai.openecomp.org.v8.Model" /> + </java-attributes> + </java-type> + + <java-type name="Model"> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by SDC to describe an inventory asset and its connections related to SDC models" /> + <xml-property name="nameProps" value="model-name,model-type" /> + <xml-property name="indexedProps" value="model-name-version-id,model-type,model-name,model-id,model-version" /> + <xml-property name="alternateKeys1" value="model-id,model-version" /> + <xml-property name="uniqueProps" value="model-name-version-id" /> + <xml-property name="container" value="models" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="model" /> + <java-attributes> + <xml-element java-attribute="modelNameVersionId" name="model-name-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in SDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelId" name="model-id" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Invariant unique ID which does not change from version to version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v8.ModelElements" /> + <xml-element java-attribute="metadata" name="metadata" type="inventory.aai.openecomp.org.v8.Metadata" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelElements"> + <xml-root-element name="model-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelElement" name="model-element" type="inventory.aai.openecomp.org.v8.ModelElement" /> + </java-attributes> + </java-type> + + <java-type name="ModelElement"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model." /> + <xml-property name="uniqueProps" value="model-element-uuid" /> + <xml-property name="indexedProps" value="model-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-elements" /> + </xml-properties> + <xml-root-element name="model-element" /> + <java-attributes> + <xml-element java-attribute="modelElementUuid" name="model-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="newDataDelFlag" name="new-data-del-flag" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicates whether this element was created as part of instantiation from this model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="cardinality" name="cardinality" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="How many of this type of element are required/allowed" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="linkagePoints" name="linkage-point" type="java.lang.String"> + <xml-element-wrapper name="linkage-points" /> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v8.ModelElements"> + <xml-properties> + <xml-property name="description" value="Defines how other models combine to make up a higher-level model" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelConstraints" name="model-constraints" type="inventory.aai.openecomp.org.v8.ModelConstraints"> + <xml-properties> + <xml-property name="description" value="Describes new constraints on this model element that are not part of that model's definition" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraints"> + <xml-root-element name="model-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelConstraint" name="model-constraint" type="inventory.aai.openecomp.org.v8.ModelConstraint" /> + </java-attributes> + </java-type> + + <java-type name="ModelConstraint"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="model-constraint-uuid" /> + <xml-property name="indexedProps" value="model-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="model-constraints" /> + </xml-properties> + <xml-root-element name="model-constraint" /> + <java-attributes> + <xml-element java-attribute="modelConstraintUuid" name="model-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constrainedElementSetUuidToReplace" name="constrained-element-set-uuid-to-replace" required="true" type="java.lang.String" /> + <xml-element java-attribute="constrainedElementSets" name="constrained-element-sets" type="inventory.aai.openecomp.org.v8.ConstrainedElementSets" /> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSets"> + <xml-root-element name="constrained-element-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="constrainedElementSet" name="constrained-element-set" type="inventory.aai.openecomp.org.v8.ConstrainedElementSet" /> + </java-attributes> + </java-type> + + <java-type name="ConstrainedElementSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="constrained-element-set-uuid" /> + <xml-property name="indexedProps" value="constrained-element-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="constrained-element-sets" /> + </xml-properties> + <xml-root-element name="constrained-element-set" /> + <java-attributes> + <xml-element java-attribute="constrainedElementSetUuid" name="constrained-element-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="checkType" name="check-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="elementChoiceSets" name="element-choice-sets" type="inventory.aai.openecomp.org.v8.ElementChoiceSets" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSets"> + <xml-root-element name="element-choice-sets" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="elementChoiceSet" name="element-choice-set" type="inventory.aai.openecomp.org.v8.ElementChoiceSet" /> + </java-attributes> + </java-type> + + <java-type name="ElementChoiceSet"> + <xml-properties> + <xml-property name="description" value="This is how we would capture constraints defining allowed sets of elements." /> + <xml-property name="uniqueProps" value="element-choice-set-uuid" /> + <xml-property name="indexedProps" value="element-choice-set-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="element-choice-sets" /> + </xml-properties> + <xml-root-element name="element-choice-set" /> + <java-attributes> + <xml-element java-attribute="elementChoiceSetUuid" name="element-choice-set-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="elementChoiceSetName" name="element-choice-set-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="cardinality" name="cardinality" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="modelElements" name="model-elements" type="inventory.aai.openecomp.org.v8.ModelElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueries"> + <xml-root-element name="named-queries" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v8.NamedQuery" /> + </java-attributes> + </java-type> + + <java-type name="NamedQuery"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="nameProps" value="named-query-name" /> + <xml-property name="uniqueProps" value="named-query-uuid" /> + <xml-property name="indexedProps" value="named-query-uuid,named-query-name" /> + <xml-property name="container" value="named-queries" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <xml-root-element name="named-query" /> + <java-attributes> + <xml-element java-attribute="namedQueryUuid" name="named-query-uuid" required="true" type="java.lang.String" xml-key="true" /> + <xml-element java-attribute="namedQueryName" name="named-query-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="namedQueryVersion" name="named-query-version" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="requiredInputParams" name="required-input-param" type="java.lang.String"> + <xml-element-wrapper name="required-input-params" /> + </xml-element> + <xml-element java-attribute="description" name="description" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v8.NamedQueryElements" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElements"> + <xml-root-element name="named-query-elements" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="namedQueryElement" name="named-query-element" type="inventory.aai.openecomp.org.v8.NamedQueryElement" /> + </java-attributes> + </java-type> + + <java-type name="NamedQueryElement"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="named-query-element-uuid" /> + <xml-property name="indexedProps" value="named-query-element-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="named-query-elements" /> + </xml-properties> + <xml-root-element name="named-query-element" /> + <java-attributes> + <xml-element java-attribute="namedQueryElementUuid" name="named-query-element-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="propertyLimitDesc" name="property-limit-desc" type="java.lang.String" /> + <xml-element java-attribute="doNotOutput" name="do-not-output" type="java.lang.String" /> + <xml-element java-attribute="namedQueryElements" name="named-query-elements" type="inventory.aai.openecomp.org.v8.NamedQueryElements" /> + <xml-element java-attribute="relatedLookups" name="related-lookups" type="inventory.aai.openecomp.org.v8.RelatedLookups" /> + <xml-element java-attribute="propertyConstraints" name="property-constraints" type="inventory.aai.openecomp.org.v8.PropertyConstraints" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookups"> + <xml-root-element name="related-lookups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedLookup" name="related-lookup" type="inventory.aai.openecomp.org.v8.RelatedLookup" /> + </java-attributes> + </java-type> + + <java-type name="RelatedLookup"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="related-lookup-uuid" /> + <xml-property name="indexedProps" value="related-lookup-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="related-lookups" /> + </xml-properties> + <xml-root-element name="related-lookup" /> + <java-attributes> + <xml-element java-attribute="relatedLookupUuid" name="related-lookup-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="sourceNodeType" name="source-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="sourceNodeProperty" name="source-node-property" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeType" name="target-node-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="targetNodeProperty" name="target-node-property" required="true" type="java.lang.String" /> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyCollectList" name="property-collect-list" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraints"> + <xml-root-element name="property-constraints" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="propertyConstraint" name="property-constraint" type="inventory.aai.openecomp.org.v8.PropertyConstraint" /> + </java-attributes> + </java-type> + + <java-type name="PropertyConstraint"> + <xml-properties> + <xml-property name="description" value="TBD" /> + <xml-property name="uniqueProps" value="property-constraint-uuid" /> + <xml-property name="indexedProps" value="property-constraint-uuid" /> + <xml-property name="allowDirectRead" value="true" /> + <xml-property name="allowDirectWrite" value="false" /> + <xml-property name="container" value="property-constraints" /> + </xml-properties> + <xml-root-element name="property-constraint" /> + <java-attributes> + <xml-element java-attribute="propertyConstraintUuid" name="property-constraint-uuid" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="autoGenerateUuid" value="true" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="constraintType" name="constraint-type" required="true" type="java.lang.String" /> + <xml-element java-attribute="property-name" name="property-name" required="true" type="java.lang.String" /> + <xml-element java-attribute="property-value" name="property-value" required="true" type="java.lang.String" /> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ModelAndNamedQuerySearch"> + <xml-properties> + <xml-property name="description" value="ModelAndNamedQuerySearch holds query-parameters and instance-properties for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="model-and-named-query-search" /> + <java-attributes> + <xml-element java-attribute="queryParameters" name="query-parameters" type="inventory.aai.openecomp.org.v8.QueryParameters" /> + <xml-element java-attribute="instanceFilters" name="instance-filters" type="inventory.aai.openecomp.org.v8.InstanceFilters" /> + <xml-element java-attribute="topNodeType" name="top-node-type" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="QueryParameters"> + <xml-properties> + <xml-property name="description" value="QueryParameters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="query-parameters" /> + <java-attributes> + <xml-element java-attribute="namedQuery" name="named-query" type="inventory.aai.openecomp.org.v8.NamedQuery" /> + <xml-element java-attribute="model" name="model" type="inventory.aai.openecomp.org.v8.Model" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilters"> + <xml-properties> + <xml-property name="description" value="InstanceFilters for performing a named-query or model query" /> + </xml-properties> + <xml-root-element name="instance-filters" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="instanceFilter" name="instance-filter" type="inventory.aai.openecomp.org.v8.InstanceFilter" /> + </java-attributes> + </java-type> + + <java-type name="InstanceFilter"> + <xml-properties> + <xml-property name="description" value="InstanceFilter for performing a named-query or model query" /> + <xml-property name="container" value="instance-filters" /> + </xml-properties> + <xml-root-element name="instance-filter" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="any" lax="true" name="any" /> + </java-attributes> + </java-type> + + <java-type name="Properties"> + <xml-properties> + <xml-property name="description" value="Property holder for query properties or instance properties" /> + </xml-properties> + <xml-root-element name="properties" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String" /> + </java-attributes> + </java-type> + + <java-type name="ResponseList"> + <xml-properties> + <xml-property name="description" value="Response container for the results of a named-query or model query" /> + </xml-properties> + <xml-root-element name="response-list" /> + <java-attributes> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v8.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItems"> + <xml-properties> + <xml-property name="description" value="Container for inventory items in response list" /> + <xml-property name="container" value="response-list" /> + </xml-properties> + <xml-root-element name="inventory-response-items" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="inventoryResponseItem" name="inventory-response-item" type="inventory.aai.openecomp.org.v8.InventoryResponseItem" /> + </java-attributes> + </java-type> + + <java-type name="InventoryResponseItem"> + <xml-properties> + <xml-property name="description" value="Inventory item for response list" /> + <xml-property name="container" value="inventory-response-items" /> + </xml-properties> + <xml-root-element name="inventory-response-item" /> + <java-attributes> + <xml-element java-attribute="modelName" name="model-name" type="java.lang.String" /> + <xml-any-element java-attribute="item" /> + <xml-element java-attribute="extraProperties" name="extra-properties" type="inventory.aai.openecomp.org.v8.ExtraProperties" /> + <xml-element java-attribute="inventoryResponseItems" name="inventory-response-items" type="inventory.aai.openecomp.org.v8.InventoryResponseItems" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperties"> + <xml-properties> + <xml-property name="description" value="Extra properties for inventory item for response list" /> + </xml-properties> + <xml-root-element name="extra-properties" /> + <java-attributes> + <xml-any-element container-type="java.util.ArrayList" java-attribute="extraProperty" name="extra-property" type="inventory.aai.openecomp.org.v8.ExtraProperty" /> + </java-attributes> + </java-type> + + <java-type name="ExtraProperty"> + <xml-root-element name="extra-property" /> + <java-attributes> + <xml-element java-attribute="propertyName" name="property-name" type="java.lang.String" /> + <xml-any-element java-attribute="propertyValue" lax="true" name="property-value" /> + </java-attributes> + </java-type> + + <java-type name="SegmentationAssignments"> + <xml-properties> + <xml-property name="description" value="Collection of openstack segmentation assignments" /> + </xml-properties> + <xml-root-element name="segmentation-assignments" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="segmentationAssignment" name="segmentation-assignment" type="inventory.aai.openecomp.org.v8.SegmentationAssignment" /> + </java-attributes> + </java-type> + + <java-type name="SegmentationAssignment"> + <xml-root-element name="segmentation-assignment" /> + <java-attributes> + <xml-element java-attribute="segmentationId" name="segmentation-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Route Table Reference id, UUID assigned to this instance." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Concurrency value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v8.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Openstack segmentation assignment." /> + <xml-property name="indexedProps" value="segmentation-id" /> + <xml-property name="dependentOn" value="l3-network" /> + <xml-property name="container" value="segmentation-assignments" /> + </xml-properties> + </java-type> + + </java-types> +</xml-bindings> diff --git a/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v9.xml b/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v9.xml new file mode 100644 index 00000000..3b447263 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/introspection/aai_oxm_v9.xml @@ -0,0 +1,596 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + ============LICENSE_START======================================================= + org.openecomp.aai + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + ============LICENSE_END========================================================= + --> + +<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="inventory.aai.openecomp.org.v9" xml-mapping-metadata-complete="true"> + <xml-schema element-form-default="QUALIFIED"> + <xml-ns namespace-uri="http://org.openecomp.aai.inventory/v9" /> + </xml-schema> + <java-types> + <java-type name="Inventory"> + <xml-root-element name="inventory" /> + <java-attributes> + <xml-element java-attribute="network" name="network" type="inventory.aai.openecomp.org.v9.Network" /> + </java-attributes> + </java-type> + <java-type name="Network"> + <xml-properties> + <xml-property name="description" value="Namespace for network inventory resources." /> + </xml-properties> + <xml-root-element name="network" /> + <java-attributes> + <xml-element java-attribute="testObjects" name="test-objects" type="inventory.aai.openecomp.org.v9.TestObjects" /> + <xml-element java-attribute="vpnBindings" name="vpn-bindings" type="inventory.aai.openecomp.org.v9.VpnBindings" /> + </java-attributes> + </java-type> + <java-type name="ServiceDesignAndCreation"> + <xml-properties> + <xml-property name="description" value="Namespace for objects managed by ASDC" /> + </xml-properties> + <xml-root-element name="service-design-and-creation" /> + <java-attributes> + <xml-element java-attribute="models" name="models" type="inventory.aai.openecomp.org.v9.Models" /> + </java-attributes> + </java-type> + <java-type name="Models"> + <xml-properties> + <xml-property name="description" value="Collection of subgraph definitions provided by ASDC to describe the inventory assets and their connections related to ASDC models" /> + </xml-properties> + <xml-root-element name="models" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="model" name="model" type="inventory.aai.openecomp.org.v9.Model" /> + </java-attributes> + </java-type> + + <java-type name="Model"> + <xml-root-element name="model" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe an inventory asset and its connections related to ASDC models, independent of version" /> + <xml-property name="nameProps" value="model-type" /> + <xml-property name="indexedProps" value="model-invariant-id,model-type" /> + <xml-property name="uniqueProps" value="model-invariant-id" /> + <xml-property name="container" value="models" /> + <xml-property name="namespace" value="service-design-and-creation" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelInvariantId" name="model-invariant-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to the main definition of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelType" name="model-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the model, e.g., service, resource, widget, etc." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVers" name="model-vers" type="inventory.aai.openecomp.org.v9.ModelVers" /> + </java-attributes> + </java-type> + + + <java-type name="ModelVers"> + <xml-root-element name="model-vers" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="modelVer" name="model-ver" type="inventory.aai.openecomp.org.v9.ModelVer" /> + </java-attributes> + </java-type> + + <java-type name="ModelVer"> + <xml-root-element name="model-ver" /> + <xml-properties> + <xml-property name="description" value="Subgraph definition provided by ASDC to describe a specific version of an inventory asset and its connections related to ASDC models" /> + <xml-property name="nameProps" value="model-name" /> + <xml-property name="indexedProps" value="model-version-id,model-name,model-version" /> + <xml-property name="uniqueProps" value="model-version-id" /> + <xml-property name="container" value="model-vers" /> + </xml-properties> + <java-attributes> + <xml-element java-attribute="modelVersionId" name="model-version-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique identifier corresponding to one version of a model in ASDC" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelName" name="model-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of the model, which can change from version to version." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersion" name="model-version" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Version" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelDescription" name="model-description" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Description" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="TestObjects"> + <xml-root-element name="test-objects" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="testObject" name="test-object" type="inventory.aai.openecomp.org.v9.TestObject" /> + </java-attributes> + <xml-properties> + <xml-property name="maximumDepth" value="0" /> + <xml-property name="description" value="Collection of VNFs" /> + </xml-properties> + </java-type> + + <java-type name="TestObject"> + <xml-root-element name="test-object" /> + <java-attributes> + <xml-element java-attribute="vnfId" name="vnf-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique id of VNF. This is unique across the graph." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName" name="vnf-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfName2" name="vnf-name2" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Alternate name of VNF." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vnfType" name="vnf-type" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="String capturing type of vnf, that was intended to identify the ASDC resource. This field has been overloaded in service-specific ways and clients should expect changes to occur in the future to this field as ECOMP matures." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="serviceId" name="service-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique identifier of service, does not necessarily map to ASDC service models. SOON TO BE DEPRECATED" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceZone" name="regional-resource-zone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Regional way of organizing pservers, source of truth should define values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="provStatus" name="prov-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Trigger for operational monitoring of this resource by Service Assurance systems." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="operationalState" name="operational-state" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Indicator for whether the resource is considered operational. Valid values are in-service-path and out-of-service-path." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKey" name="license-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="OBSOLETE - do not use" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="equipmentRole" name="equipment-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Client should send valid enumerated value" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, used by MSO." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementOption" name="management-option" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="identifier of managed by company or customer" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4OamAddress" name="ipv4-oam-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Address tail-f uses to configure test-object, also used for troubleshooting and is IP used for traps generated by test-object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="ipv4Loopback0Address" name="ipv4-loopback0-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v4 Loopback0 address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="nmLanV6Address" name="nm-lan-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 Loopback address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="managementV6Address" name="management-v6-address" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="v6 management address" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpu" name="vcpu" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vcpus ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vcpuUnits" name="vcpu-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vcpu, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemory" name="vmemory" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of GB of memory ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vmemoryUnits" name="vmemory-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vmemory, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdisk" name="vdisk" type="java.lang.Long"> + <xml-properties> + <xml-property name="description" value="number of vdisks ordered for this instance of VNF, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vdiskUnits" name="vdisk-units" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="units associated with vdisk, used for VNFs with no vservers/flavors, to be used only in some usecases" /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="inMaint" name="in-maint" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether or not this object is in maintenance mode (maintenance mode = true). This field (in conjunction with prov-status) is used to suppress alarms and vSCL on VNFs/VMs." /> + </xml-properties> + </xml-element> + <xml-element default-value="false" required="true" java-attribute="isClosedLoopDisabled" name="is-closed-loop-disabled" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="defaultValue" value="false"/> + <xml-property name="description" value="used to indicate whether closed loop function is enabled on this node" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="summaryStatus" name="summary-status" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="details regarding the test-object operation, PLEASE DISCONTINUE USE OF THIS FIELD." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="encryptedAccessFlag" name="encrypted-access-flag" type="java.lang.Boolean"> + <xml-properties> + <xml-property name="description" value="indicates whether access uses SSH" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementAssignmentGroupUuid" name="entitlement-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the Entitlement group used for licensing VNFs, OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="entitlementResourceUuid" name="entitlement-resource-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the specific entitlement resource. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseAssignmentGroupUuid" name="license-assignment-group-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the license assignment group. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="licenseKeyUuid" name="license-key-uuid" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="UUID of the actual license resource. OBSOLETE - See child relationships." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelId" name="persona-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model id for this resource or service model." /> + <xml-property name="dbAlias" value="model-invariant-id-local" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelVersion" name="persona-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC model version for this resource or service model." /> + <xml-property name="visibility" value="internal" /> + <xml-property name="dbAlias" value="model-version-id-local" /> + <xml-property name="dataCopy" value="service-design-and-creation/models/model/{persona-model-id}/model-vers?model-version={persona-model-version}#model-version-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="personaModelCustomizationId" name="persona-model-customization-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="captures the id of all the configuration used to customize the resource for the service." /> + <xml-property name="dbAlias" value="model-customization-id" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelId" name="widget-model-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary widget model. This maps directly to the A&AI widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="widgetModelVersion" name="widget-model-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the ASDC data dictionary version of the widget model.This maps directly to the A&AI version of the widget." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="asNumber" name="as-number" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="as-number of the VNF" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="regionalResourceSubzone" name="regional-resource-subzone" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="represents sub zone of the rr plane" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="selflink" name="selflink" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Path to the controller object." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList" /> + </java-attributes> + <xml-properties> + <xml-property name="description" value="General purpose VNF" /> + <xml-property name="nameProps" value="vnf-name" /> + <xml-property name="indexedProps" value="is-closed-loop-disabled,vnf-name2,vnf-type,heat-stack-id,in-maint,vnf-name,vnf-id,regional-resource-zone,prov-status,service-id,persona-model-id,persona-model-version,widget-model-id,widget-model-version" /> + <xml-property name="searchable" value="vnf-id,vnf-name,vnf-name2" /> + <xml-property name="uniqueProps" value="vnf-id" /> + <xml-property name="container" value="test-objects" /> + <xml-property name="namespace" value="network" /> + <xml-property name="extends" value="vnf" /> + </xml-properties> + </java-type> + + <java-type name="PortGroups"> + <xml-root-element name="port-groups" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="portGroup" name="port-group" type="inventory.aai.openecomp.org.v9.PortGroup" /> + </java-attributes> + </java-type> + + <java-type name="PortGroup"> + <xml-root-element name="port-group" /> + <java-attributes> + <xml-element java-attribute="interfaceId" name="interface-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="Unique ID of the interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkId" name="neutron-network-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network id of this Interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="neutronNetworkName" name="neutron-network-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Neutron network name of this Interface" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="interfaceRole" name="interface-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this Interface, should use values as defined in ECOMP Yang models." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupId" name="port-group-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Unique ID for port group in vmware" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="portGroupName" name="port-group-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Likely to duplicate value of neutron network name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="switchName" name="switch-name" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="DVS or standard switch name (should be non-null for port groups associated with DVS)" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="orchestrationStatus" name="orchestration-status" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Orchestration status of this VNF, mastered by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="heatStackId" name="heat-stack-id" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Heat stack id corresponding to this instance, managed by MSO" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="msoCatalogKey" name="mso-catalog-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Corresponds to the SDN-C catalog id used to configure this VCE" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="Used to capture the network interfaces of this VCE" /> + <xml-property name="nameProps" value="port-group-name" /> + <xml-property name="indexedProps" value="port-group-id,heat-stack-id,interface-id,interface-name,switch-name" /> + <xml-property name="dependentOn" value="vce" /> + <xml-property name="container" value="port-groups" /> + </xml-properties> + </java-type> + <java-type name="RelationshipList"> + <xml-root-element name="relationship-list" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="relationship" name="relationship" type="inventory.aai.openecomp.org.v9.Relationship" /> + </java-attributes> + </java-type> + + <java-type name="Relationship"> + <xml-root-element name="relationship" /> + <java-attributes> + <xml-element java-attribute="relatedTo" name="related-to" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate type of node." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relatedLink" name="related-link" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="URL to the object in A&AI." /> + </xml-properties> + </xml-element> + <xml-element container-type="java.util.ArrayList" java-attribute="relationshipData" name="relationship-data" type="inventory.aai.openecomp.org.v9.RelationshipData" /> + <xml-element container-type="java.util.ArrayList" java-attribute="relatedToProperty" name="related-to-property" type="inventory.aai.openecomp.org.v9.RelatedToProperty" /> + </java-attributes> + </java-type> + + <java-type name="RelatedToProperty"> + <xml-root-element name="related-to-property" /> + <java-attributes> + <xml-element java-attribute="propertyKey" name="property-key" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Key part of a key/value pair" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="propertyValue" name="property-value" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value part of a key/value pair" /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate an attribute." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="RelationshipData"> + <xml-root-element name="relationship-data" /> + <java-attributes> + <xml-element java-attribute="relationshipKey" name="relationship-key" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="A keyword provided by A&AI to indicate an attribute." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipValue" name="relationship-value" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Value of the attribute." /> + </xml-properties> + </xml-element> + </java-attributes> + </java-type> + <java-type name="VpnBindings"> + <xml-root-element name="vpn-bindings" /> + <java-attributes> + <xml-element container-type="java.util.ArrayList" java-attribute="vpnBinding" name="vpn-binding" type="inventory.aai.openecomp.org.v9.VpnBinding" /> + </java-attributes> + </java-type> + + <java-type name="VpnBinding"> + <xml-root-element name="vpn-binding" /> + <java-attributes> + <xml-element java-attribute="vpnId" name="vpn-id" required="true" type="java.lang.String" xml-key="true"> + <xml-properties> + <xml-property name="description" value="VPN ID, globally unique within A&AI" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnName" name="vpn-name" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="VPN Name" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="globalRouteTarget" name="global-route-target" required="true" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Number used to identify a VPN, globally unique in the network" /> + <xml-property name="dataLink" value="./route-targets/route-target/{global-route-target}/{route-target-role}" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnPlatform" name="vpn-platform" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="the platform associated with the VPN example AVPN, Mobility" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="vpnType" name="vpn-type" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Type of the vpn, should be taken from enumerated/valid values" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeDistinguisher" name="route-distinguisher" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used to distinguish the distinct VPN routes of separate customers who connect to the provider in an MPLS network." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="routeTargetRole" name="route-target-role" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Role assigned to this route target" /> + <xml-property name="dataLink" value="./route-targets/route-target/{global-route-target}/{route-target-role}" /> + </xml-properties> + </xml-element> + <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String"> + <xml-properties> + <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." /> + </xml-properties> + </xml-element> + <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.openecomp.org.v9.RelationshipList"> + <xml-properties> + <xml-property name="description" value="l3-networks relate to vpn-bindings" /> + </xml-properties> + </xml-element> + </java-attributes> + <xml-properties> + <xml-property name="description" value="VPN binding" /> + <xml-property name="nameProps" value="vpn-name,vpn-type" /> + <xml-property name="indexedProps" value="vpn-name,vpn-id,global-route-target,vpn-type" /> + <xml-property name="searchable" value="vpn-id,vpn-name" /> + <xml-property name="uniqueProps" value="vpn-id" /> + <xml-property name="container" value="vpn-bindings" /> + <xml-property name="namespace" value="network" /> + </xml-properties> + </java-type> + </java-types> +</xml-bindings> diff --git a/aai-core/src/test/resources/org/openecomp/aai/introspection/sideeffect/nested-case.json b/aai-core/src/test/resources/org/openecomp/aai/introspection/sideeffect/nested-case.json new file mode 100644 index 00000000..40a0493a --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/introspection/sideeffect/nested-case.json @@ -0,0 +1,18 @@ +{ + "global-customer-id": "key1", + "subscriber-name": "44IPZu0Ri", + "subscriber-type": "gIgOtou5Np5u", + "service-subscriptions": { + "service-subscription" : [ { + "service-type" : "key2", + "temp-ub-sub-account-id" : "JJYRez", + "service-instances" : { + "service-instance" : [ { + "service-instance-id" : "nested-instance-key", + "model-invariant-id" : "key1", + "model-version-id" : "key2" + }] + } + }] + } + }
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/ambiguous-relationship.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/ambiguous-relationship.json new file mode 100644 index 00000000..241cc146 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/ambiguous-relationship.json @@ -0,0 +1,10 @@ +{ + "related-to": "test-object", + "relationship-data" : [{ + "relationship-key" : "test-object.vnf-id", + "relationship-value":"key1" + },{ + "relationship-key" : "test-object.vnf-id", + "relationship-value":"key2" + }] +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/both-failv10-successv9.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/both-failv10-successv9.json new file mode 100644 index 00000000..0f0378d9 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/both-failv10-successv9.json @@ -0,0 +1,8 @@ +{ + "related-to": "test-object", + "related-link": "/aai/v10/network/test-objects/test-objet/key1", + "relationship-data" : [{ + "relationship-key" : "test-object.vnf-id", + "relationship-value":"key2" + }] +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/both-successv10-failv9.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/both-successv10-failv9.json new file mode 100644 index 00000000..490bbd30 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/both-successv10-failv9.json @@ -0,0 +1,8 @@ +{ + "related-to": "test-object", + "related-link": "http://localhost/aai/v10/network/test-objects/test-object/key1", + "relationship-data" : [{ + "relationship-key" : "test-obect.vnf-id", + "relationship-value":"key2" + }] +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/only-related-link.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/only-related-link.json new file mode 100644 index 00000000..15e383aa --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/only-related-link.json @@ -0,0 +1,4 @@ +{ + "related-to": "test-object", + "related-link": "http://localhost/aai/v10/network/test-objects/test-object/key1" +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/only-relationship-data.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/only-relationship-data.json new file mode 100644 index 00000000..dc7445e0 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/only-relationship-data.json @@ -0,0 +1,7 @@ +{ + "related-to": "test-object", + "relationship-data" : [{ + "relationship-key" : "test-object.vnf-id", + "relationship-value":"key1" + }] +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/too-many-items-relationship.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/too-many-items-relationship.json new file mode 100644 index 00000000..97765cfb --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/too-many-items-relationship.json @@ -0,0 +1,19 @@ +{ + "related-to": "l-interface", + "relationship-data" : [{ + "relationship-key" : "generic-vnf.vnf-id", + "relationship-value":"key1" + },{ + "relationship-key" : "subnet.subnet-id", + "relationship-value":"key5" + },{ + "relationship-key" : "vlan.vlan-interface", + "relationship-value":"key3" + },{ + "relationship-key" : "l-interface.interface-name", + "relationship-value":"key2" + },{ + "relationship-key" : "l3-interface-ipv4-address-list.l3-interface-ipv4-address", + "relationship-value":"key4" + }] +} diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/top-level-two-keys-relationship.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/top-level-two-keys-relationship.json new file mode 100644 index 00000000..c6dbf557 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/top-level-two-keys-relationship.json @@ -0,0 +1,13 @@ +{ + "related-to" : "availability-zone", + "relationship-data" : [ { + "relationship-key" : "cloud-region.cloud-owner", + "relationship-value" : "key1" + }, { + "relationship-key" : "cloud-region.cloud-region-id", + "relationship-value" : "key2" + }, { + "relationship-key" : "availability-zone.availability-zone-name", + "relationship-value" : "key3" + } ] +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/two-top-level-relationship.json b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/two-top-level-relationship.json new file mode 100644 index 00000000..54cac2c8 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/parsers/relationship/two-top-level-relationship.json @@ -0,0 +1,19 @@ +{ + "related-to": "l-interface", + "relationship-data" : [{ + "relationship-key" : "generic-vnf.vnf-id", + "relationship-value":"key1" + },{ + "relationship-key" : "vlan.vlan-interface", + "relationship-value":"key3" + },{ + "relationship-key" : "l-interface.interface-name", + "relationship-value":"key2" + },{ + "relationship-key" : "zone.zone-id", + "relationship-value":"key5" + },{ + "relationship-key" : "l3-interface-ipv4-address-list.l3-interface-ipv4-address", + "relationship-value":"key4" + }] +} diff --git a/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/graphson/resource.graphson b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/graphson/resource.graphson new file mode 100644 index 00000000..04f48174 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/graphson/resource.graphson @@ -0,0 +1,2 @@ +{"id": 386506928,"label": "vertex","properties": {"aai-last-mod-ts": [{"id": "ob632u-6e46nk-5j45","value": 1488308500413}],"aai-uri": [{"id": "ob6712-6e46nk-5lhh","value": "/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-987654321-9922-as988q/cloud-region-id-987654321-9922-as988q/tenants/tenant/tenant-987654321-9999-as988q/vservers/vserver/vserver-987654321-9999-as988q"}],"prov-status": [{"id": "ob651y-6e46nk-1kw5","value": "example-prov-status-val-7367"}],"aai-created-ts": [{"id": "ob62ae-6e46nk-5gqt","value": 1488308500413}],"source-of-truth": [{"id": "ob61w6-6e46nk-5jwl","value": "FitNesse-Test-as988q"}],"vserver-selflink": [{"id": "ob65g6-6e46nk-3xfp","value": "example-vserver-selflink-val-7367"}],"aai-node-type": [{"id": "ob61hy-6e46nk-5f5x","value": "vserver"}],"in-maint": [{"id": "ob65ue-6e46nk-20p1","value": false}],"resource-version": [{"id": "ob62om-6e46nk-23ut","value": "1488308500413"}],"vserver-name": [{"id": "ob649i-6e46nk-3u9x","value": "example-vserver-name-val-7367vserver-987654321-9999-as988q"}],"vserver-id": [{"id": "ob63va-6e46nk-3sp1","value": "vserver-987654321-9999-as988q"}],"last-mod-source-of-truth": [{"id": "ob63h2-6e46nk-5edh","value": "FitNesse-Test-as988q"}],"vserver-name2": [{"id": "ob64nq-6e46nk-3vut","value": "example-vserver-name2-val-7367"}],"is-closed-loop-disabled": [{"id": "ob668m-6e46nk-229x","value": false}]}} +{"id": 2461872,"label": "vertex","properties": {"aai-last-mod-ts": [{"id": "21hqu-1grlc-5j45","value": 1467901600}],"in-maint": [{"id": "21i52-1grlc-20p1","value": false}],"resource-version": [{"id": "21ija-1grlc-23ut","value": "1467901600"}],"vserver-name": [{"id": "21ixi-1grlc-3u9x","value": "PerfTest_VServerFix0027TenantPez002701611467901587187Name"}],"aai-created-ts": [{"id": "21jbq-1grlc-5gqt","value": 1467901600}],"vserver-id": [{"id": "21jpy-1grlc-3sp1","value": "PerfTest_VServerFix0027TenantPez002701611467901587187"}],"last-mod-source-of-truth": [{"id": "21k46-1grlc-5edh","value": "MSO"}],"vserver-name2": [{"id": "21kie-1grlc-3vut","value": "PerfTest_VServerFix0027TenantPez002701611467901587187-VM Name2 optional"}],"source-of-truth": [{"id": "21kwm-1grlc-5jwl","value": "MSO"}],"vserver-selflink": [{"id": "21lau-1grlc-3xfp","value": "http://testvserverLink.com/.html?vserv=VserverLink"}],"is-closed-loop-disabled": [{"id": "21lp2-1grlc-229x","value": false}],"aai-node-type": [{"id": "21m3a-1grlc-5f5x","value": "vserver"}],"aai-uri": [{"id": "21m3a-1grlc-5a5x","value": "/vservers/vserver/test1"}]}}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/resource-format.json b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/resource-format.json new file mode 100644 index 00000000..c7e42556 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/resource-format.json @@ -0,0 +1,13 @@ +{ + "results": [ + { + "vserver": { + + } + }, + { + "vserver": { + } + } + ] +}
\ No newline at end of file diff --git a/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/resource_and_url-format.json b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/resource_and_url-format.json new file mode 100644 index 00000000..80d6560b --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/resource_and_url-format.json @@ -0,0 +1,16 @@ +{ + "results": [ + { + "url" : "/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-987654321-9922/cloud-region-id-987654321-9922/tenants/tenant/tenant-987654321-9999/vservers/vserver/vserver-987654321-9999", + "vserver": { + + } + }, + { + "url" : "/vservers/vserver/test1", + "vserver": { + + } + } + ] +} diff --git a/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/simple-format.json b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/simple-format.json new file mode 100644 index 00000000..dd342615 --- /dev/null +++ b/aai-core/src/test/resources/org/openecomp/aai/serialization/queryformats/simple-format.json @@ -0,0 +1,43 @@ +{ + "results" : [{ + "id" : "0", + "node-type" : "generic-vnf", + "url" : "urimissing", + "properties" : { + "vnf-name" : "myVnf" + }, + "related-to" : [{ + "node-type" : "vserver", + "id" : "1", + "url" : "urimissing" + }] + } , { + "id" : "1", + "node-type" : "vserver", + "url" : "urimissing", + "properties" : { + "vserver-name" : "myVserver" + }, + "related-to" : [{ + "node-type" : "generic-vnf", + "id" : "0", + "url" : "urimissing" + },{ + "node-type" : "pserver", + "id" : "2", + "url" : "/pservers/pserver/key1" + }] + },{ + "id" : "2", + "node-type" : "pserver", + "url" : "/pservers/pserver/key1", + "properties" : { + "hostname" : "myPserver" + }, + "related-to" : [{ + "node-type" : "vserver", + "id" : "1", + "url" : "urimissing" + }] + }] +}
\ No newline at end of file |