cb61edd2d5d58f9ca44c07bd2c819e848f3e6865
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPServerSessionNegotiator.java
1 /*
2  * Copyright (c) 2014 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.rib.impl;
9
10 import io.netty.channel.Channel;
11 import io.netty.util.concurrent.Promise;
12 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
13 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.Open;
16
17 /**
18  * Server negotiator. Validates established connections using BGPServerSessionValidator
19  */
20 public final class BGPServerSessionNegotiator extends AbstractBGPSessionNegotiator {
21
22     public BGPServerSessionNegotiator(final Promise<BGPSessionImpl> promise, final Channel channel,
23             final BGPPeerRegistry registry) {
24         super(promise, channel, registry);
25     }
26
27     @Override
28     protected Ipv4AddressNoZone getSourceId(final Open openMsg, final BGPSessionPreferences preferences) {
29         return preferences.getBgpId();
30     }
31
32     @Override
33     protected Ipv4AddressNoZone getDestinationId(final Open openMsg, final BGPSessionPreferences preferences) {
34         return openMsg.getBgpIdentifier();
35     }
36 }