Graph: add Multi-Topology support
[bgpcep.git] / graph / graph-api / src / main / java / org / opendaylight / graph / ConnectedGraphTrigger.java
1 /*
2  * Copyright (c) 2022 Orange.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.graph;
9
10 import java.util.Collection;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev220720.Edge;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.rev220720.Vertex;
14
15 /**
16  * Connected Graph Trigger class aims to trigger action when major modification(s) takes place on a Vertex or a Edge.
17  * Once trigger registered (see ConnectedGraph interface), the verify() method is called in order to determine
18  * if some corrections should be executed.
19  *
20  * <p>verifyVertex() and verifyEdge() method must be provided by the class which registered the trigger.
21  * These methods take as argument the global list of triggers registered for Vertices or Edges.
22  *
23  * <p>This class allows to implement close loop against modification on the Connected Graph e.g. Segment Routing SIDs
24  * change on a Vertex which imposes to adjust SR path description that belongs to this Vertex or Delay modification
25  * that goes upper a certain threshold that imposes to re-compute the constrained Path.
26  *
27  * @author Olivier Dugeon
28  */
29 public interface ConnectedGraphTrigger {
30
31     /**
32      * This method verifies the next Vertex attributes against the current one to determine if is necessary
33      * to launch correction which are left at the discretion of the class which implements this method.
34      *
35      * <p>If current Vertex is null, this means that the Connected Vertex will be added in the Connected Graph.
36      * If next Connected Vertex is null, this means that the Connected Vertex will be deleted from the Connected Graph.
37      * Otherwise, this is an update of Vertex attributes.
38
39      * @param next      Next Connected Vertex to be installed in the Connected Graph
40      * @param current   Current Vertex installed in the Connected Graph
41      */
42     void verifyVertex(Collection<ConnectedVertexTrigger> triggers, @Nullable ConnectedVertex next,
43             @Nullable Vertex current);
44
45     /**
46      * This method verifies the next Edge attributes against the current one to determine if is necessary
47      * to launch correction which are left at the discretion of the class which implements this method.
48      *
49      * <p>If current Edge is null, this means that the Connected Edge will be added in the Connected Graph.
50      * If next Connected Edge is null, this means that the Edge will be deleted from the Connected Graph.
51      * Otherwise, this is an update of Edge attributes.
52
53      * @param next      Next Edge to be installed in the Connected Graph
54      * @param current   Current Edge installed in the Connected Graph
55      */
56     void verifyEdge(Collection<ConnectedEdgeTrigger> triggers, @Nullable ConnectedEdge next, @Nullable Edge current);
57 }