Add new revision for pcep types model
[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
9 package org.opendaylight.protocol.pcep.segment.routing;
10
11 import org.junit.Assert;
12 import org.junit.Test;
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.Tlvs;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
16
17 public class PCEPSegmentRoutingCapabilityTest {
18
19     private static final Tlvs EXPECTED_TLVS =
20         new TlvsBuilder()
21             .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1.class,
22                     new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1Builder()
23                     .setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 0).build()).build())
24             .build();
25
26     @Test
27     public void testSegmentRoutingCapability() {
28         final PCEPSegmentRoutingCapability sspf = new PCEPSegmentRoutingCapability(true);
29         Assert.assertTrue(sspf.isSegmentRoutingCapable());
30         final TlvsBuilder builder = new TlvsBuilder();
31         sspf.setCapabilityProposal(null, builder);
32         Assert.assertEquals(EXPECTED_TLVS, builder.build());
33     }
34 }