Search in sources :

Example 21 with DefaultVertexRef

use of org.opennms.features.topology.api.topo.DefaultVertexRef in project opennms by OpenNMS.

the class ApplicationSearchProvider method addVertexHopCriteria.

@Override
public void addVertexHopCriteria(SearchResult searchResult, GraphContainer container) {
    LOG.debug("ApplicationServiceSearchProvider->addVertexHopCriteria: called with search result: '{}'", searchResult);
    VertexHopGraphProvider.DefaultVertexHopCriteria criterion = new VertexHopGraphProvider.DefaultVertexHopCriteria(new DefaultVertexRef(searchResult.getNamespace(), searchResult.getId(), searchResult.getLabel()));
    container.addCriteria(criterion);
    LOG.debug("ApplicationServiceSearchProvider->addVertexHop: adding hop criteria {}.", criterion);
    LOG.debug("ApplicationServiceSearchProvider->addVertexHop: current criteria {}.", Arrays.toString(container.getCriteria()));
}
Also used : DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef) VertexHopGraphProvider(org.opennms.features.topology.api.support.VertexHopGraphProvider)

Example 22 with DefaultVertexRef

use of org.opennms.features.topology.api.topo.DefaultVertexRef in project opennms by OpenNMS.

the class EnhancedLinkdMockDataPopulator method check.

@SuppressWarnings("deprecation")
public void check(GraphProvider topologyProvider) {
    String vertexNamespace = topologyProvider.getNamespace();
    Assert.assertEquals(8, topologyProvider.getVertices().size());
    Assert.assertEquals(9, topologyProvider.getEdges().size());
    Assert.assertTrue(topologyProvider.containsVertexId("1"));
    Assert.assertTrue(topologyProvider.containsVertexId("2"));
    Assert.assertTrue(topologyProvider.containsVertexId("3"));
    Assert.assertTrue(topologyProvider.containsVertexId("4"));
    Assert.assertTrue(topologyProvider.containsVertexId("5"));
    Assert.assertTrue(topologyProvider.containsVertexId("6"));
    Assert.assertTrue(topologyProvider.containsVertexId("7"));
    Assert.assertTrue(topologyProvider.containsVertexId("8"));
    Assert.assertTrue(!topologyProvider.containsVertexId("15"));
    Assert.assertEquals(3, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "1")).length);
    Assert.assertEquals(3, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "2")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "3")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "4")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "5")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "6")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "7")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "8")).length);
    /**
         * This is a little hokey because it relies on the fact that edges are only judged to be equal based
         * on the namespace and id tuple.
         */
    Vertex mockVertex = EasyMock.createMock(Vertex.class);
    EasyMock.expect(mockVertex.getId()).andReturn("v0").anyTimes();
    EasyMock.expect(mockVertex.getLabel()).andReturn(null).anyTimes();
    EasyMock.replay(mockVertex);
    AbstractEdge[] edgeidsforvertex1 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10018|10081", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10012|10021", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.OSPF_EDGE_NAMESPACE, "10112|10121", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex2 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10023|10032", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10012|10021", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.OSPF_EDGE_NAMESPACE, "10112|10121", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex3 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10023|10032", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10034|10043", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex4 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10045|10054", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10034|10043", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex5 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10045|10054", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10056|10065", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex6 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10056|10065", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10067|10076", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex7 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10078|10087", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10067|10076", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex8 = { new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10018|10081", mockVertex, mockVertex), new AbstractEdge(EnhancedLinkdTopologyProvider.LLDP_EDGE_NAMESPACE, "10078|10087", mockVertex, mockVertex) };
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "1")), edgeidsforvertex1);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "2")), edgeidsforvertex2);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "3")), edgeidsforvertex3);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "4")), edgeidsforvertex4);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "5")), edgeidsforvertex5);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "6")), edgeidsforvertex6);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "7")), edgeidsforvertex7);
    OnmsAssert.assertArrayEqualsIgnoreOrder(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "8")), edgeidsforvertex8);
}
Also used : Vertex(org.opennms.features.topology.api.topo.Vertex) AbstractEdge(org.opennms.features.topology.api.topo.AbstractEdge) DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef)

Example 23 with DefaultVertexRef

use of org.opennms.features.topology.api.topo.DefaultVertexRef in project opennms by OpenNMS.

the class LinkdHopCriteria method getVertices.

@Override
public Set<VertexRef> getVertices() {
    Integer id = Integer.valueOf(m_nodeId);
    OnmsNode node = m_nodeDao.get(id);
    Set<VertexRef> vertices = new TreeSet<VertexRef>(new RefComparator());
    if (node != null) {
        String label = node.getLabel();
        vertices.add(new DefaultVertexRef("nodes", m_nodeId, label));
    }
    return vertices;
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef) TreeSet(java.util.TreeSet) DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef) VertexRef(org.opennms.features.topology.api.topo.VertexRef) RefComparator(org.opennms.features.topology.api.topo.RefComparator)

Example 24 with DefaultVertexRef

use of org.opennms.features.topology.api.topo.DefaultVertexRef in project opennms by OpenNMS.

the class EasyMockDataPopulator method check.

@SuppressWarnings("deprecation")
public void check(GraphProvider topologyProvider) {
    String vertexNamespace = topologyProvider.getNamespace();
    Assert.assertEquals(8, topologyProvider.getVertices().size());
    Assert.assertEquals(8, topologyProvider.getEdges().size());
    Assert.assertTrue(topologyProvider.containsVertexId("1"));
    Assert.assertTrue(topologyProvider.containsVertexId("2"));
    Assert.assertTrue(topologyProvider.containsVertexId("3"));
    Assert.assertTrue(topologyProvider.containsVertexId("4"));
    Assert.assertTrue(topologyProvider.containsVertexId("5"));
    Assert.assertTrue(topologyProvider.containsVertexId("6"));
    Assert.assertTrue(topologyProvider.containsVertexId("7"));
    Assert.assertTrue(topologyProvider.containsVertexId("8"));
    Assert.assertTrue(!topologyProvider.containsVertexId("15"));
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "1")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "2")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "3")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "4")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "5")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "6")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "7")).length);
    Assert.assertEquals(2, topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "8")).length);
    /**
         * This is a little hokey because it relies on the fact that edges are only judged to be equal based
         * on the namespace and id tuple.
         */
    Vertex mockVertex = EasyMock.createMock(Vertex.class);
    EasyMock.expect(mockVertex.getId()).andReturn("v0").anyTimes();
    EasyMock.expect(mockVertex.getLabel()).andReturn(null).anyTimes();
    EasyMock.replay(mockVertex);
    AbstractEdge[] edgeidsforvertex1 = { new AbstractEdge("nodes", "10012", mockVertex, mockVertex), new AbstractEdge("nodes", "10081", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex2 = { new AbstractEdge("nodes", "10012", mockVertex, mockVertex), new AbstractEdge("nodes", "10023", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex3 = { new AbstractEdge("nodes", "10023", mockVertex, mockVertex), new AbstractEdge("nodes", "10034", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex4 = { new AbstractEdge("nodes", "10034", mockVertex, mockVertex), new AbstractEdge("nodes", "10045", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex5 = { new AbstractEdge("nodes", "10045", mockVertex, mockVertex), new AbstractEdge("nodes", "10056", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex6 = { new AbstractEdge("nodes", "10056", mockVertex, mockVertex), new AbstractEdge("nodes", "10067", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex7 = { new AbstractEdge("nodes", "10067", mockVertex, mockVertex), new AbstractEdge("nodes", "10078", mockVertex, mockVertex) };
    AbstractEdge[] edgeidsforvertex8 = { new AbstractEdge("nodes", "10078", mockVertex, mockVertex), new AbstractEdge("nodes", "10081", mockVertex, mockVertex) };
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "1")), edgeidsforvertex1);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "2")), edgeidsforvertex2);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "3")), edgeidsforvertex3);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "4")), edgeidsforvertex4);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "5")), edgeidsforvertex5);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "6")), edgeidsforvertex6);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "7")), edgeidsforvertex7);
    Assert.assertArrayEquals(topologyProvider.getEdgeIdsForVertex(new DefaultVertexRef(vertexNamespace, "8")), edgeidsforvertex8);
}
Also used : Vertex(org.opennms.features.topology.api.topo.Vertex) AbstractEdge(org.opennms.features.topology.api.topo.AbstractEdge) DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef)

Example 25 with DefaultVertexRef

use of org.opennms.features.topology.api.topo.DefaultVertexRef in project opennms by OpenNMS.

the class EnhancedLinkdTopologyProviderTest method test.

@SuppressWarnings("deprecation")
@Test
public void test() throws Exception {
    assertEquals(8, m_topologyProvider.getVertices().size());
    // Add v0 vertex
    Vertex vertexA = m_topologyProvider.addVertex(50, 100);
    assertEquals(9, m_topologyProvider.getVertices().size());
    assertEquals("v0", vertexA.getId());
    //LoggerFactory.getLogger(this.getClass()).debug(m_topologyProvider.getVertices().get(0).toString());
    assertTrue(m_topologyProvider.containsVertexId(vertexA));
    assertTrue(m_topologyProvider.containsVertexId(new DefaultVertexRef("nodes", "v0")));
    assertFalse(m_topologyProvider.containsVertexId(new DefaultVertexRef("nodes", "v1")));
    ((AbstractVertex) vertexA).setIpAddress("10.0.0.4");
    // Search by VertexRef
    VertexRef vertexAref = new DefaultVertexRef(m_topologyProvider.getNamespace(), "v0");
    VertexRef vertexBref = new DefaultVertexRef(m_topologyProvider.getNamespace(), "v1");
    assertEquals(1, m_topologyProvider.getVertices(Collections.singletonList(vertexAref)).size());
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(vertexBref)).size());
    // Add v1 vertex
    Vertex vertexB = m_topologyProvider.addVertex(100, 50);
    assertEquals("v1", vertexB.getId());
    assertTrue(m_topologyProvider.containsVertexId(vertexB));
    assertTrue(m_topologyProvider.containsVertexId("v1"));
    assertEquals(1, m_topologyProvider.getVertices(Collections.singletonList(vertexBref)).size());
    // Added 3 more vertices
    Vertex vertexC = m_topologyProvider.addVertex(100, 150);
    Vertex vertexD = m_topologyProvider.addVertex(150, 100);
    Vertex vertexE = m_topologyProvider.addVertex(200, 200);
    assertEquals(13, m_topologyProvider.getVertices().size());
    // Add 2 groups
    Vertex group1 = m_topologyProvider.addGroup("Group 1", Constants.GROUP_ICON_KEY);
    Vertex group2 = m_topologyProvider.addGroup("Group 2", Constants.GROUP_ICON_KEY);
    assertEquals(15, m_topologyProvider.getVertices().size());
    // Link v0, v1 to Group 1 and v2, v3 to Group 2
    m_topologyProvider.setParent(vertexA, group1);
    m_topologyProvider.setParent(vertexB, group1);
    m_topologyProvider.setParent(vertexC, group2);
    m_topologyProvider.setParent(vertexD, group2);
    // Connect various vertices together
    m_topologyProvider.connectVertices(vertexA, vertexB);
    m_topologyProvider.connectVertices(vertexA, vertexC);
    m_topologyProvider.connectVertices(vertexB, vertexC);
    m_topologyProvider.connectVertices(vertexB, vertexD);
    m_topologyProvider.connectVertices(vertexC, vertexD);
    m_topologyProvider.connectVertices(vertexA, vertexE);
    m_topologyProvider.connectVertices(vertexD, vertexE);
    assertEquals(1, m_topologyProvider.getVertices(Collections.singletonList(vertexAref)).size());
    assertEquals(1, m_topologyProvider.getVertices(Collections.singletonList(vertexBref)).size());
    assertEquals(15, m_topologyProvider.getVertices().size());
    assertEquals(3, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(vertexAref)).length);
    assertEquals(3, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(vertexBref)).length);
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(group1));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(group2));
    assertEquals(1, m_topologyProvider.getSemanticZoomLevel(vertexA));
    assertEquals(1, m_topologyProvider.getSemanticZoomLevel(vertexB));
    assertEquals(1, m_topologyProvider.getSemanticZoomLevel(vertexC));
    assertEquals(1, m_topologyProvider.getSemanticZoomLevel(vertexD));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexE));
    m_topologyProvider.resetContainer();
    // Ensure that the topology provider has been erased
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(vertexAref)).size());
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(vertexBref)).size());
    assertEquals(0, m_topologyProvider.getVertices().size());
    assertEquals(0, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(vertexAref)).length);
    assertEquals(0, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(vertexBref)).length);
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(group1));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(group2));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexA));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexB));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexC));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexD));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexE));
    m_topologyProvider.refresh();
    // Ensure that all of the content has been reloaded properly
    // Plain vertices should not be reloaded from the XML
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(vertexAref)).size());
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(vertexBref)).size());
    // Groups should not be reloaded, because they are not persisted
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(group1)).size());
    assertEquals(0, m_topologyProvider.getVertices(Collections.singletonList(group2)).size());
    assertEquals(8, m_topologyProvider.getVertices().size());
    assertEquals(0, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(vertexAref)).length);
    assertEquals(0, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(vertexBref)).length);
    assertEquals(0, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(group1)).length);
    assertEquals(0, m_topologyProvider.getEdgeIdsForVertex(m_topologyProvider.getVertex(group2)).length);
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(group1));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(group2));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexA));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexB));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexC));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexD));
    assertEquals(0, m_topologyProvider.getSemanticZoomLevel(vertexE));
}
Also used : AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) Vertex(org.opennms.features.topology.api.topo.Vertex) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) SimpleLeafVertex(org.opennms.features.topology.api.topo.SimpleLeafVertex) DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef) DefaultVertexRef(org.opennms.features.topology.api.topo.DefaultVertexRef) VertexRef(org.opennms.features.topology.api.topo.VertexRef) Test(org.junit.Test)

Aggregations

DefaultVertexRef (org.opennms.features.topology.api.topo.DefaultVertexRef)27 VertexRef (org.opennms.features.topology.api.topo.VertexRef)19 Test (org.junit.Test)10 Point (org.opennms.features.topology.api.Point)6 HashMap (java.util.HashMap)4 TreeSet (java.util.TreeSet)4 AbstractEdge (org.opennms.features.topology.api.topo.AbstractEdge)4 RefComparator (org.opennms.features.topology.api.topo.RefComparator)4 OnmsNode (org.opennms.netmgt.model.OnmsNode)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 SimpleGraphBuilder (org.opennms.features.topology.api.support.SimpleGraphBuilder)3 VertexHopGraphProvider (org.opennms.features.topology.api.support.VertexHopGraphProvider)3 GraphProvider (org.opennms.features.topology.api.topo.GraphProvider)3 Vertex (org.opennms.features.topology.api.topo.Vertex)3 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2