Add transport-{api,tcp}
[netconf.git] / transport / transport-tcp / src / main / java / org / opendaylight / netconf / transport / tcp / IetfTcpClientFeatureProvider.java
1 /*
2  * Copyright (c) 2022 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.netconf.transport.tcp;
9
10 import java.util.Set;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.kohsuke.MetaInfServices;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.tcp.client.rev220524.IetfTcpClientData;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.tcp.client.rev220524.LocalBindingSupported;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.tcp.client.rev220524.TcpClientKeepalives;
16 import org.opendaylight.yangtools.yang.binding.YangFeature;
17 import org.opendaylight.yangtools.yang.binding.YangFeatureProvider;
18
19 /**
20  * Baseline features supported from {@code ietf-tcp-client.yang}.
21  */
22 @MetaInfServices
23 @NonNullByDefault
24 public final class IetfTcpClientFeatureProvider implements YangFeatureProvider<IetfTcpClientData> {
25     @Override
26     public Class<IetfTcpClientData> boundModule() {
27         return IetfTcpClientData.class;
28     }
29
30     @Override
31     public Set<? extends YangFeature<?, IetfTcpClientData>> supportedFeatures() {
32         return NettyTransportSupport.keepalivesSupported()
33             ? Set.of(LocalBindingSupported.VALUE, TcpClientKeepalives.VALUE) : Set.of(LocalBindingSupported.VALUE);
34     }
35 }