Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2017-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 | package org.onosproject.incubator.net.l2monitoring.cfm; |
| 17 | |
| 18 | import java.time.Duration; |
| 19 | |
| 20 | import org.onlab.packet.MacAddress; |
| 21 | import org.onosproject.incubator.net.l2monitoring.cfm.SenderIdTlv.SenderIdTlvType; |
| 22 | import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId; |
| 23 | |
| 24 | /** |
| 25 | * Defined in IEEE 802.1Q Section 12.14.7.6.3 Read MEP Database - Outputs. |
| 26 | * |
| 27 | */ |
| 28 | public interface RemoteMepEntry { |
| 29 | |
| 30 | MepId remoteMepId(); |
| 31 | |
| 32 | /** |
| 33 | * Get the operational state of a Remote MEP state machine for a remote MEP. |
| 34 | * @return An enumerated value |
| 35 | */ |
| 36 | RemoteMepState state(); |
| 37 | |
| 38 | /** |
| 39 | * Get the time since Remote MEP last entered either RMEP_FAILED or RMEP_OK state. |
| 40 | * @return Duration |
| 41 | */ |
| 42 | Duration failedOrOkTime(); |
| 43 | |
| 44 | /** |
| 45 | * Get the MAC address of the remote MEP or 0 if no CCM has been received. |
| 46 | * @return A MAC address |
| 47 | */ |
| 48 | MacAddress macAddress(); |
| 49 | |
| 50 | /** |
| 51 | * A Boolean value indicating the state of the RDI bit in the last received CCM. |
| 52 | * |
| 53 | * @return (TRUE for RDI = 1), or FALSE, if none has been received |
| 54 | */ |
| 55 | boolean rdi(); |
| 56 | |
| 57 | /** |
| 58 | * Get the Port Status TLV from the last CCM received from the remote MEP. |
| 59 | * @return An enumerated value |
| 60 | */ |
| 61 | PortStatusTlvType portStatusTlvType(); |
| 62 | |
| 63 | /** |
| 64 | * Get the Interface Status TLV from the last CCM received from the remote MEP. |
| 65 | * @return An enumerated value |
| 66 | */ |
| 67 | InterfaceStatusTlvType interfaceStatusTlvType(); |
| 68 | |
| 69 | /** |
| 70 | * Get the Sender ID TLV type from the last CCM received from the remote MEP or default. |
| 71 | * @return An enumerated value |
| 72 | */ |
| 73 | SenderIdTlvType senderIdTlvType(); |
| 74 | |
| 75 | /** |
| 76 | * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry}. |
| 77 | */ |
| 78 | public interface RemoteMepEntryBuilder { |
| 79 | RemoteMepEntryBuilder failedOrOkTime(Duration failedOrOkTime); |
| 80 | |
| 81 | RemoteMepEntryBuilder macAddress(MacAddress macAddress); |
| 82 | |
| 83 | RemoteMepEntryBuilder rdi(boolean rdi); |
| 84 | |
| 85 | RemoteMepEntryBuilder portStatusTlvType(PortStatusTlvType portStatusTlvType); |
| 86 | |
| 87 | RemoteMepEntryBuilder interfaceStatusTlvType(InterfaceStatusTlvType interfaceStatusTlvType); |
| 88 | |
| 89 | RemoteMepEntryBuilder senderIdTlvType(SenderIdTlvType senderIdTlvType); |
| 90 | |
| 91 | RemoteMepEntry build(); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Remote MEP States. |
| 96 | */ |
| 97 | public enum RemoteMepState { |
| 98 | RMEP_IDLE, |
| 99 | RMEP_START, |
| 100 | RMEP_FAILED, |
| 101 | RMEP_OK |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Port Status TLV types. |
| 106 | */ |
| 107 | public enum PortStatusTlvType { |
| 108 | PS_NO_STATUS_TLV, |
| 109 | PS_BLOCKED, |
| 110 | PS_UP; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Interface Status TLV types. |
| 115 | */ |
| 116 | public enum InterfaceStatusTlvType { |
| 117 | IS_NO_STATUS_TLV, |
| 118 | IS_UP, |
| 119 | IS_DOWN, |
| 120 | IS_TESTING, |
| 121 | IS_UNKNOWN, |
| 122 | IS_DORMANT, |
| 123 | IS_NOTPRESENT, |
| 124 | IS_LOWERLAYERDOWN; |
| 125 | } |
| 126 | } |