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
9 package org.opendaylight.protocol.pcep.pcc.mock;
11 import static org.junit.Assert.assertNotNull;
13 import io.netty.channel.Channel;
14 import java.math.BigInteger;
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Optional;
18 import org.junit.Test;
19 import org.opendaylight.protocol.pcep.PCEPCapability;
20 import org.opendaylight.protocol.pcep.PCEPSession;
21 import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
22 import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal;
24 public class PCCSyncAvoidanceProcedureTest extends PCCMockCommon {
26 public void testSessionAvoidanceDesynchronizedEstablishment() throws Exception {
27 final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
29 final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
30 final PCEPSession session = createPCCSession(BigInteger.TEN).get();
31 assertNotNull(session);
32 final TestingSessionListener pceSessionListener = getListener(factory);
33 assertNotNull(pceSessionListener);
34 assertNotNull(pceSessionListener.getSession());
35 checkResyncSession(Optional.empty(), 11, 11, null,
36 BigInteger.valueOf(10), pceSessionListener);
37 channel.close().get();
41 protected List<PCEPCapability> getCapabilities() {
42 final List<PCEPCapability> caps = new ArrayList<>();
43 caps.add(new PCEPStatefulCapability(true, true, true, false,