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.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.Graph;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.Edge;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.EdgeKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.Prefix;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.Vertex;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev191125.graph.topology.graph.VertexKey;
21 * Connected Graph class is the connected version of the Graph class from the graph yang model.
24 * Connected Graph is composed by Connected Vertex, Connected Edges and Prefix. It models Unidirectional Connected
25 * Graph (see graph theory). So, Edge and Connected Edge are unidirectional, thus to connect bi-directionally 2 vertices
26 * Va and Vb, it is necessary to setup 2 edges: Va to Vb and Vb to Va.
29 * -------------- --------------------------- --------------
30 * | Connected |---->| Connected Edge Va to Vb |--->| Connected |
31 * ---->| Vertex | --------------------------- | Vertex |---->
33 * | - Key (Va) | | - Key (Vb) |
34 * <----| - Vertex | --------------------------- | - Vertex |<----
35 * | |<----| Connected Edge Vb to Va |<---| |
36 * -------------- --------------------------- --------------
40 * @author Olivier Dugeon
41 * @author Philippe Niger
43 public interface ConnectedGraph {
46 * Returns the Graph associated to this Connected Graph.
53 * Returns the list of Connected Vertices that form this graph.
55 * @return list of Connected Vertices
57 List<ConnectedVertex> getVertices();
60 * Returns the Vertex associated to the given key.
62 * @param key Unique Vertex Identifier
63 * @return Vertex or null if there is no Vertex associated to the given key in this graph
65 ConnectedVertex getConnectedVertex(Long key);
68 * Returns the Vertex associated to the given IP address.
70 * @param address IP address of the Loopback of the Vertex
72 * @return Vertex or null if there is no Vertex associated to the given IP address in this graph
74 ConnectedVertex getConnectedVertex(IpAddress address);
77 * Add Vertex in the Connected Graph. This action will automatically create the associated Connected Vertex and
78 * update the Graph in the DataStore.
80 * @param vertex Vertex to be added
82 * @return Connected Vertex associated to the given Vertex
84 ConnectedVertex addVertex(Vertex vertex);
87 * Remove the Vertex in the Connected Graph. This action will automatically remove the associated Connected Vertex
88 * and update the Graph in the DataStore.
90 * @param vertexKey Unique Vertex Identifier
92 void deleteVertex(VertexKey vertexKey);
95 * Returns the number of Vertices in the graph.
97 * @return number of vertices
99 int getVerticesSize();
102 * Returns the list of Connected Edges that form this graph.
104 * @return list of Connected Edges
106 List<ConnectedEdge> getEdges();
109 * Returns the Edge associated to the given key.
111 * @param key Unique Edge Identifier
112 * @return Edge or null if there is no Edge associated to the given key in this graph
114 ConnectedEdge getConnectedEdge(Long key);
117 * Returns the Edge associated to the given IP address.
119 * @param address IP address of the Edge
121 * @return Edge or null if there is no Edge associated to the given IP address in this graph
123 ConnectedEdge getConnectedEdge(IpAddress address);
126 * Add Edge in the Connected Graph. This action will automatically create the associated Connected Edge and
127 * update the Graph in the DataStore.
129 * @param edge Edge to be added
131 * @return Connected Edge associated to the given Edge
133 ConnectedEdge addEdge(Edge edge);
136 * Remove the Edge in the Connected Graph. This action will automatically remove the associated Connected Edge
137 * and update the Graph in the DataStore.
139 * @param edgeKey Unique Edge Identifier
141 void deleteEdge(EdgeKey edgeKey);
144 * Returns the number of Edges in the graph.
146 * @return number of edges
151 * Returns the list of Prefix that are stored in this graph.
153 * @return list of Prefix
155 List<Prefix> getPrefixes();
158 * Returns the Prefix associated to the given IP prefix.
160 * @param ippfx IPv4 or IPv6 prefix
162 * @return Prefix that match the given IPv4 or IPv6 prefix
164 Prefix getPrefix(IpPrefix ippfx);
167 * Add Prefix in the Connected Graph. This action will automatically update the Graph in the DataStore.
169 * @param prefix Prefix to be added
172 void addPrefix(Prefix prefix);
175 * Remove the Prefix in the Connected Graph. This action will automatically update the Graph in the DataStore.
177 * @param ippfx IPv4 or IPv6 prefix
179 void deletePrefix(IpPrefix ippfx);
182 * Clear the Connected Graph by removing all Vertices, Edges and Prefixes. This also remove the associated Graph
189 * Returns the summary of the graph characteristics: number of Vertices, Edges and Prefix.
191 * @return characteristics of the Graph as a string