BUG-9079 Make PCEP session recoverable from exception
[bgpcep.git] / pcep / topology / topology-provider / src / main / java / org / opendaylight / bgpcep / pcep / topology / provider / config / PCEPTopologyDeployer.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.bgpcep.pcep.topology.provider.config;
9
10 import com.google.common.base.Optional;
11 import java.net.InetSocketAddress;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
15 import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderRuntimeRegistrator;
16 import org.opendaylight.protocol.concepts.KeyMapping;
17 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
18
19 /**
20  * The PCEPTopologyDeployer service is managing PcepTopologyProvider
21  */
22 public interface PCEPTopologyDeployer {
23     /**
24      * Creates and register topology provider instance
25      *  @param topologyId topology ID
26      * @param inetSocketAddress inetSocketAddress
27      * @param rpcTimeout rpc Timeout
28      * @param keys List of clients password configuration
29      * @param scheduler  Instruction Scheduler
30      */
31     @Deprecated
32     default void createTopologyProvider(@Nonnull TopologyId topologyId, @Nonnull InetSocketAddress inetSocketAddress,
33         short rpcTimeout, @Nullable Optional<KeyMapping> keys, @Nonnull InstructionScheduler scheduler,
34         Optional<PCEPTopologyProviderRuntimeRegistrator> runtime) {
35         if(keys.isPresent()) {
36             createTopologyProvider(topologyId, inetSocketAddress, rpcTimeout, keys.get(), scheduler, runtime);
37         }
38         createTopologyProvider(topologyId, inetSocketAddress, rpcTimeout, KeyMapping.getKeyMapping(),
39             scheduler, runtime);
40     }
41
42     /**
43      * Creates and register topology provider instance
44      *  @param topologyId topology ID
45      * @param inetSocketAddress inetSocketAddress
46      * @param rpcTimeout rpc Timeout
47      * @param client List of clients password configuration
48      * @param scheduler  Instruction Scheduler
49      */
50     void createTopologyProvider(@Nonnull TopologyId topologyId, @Nonnull InetSocketAddress inetSocketAddress,
51         short rpcTimeout, @Nonnull KeyMapping client, @Nonnull InstructionScheduler scheduler,
52         Optional<PCEPTopologyProviderRuntimeRegistrator> runtime);
53
54     /**
55      * Closes and unregister topology provider instance
56      *
57      * @param topologyID topology ID
58      */
59     void removeTopologyProvider(@Nonnull TopologyId topologyID);
60 }