Bump upstreams
[bgpcep.git] / pcep / topology / topology-provider / src / main / java / org / opendaylight / bgpcep / pcep / topology / provider / TopologyPCEPSessionNegotiatorFactory.java
1 /*
2  * Copyright (c) 2023 PANTHEON.tech, 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;
9
10 import java.net.InetSocketAddress;
11 import java.util.List;
12 import org.opendaylight.mdsal.binding.api.DataBroker;
13 import org.opendaylight.protocol.pcep.PCEPCapability;
14 import org.opendaylight.protocol.pcep.PCEPSessionListenerFactory;
15 import org.opendaylight.protocol.pcep.PCEPTimerProposal;
16 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionTls;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
19 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
20 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
21 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
22 import org.opendaylight.yangtools.yang.common.Uint16;
23
24 final class TopologyPCEPSessionNegotiatorFactory extends DefaultPCEPSessionNegotiatorFactory {
25     private final PCEPStatefulPeerProposal proposal;
26
27     TopologyPCEPSessionNegotiatorFactory(final PCEPSessionListenerFactory listenerFactory,
28             final PCEPTimerProposal timers, final List<PCEPCapability> capabilities, final Uint16 maxUnknownMessages,
29             final PcepSessionTls tlsConfiguration, final DataBroker dataBroker,
30             final KeyedInstanceIdentifier<Topology, TopologyKey> topology) {
31         super(listenerFactory, timers, capabilities, maxUnknownMessages, tlsConfiguration);
32         proposal = new PCEPStatefulPeerProposal(dataBroker, topology);
33     }
34
35     @Override
36     protected void appendPeerSpecificTls(final InetSocketAddress address, final TlvsBuilder builder) {
37         proposal.setPeerSpecificProposal(address, builder);
38     }
39
40     void close() {
41         proposal.close();
42     }
43 }