where the assumption is the aai-node-type property will
exist on the node types. There is a case where a vertex
is in the process of being deleted and during that time
the vertex will be missing some properties and during
that time the GET with depth all will result in exception
This is possible because of our database being
an eventually consistent database
Issue-ID: AAI-2330
Change-Id: I2b11c9a2ec5c3b6bffd2690a0c075962e80781cc
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
import org.onap.aai.introspection.sideeffect.*;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.LogFormatTools;
import org.onap.aai.introspection.sideeffect.*;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.logging.LoggingContext;
import org.onap.aai.logging.StopWatch;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.parsers.uri.URIParser;
import org.onap.aai.logging.StopWatch;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.parsers.uri.URIParser;
private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DBSerializer.class);
private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(DBSerializer.class);
+ private static final String MISSING_REQUIRED_NODE_PROPERTY = "Vertex missing required aai-node-type property";
+
private final TransactionalGraphEngine engine;
private final String sourceOfTruth;
private final ModelType introspectionType;
private final TransactionalGraphEngine engine;
private final String sourceOfTruth;
private final ModelType introspectionType;
}
List<Object> relationshipObjList = obj.getValue("relationship");
}
List<Object> relationshipObjList = obj.getValue("relationship");
- String aNodeType = v.property("aai-node-type").value().toString();
+ VertexProperty nodeTypeProperty = v.property(AAIProperties.NODE_TYPE);
+
+ if(!nodeTypeProperty.isPresent()){
+ LoggingContext.responseDescription(MISSING_REQUIRED_NODE_PROPERTY);
+ LOGGER.warn("Not processing the vertex {} because its missing required property aai-node-type", v.id());
+ LoggingContext.remove(LoggingContext.LoggingField.RESPONSE_DESCRIPTION.toString());
+ return null;
+ }
+
+ String aNodeType = nodeTypeProperty.value().toString();
TypeAlphabetizer alphabetizer = new TypeAlphabetizer();
TypeAlphabetizer alphabetizer = new TypeAlphabetizer();
// from using the edge rules json and get the edge rule out of it
EdgeRuleQuery.Builder queryBuilder = new EdgeRuleQuery.Builder(aNodeType);
for (Vertex cousin : cousins) {
// from using the edge rules json and get the edge rule out of it
EdgeRuleQuery.Builder queryBuilder = new EdgeRuleQuery.Builder(aNodeType);
for (Vertex cousin : cousins) {
- VertexProperty vertexProperty = cousin.property("aai-node-type");
+ VertexProperty vertexProperty = cousin.property(AAIProperties.NODE_TYPE);
String bNodeType = null;
if(vertexProperty.isPresent()){
String bNodeType = null;
if(vertexProperty.isPresent()){
- bNodeType = cousin.property("aai-node-type").value().toString();
+ bNodeType = cousin.property(AAIProperties.NODE_TYPE).value().toString();
} else {
// If the vertex is missing the aai-node-type
// Then its either a bad vertex or its in the process
// of getting deleted so we should ignore these vertexes
} else {
// If the vertex is missing the aai-node-type
// Then its either a bad vertex or its in the process
// of getting deleted so we should ignore these vertexes
+ LoggingContext.responseDescription(MISSING_REQUIRED_NODE_PROPERTY);
if(LOGGER.isDebugEnabled()){
LOGGER.debug("For the vertex {}, unable to retrieve the aai-node-type", v.id().toString());
} else {
LOGGER.info("Unable to retrieve the aai-node-type for vertex, for more info enable debug log");
}
if(LOGGER.isDebugEnabled()){
LOGGER.debug("For the vertex {}, unable to retrieve the aai-node-type", v.id().toString());
} else {
LOGGER.info("Unable to retrieve the aai-node-type for vertex, for more info enable debug log");
}
+ LoggingContext.remove(LoggingContext.LoggingField.RESPONSE_DESCRIPTION.toString());
continue;
}
if (obj.getVersion().compareTo(schemaVersions.getEdgeLabelVersion()) >= 0) {
continue;
}
if (obj.getVersion().compareTo(schemaVersions.getEdgeLabelVersion()) >= 0) {