Hyunsun Moon | a74171d | 2016-02-24 14:41:48 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | package org.onosproject.openstack4j; |
| 17 | |
| 18 | import org.openstack4j.api.OSClient; |
| 19 | import org.openstack4j.model.network.Network; |
| 20 | import org.openstack4j.model.network.Port; |
| 21 | import org.openstack4j.model.network.Subnet; |
| 22 | import org.openstack4j.model.network.options.PortListOptions; |
| 23 | |
| 24 | import java.util.List; |
| 25 | |
| 26 | /** |
| 27 | * Wrapper service of openstack4j. |
| 28 | */ |
| 29 | public interface OpenStack4jService { |
| 30 | |
| 31 | /** |
| 32 | * Returns OpenStack REST client. |
| 33 | * |
| 34 | * @param endpoint endpoint URL |
| 35 | * @param tenant tenant name |
| 36 | * @param user user name |
| 37 | * @param password password |
| 38 | * @return openstack rest client or null if auth failed |
| 39 | */ |
| 40 | OSClient getClient(String endpoint, String tenant, String user, String password); |
| 41 | |
| 42 | /** |
| 43 | * Returns list of networks with a client information. |
| 44 | * |
| 45 | * @param client openstack rest client |
| 46 | * @return list of networks or empty list if no networks |
| 47 | */ |
| 48 | List<Network> getNetworks(OSClient client); |
| 49 | |
| 50 | /** |
| 51 | * Returns network information. |
| 52 | * |
| 53 | * @param client openstack rest client |
| 54 | * @param networkId network id |
| 55 | * @return network or null if not found |
| 56 | */ |
| 57 | Network getNetwork(OSClient client, String networkId); |
| 58 | |
| 59 | /** |
| 60 | * Returns all ports. |
| 61 | * |
| 62 | * @param client openstack rest client |
| 63 | * @return list of port or empty list if no ports |
| 64 | */ |
| 65 | List<Port> getPorts(OSClient client); |
| 66 | |
| 67 | /** |
| 68 | * Returns ports with a given options. |
| 69 | * |
| 70 | * @param client openstack rest client |
| 71 | * @param options port list options |
| 72 | * @return port list or empty list if no ports |
| 73 | */ |
| 74 | List<Port> getPorts(OSClient client, PortListOptions options); |
| 75 | |
| 76 | /** |
| 77 | * Returns port with a given port ID. |
| 78 | * |
| 79 | * @param client openstack rest client |
| 80 | * @param portId port id |
| 81 | * @return port or null if not found |
| 82 | */ |
| 83 | Port getPort(OSClient client, String portId); |
| 84 | |
| 85 | /** |
| 86 | * Returns all subnets. |
| 87 | * |
| 88 | * @param client openstack rest client |
| 89 | * @return subnet list or empty list if no subnets |
| 90 | */ |
| 91 | List<Subnet> getSubnets(OSClient client); |
| 92 | |
| 93 | /** |
| 94 | * Returns subnet with a given subnet ID. |
| 95 | * |
| 96 | * @param client openstack rest client |
| 97 | * @param subnetId subnet id |
| 98 | * @return subnet or null if not found |
| 99 | */ |
| 100 | Subnet getSubnet(OSClient client, String subnetId); |
| 101 | } |