Jian Li | e2d8751 | 2018-08-23 17:33:05 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 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 | |
| 17 | package org.onosproject.simplefabric.api; |
| 18 | |
| 19 | import org.onlab.packet.VlanId; |
| 20 | import org.onosproject.net.ConnectPoint; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.EncapsulationType; |
| 23 | import org.onosproject.net.Host; |
| 24 | import org.onosproject.net.HostId; |
| 25 | import org.onosproject.net.intf.Interface; |
| 26 | |
| 27 | import java.util.Set; |
| 28 | |
| 29 | /** |
| 30 | * Interface of fabric network. |
| 31 | */ |
| 32 | public interface FabricNetwork { |
| 33 | |
| 34 | /** |
| 35 | * Gets DefaultFabricNetwork name. |
| 36 | * |
| 37 | * @return the name of DefaultFabricNetwork |
| 38 | */ |
| 39 | String name(); |
| 40 | |
| 41 | /** |
| 42 | * Gets DefaultFabricNetwork interfaceNames. |
| 43 | * |
| 44 | * @return the interfaceNames of DefaultFabricNetwork |
| 45 | */ |
| 46 | Set<String> interfaceNames(); |
| 47 | |
| 48 | /** |
| 49 | * Gets DefaultFabricNetwork encapsulation type. |
| 50 | * |
| 51 | * @return the encapsulation type of DefaultFabricNetwork |
| 52 | */ |
| 53 | EncapsulationType encapsulation(); |
| 54 | |
| 55 | /** |
| 56 | * Gets DefaultFabricNetwork forward flag. |
| 57 | * |
| 58 | * @return the forward flag of DefaultFabricNetwork |
| 59 | */ |
| 60 | boolean isForward(); |
| 61 | |
| 62 | /** |
| 63 | * Gets DefaultFabricNetwork broadcast flag. |
| 64 | * |
| 65 | * @return the broadcast flag of DefaultFabricNetwork |
| 66 | */ |
| 67 | boolean isBroadcast(); |
| 68 | |
| 69 | /** |
| 70 | * Gets DefaultFabricNetwork interfaces. |
| 71 | * |
| 72 | * @return the interfaces of DefaultFabricNetwork |
| 73 | */ |
| 74 | Set<Interface> interfaces(); |
| 75 | |
| 76 | /** |
| 77 | * Gets DefaultFabricNetwork hosts. |
| 78 | * |
| 79 | * @return the hosts of DefaultFabricNetwork |
| 80 | */ |
| 81 | Set<HostId> hostIds(); |
| 82 | |
| 83 | /** |
| 84 | * Gets DefaultFabricNetwork isDirty flag. |
| 85 | * |
| 86 | * @return the isDirty flag of DefaultFabricNetwork |
| 87 | */ |
| 88 | boolean isDirty(); |
| 89 | |
| 90 | /** |
| 91 | * Checks if the interface is of DefaultFabricNetwork. |
| 92 | * |
| 93 | * @param iface the interface to be checked |
| 94 | * @return true if DefaultFabricNetwork contains the interface |
| 95 | */ |
| 96 | boolean contains(Interface iface); |
| 97 | |
| 98 | /** |
| 99 | * Checks if the ConnectPoint and Vlan is of DefaultFabricNetwork. |
| 100 | * |
| 101 | * @param port the ConnectPoint to be checked |
| 102 | * @param vlanId the VlanId of the ConnectPoint to be checked |
| 103 | * @return true if DefaultFabricNetwork contains the interface of the ConnnectPoint and VlanId |
| 104 | */ |
| 105 | boolean contains(ConnectPoint port, VlanId vlanId); |
| 106 | |
| 107 | /** |
| 108 | * Checks if the DeviceId is of DefaultFabricNetwork. |
| 109 | * |
| 110 | * @param deviceId the DeviceId to be checked |
| 111 | * @return true if DefaultFabricNetwork contains any interface of the DeviceId |
| 112 | */ |
| 113 | boolean contains(DeviceId deviceId); |
| 114 | |
| 115 | /** |
| 116 | * Adds interface to DefaultFabricNetwork. |
| 117 | * |
| 118 | * @param iface the Interface to be added |
| 119 | */ |
| 120 | void addInterface(Interface iface); |
| 121 | |
| 122 | /** |
| 123 | * Adds host to DefaultFabricNetwork. |
| 124 | * |
| 125 | * @param host the Host to be added |
| 126 | */ |
| 127 | void addHost(Host host); |
| 128 | |
| 129 | /** |
| 130 | * Sets DefaultFabricNetwork isDirty flag. |
| 131 | * |
| 132 | * @param newDirty the isDirty flag to be set |
| 133 | */ |
| 134 | void setDirty(boolean newDirty); |
| 135 | |
| 136 | /** |
| 137 | * Builder of FabricNetwork. |
| 138 | */ |
| 139 | interface Builder { |
| 140 | |
| 141 | /** |
| 142 | * Returns FabricNetwork builder with supplied network name. |
| 143 | * |
| 144 | * @param name network name |
| 145 | * @return FabricNetwork instance builder |
| 146 | */ |
| 147 | Builder name(String name); |
| 148 | |
| 149 | /** |
| 150 | * Returns FabricNetwork builder with supplied interface names. |
| 151 | * |
| 152 | * @param interfaceNames interface names |
| 153 | * @return FabricNetwork instance builder |
| 154 | */ |
| 155 | Builder interfaceNames(Set<String> interfaceNames); |
| 156 | |
| 157 | /** |
| 158 | * Returns FabricNetwork builder with supplied encapsulation type. |
| 159 | * |
| 160 | * @param encapsulation encapsulation type |
| 161 | * @return FabricNetwork instance builder |
| 162 | */ |
| 163 | Builder encapsulation(EncapsulationType encapsulation); |
| 164 | |
| 165 | /** |
| 166 | * Returns FabricNetwork builder with supplied forward flag. |
| 167 | * |
| 168 | * @param forward forward flag |
| 169 | * @return FabricNetwork instance builder |
| 170 | */ |
| 171 | Builder forward(boolean forward); |
| 172 | |
| 173 | /** |
| 174 | * Returns FabricNetwork builder with supplied broadcast flag. |
| 175 | * |
| 176 | * @param broadcast broadcast flag |
| 177 | * @return FabricNetwork instance builder |
| 178 | */ |
| 179 | Builder broadcast(boolean broadcast); |
| 180 | |
| 181 | /** |
| 182 | * Builds an immutable FabricNetwork instance. |
| 183 | * |
| 184 | * @return FabricNetwork instance |
| 185 | */ |
| 186 | FabricNetwork build(); |
| 187 | } |
| 188 | } |