Add new revision for pcep types model
[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
9 package org.opendaylight.protocol.pcep.segment.routing;
10
11 import java.net.InetSocketAddress;
12 import org.opendaylight.protocol.pcep.PCEPCapability;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1Builder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
17
18 public class PCEPSegmentRoutingCapability implements PCEPCapability {
19
20     private final boolean isSegmentRoutingCapable;
21
22     public PCEPSegmentRoutingCapability(final boolean isSegmentRoutingCapable) {
23         this.isSegmentRoutingCapable = isSegmentRoutingCapable;
24     }
25
26     @Override
27     public void setCapabilityProposal(final InetSocketAddress address, final TlvsBuilder builder) {
28         if (this.isSegmentRoutingCapable) {
29             builder.addAugmentation(Tlvs1.class,
30                     new Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 0).build())
31                             .build());
32         }
33     }
34
35     public boolean isSegmentRoutingCapable() {
36         return this.isSegmentRoutingCapable;
37     }
38
39     @Override
40     public boolean isStateful() {
41         return false;
42     }
43 }