Search in sources :

Example 16 with JanusGraphDBEngine

use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-graphadmin by onap.

the class MigrateForwarderEvcCircuitIdTest method setUp.

@Before
public void setUp() throws Exception {
    g = tx.traversal();
    loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
    dbEngine = new JanusGraphDBEngine(queryStyle, loader);
    System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
    Vertex pnf1 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-1").next();
    Vertex pnf2 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-2").next();
    Vertex pnf3 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-3").next();
    Vertex pnf4 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-4").next();
    Vertex pnf5 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-5").next();
    Vertex pInterface1 = g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface-1").next();
    Vertex pInterface2 = g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface-2").next();
    Vertex pInterface3 = g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface-3").next();
    Vertex pInterface4 = g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface-4").next();
    Vertex pInterface5 = g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface-5").next();
    Vertex forwarder1 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1).property("forwarder-role", "ingress").next();
    Vertex forwarder2 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1).property("forwarder-role", "ingress").next();
    Vertex forwarder3 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1).property("forwarder-role", "ingress").next();
    Vertex forwarder4 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1).property("forwarder-role", "ingress").next();
    Vertex forwarder5 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1).property("forwarder-role", "ingress").next();
    Vertex configuration1 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-1").property("configuration-type", "test").property("configuration-subt-type", "test").next();
    Vertex configuration2 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-2").property("configuration-type", "test").property("configuration-subt-type", "test").next();
    Vertex configuration3 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-3").property("configuration-type", "test").property("configuration-subt-type", "test").next();
    Vertex configuration4 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-4").property("configuration-type", "test").property("configuration-subt-type", "test").next();
    Vertex configuration5 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-5").property("configuration-type", "test").property("configuration-subt-type", "test").next();
    Vertex forwarderEvc1 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-1").property("circuit-id", "1").property("resource-version", "v13").next();
    Vertex forwarderEvc2 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-2").property("circuit-id", "2").property("resource-version", "v13").next();
    Vertex forwarderEvc3 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-3").property("resource-version", "v13").next();
    Vertex forwarderEvc4 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-4").property("circuit-id", "3").property("resource-version", "v13").next();
    Vertex forwarderEvc5 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-5").property("resource-version", "v13").next();
    edgeSerializer.addTreeEdge(g, pnf1, pInterface1);
    edgeSerializer.addEdge(g, pInterface1, forwarder1);
    edgeSerializer.addEdge(g, forwarder1, configuration1);
    edgeSerializer.addTreeEdge(g, configuration1, forwarderEvc1);
    edgeSerializer.addTreeEdge(g, pnf2, pInterface2);
    edgeSerializer.addEdge(g, pInterface2, forwarder2);
    edgeSerializer.addEdge(g, forwarder2, configuration2);
    edgeSerializer.addTreeEdge(g, configuration2, forwarderEvc2);
    edgeSerializer.addTreeEdge(g, pnf3, pInterface3);
    edgeSerializer.addEdge(g, pInterface3, forwarder3);
    edgeSerializer.addEdge(g, forwarder3, configuration3);
    edgeSerializer.addTreeEdge(g, configuration3, forwarderEvc3);
    edgeSerializer.addTreeEdge(g, pnf4, pInterface4);
    edgeSerializer.addEdge(g, pInterface4, forwarder4);
    edgeSerializer.addEdge(g, forwarder4, configuration4);
    edgeSerializer.addTreeEdge(g, configuration4, forwarderEvc4);
    edgeSerializer.addTreeEdge(g, pnf5, pInterface5);
    edgeSerializer.addEdge(g, pInterface5, forwarder5);
    edgeSerializer.addEdge(g, forwarder5, configuration5);
    edgeSerializer.addTreeEdge(g, configuration5, forwarderEvc5);
    TransactionalGraphEngine spy = spy(dbEngine);
    TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
    GraphTraversalSource traversal = g;
    GraphTraversalSource readOnly = tx.traversal(GraphTraversalSource.build().with(ReadOnlyStrategy.instance()));
    when(spy.tx()).thenReturn(tx);
    when(spy.asAdmin()).thenReturn(adminSpy);
    when(adminSpy.getTraversalSource()).thenReturn(traversal);
    when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
    migration = new MigrateForwarderEvcCircuitId(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
    migration.run();
}
Also used : TransactionalGraphEngine(org.onap.aai.serialization.engines.TransactionalGraphEngine) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) JanusGraphDBEngine(org.onap.aai.serialization.engines.JanusGraphDBEngine)

Example 17 with JanusGraphDBEngine

use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-graphadmin by onap.

the class MigrateInMaintDefaultToFalseTest method setup.

@Before
public void setup() throws Exception {
    g = tx.traversal();
    loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
    dbEngine = new JanusGraphDBEngine(queryStyle, loader);
    // generic-vnf
    g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "generic-vnf0").next();
    g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "generic-vnf1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "generic-vnf2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "generic-vnf3").property("in-maint", false).next();
    // l-interface
    g.addV().property("aai-node-type", "l-interface").property("interface-name", "l-interface0").next();
    g.addV().property("aai-node-type", "l-interface").property("interface-name", "l-interface1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "l-interface").property("interface-name", "l-interface2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "l-interface").property("interface-name", "l-interface3").property("in-maint", false).next();
    // lag-interface
    g.addV().property("aai-node-type", "lag-interface").property("interface-name", "lag-interface0").next();
    g.addV().property("aai-node-type", "lag-interface").property("interface-name", "lag-interface1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "lag-interface").property("interface-name", "lag-interface2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "lag-interface").property("interface-name", "lag-interface3").property("in-maint", false).next();
    // logical-link
    g.addV().property("aai-node-type", "logical-link").property("link-name", "logical-link0").next();
    g.addV().property("aai-node-type", "logical-link").property("link-name", "logical-link1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "logical-link").property("link-name", "logical-link2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "logical-link").property("link-name", "logical-link3").property("in-maint", false).next();
    // p-interface
    g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface0").next();
    g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "p-interface").property("interface-name", "p-interface3").property("in-maint", false).next();
    // pnf
    g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf0").next();
    g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf3").property("in-maint", false).next();
    // pserver
    g.addV().property("aai-node-type", "pserver").property("pserver-id", "pserver0").next();
    g.addV().property("aai-node-type", "pserver").property("pserver-id", "pserver1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "pserver").property("pserver-id", "pserver2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "pserver").property("pserver-id", "pserver3").property("in-maint", false).next();
    // vlan
    g.addV().property("aai-node-type", "vlan").property("vlan-interface", "vlan0").next();
    g.addV().property("aai-node-type", "vlan").property("vlan-interface", "vlan1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "vlan").property("vlan-interface", "vlan2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "vlan").property("vlan-interface", "vlan3").property("in-maint", false).next();
    // vnfc
    g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc0").next();
    g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc3").property("in-maint", false).next();
    // vserver
    g.addV().property("aai-node-type", "vserver").property("vserver-id", "vserver0").next();
    g.addV().property("aai-node-type", "vserver").property("vserver-id", "vserver1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "vserver").property("vserver-id", "vserver2").property("in-maint", true).property("is-closed-loop-disabled", true).next();
    g.addV().property("aai-node-type", "vserver").property("vserver-id", "vserver3").property("in-maint", false).next();
    // nos-server
    g.addV().property("aai-node-type", "nos-server").property("nos-server-id", "nos-server0").property("nos-server-name", "nos-server-name0").property("vendor", "vendor0").property("nos-server-selflink", "nos-server-selflink0").next();
    g.addV().property("aai-node-type", "nos-server").property("nos-server-id", "nos-server1").property("nos-server-name", "nos-server-name1").property("vendor", "vendor1").property("nos-server-selflink", "nos-server-selflink1").property("in-maint", "").next();
    g.addV().property("aai-node-type", "nos-server").property("nos-server-id", "nos-server2").property("nos-server-name", "nos-server-name2").property("vendor", "vendor2").property("nos-server-selflink", "nos-server-selflink2").property("in-maint", true).next();
    g.addV().property("aai-node-type", "nos-server").property("nos-server-id", "nos-server3").property("nos-server-name", "nos-server-name3").property("vendor", "vendor3").property("nos-server-selflink", "nos-server-selflink3").property("in-maint", false).next();
    TransactionalGraphEngine spy = spy(dbEngine);
    TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
    GraphTraversalSource traversal = g;
    when(spy.asAdmin()).thenReturn(adminSpy);
    when(adminSpy.getTraversalSource()).thenReturn(traversal);
    migration = new InMaintDefaultMigrator(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
    migration.run();
}
Also used : TransactionalGraphEngine(org.onap.aai.serialization.engines.TransactionalGraphEngine) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) JanusGraphDBEngine(org.onap.aai.serialization.engines.JanusGraphDBEngine) InMaintDefaultMigrator(org.onap.aai.migration.v13.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator) Before(org.junit.Before)

Example 18 with JanusGraphDBEngine

use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-graphadmin by onap.

the class MigrateInstanceGroupModelVersionIdTest method setUp.

@Before
public void setUp() throws Exception {
    graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
    tx = graph.newTransaction();
    g = tx.traversal();
    loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
    dbEngine = new JanusGraphDBEngine(queryStyle, loader);
    Vertex instancegroup1 = g.addV().property("aai-node-type", "instance-group").property("id", "instance-id-1").property("description", "instance-description-1").property("instanceGroupType", "instance-type-1").property("model-version-id", "instance-version-id-1").next();
    Vertex instancegroup2 = g.addV().property("aai-node-type", "instance-group").property("id", "instance-id-2").property("description", "instance-description-2").property("instanceGroupType", "instance-type-1").property("model-version-id-local", "instance-version-id-2").next();
    TransactionalGraphEngine spy = spy(dbEngine);
    TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
    GraphTraversalSource traversal = g;
    GraphTraversalSource readOnly = tx.traversal(GraphTraversalSource.build().with(ReadOnlyStrategy.instance()));
    when(spy.tx()).thenReturn(tx);
    when(spy.asAdmin()).thenReturn(adminSpy);
    when(adminSpy.getTraversalSource()).thenReturn(traversal);
    when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
    migration = new MigrateInstanceGroupModelVersionId(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
    migration.run();
}
Also used : TransactionalGraphEngine(org.onap.aai.serialization.engines.TransactionalGraphEngine) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) JanusGraphDBEngine(org.onap.aai.serialization.engines.JanusGraphDBEngine) Before(org.junit.Before)

Example 19 with JanusGraphDBEngine

use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-graphadmin by onap.

the class MigrateInstanceGroupSubTypeTest method setUp.

@Before
public void setUp() throws Exception {
    graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
    tx = graph.newTransaction();
    g = tx.traversal();
    loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
    dbEngine = new JanusGraphDBEngine(queryStyle, loader);
    instanceGroup = g.addV().property("aai-node-type", MigrateInstanceGroupSubType.INSTANCE_GROUP_NODE_TYPE).property(MigrateInstanceGroupSubType.SUB_TYPE_PROPERTY, SUB_TYPE_VALUE).next();
    instanceGroupWithoutTSubType = g.addV().property("aai-node-type", MigrateInstanceGroupSubType.INSTANCE_GROUP_NODE_TYPE).next();
    TransactionalGraphEngine spy = spy(dbEngine);
    TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
    GraphTraversalSource traversal = g;
    when(spy.asAdmin()).thenReturn(adminSpy);
    when(adminSpy.getTraversalSource()).thenReturn(traversal);
    migration = new MigrateInstanceGroupSubType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
}
Also used : TransactionalGraphEngine(org.onap.aai.serialization.engines.TransactionalGraphEngine) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) JanusGraphDBEngine(org.onap.aai.serialization.engines.JanusGraphDBEngine) Before(org.junit.Before)

Example 20 with JanusGraphDBEngine

use of org.onap.aai.serialization.engines.JanusGraphDBEngine in project aai-graphadmin by onap.

the class MigrateModelVerTest method setUp.

@Before
public void setUp() throws Exception {
    graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
    JanusGraphManagement janusgraphManagement = graph.openManagement();
    tx = graph.newTransaction();
    g = graph.traversal();
    loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
    dbEngine = new JanusGraphDBEngine(queryStyle, loader);
    TransactionalGraphEngine spy = spy(dbEngine);
    TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
    GraphTraversalSource traversal = g;
    when(spy.asAdmin()).thenReturn(adminSpy);
    when(adminSpy.getTraversalSource()).thenReturn(traversal);
    Mockito.doReturn(janusgraphManagement).when(adminSpy).getManagementSystem();
    // Add model1/model-ver1 -- invalid model/model-ver
    Vertex model1 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-1").property("model-type", "widget").next();
    Vertex modelVer1 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-1").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-1/model-vers/model-ver/model-version-id-1").property("model-name", "connector").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model1, modelVer1);
    // connector
    Vertex connector1 = g.addV().property("aai-node-type", "connector").property("resource-instance-id", "connector1").property("model-invariant-id-local", "model-invariant-id-1").property("model-version-id-local", "model-version-id-1").next();
    Vertex connector2 = g.addV().property("aai-node-type", "connector").property("resource-instance-id", "connector2").property("model-invariant-id-local", "model-invariant-id-x").property("model-version-id-local", "model-version-id-x").next();
    Vertex connector3 = g.addV().property("aai-node-type", "connector").property("resource-instance-id", "connector3").property("model-invariant-id-local", "model-invariant-id-1").property("model-version-id-local", "model-version-id-1").next();
    edgeSerializer.addPrivateEdge(traversal, connector3, modelVer1, null);
    // Add model1/model-ver1 -- invalid model/model-ver
    Vertex model2 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-2").property("model-type", "widget").next();
    Vertex modelVer2 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-2").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-2/model-vers/model-ver/model-version-id-2").property("model-name", "service-instance").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model2, modelVer2);
    // serivce-instance
    Vertex serviceInstance1 = g.addV().property("aai-node-type", "service-instance").property("service-instance-id", "serviceinstance1").property("model-invariant-id-local", "model-invariant-id-2").property("model-version-id-local", "model-version-id-2").next();
    Vertex serviceInstance2 = g.addV().property("aai-node-type", "service-instance").property("service-instance-id", "serviceinstance2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex serviceInstance3 = g.addV().property("aai-node-type", "service-instance").property("service-instance-id", "serviceinstance3").property("model-invariant-id-local", "model-invariant-id-2").property("model-version-id-local", "model-version-id-2").next();
    edgeSerializer.addPrivateEdge(traversal, serviceInstance3, modelVer2, null);
    // Add model3/model-ver3
    Vertex model3 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-3").property("model-type", "widget").next();
    Vertex modelVer3 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-3").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-3/model-vers/model-ver/model-version-id-3").property("model-name", "pnf").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model3, modelVer3);
    // pnf
    Vertex pnfName1 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnfName1").property("model-invariant-id-local", "model-invariant-id-3").property("model-version-id-local", "model-version-id-3").next();
    Vertex pnfName2 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnfName2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex pnfName3 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnfName3").property("model-invariant-id-local", "model-invariant-id-3").property("model-version-id-local", "model-version-id-3").next();
    edgeSerializer.addPrivateEdge(traversal, pnfName3, modelVer3, null);
    // Add model4/model-ver4
    Vertex model4 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-4").property("model-type", "widget").next();
    Vertex modelVer4 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-4").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-4/model-vers/model-ver/model-version-id-4").property("model-name", "logical-link").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model4, modelVer4);
    // logical-link
    Vertex linkName1 = g.addV().property("aai-node-type", "logical-link").property("link-name", "linkName1").property("model-invariant-id-local", "model-invariant-id-4").property("model-version-id-local", "model-version-id-4").next();
    Vertex linkName2 = g.addV().property("aai-node-type", "logical-link").property("link-name", "linkName2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex linkName3 = g.addV().property("aai-node-type", "logical-link").property("link-name", "linkName3").property("model-invariant-id-local", "model-invariant-id-4").property("model-version-id-local", "model-version-id-4").next();
    edgeSerializer.addPrivateEdge(traversal, linkName3, modelVer4, null);
    // Add model5/model-ver5
    Vertex model5 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-5").property("model-type", "widget").next();
    Vertex modelVer5 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-5").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-5/model-vers/model-ver/model-version-id-5").property("model-name", "vnfc").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model5, modelVer5);
    // vnfc
    Vertex vnfc1 = g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc1").property("model-invariant-id-local", "model-invariant-id-5").property("model-version-id-local", "model-version-id-5").next();
    Vertex vnfc2 = g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex vnfc3 = g.addV().property("aai-node-type", "vnfc").property("vnfc-name", "vnfc3").property("model-invariant-id-local", "model-invariant-id-5").property("model-version-id-local", "model-version-id-5").next();
    edgeSerializer.addPrivateEdge(traversal, vnfc3, modelVer5, null);
    // Add model6/model-ver6
    Vertex model6 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-6").property("model-type", "widget").next();
    Vertex modelVer6 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-6").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-6/model-vers/model-ver/model-version-id-6").property("model-name", "vnf").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model6, modelVer6);
    // generic-vnf
    Vertex vnf1 = g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "vnf1").property("model-invariant-id-local", "model-invariant-id-6").property("model-version-id-local", "model-version-id-6").next();
    Vertex vnf2 = g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "vnf2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex vnf3 = g.addV().property("aai-node-type", "generic-vnf").property("vnf-id", "vnf3").property("model-invariant-id-local", "model-invariant-id-6").property("model-version-id-local", "model-version-id-6").next();
    edgeSerializer.addPrivateEdge(traversal, vnf3, modelVer6, null);
    // Add model7/model-ver7
    Vertex model7 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-7").property("model-type", "widget").next();
    Vertex modelVer7 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-7").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-7/model-vers/model-ver/model-version-id-7").property("model-name", "configuration").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model7, modelVer7);
    // configuration
    Vertex configuration1 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "configuration1").property("model-invariant-id-local", "model-invariant-id-7").property("model-version-id-local", "model-version-id-7").next();
    Vertex configuration2 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "configuration2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex configuration3 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "configuration3").property("model-invariant-id-local", "model-invariant-id-7").property("model-version-id-local", "model-version-id-7").next();
    edgeSerializer.addPrivateEdge(traversal, configuration3, modelVer7, null);
    // Add model8/model-ver8
    Vertex model8 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-8").property("model-type", "widget").next();
    Vertex modelVer8 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-8").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-8/model-vers/model-ver/model-version-id-8").property("model-name", "l3-network").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model8, modelVer8);
    // l3-network
    Vertex l3Network1 = g.addV().property("aai-node-type", "l3-network").property("network-id", "l3Network1").property("model-invariant-id-local", "model-invariant-id-8").property("model-version-id-local", "model-version-id-8").next();
    Vertex l3Network2 = g.addV().property("aai-node-type", "l3-network").property("network-id", "l3Network2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex l3Network3 = g.addV().property("aai-node-type", "l3-network").property("network-id", "l3Network3").property("model-invariant-id-local", "model-invariant-id-8").property("model-version-id-local", "model-version-id-8").next();
    edgeSerializer.addPrivateEdge(traversal, l3Network3, modelVer8, null);
    // Add model9/model-ver9
    Vertex model9 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-9").property("model-type", "widget").next();
    Vertex modelVer9 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-9").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-9/model-vers/model-ver/model-version-id-9").property("model-name", "vf-module").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model9, modelVer9);
    // vf-module
    Vertex vfModule1 = g.addV().property("aai-node-type", "vf-module").property("vf-module-id", "vfModule1").property("model-invariant-id-local", "model-invariant-id-9").property("model-version-id-local", "model-version-id-9").next();
    Vertex vfModule2 = g.addV().property("aai-node-type", "vf-module").property("vf-module-id", "vfModule2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex vfModule3 = g.addV().property("aai-node-type", "vf-module").property("vf-module-id", "vfModule3").property("model-invariant-id-local", "model-invariant-id-9").property("model-version-id-local", "model-version-id-9").next();
    edgeSerializer.addPrivateEdge(traversal, vfModule3, modelVer9, null);
    // Add model10/model-ver10
    Vertex model10 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-10").property("model-type", "widget").next();
    Vertex modelVer10 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-10").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-10/model-vers/model-ver/model-version-id-10").property("model-name", "collection").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model10, modelVer10);
    // collection
    Vertex collection1 = g.addV().property("aai-node-type", "collection").property("collection-id", "collection1").property("model-invariant-id-local", "model-invariant-id-10").property("model-version-id-local", "model-version-id-10").next();
    Vertex collection2 = g.addV().property("aai-node-type", "collection").property("collection-id", "collection2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex collection3 = g.addV().property("aai-node-type", "collection").property("collection-id", "collection3").property("model-invariant-id-local", "model-invariant-id-10").property("model-version-id-local", "model-version-id-10").next();
    edgeSerializer.addPrivateEdge(traversal, collection3, modelVer10, null);
    // Add model11/model-ver11
    Vertex model11 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-11").property("model-type", "widget").next();
    Vertex modelVer11 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-11").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-11/model-vers/model-ver/model-version-id-11").property("model-name", "instance-group").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model11, modelVer11);
    // instance-group
    Vertex instanceGroup1 = g.addV().property("aai-node-type", "instance-group").property("id", "instanceGroup1").property("model-invariant-id-local", "model-invariant-id-11").property("model-version-id-local", "model-version-id-11").next();
    Vertex instanceGroup2 = g.addV().property("aai-node-type", "instance-group").property("id", "instanceGroup2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex instanceGroup3 = g.addV().property("aai-node-type", "instance-group").property("id", "instanceGroup3").property("model-invariant-id-local", "model-invariant-id-11").property("model-version-id-local", "model-version-id-11").next();
    edgeSerializer.addPrivateEdge(traversal, instanceGroup3, modelVer11, null);
    // Add model12/model-ver12
    Vertex model12 = g.addV().property("aai-node-type", "model").property("model-invariant-id", "model-invariant-id-12").property("model-type", "widget").next();
    Vertex modelVer12 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-12").property("aai-uri", "/service-design-and-creation/models/model/model-invariant-id-12/model-vers/model-ver/model-version-id-12").property("model-name", "allotted-resource").property("model-version", "v1.0").next();
    edgeSerializer.addTreeEdge(g, model12, modelVer12);
    // allotted-resource
    Vertex allottedResource1 = g.addV().property("aai-node-type", "allotted-resource").property("id", "allottedResource1").property("model-invariant-id-local", "model-invariant-id-12").property("model-version-id-local", "model-version-id-12").next();
    Vertex allottedResource2 = g.addV().property("aai-node-type", "allotted-resource").property("id", "allottedResource2").property("model-invariant-id-local", "model-invariant-id-y").property("model-version-id-local", "model-version-id-y").next();
    Vertex allottedResource3 = g.addV().property("aai-node-type", "allotted-resource").property("id", "allottedResource3").property("model-invariant-id-local", "model-invariant-id-12").property("model-version-id-local", "model-version-id-12").next();
    edgeSerializer.addPrivateEdge(traversal, allottedResource3, modelVer12, null);
    migration = new MigrateModelVer(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
    migration.run();
}
Also used : JanusGraphManagement(org.janusgraph.core.schema.JanusGraphManagement) TransactionalGraphEngine(org.onap.aai.serialization.engines.TransactionalGraphEngine) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) JanusGraphDBEngine(org.onap.aai.serialization.engines.JanusGraphDBEngine) Before(org.junit.Before)

Aggregations

JanusGraphDBEngine (org.onap.aai.serialization.engines.JanusGraphDBEngine)78 TransactionalGraphEngine (org.onap.aai.serialization.engines.TransactionalGraphEngine)51 GraphTraversalSource (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource)45 Before (org.junit.Before)40 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)27 DBSerializer (org.onap.aai.serialization.db.DBSerializer)10 JanusGraphManagement (org.janusgraph.core.schema.JanusGraphManagement)8 SchemaVersion (org.onap.aai.setup.SchemaVersion)8 Loader (org.onap.aai.introspection.Loader)7 AAIException (org.onap.aai.exceptions.AAIException)5 ModelType (org.onap.aai.introspection.ModelType)3 QueryStyle (org.onap.aai.serialization.engines.QueryStyle)3 UrlBuilder (org.onap.aai.serialization.queryformats.utils.UrlBuilder)3 Properties (java.util.Properties)2 Test (org.junit.Test)2 NotificationHelper (org.onap.aai.migration.NotificationHelper)2 UEBNotification (org.onap.aai.rest.ueb.UEBNotification)2 JCommander (com.beust.jcommander.JCommander)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URI (java.net.URI)1