blob: 2bda4543b9a1cc63feddca705e0055624b3e4db0 [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 */
16package org.onosproject.l3vpn.netl3vpn;
17
18/**
19 * Represents the route protocol of BGP info.
20 */
21public enum RouteProtocol {
22
23 /**
24 * Requested route protocol type is of BGP.
25 */
26 BGP("bgp"),
27
28 /**
29 * Requested route protocol type is of direct.
30 */
31 DIRECT("direct"),
32
33 /**
34 * Requested route protocol type is of OSPF.
35 */
36 OSPF("ospf"),
37
38 /**
39 * Requested route protocol type is of RIP.
40 */
41 RIP("rip"),
42
43 /**
44 * Requested route protocol type is of RIPNG.
45 */
46 RIP_NG("ripng"),
47
48 /**
49 * Requested route protocol type is of VRRP.
50 */
51 VRRP("vrrp"),
52
53 /**
54 * Requested route protocol type is of static.
55 */
56 STATIC("yangautoprefixstatic");
57
58 /**
59 * Defined protocol type from the enum value.
60 */
61 private final String proType;
62
63 /**
64 * Constructs protocol type value from enum.
65 *
66 * @param proType value of enum
67 */
68 RouteProtocol(String proType) {
69 this.proType = proType;
70 }
71
72 /**
73 * Returns route protocol for corresponding protocol name.
74 *
75 * @param name protocol name
76 * @return route protocol
77 */
janani b35f6cbc2017-03-24 21:56:58 +053078 public static RouteProtocol getProType(String name) {
janani bf41dec32017-03-24 18:44:07 +053079 for (RouteProtocol protocol : values()) {
80 if (protocol.proType.equals(name.toLowerCase())) {
81 return protocol;
82 }
83 }
84 throw new NetL3VpnException("There is no protocol type as " + name);
85 }
86
87}