blob: a0da969e4398515fcb54a571c86fb74f60fd50c3 [file] [log] [blame]
janani bf41dec32017-03-24 18:44:07 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
janani bf41dec32017-03-24 18:44:07 +05303 *
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 */
janani b35f6cbc2017-03-24 21:56:58 +053049 public Map<RouteProtocol, ProtocolInfo> protocolInfo() {
janani bf41dec32017-03-24 18:44:07 +053050 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 */
janani b35f6cbc2017-03-24 21:56:58 +053058 public void protocolInfo(Map<RouteProtocol, ProtocolInfo> protocolInfo) {
janani bf41dec32017-03-24 18:44:07 +053059 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 */
janani b35f6cbc2017-03-24 21:56:58 +053068 public void addProtocolInfo(RouteProtocol route, ProtocolInfo info) {
janani bf41dec32017-03-24 18:44:07 +053069 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 */
janani b35f6cbc2017-03-24 21:56:58 +053080 public String vpnName() {
janani bf41dec32017-03-24 18:44:07 +053081 return vpnName;
82 }
83
84 /**
85 * Sets the VPN name.
86 *
87 * @param vpnName VPN name
88 */
janani b35f6cbc2017-03-24 21:56:58 +053089 public void vpnName(String vpnName) {
janani bf41dec32017-03-24 18:44:07 +053090 this.vpnName = vpnName;
91 }
92
93 @Override
94 public String toString() {
95 return "VPN name : " + vpnName;
96 }
97}
98