2 * Copyright (c) 2013 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.testtool;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 import org.opendaylight.protocol.framework.TerminationReason;
17 import org.opendaylight.protocol.pcep.PCEPMessage;
18 import org.opendaylight.protocol.pcep.PCEPSession;
19 import org.opendaylight.protocol.pcep.PCEPSessionListener;
20 import org.opendaylight.protocol.pcep.object.PCEPCloseObject;
21 import org.opendaylight.protocol.pcep.object.PCEPOpenObject;
24 * Simple Session Listener that is notified about messages and changes in the session.
26 public class SimpleSessionListener extends PCEPSessionListener {
28 public List<PCEPMessage> messages = new ArrayList<PCEPMessage>();
30 public boolean up = false;
32 private static final Logger logger = LoggerFactory.getLogger(SimpleSessionListener.class);
34 public SimpleSessionListener() {
38 public void onMessage(PCEPSession session, PCEPMessage message) {
39 logger.debug("Received message: " + message);
40 this.messages.add(message);
44 public void onSessionUp(PCEPSession session, PCEPOpenObject local,
45 PCEPOpenObject remote) {
46 logger.debug("Session up.");
52 public void onSessionDown(PCEPSession session, PCEPCloseObject reason, Exception e) {
53 logger.debug("Session down.");
59 public void onSessionTerminated(PCEPSession session,
60 TerminationReason cause) {
61 logger.debug("Session terminated. Cause : " + cause.toString());