Jonathan Hart | 194e764 | 2016-12-15 15:33:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present 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 | |
| 17 | package org.onosproject.patchpanel.impl; |
| 18 | |
| 19 | import org.onosproject.net.ConnectPoint; |
| 20 | |
| 21 | /** |
| 22 | * Abstraction of a patch between two ports on a switch. |
| 23 | */ |
| 24 | public class Patch { |
| 25 | |
| 26 | private final PatchId patchId; |
| 27 | private final ConnectPoint port1; |
| 28 | private final ConnectPoint port2; |
| 29 | |
| 30 | /** |
| 31 | * Creates a new patch. |
| 32 | * |
| 33 | * @param patchId patch ID |
| 34 | * @param port1 first switch port |
| 35 | * @param port2 second switch port |
| 36 | */ |
| 37 | public Patch(PatchId patchId, ConnectPoint port1, ConnectPoint port2) { |
| 38 | this.patchId = patchId; |
| 39 | this.port1 = port1; |
| 40 | this.port2 = port2; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Gets the patch ID. |
| 45 | * |
| 46 | * @return patch ID |
| 47 | */ |
| 48 | public PatchId id() { |
| 49 | return patchId; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Gets the first connect point. |
| 54 | * |
| 55 | * @return connect point |
| 56 | */ |
| 57 | public ConnectPoint port1() { |
| 58 | return port1; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Gets the second connect point. |
| 63 | * |
| 64 | * @return connect point |
| 65 | */ |
| 66 | public ConnectPoint port2() { |
| 67 | return port2; |
| 68 | } |
| 69 | } |