2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.pcep.ietf;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
14 import org.junit.Test;
15 import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev181109.Stateful1Builder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.Tlvs1Builder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.stateful.capability.tlv.StatefulBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
22 public class PCEPStatefulCapabilityTest {
24 private static final Tlvs EXPECTED_TLVS = new TlvsBuilder()
25 .addAugmentation(new Tlvs1Builder()
26 .setStateful(new StatefulBuilder().setLspUpdateCapability(true)
27 .addAugmentation(new Stateful1Builder().setInitiation(true).build())
28 .addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller
29 .pcep.sync.optimizations.rev181109.Stateful1Builder()
30 .setTriggeredInitialSync(true)
31 .setTriggeredResync(false)
32 .setDeltaLspSyncCapability(true)
33 .setIncludeDbVersion(true)
40 public void testPCEPStatefulCapability() {
41 final PCEPStatefulCapability sspf = new PCEPStatefulCapability(true, true, true, true, false, true, false);
42 assertTrue(sspf.isActive());
43 assertTrue(sspf.isInstant());
44 assertTrue(sspf.isStateful());
45 assertFalse(sspf.isTriggeredResync());
46 assertTrue(sspf.isTriggeredSync());
47 assertTrue(sspf.isDeltaLspSync());
48 assertTrue(sspf.isIncludeDbVersion());
49 final TlvsBuilder builder = new TlvsBuilder();
50 sspf.setCapabilityProposal(null, builder);
51 assertEquals(EXPECTED_TLVS, builder.build());