Add new revision for pcep types model
[bgpcep.git] / pcep / pcc-mock / src / test / java / org / opendaylight / protocol / pcep / pcc / mock / PCCSyncAvoidanceProcedureTest.java
1 /*
2  * Copyright (c) 2015 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.pcc.mock;
10
11 import static org.junit.Assert.assertNotNull;
12
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;
23
24 public class PCCSyncAvoidanceProcedureTest extends PCCMockCommon {
25     @Test
26     public void testSessionAvoidanceDesynchronizedEstablishment() throws Exception {
27         final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
28
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();
38     }
39
40     @Override
41     protected List<PCEPCapability> getCapabilities() {
42         final List<PCEPCapability> caps = new ArrayList<>();
43         caps.add(new PCEPStatefulCapability(true, true, true, false,
44             false, false, true));
45         return caps;
46     }
47 }