Migrate to using blueprints for unimgr initialisation.
[unimgr.git] / impl / src / main / java / org / opendaylight / unimgr / mef / nrp / api / ActivationDriver.java
1 /*
2  * Copyright (c) 2016 Cisco Systems Inc and others.  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.unimgr.mef.nrp.api;
9
10 import org.opendaylight.yang.gen.v1.uri.onf.coremodel.corenetworkmodule.objectclasses.rev160413.GFcPort;
11 import org.opendaylight.yang.gen.v1.uri.onf.coremodel.corenetworkmodule.objectclasses.rev160413.GForwardingConstruct;
12
13 /**
14  * Interface of a driver that maps NRP concepts to the configuration of underlying infrastructure.
15  * The driver is used in following scenario
16  * <ol>
17  *     <li>Driver is initialized. Otherwise stop</li>
18  *     <li>Driver is attached to transaction</li>
19  *     <li>Driver activate/deactivate method gets called</li>
20  *     <li>If all drivers within transaction succeed commit method is called. Otherwise rollback is triggered</li>
21  * </ol>
22  *
23  * @author bartosz.michalik@amartus.com
24  */
25 public interface ActivationDriver {
26
27     /**
28      * Called in case all drivers in the transaction has succeeded.
29      */
30     void commit();
31
32     /**
33      * Called in case any of drivers in the transaction has failed.
34      */
35     void rollback();
36
37     /**
38      * Set state for the driver for a (de)activation transaction.
39      * @param from near end
40      * @param to far end
41      * @param context context
42      */
43     void initialize(GFcPort from, GFcPort to, GForwardingConstruct context);
44
45     /**
46      * Performs the activation action.
47      */
48     void activate();
49
50     /**
51      * Performs the deactivation action.
52      */
53     void deactivate();
54
55
56     /**
57      * Influences the order in which drivers are called within the transaction.
58      * @return int priority of this driver when resoving ambiguity
59      */
60     int priority();
61 }