Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 1 | /* |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Laboratory |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -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 | */ |
Hyunsun Moon | fd5a24e | 2016-10-19 19:15:48 -0700 | [diff] [blame] | 16 | package org.opencord.cordvtn.api.net; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 17 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 20 | import org.onlab.packet.VlanId; |
| 21 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 22 | import java.util.Comparator; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 23 | import java.util.Set; |
| 24 | |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 25 | /** |
Hyunsun Moon | 5c14395 | 2016-10-19 18:34:46 -0700 | [diff] [blame] | 26 | * Representation of a service port which holds service specific port information, |
| 27 | * like vlan tag or additional addresses, to the common network port. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 28 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 29 | public interface ServicePort { |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 30 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 31 | Comparator<ServicePort> SERVICE_PORT_COMPARATOR = |
| 32 | (port1, port2) -> port1.networkId().id().compareTo(port2.networkId().id()); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 35 | * Returns the port identifier. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 36 | * |
| 37 | * @return port id |
| 38 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 39 | PortId id(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 40 | |
| 41 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 42 | * Returns the port name. |
| 43 | * |
| 44 | * @return port name |
| 45 | */ |
| 46 | String name(); |
| 47 | |
| 48 | /** |
| 49 | * Returns associated network identifier of the service port. |
| 50 | * |
| 51 | * @return network id |
| 52 | */ |
| 53 | NetworkId networkId(); |
| 54 | |
| 55 | /** |
| 56 | * Returns the MAC address of the service port. |
| 57 | * |
| 58 | * @return mac address |
| 59 | */ |
| 60 | MacAddress mac(); |
| 61 | |
| 62 | /** |
| 63 | * Returns the fixed IP address of the service port. |
| 64 | * |
| 65 | * @return ip address |
| 66 | */ |
| 67 | IpAddress ip(); |
| 68 | |
| 69 | /** |
| 70 | * Returns VLAN of service the port. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 71 | * |
| 72 | * @return vlan id |
| 73 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 74 | VlanId vlanId(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 75 | |
| 76 | /** |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 77 | * Returns additional floating address pairs of the service port. |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 78 | * |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 79 | * @return set of mac and ip address pair |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 80 | */ |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 81 | Set<AddressPair> addressPairs(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 82 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 83 | /** |
| 84 | * Builder of new service port entities. |
| 85 | */ |
| 86 | interface Builder { |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 87 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 88 | /** |
| 89 | * Builds an immutable service port instance. |
| 90 | * |
| 91 | * @return service port |
| 92 | */ |
| 93 | ServicePort build(); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 94 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 95 | /** |
| 96 | * Returns service port builder with the supplied identifier. |
| 97 | * |
| 98 | * @param id port id |
| 99 | * @return service port builder |
| 100 | */ |
| 101 | Builder id(PortId id); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 102 | |
Hyunsun Moon | 187bf53 | 2017-01-19 10:57:40 +0900 | [diff] [blame] | 103 | /** |
| 104 | * Returns service port builder with the supplied name. |
| 105 | * |
| 106 | * @param name port name |
| 107 | * @return service port builder |
| 108 | */ |
| 109 | Builder name(String name); |
| 110 | |
| 111 | /** |
| 112 | * Returns service port builder with the supplied network identifier. |
| 113 | * |
| 114 | * @param networkId network id |
| 115 | * @return service port builder |
| 116 | */ |
| 117 | Builder networkId(NetworkId networkId); |
| 118 | |
| 119 | /** |
| 120 | * Returns service port builder with the supplied MAC address. |
| 121 | * |
| 122 | * @param mac mac address |
| 123 | * @return service port builder |
| 124 | */ |
| 125 | Builder mac(MacAddress mac); |
| 126 | |
| 127 | /** |
| 128 | * Returns service port builder with the supplied IP address. |
| 129 | * |
| 130 | * @param ip ip address |
| 131 | * @return service port builder |
| 132 | */ |
| 133 | Builder ip(IpAddress ip); |
| 134 | |
| 135 | /** |
| 136 | * Returns service port builder with the supplied VLAN. |
| 137 | * |
| 138 | * @param vlanId vlan id |
| 139 | * @return service port builder |
| 140 | */ |
| 141 | Builder vlanId(VlanId vlanId); |
| 142 | |
| 143 | /** |
| 144 | * Returns service port builder with the supplied address pairs. |
| 145 | * |
| 146 | * @param addressPairs set of address pair |
| 147 | * @return service port builder |
| 148 | */ |
| 149 | Builder addressPairs(Set<AddressPair> addressPairs); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 150 | } |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 151 | } |