Merge "BUG-48: Tunnel integration, part 1"
[bgpcep.git] / pcep / topology-provider / src / main / java / org / opendaylight / bgpcep / pcep / topology / provider / PCEPTopologyProvider.java
1 /*
2  * Copyright (c) 2013 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.bgpcep.pcep.topology.provider;
9
10 import io.netty.channel.ChannelFuture;
11
12 import java.net.InetSocketAddress;
13
14 import org.opendaylight.bgpcep.programming.spi.InstructionScheduler;
15 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
16 import org.opendaylight.protocol.pcep.PCEPDispatcher;
17 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19
20 import com.google.common.base.Preconditions;
21
22 public final class PCEPTopologyProvider {
23         private final PCEPDispatcher dispatcher;
24         private final TopologyProgramming topology;
25         private final ServerSessionManager manager;
26         private final TopologyRPCs element;
27
28         public PCEPTopologyProvider(final PCEPDispatcher dispatcher,
29                         final InstructionScheduler scheduler,
30                         final DataProviderService dataService,
31                         final InstanceIdentifier<Topology> topology) {
32                 this.dispatcher = Preconditions.checkNotNull(dispatcher);
33
34
35                 this.manager = new ServerSessionManager(dataService, topology);
36                 this.element = new TopologyRPCs(manager);
37                 this.topology = new TopologyProgramming(scheduler, manager);
38         }
39
40         public ChannelFuture startServer(final InetSocketAddress address) {
41                 return dispatcher.createServer(address, manager);
42         }
43 }