Update MRI projects for Aluminium
[bgpcep.git] / pcep / segment-routing / src / main / java / org / opendaylight / protocol / pcep / segment / routing / PCEPSegmentRoutingCapability.java
1 /*
2  * Copyright (c) 2014 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.protocol.pcep.segment.routing;
9
10 import java.net.InetSocketAddress;
11 import org.opendaylight.protocol.pcep.PCEPCapability;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1Builder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
15 import org.opendaylight.yangtools.yang.common.Uint8;
16
17 public class PCEPSegmentRoutingCapability implements PCEPCapability {
18
19     private final boolean isSegmentRoutingCapable;
20
21     public PCEPSegmentRoutingCapability(final boolean isSegmentRoutingCapable) {
22         this.isSegmentRoutingCapable = isSegmentRoutingCapable;
23     }
24
25     @Override
26     public void setCapabilityProposal(final InetSocketAddress address, final TlvsBuilder builder) {
27         if (this.isSegmentRoutingCapable) {
28             builder.addAugmentation(new Tlvs1Builder()
29                 .setSrPceCapability(new SrPceCapabilityBuilder().setMsd(Uint8.ZERO).build())
30                 .build());
31         }
32     }
33
34     public boolean isSegmentRoutingCapable() {
35         return this.isSegmentRoutingCapable;
36     }
37
38     @Override
39     public boolean isStateful() {
40         return false;
41     }
42 }