summaryrefslogtreecommitdiffstats
path: root/aai-core/src/main/java
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2017-09-15 07:43:00 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-09-15 07:50:51 -0400
commit4bf722bff30e0b08586946eb973facf0022d3989 (patch)
tree4753784d55e3000c474c50c13336216f1944aa07 /aai-core/src/main/java
parentd4a0f78244d85b406a11735f84c7dd0e50eda296 (diff)
Increase code coverage for aai-common repo to 30%
Issue-ID: AAI-215 Change-Id: Ied7d885274d83fa183880ca683a2c440818e66dc Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-core/src/main/java')
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/db/schema/AuditOXM.java11
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/ConvertDeleteScope.java114
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRules.java433
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRulesConverter.java222
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/EdgeRuleBean.java88
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/v10/gen/DbEdgeRules.java475
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/v8/gen/DbEdgeRules.java300
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/dbmodel/v9/gen/DbEdgeRules.java459
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java43
-rw-r--r--aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java112
10 files changed, 46 insertions, 2211 deletions
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
index 4257bf4d..b7aab081 100644
--- 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
@@ -33,12 +33,13 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.openecomp.aai.serialization.db.EdgeRule;
+import org.openecomp.aai.serialization.db.EdgeRules;
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;
@@ -221,14 +222,14 @@ public class AuditOXM extends Auditor {
* Creates the edge labels.
*/
private void createEdgeLabels() {
- Multimap<String, String> edgeRules = DbEdgeRules.EdgeRules;
+ Multimap<String, EdgeRule> edgeRules = EdgeRules.getInstance().getAllRules();
for (String key : edgeRules.keySet()) {
- Collection<String> collection = edgeRules.get(key);
+ Collection<EdgeRule> 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];
+ for (EdgeRule item : collection) {
+ label = item.getLabel();
}
prop.setName(label);
prop.setMultiplicity(Multiplicity.MULTI);
diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/ConvertDeleteScope.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/ConvertDeleteScope.java
deleted file mode 100644
index 7fbf3954..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/ConvertDeleteScope.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ============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 static com.jayway.jsonpath.Criteria.where;
-//import static com.jayway.jsonpath.Filter.filter;
-//
-//import java.io.IOException;
-//import java.nio.file.Files;
-//import java.nio.file.Paths;
-//import java.util.Collection;
-//import java.util.List;
-//import java.util.Map;
-//import java.util.Map.Entry;
-//
-//import org.openecomp.aai.introspection.Version;
-//import org.openecomp.aai.serialization.db.AAIDirection;
-//
-//import com.google.common.collect.Multimap;
-//import com.jayway.jsonpath.Configuration;
-//import com.jayway.jsonpath.DocumentContext;
-//import com.jayway.jsonpath.JsonPath;
-//import com.jayway.jsonpath.Option;
-//
-//public class ConvertDeleteScope {
-//
-//
-//
-// private static final String edgeClasspath = "org.openecomp.aai.dbmodel";
-// private static final String edgeClassSuffix = ".%s.gen";
-// private static final String jsonEdgeFile = "src/main/resources/dbedgerules/DbEdgeRules_%s.json";
-//
-// public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException, IllegalArgumentException, NoSuchFieldException, SecurityException {
-// for (Version v : Version.values()) {
-// convert(v);
-// }
-// }
-// private static void convert(Version v) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, NoSuchFieldException, SecurityException {
-// DocumentContext rulesDoc;
-// Multimap<String, String> deleteScope;
-// Configuration conf = Configuration.defaultConfiguration().addOptions(Option.ALWAYS_RETURN_LIST, Option.SUPPRESS_EXCEPTIONS);
-//
-// rulesDoc = JsonPath.using(conf).parse(readFile(String.format(jsonEdgeFile, v)));
-// if (v.equals(Version.getLatest())) {
-// Object rules = Class.forName(edgeClasspath + ".DbEdgeRules").newInstance();
-// deleteScope = (Multimap<String, String>) rules.getClass().getField("DefaultDeleteScope").get(rules);
-// } else {
-// Object rules = Class.forName(edgeClasspath + String.format(edgeClassSuffix, v) + ".DbEdgeRules").newInstance();
-// deleteScope = (Multimap<String, String>) rules.getClass().getField("DefaultDeleteScope").get(rules);
-// }
-// Collection<Entry<String, String>> entries = deleteScope.entries();
-// for (Entry<String, String> entry : entries) {
-// String key = entry.getKey();
-// String value = entry.getValue();
-//
-// addRule(rulesDoc, key, value);
-//
-// }
-// List<Map<String, String>> results = rulesDoc.read("$.rules.[?]", filter(where("preventDelete").exists(false)));
-// for (Map<String, String> result : results) {
-// result.put("preventDelete", AAIDirection.NONE.toString());
-// }
-// System.out.println("Version: " + v + " " + rulesDoc.jsonString());
-//
-//
-// }
-//
-// private static String readFile (String path) throws IOException {
-// return new String(Files.readAllBytes(Paths.get(path)));
-// }
-//
-// private static void addRule(DocumentContext rulesDoc, String nodeType, String deleteScope) {
-//
-// if (deleteScope.equals("THIS_NODE_ONLY")) {
-// List<Map<String, String>> results = rulesDoc.read("$.rules.[?]", filter(
-// where("from").is(nodeType)
-// ).and(
-// filter(where("isParent").is("${direction}")).or(
-// where("hasDelTarget").is("${direction}")
-// )
-// )
-// );
-// for (Map<String, String> result : results) {
-// result.put("preventDelete", "${direction}");
-// }
-// } else if (deleteScope.contains("_IN_")) {
-// List<Map<String, String>> results = rulesDoc.read("$.rules.[?]", filter(where("to").is(nodeType).and("isParent").is("false")));
-// for (Map<String, String> result : results) {
-// result.put("preventDelete", "!${direction}");
-// }
-// } else {
-//
-// }
-// }
-//
-//
-//}
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
deleted file mode 100644
index 1e6a1496..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRules.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*-
- * ============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|instance-group",
- "memberOf,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("allotted-resource|l-interface", "uses,OUT,One2Many,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")
- .putAll("allotted-resource|vpn-binding", "belongsTo,OUT,Many2Many,false,false,false,false")
- .putAll("allotted-resource|allotted-resource", "bindsTo,OUT,One2One,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", "ERROR_IF_ANY_IN_EDGES")
- .putAll("sriov-vf", "THIS_NODE_ONLY")
- .putAll("vpn-binding", "ERROR_4_IN_EDGES_OR_CASCADE")
- .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")
- .putAll("sriov-pf", "THIS_NODE_ONLY").build();
-}
diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRulesConverter.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRulesConverter.java
deleted file mode 100644
index bbb456bd..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/DbEdgeRulesConverter.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*-
- * ============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.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.openecomp.aai.introspection.Version;
-
-import com.google.common.collect.Multimap;
-
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateExceptionHandler;
-
-/**
- * Converts the old DbEdgeRules multimap to new json format
- */
-public class DbEdgeRulesConverter {
- private static final int LABEL = 0;
- private static final int DIRECTION = 1;
- private static final int MULTIPLICITY = 2;
- private static final int ISPARENT = 3;
- private static final int USESRESOURCE = 4;
- private static final int HASDELTARGET = 5;
- private static final int SVCINFRA = 6;
-
- private Configuration config = new Configuration();
- private Template template;
- private String destDirectory;
- private FileOutputStream writeStream;
-
- public DbEdgeRulesConverter(){ /*pretty much just so I can test functionality without dealing with template setup*/ }
-
- public DbEdgeRulesConverter(String destinationDir) {
- destDirectory = destinationDir;
- try {
- setup(destinationDir);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Sets up the freemarker template and the directory to be written to. Run this once before
- * doing any converting, does not need to be run per file generated (unless you want different directories for each file).
- *
- * @param destinationDir - String of the path to the directory where you want the new format files written to,
- * relative to aai-core/
- * @throws IOException if it can't find the template loading directory or the template file itself
- */
- public void setup(String destinationDir) throws IOException {
- config.setDirectoryForTemplateLoading(new File("src/main/resources/dbedgerules/conversion"));
- config.setDefaultEncoding("UTF-8");
- config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
- template = config.getTemplate("edgerulesTemplate.ftlh");
-
- File destination = new File(destinationDir);
- if (!destination.exists()) {
- destination.mkdir();
- }
- }
-
- /**
- * Converts the given DbEdgeRules multimap representation into a json file of the new format.
- *
- * @param rules - a Multimap<String, String> of the old DbEdgeRules format
- * @param writer - writes to the output file (designate that file when you instantiate the writer)
- */
- public void convert(Multimap<String, String> rules, Writer writer) {
-
- List<EdgeRuleBean> rulesToWrite = new ArrayList<>();
- for (Entry<String, String> rule : rules.entries()) {
- rulesToWrite.add(extractData(rule));
- }
- Map<String, List<EdgeRuleBean>> wrappedRules = new HashMap<>();
- wrappedRules.put("wrappedRules", rulesToWrite);
- try {
- template.process(wrappedRules, writer);
- } catch (TemplateException e) {
- System.out.println("Something went wrong when trying to combine the data and the template");
- e.printStackTrace();
- } catch (IOException e) {
- System.out.println("There was a problem writing to the output file");
- e.printStackTrace();
- }
- }
-
- /**
- * Extracts the pieces of information that go in each field of the new json format from the old
- * DbEdgeRules format.
- *
- * @param rule - one <String, String> entry from the DbEdgeRules multimap representation
- * Takes the form <"from-node|to-node", "label,direction,multiplicity,isParent,usesResource,hasDelTarget,svc-infra">
- * @return EdgeRuleBean with the pieces of information the template needs, in a format the template can understand
- */
- public EdgeRuleBean extractData(Entry<String, String> rule){
- EdgeRuleBean data = new EdgeRuleBean();
-
- String oldName = rule.getKey();
- String[] nodes = oldName.split("\\|");
- data.setFrom(nodes[0]);
- data.setTo(nodes[1]);
-
- String oldSpecs = rule.getValue();
- String[] specs = oldSpecs.split(",");
- data.setLabel(specs[LABEL]);
- data.setDirection(specs[DIRECTION]);
- data.setMultiplicity(specs[MULTIPLICITY]);
- data.setParent(specs[ISPARENT]);
- data.setUsesResource(specs[USESRESOURCE]);
- data.setHasDelTarget(specs[HASDELTARGET]);
- data.setSvcInfra(specs[SVCINFRA]);
-
- return data;
- }
-
- private Multimap<String, String> getEdgeRules(Version v) {
- try {
- Class <?> dbEdgeRules;
- //use reflection to get the corresponding DbEdgeRules class
- //need this weird if-else bc current version doesn't sit in a v.gen subdirectory
- if (Version.isLatest(v)) {
- dbEdgeRules = Class.forName("org.openecomp.aai.dbmodel.DbEdgeRules");
- } else {
- dbEdgeRules = Class.forName("org.openecomp.aai.dbmodel." + v + ".gen.DbEdgeRules");
- }
-
- @SuppressWarnings("unchecked")
- Multimap<String, String> rules = (Multimap<String,String>)dbEdgeRules.getDeclaredField("EdgeRules").get(null);
-
- return rules;
- } catch (ClassNotFoundException e) {
- System.out.println("could not find DbEdgeRules class for version " + v);
- e.printStackTrace();
- return null;
- } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
- System.out.println("Something went wrong trying to retrieve the rules");
- e.printStackTrace();
- return null;
- }
- }
-
- private Writer buildOutputWriter(Version v) {
- try {
- File output = new File(destDirectory + "DbEdgeRules_" + v + ".json");
- writeStream = new FileOutputStream(output);
- return new OutputStreamWriter(writeStream);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * Runs all the conversion steps for the specified version.
- *
- * @param v
- */
- public void convertVersion(Version v) {
- try {
- Multimap<String, String> rules = getEdgeRules(v);
- if (rules == null) { //something went wrong, we've already logged it in the helper so just stop execution
- return;
- }
-
- Writer writer = buildOutputWriter(v);
- if (writer == null) { //something went wrong, we've already logged it in the helper so just stop execution
- return;
- }
- convert(rules, writer);
-
- writer.close();
- writeStream.close();
- } catch (IOException e) {
- System.out.println("Something went wrong closing the writer/writestream");
- e.printStackTrace();
- }
- }
-
- /**
- * Runs the converter for each DbEdgeRules version currently supported (2, 7, 8, 9, and 10)
- *
- * @param args - none actually
- */
- public static void main(String[] args) {
- String destDirectory = "src/main/resources/dbedgerules/";
- DbEdgeRulesConverter dberConverter = new DbEdgeRulesConverter(destDirectory);
-
- for (Version v : Version.values()) {
- dberConverter.convertVersion(v);
- }
- }
-}
diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/EdgeRuleBean.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/EdgeRuleBean.java
deleted file mode 100644
index f80bbca9..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/EdgeRuleBean.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * ============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;
-
-public class EdgeRuleBean {
- private String from;
- private String to;
- private String label;
- private String direction;
- private String multiplicity;
- private String isParent;
- private String usesResource;
- private String hasDelTarget;
- private String svcInfra;
-
- public String getFrom() {
- return from;
- }
- public void setFrom(String from) {
- this.from = from;
- }
- public String getTo() {
- return to;
- }
- public void setTo(String to) {
- this.to = to;
- }
- public String getLabel() {
- return label;
- }
- public void setLabel(String label) {
- this.label = label;
- }
- public String getDirection() {
- return direction;
- }
- public void setDirection(String direction) {
- this.direction = direction;
- }
- public String getMultiplicity() {
- return multiplicity;
- }
- public void setMultiplicity(String multiplicity) {
- this.multiplicity = multiplicity;
- }
- public String getIsParent() {
- return isParent;
- }
- public void setParent(String isParent) {
- this.isParent = isParent;
- }
- public String getUsesResource() {
- return usesResource;
- }
- public void setUsesResource(String usesResource) {
- this.usesResource = usesResource;
- }
- public String getHasDelTarget() {
- return hasDelTarget;
- }
- public void setHasDelTarget(String hasDelTarget) {
- this.hasDelTarget = hasDelTarget;
- }
- public String getSvcInfra() {
- return svcInfra;
- }
- public void setSvcInfra(String svcInfra) {
- this.svcInfra = svcInfra;
- }
-}
diff --git a/aai-core/src/main/java/org/openecomp/aai/dbmodel/v10/gen/DbEdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/dbmodel/v10/gen/DbEdgeRules.java
deleted file mode 100644
index 1069e849..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/v10/gen/DbEdgeRules.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*-
- * ============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.v10.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("generic-vnf|license-key-resource",
- "uses,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("license-key-resource", "ERROR_IF_ANY_IN_EDGES")
- .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", "ERROR_IF_ANY_IN_EDGES")
- .putAll("sriov-vf", "THIS_NODE_ONLY")
- .putAll("vpn-binding", "ERROR_4_IN_EDGES_OR_CASCADE")
- .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
deleted file mode 100644
index fac0ae48..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/v8/gen/DbEdgeRules.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*-
- * ============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
deleted file mode 100644
index 8e75c4d3..00000000
--- a/aai-core/src/main/java/org/openecomp/aai/dbmodel/v9/gen/DbEdgeRules.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*-
- * ============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/serialization/db/EdgeRules.java b/aai-core/src/main/java/org/openecomp/aai/serialization/db/EdgeRules.java
index 22a94554..8dbff6c4 100644
--- 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
@@ -56,7 +56,7 @@ import com.jayway.jsonpath.JsonPath;
public class EdgeRules {
private EELFLogger logger = EELFManager.getInstance().getLogger(EdgeRules.class);
-
+
private DocumentContext rulesDoc;
/**
@@ -75,17 +75,17 @@ public class EdgeRules {
String json = this.getEdgeRuleJson(rulesFilename);
rulesDoc = JsonPath.parse(json);
}
-
+
private String getEdgeRuleJson(String rulesFilename) {
InputStream is = getClass().getResourceAsStream(rulesFilename);
Scanner scanner = new Scanner(is);
String json = scanner.useDelimiter("\\Z").next();
scanner.close();
-
+
return json;
}
-
+
/**
* Loads the versioned DbEdgeRules json file for later parsing.
*/
@@ -93,6 +93,13 @@ public class EdgeRules {
private EdgeRules(Version version) {
String json = this.getEdgeRuleJson(version);
rulesDoc = JsonPath.parse(json);
+
+ if (!Version.isLatest(version)) {
+ try {
+ Class<?> dbEdgeRules = Class.forName("org.openecomp.aai.dbmodel." + version.toString() + ".gen.DbEdgeRules");
+ } catch (Exception e) {
+ }
+ }
}
private String getEdgeRuleJson(Version version) {
@@ -108,11 +115,11 @@ public class EdgeRules {
private static class Helper {
private static final EdgeRules INSTANCE = new EdgeRules();
private static final Map<Version, EdgeRules> INSTANCEMAP = new ConcurrentHashMap<>();
-
+
private static EdgeRules getEdgeRulesByFilename(String rulesFilename) {
return new EdgeRules(rulesFilename);
}
-
+
private static EdgeRules getVersionedEdgeRules(Version v) {
if (Version.isLatest(v)) {
return INSTANCE;
@@ -146,14 +153,14 @@ public class EdgeRules {
/**
* Loads edge rules from the given file.
- *
+ *
* @param rulesFilename - name of the file to load rules from
* @return the EdgeRules instance
*/
public static EdgeRules getInstance(String rulesFilename) {
return Helper.getEdgeRulesByFilename(rulesFilename);
}
-
+
/**
* Adds the tree edge.
*
@@ -318,8 +325,8 @@ public class EdgeRules {
return result;
}
-
-
+
+
/**
* Gets the edge rule of the given type that exists between A and B.
* Will check B|A as well, and flips the direction accordingly if that succeeds
@@ -492,7 +499,7 @@ public class EdgeRules {
/**
* Verifies that all required properties are defined in the given edge rule.
* If they are not, throws a RuntimeException.
- *
+ *
* @param rule - Map<String edge property, String edge property value> representing
* an edge rule
*/
@@ -512,21 +519,21 @@ public class EdgeRules {
}
}
}
-
+
/**
* Reads all the edge rules from the loaded json file.
- *
+ *
* @return List<Map<String edge property, String edge property value>>
* Each map represents a rule read from the json.
*/
private List<Map<String, String>> readRules() {
return readRules(null);
}
-
+
/**
* Reads the edge rules from the loaded json file, using the given filter
* to get specific rules. If filter is null, will get all rules.
- *
+ *
* @param filter - may be null to indicate get all
* @return List<Map<String edge property, String edge property value>>
* Each map represents a rule read from the json.
@@ -543,7 +550,7 @@ public class EdgeRules {
}
return results;
}
-
+
/**
* Gets all the edge rules we define.
*
@@ -562,10 +569,10 @@ public class EdgeRules {
return result;
}
- /**
+ /**
* Gets all edge rules that define a child relationship from
* the given node type.
- *
+ *
* @param nodeType
* @return
*/
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
index b3c78410..15ea8a32 100644
--- a/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java
+++ b/aai-core/src/main/java/org/openecomp/aai/util/GenerateXsd.java
@@ -20,49 +20,22 @@
package org.openecomp.aai.util;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-import java.util.StringTokenizer;
-import java.util.Vector;
+import com.google.common.base.Joiner;
+import com.jayway.jsonpath.JsonPath;
+import org.openecomp.aai.introspection.Version;
+import org.openecomp.aai.serialization.db.EdgeProperty;
+import org.w3c.dom.*;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-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.openecomp.aai.dbmodel.DbEdgeRules;
-import org.openecomp.aai.introspection.Version;
-import org.openecomp.aai.serialization.db.EdgeProperty;
-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 com.google.common.base.Joiner;
-import com.google.common.collect.Multimap;
-import com.jayway.jsonpath.JsonPath;
+import javax.xml.xpath.*;
+import java.io.*;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
@@ -78,7 +51,6 @@ public class GenerateXsd {
static Map<String, String> generatedJavaType;
static Map<String, String> appliedPaths;
static NodeList javaTypeNodes;
- static Class<?> versionedClass;
public static final int VALUE_NONE = 0;
@@ -803,19 +775,6 @@ public class GenerateXsd {
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
@@ -891,44 +850,7 @@ public class GenerateXsd {
return edges;
}
- /**
- * 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,
+ 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) {
@@ -1626,17 +1548,14 @@ public class GenerateXsd {
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) {
+ if (pathDescriptionProperty != 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)
+ if (validEdges != null)
definitionsSb.append(validEdges);
}
@@ -1670,7 +1589,6 @@ public class GenerateXsd {
sb.append(" description: bad request\n");
*/
try {
- versionedClass = getEdgeRulesClass();
File initialFile = new File("src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
InputStream is = new FileInputStream(initialFile);