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.soam.loss; |
| 17 | |
| 18 | import java.time.Instant; |
| 19 | import java.util.Collection; |
| 20 | |
| 21 | import org.onosproject.incubator.net.l2monitoring.soam.MilliPct; |
| 22 | import org.onosproject.incubator.net.l2monitoring.soam.SoamId; |
| 23 | |
| 24 | /** |
| 25 | * A model of Loss Measurement from ITU Y.1731 Chapter 8.2, MEF 17, MEF 36.1 and MEF 39. |
| 26 | * |
| 27 | * In this model Loss Measurements entries are returned as a collection in the |
| 28 | * MepEntry. In this way Loss Measurements are created by calling on the |
| 29 | * Create Loss Measurement function, passing in any arguments needed to |
| 30 | * configure it. The Loss Measurement is a result and not configured or |
| 31 | * persisted in ONOS, but instead is is passed on to some analytics system. |
| 32 | */ |
| 33 | public interface LossMeasurementEntry extends LossMeasurementCreate { |
| 34 | /** |
| 35 | * Ian id that uniquely identifies a scheduled measurement. |
| 36 | * It is automatically generated by the server on creation of a new measurement |
| 37 | * @return An LM id |
| 38 | */ |
| 39 | SoamId lmId(); |
| 40 | |
| 41 | /** |
| 42 | * Contains the Frame Loss Ratio in the forward direction calculated by this MEP. |
| 43 | * from the last received SOAM PDU. |
| 44 | * The FLR value is a ratio that is expressed as a percent with a value of |
| 45 | * 0 (ratio 0.00) through 100000 (ratio 1.00). |
| 46 | * @return Units are in milli-percent, where 1 indicates 0.001 per-cent |
| 47 | */ |
| 48 | MilliPct measuredForwardFlr(); |
| 49 | |
| 50 | /** |
| 51 | * Contains the Frame Loss Ratio in the backward direction calculated by this MEP. |
| 52 | * from the last received SOAM PDU. |
| 53 | * The FLR value is a ratio that is expressed as a percent with a value of |
| 54 | * 0 (ratio 0.00) through 100000 (ratio 1.00). |
| 55 | * @return Units are in milli-percent, where 1 indicates 0.001 per-cent |
| 56 | */ |
| 57 | MilliPct measuredBackwardFlr(); |
| 58 | |
| 59 | /** |
| 60 | * The availability status (the outcome of the last availability indicator) in the forward direction. |
| 61 | * based upon the last received SOAM PDU |
| 62 | * @return enumerated availability value |
| 63 | */ |
| 64 | AvailabilityType measuredAvailabilityForwardStatus(); |
| 65 | |
| 66 | /** |
| 67 | * The availability status (the outcome of the last availability indicator) in the backward direction. |
| 68 | * based upon the last received SOAM PDU |
| 69 | * @return enumerated availability value |
| 70 | */ |
| 71 | AvailabilityType measuredAvailabilityBackwardStatus(); |
| 72 | |
| 73 | /** |
| 74 | * The time of the last transition between available and unavailable in the forward direction. |
| 75 | * If there have been no transitions since the Loss Measurement Session was |
| 76 | * started, this is set to 0 |
| 77 | * @return The transition time |
| 78 | */ |
| 79 | Instant measuredForwardLastTransitionTime(); |
| 80 | |
| 81 | /** |
| 82 | * The time of the last transition between available and unavailable in the backward direction. |
| 83 | * If there have been no transitions since the Loss Measurement Session was |
| 84 | * started, this is set to 0 |
| 85 | * @return The transition time |
| 86 | */ |
| 87 | Instant measuredBackwardLastTransitionTime(); |
| 88 | |
| 89 | /** |
| 90 | * The results for the current Measurement Interval in a SOAM Loss Measurement session. |
| 91 | * gathered during the interval indicated by measurement-interval |
| 92 | * @return An object with current measurements |
| 93 | */ |
| 94 | LossMeasurementStatCurrent measurementCurrent(); |
| 95 | |
| 96 | /** |
| 97 | * The results for history Measurement Intervals in a SOAM Loss Measurement session. |
| 98 | * @return An object with historic measurements |
| 99 | */ |
| 100 | Collection<LossMeasurementStatHistory> measurementHistories(); |
| 101 | |
| 102 | /** |
| 103 | * The current results for a SOAM Loss Measurement session for availability statistics. |
| 104 | * gathered during the interval indicated by availability-measurement-interval |
| 105 | * @return An object with current availability |
| 106 | */ |
| 107 | LossAvailabilityStatCurrent availabilityCurrent(); |
| 108 | |
| 109 | /** |
| 110 | * The results for availability history Measurement Intervals in a SOAM Loss Measurement session. |
| 111 | * @return An object with historic availability |
| 112 | */ |
| 113 | Collection<LossAvailabilityStatHistory> availabilityHistories(); |
| 114 | |
| 115 | /** |
| 116 | * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementEntry}. |
| 117 | */ |
| 118 | public interface LmEntryBuilder extends LmCreateBuilder { |
| 119 | LmEntryBuilder measuredForwardFlr(MilliPct measuredForwardFlr); |
| 120 | |
| 121 | LmEntryBuilder measuredBackwardFlr(MilliPct measuredBackwardFlr); |
| 122 | |
| 123 | LmEntryBuilder measuredAvailabilityForwardStatus( |
| 124 | AvailabilityType measuredAvailabilityForwardStatus); |
| 125 | |
| 126 | LmEntryBuilder measuredAvailabilityBackwardStatus( |
| 127 | AvailabilityType measuredAvailabilityBackwardStatus); |
| 128 | |
| 129 | LmEntryBuilder measuredForwardLastTransitionTime( |
| 130 | Instant measuredForwardLastTransitionTime); |
| 131 | |
| 132 | LmEntryBuilder measuredBackwardLastTransitionTime( |
| 133 | Instant measuredBackwardLastTransitionTime); |
| 134 | |
| 135 | LmEntryBuilder measurementCurrent( |
| 136 | LossMeasurementStatCurrent measurementCurrent); |
| 137 | |
| 138 | LmEntryBuilder addToMeasurementHistories( |
| 139 | LossMeasurementStatHistory history); |
| 140 | |
| 141 | LmEntryBuilder availabilityCurrent( |
| 142 | LossAvailabilityStatCurrent availabilityCurrent); |
| 143 | |
| 144 | LmEntryBuilder addToAvailabilityHistories(LossAvailabilityStatHistory history); |
| 145 | |
| 146 | LossMeasurementEntry build(); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Options for Availability test types. |
| 151 | */ |
| 152 | public enum AvailabilityType { |
| 153 | AVAILABLE, |
| 154 | UNAVAILABLE, |
| 155 | UNKNOWN; |
| 156 | } |
| 157 | } |