Pingping Lin | ffa27d3 | 2015-04-30 14:41:03 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Pingping Lin | ffa27d3 | 2015-04-30 14:41:03 -0700 | [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 | */ |
| 16 | package org.onosproject.virtualbng; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
Pingping Lin | be12656 | 2015-05-06 17:57:10 -0700 | [diff] [blame] | 19 | import org.onlab.packet.MacAddress; |
Jonathan Hart | bbc352f | 2015-10-27 19:24:36 -0700 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
| 21 | |
| 22 | import java.util.Map; |
Pingping Lin | ffa27d3 | 2015-04-30 14:41:03 -0700 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Provides information about the virtual BNG configuration. |
| 26 | */ |
| 27 | public interface VbngConfigurationService { |
| 28 | |
| 29 | /** |
| 30 | * Gets the IP address configured for the next hop. |
| 31 | * |
| 32 | * @return the IP address of next hop |
| 33 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 34 | IpAddress getNextHopIpAddress(); |
Pingping Lin | ffa27d3 | 2015-04-30 14:41:03 -0700 | [diff] [blame] | 35 | |
| 36 | /** |
Pingping Lin | be12656 | 2015-05-06 17:57:10 -0700 | [diff] [blame] | 37 | * Gets the MAC address configured for all the public IP addresses. |
| 38 | * |
| 39 | * @return the MAC address |
| 40 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 41 | MacAddress getPublicFacingMac(); |
Pingping Lin | be12656 | 2015-05-06 17:57:10 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
Pingping Lin | e10ece0 | 2015-06-11 19:26:24 -0700 | [diff] [blame] | 44 | * Gets the IP address configured for XOS server. |
| 45 | * |
| 46 | * @return the IP address configured for the XOS server |
| 47 | */ |
| 48 | IpAddress getXosIpAddress(); |
| 49 | |
| 50 | /** |
| 51 | * Gets the REST communication port configured for XOS server. |
| 52 | * |
| 53 | * @return the REST communication port configured for XOS server |
| 54 | */ |
| 55 | int getXosRestPort(); |
| 56 | |
| 57 | /** |
Jonathan Hart | bbc352f | 2015-10-27 19:24:36 -0700 | [diff] [blame] | 58 | * Gets the host to port map. |
| 59 | * |
| 60 | * @return host to port map |
| 61 | */ |
| 62 | Map<String, ConnectPoint> getNodeToPort(); |
| 63 | |
| 64 | /** |
Pingping Lin | be12656 | 2015-05-06 17:57:10 -0700 | [diff] [blame] | 65 | * Evaluates whether an IP address is an assigned public IP address. |
| 66 | * |
| 67 | * @param ipAddress the IP address to evaluate |
| 68 | * @return true if the input IP address is an assigned public IP address, |
| 69 | * otherwise false |
| 70 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 71 | boolean isAssignedPublicIpAddress(IpAddress ipAddress); |
Pingping Lin | be12656 | 2015-05-06 17:57:10 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
Pingping Lin | ffa27d3 | 2015-04-30 14:41:03 -0700 | [diff] [blame] | 74 | * Gets an available public IP address from local public IP prefixes. |
| 75 | * |
| 76 | * @param privateIpAddress a private IP address |
| 77 | * @return an available public IP address if it exists, otherwise null |
| 78 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 79 | IpAddress getAvailablePublicIpAddress(IpAddress privateIpAddress); |
Pingping Lin | 4e0c73d | 2015-05-06 15:41:10 -0700 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * Gets the public IP address already assigned for a private IP address. |
| 83 | * |
| 84 | * @param privateIpAddress a private IP address |
| 85 | * @return the assigned public IP address if it exists, otherwise null |
| 86 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 87 | IpAddress getAssignedPublicIpAddress(IpAddress privateIpAddress); |
Pingping Lin | d2afaf2 | 2015-06-02 10:46:29 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * Recycles the public IP address assigned for a private IP address, and |
| 91 | * at the same time deletes the mapping entry from this private IP address |
| 92 | * to the public IP address. |
| 93 | * |
| 94 | * @param privateIpAddress a private IP address |
| 95 | * @return the assigned public IP address if it exists, otherwise null |
| 96 | */ |
| 97 | IpAddress recycleAssignedPublicIpAddress(IpAddress privateIpAddress); |
Pingping Lin | de77ee5 | 2015-06-03 17:16:07 -0700 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * Gets all the mapping entries from private IP address to public IP |
| 101 | * address. |
| 102 | * |
| 103 | * @return the address map from private IP address to public IP address |
| 104 | */ |
| 105 | Map<IpAddress, IpAddress> getIpAddressMappings(); |
Pingping Lin | 53ae34f | 2015-06-09 10:07:08 -0700 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * Tries to assign a given public IP address to a private IP address. If |
| 109 | * success, then sets up the mapping from this private IP address to the |
| 110 | * public IP address, and stores the mapping. |
| 111 | * |
| 112 | * @param publicIpAddress the public IP address try to assign |
| 113 | * @param privateIpAddress a private IP address |
| 114 | * @return true if this public IP address is available, otherwise false |
| 115 | */ |
| 116 | boolean assignSpecifiedPublicIp(IpAddress publicIpAddress, |
| 117 | IpAddress privateIpAddress); |
Pingping Lin | ffa27d3 | 2015-04-30 14:41:03 -0700 | [diff] [blame] | 118 | } |