BUG-50 : added test for PathKey Object.
[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 DataProviderService dataProvider;
25         private final InstanceIdentifier<Topology> topology;
26         private final InstructionScheduler scheduler;
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                 this.dataProvider = Preconditions.checkNotNull(dataService);
34                 this.topology = Preconditions.checkNotNull(topology);
35                 this.scheduler = Preconditions.checkNotNull(scheduler);
36         }
37
38         public ChannelFuture startServer(final InetSocketAddress address) {
39                 return dispatcher.createServer(address, new ServerSessionManager(scheduler, dataProvider, topology));
40         }
41 }