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 com.google.common.base.Optional;
14 import io.netty.channel.Channel;
15 import java.math.BigInteger;
16 import java.net.UnknownHostException;
17 import java.util.ArrayList;
18 import java.util.List;
19 import java.util.concurrent.ExecutionException;
20 import org.junit.Test;
21 import org.opendaylight.protocol.pcep.PCEPCapability;
22 import org.opendaylight.protocol.pcep.PCEPSession;
23 import org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability;
24 import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal;
26 public class PCCSyncAvoidanceProcedureTest extends PCCMockCommon {
28 public void testSessionAvoidanceDesynchronizedEstablishment() throws UnknownHostException, InterruptedException, ExecutionException {
29 final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
31 final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
32 PCEPSession session = createPCCSession(BigInteger.TEN).get();
33 assertNotNull(session);
34 final TestingSessionListener pceSessionListener = getListener(factory);
35 assertNotNull(pceSessionListener);
36 assertNotNull(pceSessionListener.getSession());
37 checkResyncSession(Optional.<Integer>absent(), 11, null, BigInteger.valueOf(10), pceSessionListener);
38 channel.close().get();
42 protected List<PCEPCapability> getCapabilities() {
43 final List<PCEPCapability> caps = new ArrayList<>();
44 caps.add(new PCEPStatefulCapability(true, true, true, false, false, false, true));