2 * Copyright (c) 2019 Orange. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.graph;
10 import java.util.List;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.Graph;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.Edge;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.EdgeKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.Prefix;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.Vertex;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.VertexKey;
22 * Connected Graph class is the connected version of the Graph class from the graph yang model.
25 * Connected Graph is composed by Connected Vertex, Connected Edges and Prefix. It models Unidirectional Connected
26 * Graph (see graph theory). So, Edge and Connected Edge are unidirectional, thus to connect bi-directionally 2 vertices
27 * Va and Vb, it is necessary to setup 2 edges: Va to Vb and Vb to Va.
30 * -------------- --------------------------- --------------
31 * | Connected |---->| Connected Edge Va to Vb |--->| Connected |
32 * ---->| Vertex | --------------------------- | Vertex |---->
34 * | - Key (Va) | | - Key (Vb) |
35 * <----| - Vertex | --------------------------- | - Vertex |<----
36 * | |<----| Connected Edge Vb to Va |<---| |
37 * -------------- --------------------------- --------------
41 * @author Olivier Dugeon
42 * @author Philippe Niger
44 public interface ConnectedGraph {
47 * Returns the Graph associated to this Connected Graph.
54 * Returns the list of Connected Vertices that form this graph.
56 * @return list of Connected Vertices
58 List<ConnectedVertex> getVertices();
61 * Returns the Vertex associated to the given key.
63 * @param key Unique Vertex Identifier
64 * @return Vertex or null if there is no Vertex associated to the given key in this graph
66 ConnectedVertex getConnectedVertex(@NonNull Long key);
69 * Returns the Vertex associated to the given IP address.
71 * @param address IP address of the Loopback of the Vertex
73 * @return Vertex or null if there is no Vertex associated to the given IP address in this graph
75 ConnectedVertex getConnectedVertex(IpAddress address);
78 * Add Vertex in the Connected Graph. This action will automatically create the associated Connected Vertex and
79 * update the Graph in the DataStore.
81 * @param vertex Vertex to be added
83 * @return Connected Vertex associated to the given Vertex
85 ConnectedVertex addVertex(Vertex vertex);
88 * Remove the Vertex in the Connected Graph. This action will automatically remove the associated Connected Vertex
89 * and update the Graph in the DataStore.
91 * @param vertexKey Unique Vertex Identifier
93 void deleteVertex(VertexKey vertexKey);
96 * Returns the number of Vertices in the graph.
98 * @return number of vertices
100 int getVerticesSize();
103 * Returns the list of Connected Edges that form this graph.
105 * @return list of Connected Edges
107 List<ConnectedEdge> getEdges();
110 * Returns the Edge associated to the given key.
112 * @param key Unique Edge Identifier
113 * @return Edge or null if there is no Edge associated to the given key in this graph
115 ConnectedEdge getConnectedEdge(@NonNull Long key);
118 * Returns the Edge associated to the given IP address.
120 * @param address IP address of the Edge
122 * @return Edge or null if there is no Edge associated to the given IP address in this graph
124 ConnectedEdge getConnectedEdge(IpAddress address);
127 * Add Edge in the Connected Graph. This action will automatically create the associated Connected Edge and
128 * update the Graph in the DataStore.
130 * @param edge Edge to be added
132 * @return Connected Edge associated to the given Edge
134 ConnectedEdge addEdge(Edge edge);
137 * Remove the Edge in the Connected Graph. This action will automatically remove the associated Connected Edge
138 * and update the Graph in the DataStore.
140 * @param edgeKey Unique Edge Identifier
142 void deleteEdge(EdgeKey edgeKey);
145 * Returns the number of Edges in the graph.
147 * @return number of edges
152 * Returns the list of Prefix that are stored in this graph.
154 * @return list of Prefix
156 List<Prefix> getPrefixes();
159 * Returns the Prefix associated to the given IP prefix.
161 * @param ippfx IPv4 or IPv6 prefix
163 * @return Prefix that match the given IPv4 or IPv6 prefix
165 Prefix getPrefix(IpPrefix ippfx);
168 * Add Prefix in the Connected Graph. This action will automatically update the Graph in the DataStore.
170 * @param prefix Prefix to be added
173 void addPrefix(Prefix prefix);
176 * Remove the Prefix in the Connected Graph. This action will automatically update the Graph in the DataStore.
178 * @param ippfx IPv4 or IPv6 prefix
180 void deletePrefix(IpPrefix ippfx);
183 * Clear the Connected Graph by removing all Vertices, Edges and Prefixes. This also remove the associated Graph
190 * Returns the summary of the graph characteristics: number of Vertices, Edges and Prefix.
192 * @return characteristics of the Graph as a string