sanghoshin | 46297d2 | 2015-11-03 17:51:24 +0900 | [diff] [blame] | 1 | /* |
Daniel Park | 3a06c52 | 2016-01-28 20:51:12 +0900 | [diff] [blame] | 2 | * Copyright 2015-2016 Open Networking Laboratory |
sanghoshin | 46297d2 | 2015-11-03 17:51:24 +0900 | [diff] [blame] | 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 | */ |
sangho | 93447f1 | 2016-02-24 00:33:22 +0900 | [diff] [blame] | 16 | package org.onosproject.openstackinterface; |
sanghoshin | 46297d2 | 2015-11-03 17:51:24 +0900 | [diff] [blame] | 17 | |
| 18 | import org.onosproject.core.ApplicationId; |
| 19 | import org.onosproject.net.config.Config; |
| 20 | import org.onosproject.net.config.basics.BasicElementConfig; |
| 21 | |
| 22 | /** |
| 23 | * Handles configuration for OpenstackSwitching app. |
| 24 | */ |
sangho | 0c2a3da | 2016-02-16 13:39:07 +0900 | [diff] [blame] | 25 | public class OpenstackNetworkingConfig extends Config<ApplicationId> { |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 26 | public static final String NEUTRON_SERVER = "neutron_server"; |
| 27 | public static final String KEYSTONE_SERVER = "keystone_server"; |
| 28 | public static final String USER_NAME = "user_name"; |
| 29 | public static final String PASSWORD = "password"; |
Daniel Park | 3a06c52 | 2016-01-28 20:51:12 +0900 | [diff] [blame] | 30 | public static final String PHYSICAL_ROUTER_MAC = "physicalRouterMac"; |
sanghoshin | 46297d2 | 2015-11-03 17:51:24 +0900 | [diff] [blame] | 31 | |
| 32 | /** |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 33 | * Returns the Neutron server IP address. |
| 34 | * |
| 35 | * @return Neutron server IP |
| 36 | */ |
| 37 | public String neutronServer() { |
| 38 | return get(NEUTRON_SERVER, ""); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Returns the Keystone server IP address. |
| 43 | * |
| 44 | * @return Keystone server IP |
| 45 | */ |
| 46 | public String keystoneServer() { |
| 47 | return get(KEYSTONE_SERVER, ""); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Returns the username for openstack. |
| 52 | * |
| 53 | * @return username for openstack |
| 54 | */ |
| 55 | public String userName() { |
| 56 | return get(USER_NAME, ""); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Returns the password for openstack. |
| 61 | * |
| 62 | * @return password for openstack |
| 63 | */ |
| 64 | public String password() { |
| 65 | return get(PASSWORD, ""); |
| 66 | } |
| 67 | |
| 68 | /** |
Daniel Park | 3a06c52 | 2016-01-28 20:51:12 +0900 | [diff] [blame] | 69 | * Returns the MacAddress for physical router. |
| 70 | * |
| 71 | * @return physical router mac |
| 72 | */ |
| 73 | public String physicalRouterMac() { |
| 74 | return get(PHYSICAL_ROUTER_MAC, ""); |
| 75 | } |
sanghoshin | f25d2e0 | 2015-11-11 23:07:17 +0900 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Sets the neutron server IP address. |
| 79 | * |
| 80 | * @param url neutron server IP address |
| 81 | * @return itself |
| 82 | */ |
| 83 | public BasicElementConfig neutronServer(String url) { |
| 84 | return (BasicElementConfig) setOrClear(NEUTRON_SERVER, url); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Sets the keystone server IP address. |
| 89 | * |
| 90 | * @param url keystone server IP address |
| 91 | * @return itself |
| 92 | */ |
| 93 | public BasicElementConfig keystoneServer(String url) { |
| 94 | return (BasicElementConfig) setOrClear(KEYSTONE_SERVER, url); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Sets the username for openstack. |
| 99 | * |
| 100 | * @param username user name for openstack |
| 101 | * @return itself |
| 102 | */ |
| 103 | public BasicElementConfig userName(String username) { |
| 104 | return (BasicElementConfig) setOrClear(USER_NAME, username); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Sets the password for openstack. |
| 109 | * |
| 110 | * @param password password for openstack |
| 111 | * @return itself |
| 112 | */ |
| 113 | public BasicElementConfig password(String password) { |
| 114 | return (BasicElementConfig) setOrClear(PASSWORD, password); |
| 115 | } |
sanghoshin | 46297d2 | 2015-11-03 17:51:24 +0900 | [diff] [blame] | 116 | } |