Cleanup.
[bgpcep.git] / pcep / testtool / src / main / java / org / opendaylight / protocol / pcep / testtool / TestingSessionListener.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.protocol.pcep.testtool;
9
10 import java.util.ArrayList;
11 import java.util.List;
12
13 import org.opendaylight.protocol.pcep.PCEPMessage;
14 import org.opendaylight.protocol.pcep.PCEPSession;
15 import org.opendaylight.protocol.pcep.PCEPSessionListener;
16 import org.opendaylight.protocol.pcep.PCEPTerminationReason;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 public class TestingSessionListener implements PCEPSessionListener {
21
22         public List<PCEPMessage> messages = new ArrayList<PCEPMessage>();
23
24         public boolean up = false;
25
26         private static final Logger logger = LoggerFactory.getLogger(TestingSessionListener.class);
27
28         public TestingSessionListener() {
29         }
30
31         @Override
32         public void onMessage(final PCEPSession session, final PCEPMessage message) {
33                 logger.debug("Received message: {}", message);
34                 this.messages.add(message);
35         }
36
37         @Override
38         public void onSessionUp(final PCEPSession session) {
39                 logger.debug("Session up.");
40                 this.up = true;
41                 // this.notifyAll();
42         }
43
44         @Override
45         public void onSessionDown(final PCEPSession session, final Exception e) {
46                 logger.debug("Session down. Cause : {} or {}", e);
47                 this.up = false;
48                 // this.notifyAll();
49         }
50
51         @Override
52         public void onSessionTerminated(final PCEPSession session, final PCEPTerminationReason cause) {
53                 logger.debug("Session terminated. Cause : {}", cause);
54         }
55 }