* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.serialization.db;
import static com.jayway.jsonpath.Filter.filter;
import java.io.InputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.Scanner;
-import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
for (Entry<EdgeProperty, String> entry : propMap.entrySet()) {
edge.property(entry.getKey().toString(), entry.getValue());
}
+
+ edge.property(AAIProperties.AAI_UUID, UUID.randomUUID().toString());
}
/**
rule.setDeleteOtherV(edge.get(EdgeProperty.DELETE_OTHER_V.toString()));
rule.setServiceInfrastructure(edge.get(EdgeProperty.SVC_INFRA.toString()));
rule.setPreventDelete(edge.get(EdgeProperty.PREVENT_DELETE.toString()));
+ rule.setTo(edge.get("to"));
+ rule.setFrom(edge.get("from"));
if (edge.containsKey("default")) {
rule.setIsDefault(edge.get("default"));
}
- return rule;
+ if(rule.getFrom().equals(rule.getTo())){
+ return this.flipDirection(rule);
+ } else {
+ return rule;
+ }
}
/**
*/
private void verifyRule(Map<String, String> rule) {
for (EdgeProperty prop : EdgeProperty.values()) {
+
+ // Description is not required as it is only set for v12 versions
+ if("description".equals(prop.toString())){
+ continue;
+ }
if (!rule.containsKey(prop.toString())) {
/* Throws RuntimeException as rule definition errors
* cannot be recovered from, and should never happen anyway