blob: 37e9c06f857174ba58716b58c2ce062a5ed7a3a3 [file] [log] [blame]
sanghoshin46297d22015-11-03 17:51:24 +09001/*
Daniel Park3a06c522016-01-28 20:51:12 +09002 * Copyright 2015-2016 Open Networking Laboratory
sanghoshin46297d22015-11-03 17:51:24 +09003 *
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 */
sangho0c2a3da2016-02-16 13:39:07 +090016package org.onosproject.openstacknetworking;
sanghoshin46297d22015-11-03 17:51:24 +090017
18import org.onosproject.core.ApplicationId;
19import org.onosproject.net.config.Config;
20import org.onosproject.net.config.basics.BasicElementConfig;
21
22/**
23 * Handles configuration for OpenstackSwitching app.
24 */
sangho0c2a3da2016-02-16 13:39:07 +090025public class OpenstackNetworkingConfig extends Config<ApplicationId> {
sanghoshin46297d22015-11-03 17:51:24 +090026 public static final String DONOTPUSH = "do_not_push_flows";
sanghoshinf25d2e02015-11-11 23:07:17 +090027 public static final String NEUTRON_SERVER = "neutron_server";
28 public static final String KEYSTONE_SERVER = "keystone_server";
29 public static final String USER_NAME = "user_name";
30 public static final String PASSWORD = "password";
Daniel Park3a06c522016-01-28 20:51:12 +090031 public static final String PHYSICAL_ROUTER_MAC = "physicalRouterMac";
sanghoshin46297d22015-11-03 17:51:24 +090032
33 /**
34 * Returns the flag whether the app pushes flows or not.
35 *
36 * @return the flag or false if not set
37 */
38 public boolean doNotPushFlows() {
39 String flag = get(DONOTPUSH, "false");
40 return Boolean.valueOf(flag);
41 }
42
43 /**
sanghoshinf25d2e02015-11-11 23:07:17 +090044 * Returns the Neutron server IP address.
45 *
46 * @return Neutron server IP
47 */
48 public String neutronServer() {
49 return get(NEUTRON_SERVER, "");
50 }
51
52 /**
53 * Returns the Keystone server IP address.
54 *
55 * @return Keystone server IP
56 */
57 public String keystoneServer() {
58 return get(KEYSTONE_SERVER, "");
59 }
60
61 /**
62 * Returns the username for openstack.
63 *
64 * @return username for openstack
65 */
66 public String userName() {
67 return get(USER_NAME, "");
68 }
69
70 /**
71 * Returns the password for openstack.
72 *
73 * @return password for openstack
74 */
75 public String password() {
76 return get(PASSWORD, "");
77 }
78
79 /**
Daniel Park3a06c522016-01-28 20:51:12 +090080 * Returns the MacAddress for physical router.
81 *
82 * @return physical router mac
83 */
84 public String physicalRouterMac() {
85 return get(PHYSICAL_ROUTER_MAC, "");
86 }
87 /**
sanghoshin46297d22015-11-03 17:51:24 +090088 * Sets the flag whether the app pushes flows or not.
89 *
90 * @param flag the flag whether the app pushes flows or not
91 * @return self
92 */
93 public BasicElementConfig doNotPushFlows(boolean flag) {
94 return (BasicElementConfig) setOrClear(DONOTPUSH, flag);
95 }
sanghoshinf25d2e02015-11-11 23:07:17 +090096
97 /**
98 * Sets the neutron server IP address.
99 *
100 * @param url neutron server IP address
101 * @return itself
102 */
103 public BasicElementConfig neutronServer(String url) {
104 return (BasicElementConfig) setOrClear(NEUTRON_SERVER, url);
105 }
106
107 /**
108 * Sets the keystone server IP address.
109 *
110 * @param url keystone server IP address
111 * @return itself
112 */
113 public BasicElementConfig keystoneServer(String url) {
114 return (BasicElementConfig) setOrClear(KEYSTONE_SERVER, url);
115 }
116
117 /**
118 * Sets the username for openstack.
119 *
120 * @param username user name for openstack
121 * @return itself
122 */
123 public BasicElementConfig userName(String username) {
124 return (BasicElementConfig) setOrClear(USER_NAME, username);
125 }
126
127 /**
128 * Sets the password for openstack.
129 *
130 * @param password password for openstack
131 * @return itself
132 */
133 public BasicElementConfig password(String password) {
134 return (BasicElementConfig) setOrClear(PASSWORD, password);
135 }
sanghoshin46297d22015-11-03 17:51:24 +0900136}