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.pcc.mock;
10 import static org.junit.Assert.assertNotNull;
12 import io.netty.channel.Channel;
13 import java.util.ArrayList;
14 import java.util.List;
15 import java.util.Optional;
16 import org.junit.Test;
17 import org.opendaylight.protocol.pcep.PCEPCapability;
18 import org.opendaylight.protocol.pcep.PCEPSession;
19 import org.opendaylight.protocol.pcep.ietf.stateful.PCEPStatefulCapability;
20 import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal;
21 import org.opendaylight.yangtools.yang.common.Uint64;
23 public class PCCSyncAvoidanceProcedureTest extends PCCMockCommon {
25 public void testSessionAvoidanceDesynchronizedEstablishment() throws Exception {
26 final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
28 final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
29 final PCEPSession session = createPCCSession(Uint64.TEN).get();
30 assertNotNull(session);
31 final TestingSessionListener pceSessionListener = getListener(factory);
32 assertNotNull(pceSessionListener);
33 assertNotNull(pceSessionListener.getSession());
34 checkResyncSession(Optional.empty(), 11, 11, null, Uint64.TEN, pceSessionListener);
35 channel.close().get();
39 protected List<PCEPCapability> getCapabilities() {
40 final List<PCEPCapability> caps = new ArrayList<>();
41 caps.add(new PCEPStatefulCapability(true, true, true, false,