import com.google.common.base.MoreObjects;
import java.net.InetSocketAddress;
-import org.eclipse.jdt.annotation.NonNull;
import org.kohsuke.MetaInfServices;
import org.opendaylight.protocol.pcep.PCEPCapability;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
@MetaInfServices
public class PCEPSegmentRoutingCapability implements PCEPCapability {
- private static final @NonNull Tlvs1 AUGMENTATION = new Tlvs1Builder()
- .setSrPceCapability(new SrPceCapabilityBuilder()
- .setNFlag(Boolean.FALSE)
- .setXFlag(Boolean.FALSE)
- .setMsd(Uint8.ZERO)
- .build())
- .build();
-
- private final boolean isSegmentRoutingCapable;
-
- public PCEPSegmentRoutingCapability() {
- this(true);
- }
-
- public PCEPSegmentRoutingCapability(final boolean isSegmentRoutingCapable) {
- this.isSegmentRoutingCapable = isSegmentRoutingCapable;
- }
-
@Override
public void setCapabilityProposal(final InetSocketAddress address, final TlvsBuilder builder) {
- if (isSegmentRoutingCapable) {
- builder.addAugmentation(AUGMENTATION);
- }
- }
-
- public boolean isSegmentRoutingCapable() {
- return isSegmentRoutingCapable;
+ builder.addAugmentation(new Tlvs1Builder()
+ .setSrPceCapability(new SrPceCapabilityBuilder()
+ .setNFlag(Boolean.FALSE)
+ .setXFlag(Boolean.FALSE)
+ .setMsd(Uint8.ZERO)
+ .build())
+ .build());
}
@Override
@Override
public String toString() {
- return MoreObjects.toStringHelper(this).add("srCapable", isSegmentRoutingCapable).toString();
+ return MoreObjects.toStringHelper(this).toString();
}
}
import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.segment.routing.app.config.rev230115.PcepSegmentRoutingConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability;
ianaSrSubobjectsType = true;
}
+ @Deprecated
+ public SegmentRoutingActivator(final PcepSegmentRoutingConfig config) {
+ this(config.requireIanaSrSubobjectsType());
+ }
+
@Deprecated
public SegmentRoutingActivator(final boolean ianaSrSubobjectsType) {
this.ianaSrSubobjectsType = ianaSrSubobjectsType;
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
<odl:clustered-app-config id="segmentRoutingConfig"
- binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.segment.routing.app.config.rev160707.PcepSegmentRoutingConfig"/>
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.segment.routing.app.config.rev230115.PcepSegmentRoutingConfig"/>
<!-- Protocal extension provider -->
<bean id="segmentRoutingActivator" class="org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator">
- <argument>
- <bean factory-ref="segmentRoutingConfig" factory-method="getIanaSrSubobjectsType"/>
- </argument>
+ <argument ref="segmentRoutingConfig"/>
</bean>
<service ref="segmentRoutingActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
odl:type="org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator"/>
-
- <!-- Capabilities -->
-
- <bean id="segmentRoutingCapability" class="org.opendaylight.protocol.pcep.segment.routing.PCEPSegmentRoutingCapability">
- <argument>
- <bean factory-ref="segmentRoutingConfig" factory-method="getSrCapable"/>
- </argument>
- </bean>
-
- <service ref="segmentRoutingCapability" interface="org.opendaylight.protocol.pcep.PCEPCapability"
- odl:type="org.opendaylight.protocol.pcep.segment.routing.PCEPSegmentRoutingCapability"/>
</blueprint>
module pcep-segment-routing-app-config {
- yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config";
prefix "pcep-segment-routing-app-config";
description
- "Configuration for the PCEP segment routing extension.";
+ "Configuration for the PCEP segment routing extension.
- revision "2016-07-07" {
- description
- "Initial revision.
+ Copyright (c) 2016 Brocade Communications Systems, Inc. All rights reserved.
+
+ This program and the accompanying materials are made available
+ under the terms of the Eclipse Public License v1.0 which
+ accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html";
- Copyright (c) 2016 Brocade Communications Systems, Inc. All rights reserved.
+ revision "2023-01-15" {
+ description "Removed sr-capable leaf.";
+ }
- This program and the accompanying materials are made available
- under the terms of the Eclipse Public License v1.0 which
- accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html";
+ revision "2016-07-07" {
+ description "Initial revision.";
}
container pcep-segment-routing-config {
type boolean;
default true;
}
-
- leaf sr-capable {
- description "Advertize segment-routing capability";
- type boolean;
- default true;
- }
}
}
*/
package org.opendaylight.protocol.pcep.segment.routing;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
import org.opendaylight.yangtools.yang.common.Uint8;
public class PCEPSegmentRoutingCapabilityTest {
- private static final Tlvs EXPECTED_TLVS =
- new TlvsBuilder().addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
- .segment.routing.rev200720.Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder()
- .setNFlag(Boolean.FALSE).setXFlag(Boolean.FALSE).setMsd(Uint8.ZERO).build()).build()).build();
-
@Test
public void testSegmentRoutingCapability() {
- final PCEPSegmentRoutingCapability sspf = new PCEPSegmentRoutingCapability(true);
- Assert.assertTrue(sspf.isSegmentRoutingCapable());
- final TlvsBuilder builder = new TlvsBuilder();
- sspf.setCapabilityProposal(null, builder);
- Assert.assertEquals(EXPECTED_TLVS, builder.build());
+ final var builder = new TlvsBuilder();
+ new PCEPSegmentRoutingCapability().setCapabilityProposal(null, builder);
+ assertEquals(new TlvsBuilder()
+ .addAugmentation(new Tlvs1Builder()
+ .setSrPceCapability(new SrPceCapabilityBuilder()
+ .setNFlag(Boolean.FALSE).setXFlag(Boolean.FALSE).setMsd(Uint8.ZERO)
+ .build())
+ .build())
+ .build(), builder.build());
}
}