Merge "Bug-1370: Reads message body bytes as well as exception is thrown during parsing."
[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
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.BgpParameters;
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 Ipv4Address bgpId;
26
27     private final List<BgpParameters> params;
28
29     /**
30      * Creates a new DTO for Open message.
31      *
32      * @param as local AS number
33      * @param hold preferred hold timer value, in seconds
34      * @param bgpId local BGP Identifier
35      * @param param advertized parameters
36      */
37     public BGPSessionPreferences(final AsNumber as, final int hold, final Ipv4Address bgpId, final List<BgpParameters> params) {
38         this.as = as;
39         this.hold = hold;
40         this.bgpId = bgpId;
41         this.params = params;
42     }
43
44     /**
45      * Returns my AS number.
46      *
47      * @return AS number
48      */
49     public AsNumber getMyAs() {
50         return this.as;
51     }
52
53     /**
54      * Returns initial value of HoldTimer.
55      *
56      * @return initial value of HoldTimer
57      */
58     public int getHoldTime() {
59         return this.hold;
60     }
61
62     /**
63      * Returns my BGP Identifier.
64      *
65      * @return BGP identifier
66      */
67     public Ipv4Address getBgpId() {
68         return this.bgpId;
69     }
70
71     public List<BgpParameters> getParams() {
72         return this.params;
73     }
74 }