58e2e469a359e67f536af48682b178496cbcfff5
[bgpcep.git] / pcep / segment-routing / src / test / java / org / opendaylight / protocol / pcep / segment / routing / PCEPSegmentRoutingCapabilityTest.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 org.junit.Assert;
11 import org.junit.Test;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
15
16 public class PCEPSegmentRoutingCapabilityTest {
17
18     private static final Tlvs EXPECTED_TLVS =
19         new TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment
20             .routing.rev181109.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
21                 .segment.routing.rev181109.Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder()
22                     .setMsd((short) 0).build()).build()).build();
23
24     @Test
25     public void testSegmentRoutingCapability() {
26         final PCEPSegmentRoutingCapability sspf = new PCEPSegmentRoutingCapability(true);
27         Assert.assertTrue(sspf.isSegmentRoutingCapable());
28         final TlvsBuilder builder = new TlvsBuilder();
29         sspf.setCapabilityProposal(null, builder);
30         Assert.assertEquals(EXPECTED_TLVS, builder.build());
31     }
32 }