BUG-5876 Enhance BGP Speaker and Peer Stats II
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / BGPSessionPreferences.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.rib.impl.spi;
9
10 import java.util.List;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
15
16 /**
17  * DTO for BGP Session preferences, that contains BGP Open message.
18  */
19 public final class BGPSessionPreferences {
20
21     private final AsNumber as;
22
23     private final int hold;
24
25     private final BgpId bgpId;
26
27     private final List<BgpParameters> params;
28
29     private final AsNumber remoteAs;
30
31     /**
32      * Creates a new DTO for Open message.
33      *
34      * @param as local AS number
35      * @param hold preferred hold timer value, in seconds
36      * @param bgpId local BGP Identifier
37      * @param remoteAs expected remote As Number
38      * @param params list of advertised parameters
39      */
40     public BGPSessionPreferences(final AsNumber as, final int hold, final BgpId bgpId, final AsNumber remoteAs,
41         final List<BgpParameters> params) {
42         this.as = as;
43         this.hold = hold;
44         this.bgpId = (bgpId != null) ? new BgpId(bgpId) : null;
45         this.remoteAs = remoteAs;
46         this.params = params;
47     }
48
49     /**
50      * Returns my AS number.
51      *
52      * @return AS number
53      */
54     public AsNumber getMyAs() {
55         return this.as;
56     }
57
58     /**
59      * Returns initial value of HoldTimer.
60      *
61      * @return initial value of HoldTimer
62      */
63     public int getHoldTime() {
64         return this.hold;
65     }
66
67     /**
68      * Returns my BGP Identifier.
69      *
70      * @return BGP identifier
71      */
72     public BgpId getBgpId() {
73         return this.bgpId;
74     }
75
76     /**
77      * Returns expected remote AS number.
78      *
79      * @return AS number
80      */
81     public AsNumber getExpectedRemoteAs() {
82         return this.remoteAs;
83     }
84
85     /**
86      * Gets a list of advertised bgp parameters.
87      *
88      * @return a list of advertised bgp parameters
89      */
90     public List<BgpParameters> getParams() {
91         return this.params;
92     }
93 }