1 .. _graph-user-guide-manage-graph:
5 This section explains how to manipulate the Graph through REST API.
14 The connected Graph is not accessible through the REST API as it is not
15 posssible to represent connected Edges and Vertices with yang model (see
16 Graph Overview). Thus, Graph feature provides a new service named
17 ConnectedGraphProvider published in Karaf. This service maintains an
18 up-to-date list of Connected Graph stored in memory and allows to:
20 * Get Connected Graph by name or GraphKey
21 * Create Connected Graph
22 * Add existing graph to create associated Connected Graph
23 * Delete existing Graph identify by its GraphKey
25 Then, Connected Graph provides method to manage Vertices, Edges and Prefix.
26 The ConnectedGraphProvider is also in charge to maintain up to date the Graph
27 associated to the Connected Graph in the OpenDaylight operational Data Store.
29 In fact, two graphs are stored in the Data Store:
31 * Operational Graph in ``restconf/operational`` which is the graph
32 associated with the Connected Graph stored in memory
33 * Configuration Graph in ``restconf/config`` which is the graph that
34 could be create / modify / delete in order to produce the Connected
35 Graph and thus, the associated Graph stored in operational Data Store
37 It is also possible to add / delete Vertices, Edges and Prefix on an existing
38 Graph through the REST API.
44 Developper will refer to the Java Doc to manage Connected and standard Graph.
45 The main principle is as follow:
47 1. First Create a Connected Graph through the ConnectedGraphProvider which is a
48 new service provided by the Graph feature through Karaf:
52 ConnectedGraph cgraph = graphProvider.createConnectedGraph("example", GraphType.IntraDomain);
54 Or by adding an initial graph:
58 Graph graph = new GraphBuilder().setName("example").setGraphType(GraphType.IntraDomain).build();
59 ConnectedGraph cgraph = graphProvider.addGraph(graph);
61 Where graphProvider is obtained from blueprint.
63 2. Once created, the Connected Graph offers various method to manage Vertices
64 and Edges. For example:
69 Vertex vertex = new VertexBuilder().setVertexId(Uint64.ValueOf(1)).build();
70 cgraph.addVertex(vertex);
73 Edge edge = new EdgeBuilder().setEdgeId(Uint64.ValueOf(1)).build();
81 This section provides the list of REST method that could be used to manage
87 Graphs are stored in operation and config Data Store. Thus there are accessible
88 through the ``graph:graph-topology`` namespace as follow:
92 **URL:** ``restconf/operational/graph:graph-topology``
109 "vertex-type": "standard"
114 "vertex-type": "standard"
117 "graph-type": "intra-domain"
123 Graphs publish in the configuration Data Store are also accessible through REST
124 API with the same namespace as follow:
128 **URL:** ``restconf/config/graph:graph-topology``
145 "vertex-type": "standard"
150 "vertex-type": "standard"
153 "graph-type": "intra-domain"
162 Graphs could be created with PUT method. In this case, all previously
163 configured graphs are removed from both the configuration and operational
164 Data Store. This includes all modification and associated Connected Graphs.
168 **URL:** ``restconf/config/graph:graph-topology``
172 **Content-Type:** ``application/json``
183 "graph-type": "intra-domain",
198 "local-vertex-id": 1,
199 "remote-vertex-id": 2
204 "local-vertex-id": 2,
205 "remote-vertex-id": 1
213 @line 5: **name** The Graph identifier. Must be unique.
215 @line 6: **graph-type** The type of the Graph: intra-domain or inter-domain.
217 @line 7: **vertex** - List of Vertices. Each Vertex ID must be unique.
219 @line 17: **edges** - List of Edges. Each Edge ID must be unique.
221 @line 21: **local-vertex-id** - Vertex ID where the Edge is connected from.
222 The vertex ID must correspond to vertex that is present in the vertex list,
223 otherwise, the connection will not be estabished in the Connected Graph.
225 @line 22: **remote-vertex-id** - Vertex ID where the Edge is connected to.
226 The vertex ID must correspond to vertex that is present in the vertex list,
227 otherwise, the connection will not be estabished in the Connected Graph.
232 It is also possible to add a Graph to the existing list. POST method will
233 be used instead of PUT. Body and URL remains the same.
238 Removing a graph used the DELETE method as follow:
242 **URL:** ``restconf/config/graph:graph-topology/graph/example``
244 **Method:** ``DELETE``
246 The name of the graph i.e. the Graph Key to be deleted must be provide
252 One or more vertex could be added to a Graph. If the graph doesn't exist,
253 it will be automatically created. Only POST method must be used.
257 **URL:** ``restconf/config/graph:graph-topology/graph/example``
261 **Content-Type:** ``application/json``
272 "router-id": "192.168.1.100"
280 Removing a vertex used the DELETE method as follow:
284 **URL:** ``restconf/config/graph:graph-topology/graph/example/vertex/10``
286 **Method:** ``DELETE``
288 The Vertex to be deleted is identified by its Vertex Id and must be provide
294 One or more edges could be added to a Graph. If the graph doesn't exist,
295 it will be automatically created. Only POST method must be used.
299 **URL:** ``restconf/config/graph:graph-topology/graph/example``
303 **Content-Type:** ``application/json``
314 "local-vertex-id": 1,
315 "remote-vertex-id": 2
320 "local-vertex-id": 2,
321 "remote-vertex-id": 1
329 Removing an edge used the DELETE method as follow:
333 **URL:** ``restconf/config/graph:graph-topology/graph/example/edge/10``
335 **Method:** ``DELETE``
337 The Edge to be deleted is identified by its Edge Id and must be provide
343 One or more prefixe could be added to a Graph. If the graph doesn't exist,
344 it will be automatically created. Only POST method must be used.
348 **URL:** ``restconf/config/graph:graph-topology/graph/example``
352 **Content-Type:** ``application/json``
361 "prefix": "192.168.1.0/24",
370 Removing a prefix used the DELETE method as follow:
374 **URL:** ``restconf/config/graph:graph-topology/graph/example/prefix/192%2e168%2e1%2e0%2f24``
376 **Method:** ``DELETE``
378 The Prefix to be deleted is identified by its Prefix Id and must be provide
379 within the URL. As the prefix identifier is the ip prefix, '.' and '/' must
380 be replace by their respective ASCII representation i.e. '%2e' for dot and