Jian Li | 44155b0 | 2017-02-15 17:03:38 +0900 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Jian Li | 44155b0 | 2017-02-15 17:03:38 +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 | */ |
| 16 | package org.onosproject.mapping; |
| 17 | |
| 18 | import org.onosproject.mapping.addresses.MappingAddress; |
| 19 | import org.onosproject.mapping.instructions.MappingInstruction; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.flow.instructions.ExtensionTreatment; |
| 22 | |
| 23 | import java.util.List; |
| 24 | |
| 25 | /** |
| 26 | * Abstraction of mapping treatment. |
| 27 | */ |
| 28 | public interface MappingTreatment { |
| 29 | |
| 30 | /** |
| 31 | * Obtains a mapping address. |
| 32 | * |
| 33 | * @return a mapping address |
| 34 | */ |
| 35 | MappingAddress address(); |
| 36 | |
| 37 | /** |
| 38 | * Obtains a collection of mapping instructions. |
| 39 | * |
| 40 | * @return a collection of mapping instructions |
| 41 | */ |
| 42 | List<MappingInstruction> instructions(); |
| 43 | |
| 44 | interface Builder { |
| 45 | |
| 46 | /** |
| 47 | * Specifies a mapping address. |
| 48 | * |
| 49 | * @param address mapping address |
| 50 | * @return a mapping treatment builder |
| 51 | */ |
| 52 | Builder withAddress(MappingAddress address); |
| 53 | |
| 54 | /** |
| 55 | * Specifies a collection of mapping instructions. |
| 56 | * |
| 57 | * @param instruction a mapping instruction |
| 58 | * @return a mapping treatment builder |
| 59 | */ |
| 60 | Builder add(MappingInstruction instruction); |
| 61 | |
| 62 | /** |
| 63 | * Adds an unicast weight instruction. |
| 64 | * |
| 65 | * @param weight unicast weight value |
| 66 | * @return a mapping treatment builder |
| 67 | */ |
| 68 | Builder setUnicastWeight(int weight); |
| 69 | |
| 70 | /** |
| 71 | * Adds an unicast priority instruction. |
| 72 | * |
| 73 | * @param priority unicast priority value |
| 74 | * @return a mapping treatment builder |
| 75 | */ |
| 76 | Builder setUnicastPriority(int priority); |
| 77 | |
| 78 | /** |
| 79 | * Adds a multicast weight instruction. |
| 80 | * |
| 81 | * @param weight multicast weight value |
| 82 | * @return a mapping treatment builder |
| 83 | */ |
| 84 | Builder setMulticastWeight(int weight); |
| 85 | |
| 86 | /** |
| 87 | * Adds a multicast priority instruction. |
| 88 | * |
| 89 | * @param priority multicast priority value |
| 90 | * @return a mapping treatment builder |
| 91 | */ |
| 92 | Builder setMulticastPriority(int priority); |
| 93 | |
| 94 | /** |
| 95 | * uses an extension treatment. |
| 96 | * |
| 97 | * @param extension extension treatment |
| 98 | * @param deviceId device identifier |
| 99 | * @return a treatment builder |
| 100 | */ |
| 101 | Builder extension(ExtensionTreatment extension, DeviceId deviceId); |
| 102 | |
| 103 | /** |
| 104 | * Builds an immutable mapping treatment. |
| 105 | * |
| 106 | * @return a mapping treatment |
| 107 | */ |
| 108 | MappingTreatment build(); |
| 109 | } |
| 110 | } |