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;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
23 * Connected Graph class is the connected version of the Graph class from the graph yang model.
26 * Connected Graph is composed by Connected Vertex, Connected Edges and Prefix. It models Unidirectional Connected
27 * Graph (see graph theory). So, Edge and Connected Edge are unidirectional, thus to connect bi-directionally 2 vertices
28 * Va and Vb, it is necessary to setup 2 edges: Va to Vb and Vb to Va.
31 * -------------- --------------------------- --------------
32 * | Connected |---->| Connected Edge Va to Vb |--->| Connected |
33 * ---->| Vertex | --------------------------- | Vertex |---->
35 * | - Key (Va) | | - Key (Vb) |
36 * <----| - Vertex | --------------------------- | - Vertex |<----
37 * | |<----| Connected Edge Vb to Va |<---| |
38 * -------------- --------------------------- --------------
42 * @author Olivier Dugeon
43 * @author Philippe Niger
45 public interface ConnectedGraph {
48 * Returns the Graph associated to this Connected Graph.
55 * Returns the list of Connected Vertices that form this graph.
57 * @return list of Connected Vertices
59 List<ConnectedVertex> getVertices();
62 * Returns the Vertex associated to the given key.
64 * @param key Unique Vertex Identifier
65 * @return Vertex or null if there is no Vertex associated to the given key in this graph
67 ConnectedVertex getConnectedVertex(@NonNull Long key);
70 * Returns the Vertex associated to the given IP address.
72 * @param address IP address of the Loopback of the Vertex
74 * @return Vertex or null if there is no Vertex associated to the given IP address in this graph
76 ConnectedVertex getConnectedVertex(IpAddress address);
79 * Add Vertex in the Connected Graph. This action will automatically create the associated Connected Vertex and
80 * update the Graph in the DataStore.
82 * @param vertex Vertex to be added
84 * @return Connected Vertex associated to the given Vertex
86 ConnectedVertex addVertex(Vertex vertex);
89 * Remove the Vertex in the Connected Graph. This action will automatically remove the associated Connected Vertex
90 * and update the Graph in the DataStore.
92 * @param vertexKey Unique Vertex Identifier
94 void deleteVertex(VertexKey vertexKey);
97 * Returns the number of Vertices in the graph.
99 * @return number of vertices
101 int getVerticesSize();
104 * Returns the list of Connected Edges that form this graph.
106 * @return list of Connected Edges
108 List<ConnectedEdge> getEdges();
111 * Returns the Edge associated to the given key.
113 * @param key Unique Edge Identifier
114 * @return Edge or null if there is no Edge associated to the given key in this graph
116 ConnectedEdge getConnectedEdge(@NonNull Long key);
119 * Returns the Edge associated to the given IP address.
121 * @param address IP address of the Edge
123 * @return Edge or null if there is no Edge associated to the given IP address in this graph
125 ConnectedEdge getConnectedEdge(IpAddress address);
128 * Add Edge in the Connected Graph. This action will automatically create the associated Connected Edge and
129 * update the Graph in the DataStore.
131 * @param edge Edge to be added
133 * @return Connected Edge associated to the given Edge
135 ConnectedEdge addEdge(Edge edge);
138 * Remove the Edge in the Connected Graph. This action will automatically remove the associated Connected Edge
139 * and update the Graph in the DataStore.
141 * @param edgeKey Unique Edge Identifier
143 void deleteEdge(EdgeKey edgeKey);
146 * Returns the number of Edges in the graph.
148 * @return number of edges
153 * Returns the list of Prefix that are stored in this graph.
155 * @return list of Prefix
157 List<Prefix> getPrefixes();
160 * Returns the Prefix associated to the given IP prefix.
162 * @param ippfx IPv4 or IPv6 prefix
164 * @return Prefix that match the given IPv4 or IPv6 prefix
166 Prefix getPrefix(IpPrefix ippfx);
169 * Add Prefix in the Connected Graph. This action will automatically update the Graph in the DataStore.
171 * @param prefix Prefix to be added
174 void addPrefix(Prefix prefix);
177 * Remove the Prefix in the Connected Graph. This action will automatically update the Graph in the DataStore.
179 * @param ippfx IPv4 or IPv6 prefix
181 void deletePrefix(IpPrefix ippfx);
184 * Clear the Connected Graph by removing all Vertices, Edges and Prefixes. This also remove the associated Graph
191 * Returns the summary of the graph characteristics: number of Vertices, Edges and Prefix.
193 * @return characteristics of the Graph as a string
198 * Register a trigger that is executed when a problem occurs on a Vertex or a Edge within the Connected Graph.
200 * @param trigger Trigger to be registered
201 * @param key Topology Key Identifier
203 * @return True if registration is done, false otherwise
205 boolean registerTrigger(ConnectedGraphTrigger trigger, TopologyKey key);
208 * Un-register a trigger that is already registered on the Connected Graph.
210 * @param trigger Trigger to be unregistered
211 * @param key Topology Key Identifier
213 * @return True if un-registration is done, false otherwise
215 boolean unRegisterTrigger(ConnectedGraphTrigger trigger, TopologyKey key);