blob: e461b24827fa00a758eff7afecb515a47d015885 [file] [log] [blame]
janani bf41dec32017-03-24 18:44:07 +05301/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.l3vpn.netl3vpn;
18
19import java.util.HashMap;
20import java.util.Map;
21
22/**
23 * Representation of BGP information which contains the protocol info and the
24 * VPN name.
25 */
26public class BgpInfo {
27
28 /**
29 * Map of route protocol and the protocol info for the BGP info.
30 */
31 private Map<RouteProtocol, ProtocolInfo> protocolInfo;
32
33 /**
34 * VPN name, to which the BGP info belongs.
35 */
36 private String vpnName;
37
38 /**
39 * Constructs BGP info.
40 */
41 public BgpInfo() {
42 }
43
44 /**
45 * Returns the map of protocol info associated with the BGP info.
46 *
47 * @return protocol info map.
48 */
49 Map<RouteProtocol, ProtocolInfo> protocolInfo() {
50 return protocolInfo;
51 }
52
53 /**
54 * Sets the map of protocol info with route protocol as key value.
55 *
56 * @param protocolInfo protocol info map
57 */
58 void protocolInfo(Map<RouteProtocol, ProtocolInfo> protocolInfo) {
59 this.protocolInfo = protocolInfo;
60 }
61
62 /**
63 * Adds a protocol info with route protocol as key to the map.
64 *
65 * @param route route protocol
66 * @param info protocol info
67 */
68 void addProtocolInfo(RouteProtocol route, ProtocolInfo info) {
69 if (protocolInfo == null) {
70 protocolInfo = new HashMap<>();
71 }
72 protocolInfo.put(route, info);
73 }
74
75 /**
76 * Returns the VPN name of the BGP info.
77 *
78 * @return VPN name
79 */
80 String vpnName() {
81 return vpnName;
82 }
83
84 /**
85 * Sets the VPN name.
86 *
87 * @param vpnName VPN name
88 */
89 void vpnName(String vpnName) {
90 this.vpnName = vpnName;
91 }
92
93 @Override
94 public String toString() {
95 return "VPN name : " + vpnName;
96 }
97}
98