42048f173a9ea81040fbd55af374fb8a5c5658f4
[bgpcep.git] / bgp / testtool / src / test / java / org / opendaylight / protocol / bgp / testtool / SpeakerSessionListener.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.bgp.testtool;
9
10 import java.util.Set;
11
12 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
13 import org.opendaylight.protocol.bgp.parser.BGPError;
14 import org.opendaylight.protocol.bgp.parser.BGPMessage;
15 import org.opendaylight.protocol.bgp.parser.BGPSession;
16 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
17 import org.opendaylight.protocol.framework.DispatcherImpl;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 public class SpeakerSessionListener extends BGPSessionListener {
22         private static final Logger logger = LoggerFactory.getLogger(SpeakerSessionListener.class);
23
24         DispatcherImpl d;
25
26         SpeakerSessionListener(final DispatcherImpl d) {
27                 this.d = d;
28         }
29
30         @Override
31         public void onSessionUp(final Set<BGPTableType> remote) {
32                 logger.info("Server: Session is up.");
33         }
34
35         @Override
36         public void onSessionTerminated(final BGPError cause) {
37                 logger.info("Server: Session terminated: {}", cause);
38         }
39
40         @Override
41         public void onSessionDown(final BGPSession session, final Exception e) {
42                 logger.info("Server: Session down.");
43                 session.close();
44                 // this.d.stop();
45         }
46
47         @Override
48         public void onMessage(final BGPMessage message) {
49                 logger.info("Server: Message received: {}", message);
50                 // this.d.stop();
51         }
52 }