Committed by
Gerrit Code Review
Generic Tunnel Subsystem (ONOS-1276) and L1/L0 (OTN/ROADM)extensions (ONOS-676):
1)Initial Work for ONOS-676: OTN/ROADM (L1/L0 NE) support in ONOS by extending the device/port modeling; - extending device type to include L1 OTN NEs; - extending port type to include ODUCLT port(T-port), OCH-port(L-port), OMS-port (WDM-port); - more standard annotations related to OTN/ROADMs support will come from PCEP provider as well as TL1 providers; 2)Intial Work for ONOS-1276: generic Tunnel subsystem in ONOS for both packet (L3/L2) networks and optical (L1/L0) networks - supporting PCEP framework, which is capable of interacting with the PCEP provider; - supporting any other kind of tunnel provider; - each Tunnel is associated with at least two Labels (abstracted logical entity/Id for virtualization of physical port); - same type of Tunnels can be formed as a reachablity graph for other services and NB applications use; Change-Id: I29af495f90e179e2c5d8753b76e02889a3b4355b
Showing
23 changed files
with
1778 additions
and
23 deletions
| ... | @@ -26,7 +26,7 @@ public interface Device extends Element { | ... | @@ -26,7 +26,7 @@ public interface Device extends Element { |
| 26 | * Coarse classification of the type of the infrastructure device. | 26 | * Coarse classification of the type of the infrastructure device. |
| 27 | */ | 27 | */ |
| 28 | public enum Type { | 28 | public enum Type { |
| 29 | - SWITCH, ROUTER, ROADM, FIREWALL, BALANCER, IPS, IDS, CONTROLLER, OTHER | 29 | + SWITCH, ROUTER, ROADM, OTN, FIREWALL, BALANCER, IPS, IDS, CONTROLLER, OTHER |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| ... | @@ -34,6 +34,7 @@ public interface Device extends Element { | ... | @@ -34,6 +34,7 @@ public interface Device extends Element { |
| 34 | * | 34 | * |
| 35 | * @return device id | 35 | * @return device id |
| 36 | */ | 36 | */ |
| 37 | + @Override | ||
| 37 | DeviceId id(); | 38 | DeviceId id(); |
| 38 | 39 | ||
| 39 | /** | 40 | /** | ... | ... |
| ... | @@ -44,12 +44,12 @@ public interface Link extends Annotated, Provided, NetworkResource { | ... | @@ -44,12 +44,12 @@ public interface Link extends Annotated, Provided, NetworkResource { |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| 46 | * Signifies that this link represents a logical link backed by | 46 | * Signifies that this link represents a logical link backed by |
| 47 | - * some form of a tunnel. | 47 | + * some form of a tunnel, e.g., GRE, MPLS, ODUk, OCH. |
| 48 | */ | 48 | */ |
| 49 | TUNNEL, | 49 | TUNNEL, |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | - * Signifies that this link is realized by optical connection. | 52 | + * Signifies that this link is realized by fiber (either single channel or WDM). |
| 53 | */ | 53 | */ |
| 54 | OPTICAL | 54 | OPTICAL |
| 55 | } | 55 | } | ... | ... |
| ... | @@ -31,7 +31,30 @@ public interface Port extends Annotated { | ... | @@ -31,7 +31,30 @@ public interface Port extends Annotated { |
| 31 | /** | 31 | /** |
| 32 | * Signifies optical fiber-based connectivity. | 32 | * Signifies optical fiber-based connectivity. |
| 33 | */ | 33 | */ |
| 34 | - FIBER | 34 | + FIBER, |
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * Signifies optical fiber-based packet port. | ||
| 38 | + */ | ||
| 39 | + PACKET, | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * Signifies optical fiber-based optical tributary port (called T-port). | ||
| 43 | + * The signal from the client side will be formed into a ITU G.709 (OTN) frame. | ||
| 44 | + */ | ||
| 45 | + ODUCLT, | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Signifies optical fiber-based Line-side port (called L-port). | ||
| 49 | + */ | ||
| 50 | + OCH, | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Signifies optical fiber-based WDM port (called W-port). | ||
| 54 | + * Optical Multiplexing Section (See ITU G.709). | ||
| 55 | + */ | ||
| 56 | + OMS | ||
| 57 | + | ||
| 35 | } | 58 | } |
| 36 | 59 | ||
| 37 | /** | 60 | /** | ... | ... |
| 1 | +package org.onosproject.net.tunnel; | ||
| 2 | + | ||
| 3 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 4 | + | ||
| 5 | +import java.util.Objects; | ||
| 6 | +import java.util.Optional; | ||
| 7 | + | ||
| 8 | +import org.onosproject.net.AbstractModel; | ||
| 9 | +import org.onosproject.net.Annotations; | ||
| 10 | +import org.onosproject.net.ElementId; | ||
| 11 | +import org.onosproject.net.PortNumber; | ||
| 12 | +import org.onosproject.net.provider.ProviderId; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * Default label model implementation. | ||
| 16 | + */ | ||
| 17 | +public class DefaultLabel extends AbstractModel implements Label { | ||
| 18 | + private final Optional<ElementId> elementId; | ||
| 19 | + private final Optional<PortNumber> portNumber; | ||
| 20 | + private final Optional<Label> parentLabel; | ||
| 21 | + private final Type type; | ||
| 22 | + private final LabelId id; | ||
| 23 | + private final boolean isGlobal; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Creates a label attributed to the specified provider (may be null). | ||
| 27 | + * if provider is null, which means the label is not managed by the SB. | ||
| 28 | + * | ||
| 29 | + * @param elementId parent network element | ||
| 30 | + * @param number port number | ||
| 31 | + * @param parentLabel parent port or parent label | ||
| 32 | + * @param type port type | ||
| 33 | + * @param id LabelId | ||
| 34 | + * @param isGlobal indicator whether the label is global significant or not | ||
| 35 | + * @param annotations optional key/value annotations | ||
| 36 | + */ | ||
| 37 | + public DefaultLabel(ProviderId providerId, Optional<ElementId> elementId, | ||
| 38 | + Optional<PortNumber> number, Optional<Label> parentLabel, | ||
| 39 | + Type type, LabelId id, boolean isGlobal, Annotations... annotations) { | ||
| 40 | + super(providerId, annotations); | ||
| 41 | + this.elementId = elementId; | ||
| 42 | + this.portNumber = number; | ||
| 43 | + this.parentLabel = parentLabel; | ||
| 44 | + this.id = id; | ||
| 45 | + this.type = type; | ||
| 46 | + this.isGlobal = isGlobal; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Override | ||
| 50 | + public LabelId id() { | ||
| 51 | + return id; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public Optional<ElementId> elementId() { | ||
| 56 | + return elementId; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public Optional<PortNumber> portNumber() { | ||
| 61 | + return portNumber; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public Optional<Label> parentLabel() { | ||
| 66 | + return parentLabel; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public boolean isGlobal() { | ||
| 71 | + return isGlobal; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public Type type() { | ||
| 76 | + return type; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @Override | ||
| 80 | + public int hashCode() { | ||
| 81 | + return Objects.hash(elementId, portNumber, parentLabel, id); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @Override | ||
| 85 | + public boolean equals(Object obj) { | ||
| 86 | + if (this == obj) { | ||
| 87 | + return true; | ||
| 88 | + } | ||
| 89 | + if (obj instanceof DefaultLabel) { | ||
| 90 | + final DefaultLabel other = (DefaultLabel) obj; | ||
| 91 | + return Objects.equals(this.id, other.id) && | ||
| 92 | + Objects.equals(this.type, other.type) && | ||
| 93 | + Objects.equals(this.isGlobal, other.isGlobal) && | ||
| 94 | + Objects.equals(this.elementId, other.elementId) && | ||
| 95 | + Objects.equals(this.portNumber, other.portNumber) && | ||
| 96 | + Objects.equals(this.parentLabel, other.parentLabel); | ||
| 97 | + } | ||
| 98 | + return false; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + @Override | ||
| 102 | + public String toString() { | ||
| 103 | + return toStringHelper(this) | ||
| 104 | + .add("elementId", elementId) | ||
| 105 | + .add("portNumber", portNumber) | ||
| 106 | + .add("parentLabel", parentLabel) | ||
| 107 | + .add("type", type) | ||
| 108 | + .add("id", id) | ||
| 109 | + .add("isGlobal", isGlobal) | ||
| 110 | + .toString(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | +} |
| 1 | +package org.onosproject.net.tunnel; | ||
| 2 | + | ||
| 3 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 4 | +import static com.google.common.base.Preconditions.checkState; | ||
| 5 | + | ||
| 6 | +import java.util.Objects; | ||
| 7 | + | ||
| 8 | +import org.onosproject.core.IdGenerator; | ||
| 9 | +import org.onosproject.net.AbstractModel; | ||
| 10 | +import org.onosproject.net.Annotations; | ||
| 11 | +import org.onosproject.net.provider.ProviderId; | ||
| 12 | +import org.onosproject.net.resource.Bandwidth; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * Default tunnel model implementation. | ||
| 16 | + */ | ||
| 17 | +public final class DefaultTunnel extends AbstractModel implements Tunnel { | ||
| 18 | + private final TunnelId id; | ||
| 19 | + private final Label src; | ||
| 20 | + private final Label dst; | ||
| 21 | + private final Type type; | ||
| 22 | + private final State state; | ||
| 23 | + private final boolean isDurable; | ||
| 24 | + private final boolean isBidirectional; | ||
| 25 | + private final Bandwidth bandwidth; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * Constructs an tunnel using the builder pattern. | ||
| 29 | + * | ||
| 30 | + * @param providerId provider identity, can be null if comes from the NB | ||
| 31 | + * @param builder tunnelBuilder | ||
| 32 | + * @param annotations optional key/value annotations | ||
| 33 | + * @return | ||
| 34 | + */ | ||
| 35 | + private DefaultTunnel(ProviderId providerId, TunnelBuilder builder, Annotations... annotations) { | ||
| 36 | + super(providerId, annotations); | ||
| 37 | + this.id = builder.id; | ||
| 38 | + this.src = builder.src; | ||
| 39 | + this.dst = builder.dst; | ||
| 40 | + this.type = builder.type; | ||
| 41 | + this.state = builder.state; | ||
| 42 | + this.isDurable = builder.isDurable; | ||
| 43 | + this.isBidirectional = builder.isBidirectional; | ||
| 44 | + this.bandwidth = builder.bandwidth; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + public TunnelId id() { | ||
| 49 | + return id; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public Label src() { | ||
| 54 | + return src; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public Label dst() { | ||
| 59 | + return dst; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public Type type() { | ||
| 64 | + return type; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public State state() { | ||
| 69 | + return state; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public boolean isDurable() { | ||
| 74 | + return isDurable; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public boolean isBidirectional() { | ||
| 79 | + return isBidirectional; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public Bandwidth bandwidth() { | ||
| 84 | + return bandwidth; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Override | ||
| 88 | + public int hashCode() { | ||
| 89 | + return Objects.hash(id); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * {@inheritDoc} | ||
| 94 | + * Note that only TunnelId is considered on equality check. | ||
| 95 | + */ | ||
| 96 | + @Override | ||
| 97 | + public boolean equals(Object obj) { | ||
| 98 | + if (this == obj) { | ||
| 99 | + return true; | ||
| 100 | + } | ||
| 101 | + if (obj instanceof DefaultTunnel) { | ||
| 102 | + final DefaultTunnel other = (DefaultTunnel) obj; | ||
| 103 | + return Objects.equals(this.id, other.id); | ||
| 104 | + } | ||
| 105 | + return false; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @Override | ||
| 109 | + public String toString() { | ||
| 110 | + return toStringHelper(this) | ||
| 111 | + .add("tunnelId", id) | ||
| 112 | + .add("src", src) | ||
| 113 | + .add("dst", dst) | ||
| 114 | + .add("type", type) | ||
| 115 | + .add("state", state) | ||
| 116 | + .add("durable", isDurable) | ||
| 117 | + .add("isBidirectional", isBidirectional) | ||
| 118 | + .add("bandwidth", bandwidth) | ||
| 119 | + .toString(); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + public static class TunnelBuilder { | ||
| 123 | + private TunnelId id = null; | ||
| 124 | + private Label src = null; | ||
| 125 | + private Label dst = null; | ||
| 126 | + private Type type = null; | ||
| 127 | + private State state = null; | ||
| 128 | + private boolean isDurable = false; | ||
| 129 | + private boolean isBidirectional = false; | ||
| 130 | + private Bandwidth bandwidth = null; | ||
| 131 | + | ||
| 132 | + private static IdGenerator idGenerator; | ||
| 133 | + | ||
| 134 | + public TunnelBuilder labelSrcDst(Label src, Label dst) { | ||
| 135 | + this.src = src; | ||
| 136 | + this.dst = dst; | ||
| 137 | + return this; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public TunnelBuilder state(State state) { | ||
| 141 | + this.state = state; | ||
| 142 | + return this; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public TunnelBuilder isDurable(boolean isDurable) { | ||
| 146 | + this.isDurable = isDurable; | ||
| 147 | + return this; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + public TunnelBuilder isBidirectional(boolean isBidirectional) { | ||
| 151 | + this.isBidirectional = isBidirectional; | ||
| 152 | + return this; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public TunnelBuilder bandwidth(Bandwidth bandwidth) { | ||
| 156 | + this.bandwidth = bandwidth; | ||
| 157 | + return this; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public DefaultTunnel build(ProviderId providerId, Annotations... annotations) { | ||
| 161 | + checkState(idGenerator != null, "Id generator is not bound."); | ||
| 162 | + this.id = TunnelId.valueOf(idGenerator.getNewId()); | ||
| 163 | + return new DefaultTunnel(providerId, this, annotations); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import com.google.common.base.MoreObjects; | ||
| 19 | + | ||
| 20 | +import org.onosproject.net.AbstractDescription; | ||
| 21 | +import org.onosproject.net.ConnectPoint; | ||
| 22 | +import org.onosproject.net.SparseAnnotations; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Default implementation of immutable tunnel description entity. | ||
| 26 | + */ | ||
| 27 | +public class DefaultTunnelDescription extends AbstractDescription | ||
| 28 | + implements TunnelDescription { | ||
| 29 | + | ||
| 30 | + private final TunnelId tunnelId; | ||
| 31 | + private final ConnectPoint src; | ||
| 32 | + private final ConnectPoint dst; | ||
| 33 | + private final Tunnel.Type type; | ||
| 34 | + private final boolean isBidirectional; | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * Creates a tunnel description using the supplied information. | ||
| 38 | + * | ||
| 39 | + * @param id TunnelId | ||
| 40 | + * @param src ConnectPoint source | ||
| 41 | + * @param dst ConnectPoint destination | ||
| 42 | + * @param type tunnel type | ||
| 43 | + * @param isBidirectional boolean | ||
| 44 | + * @param annotations optional key/value annotations | ||
| 45 | + */ | ||
| 46 | + public DefaultTunnelDescription(TunnelId id, ConnectPoint src, ConnectPoint dst, | ||
| 47 | + Tunnel.Type type, boolean isBidirectional, | ||
| 48 | + SparseAnnotations... annotations) { | ||
| 49 | + super(annotations); | ||
| 50 | + this.tunnelId = id; | ||
| 51 | + this.src = src; | ||
| 52 | + this.dst = dst; | ||
| 53 | + this.type = type; | ||
| 54 | + this.isBidirectional = isBidirectional; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public TunnelId id() { | ||
| 59 | + return tunnelId; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public ConnectPoint src() { | ||
| 64 | + return src; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public ConnectPoint dst() { | ||
| 69 | + return dst; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public Tunnel.Type type() { | ||
| 74 | + return type; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public boolean isBidirectional() { | ||
| 79 | + return isBidirectional; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public String toString() { | ||
| 84 | + return MoreObjects.toStringHelper(this) | ||
| 85 | + .add("tunnelId", id()) | ||
| 86 | + .add("src", src()) | ||
| 87 | + .add("dst", dst()) | ||
| 88 | + .add("type", type()) | ||
| 89 | + .add("isBidirectional", isBidirectional()) | ||
| 90 | + .toString(); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import java.util.Optional; | ||
| 19 | + | ||
| 20 | +import org.onosproject.net.Annotated; | ||
| 21 | +import org.onosproject.net.ElementId; | ||
| 22 | +import org.onosproject.net.NetworkResource; | ||
| 23 | +import org.onosproject.net.PortNumber; | ||
| 24 | +import org.onosproject.net.Provided; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * Generic representation of a logical port entity in a consistent way, | ||
| 28 | + * it is used to identify e.g., VLAN#, MPLS label#, ODUk timeSlot, WDM lambda, etc. | ||
| 29 | + * It supports nested case. | ||
| 30 | + */ | ||
| 31 | +public interface Label extends Annotated, Provided, NetworkResource { | ||
| 32 | + | ||
| 33 | + /** Represents coarse Label type classification. */ | ||
| 34 | + public enum Type { | ||
| 35 | + /** | ||
| 36 | + * Signifies VLAN-based tag. | ||
| 37 | + */ | ||
| 38 | + VLAN, | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * Signifies LAG-based label. | ||
| 42 | + */ | ||
| 43 | + LAG, | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * Signifies MPLS-based label. | ||
| 47 | + */ | ||
| 48 | + MPLS, | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * Signifies IP-based label. | ||
| 52 | + */ | ||
| 53 | + IP, | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * Signifies optical data unit-based label. | ||
| 57 | + */ | ||
| 58 | + TIMESLOT, | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * Signifies optical wavelength-based label. | ||
| 62 | + */ | ||
| 63 | + LAMBDA, | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * Signifies device-based identifier for the label. | ||
| 67 | + */ | ||
| 68 | + DEVICE | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * Returns the identifier to this Label. | ||
| 73 | + * | ||
| 74 | + * @return identifier | ||
| 75 | + */ | ||
| 76 | + LabelId id(); | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * Returns the parent network element to which this label belongs. | ||
| 80 | + * | ||
| 81 | + * @return parent network element | ||
| 82 | + */ | ||
| 83 | + Optional<ElementId> elementId(); | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * Returns the parent network port to which this label belongs, can not be be null. | ||
| 87 | + * | ||
| 88 | + * @return port number | ||
| 89 | + */ | ||
| 90 | + Optional<PortNumber> portNumber(); | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * Returns the parent label to which this label belongs, optional. | ||
| 94 | + * | ||
| 95 | + * @return parent label, if it is null, the parent is a physical port | ||
| 96 | + */ | ||
| 97 | + Optional<Label> parentLabel(); | ||
| 98 | + | ||
| 99 | + /** | ||
| 100 | + * Indicates whether or not the port is global significant. | ||
| 101 | + * | ||
| 102 | + * @return true if the port is global significant | ||
| 103 | + */ | ||
| 104 | + boolean isGlobal(); | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * Returns the label type. | ||
| 108 | + * | ||
| 109 | + * @return label type | ||
| 110 | + */ | ||
| 111 | + Type type(); | ||
| 112 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | +import com.google.common.primitives.UnsignedLongs; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * Representation of a label Id, a logical port identifier. | ||
| 23 | + */ | ||
| 24 | +public final class LabelId { | ||
| 25 | + /** | ||
| 26 | + * Represents a logical Id. | ||
| 27 | + */ | ||
| 28 | + private final long labelId; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor, public creation is prohibited. | ||
| 32 | + */ | ||
| 33 | + private LabelId(long id) { | ||
| 34 | + this.labelId = id; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Returns the LabelId representing the specified long value. | ||
| 39 | + * | ||
| 40 | + * @param id identifier as long value | ||
| 41 | + * @return LabelId | ||
| 42 | + */ | ||
| 43 | + public static LabelId labelId(long id) { | ||
| 44 | + return new LabelId(id); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public static LabelId labelId(String string) { | ||
| 48 | + return new LabelId(UnsignedLongs.decode(string)); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public long toLong() { | ||
| 52 | + return labelId; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public String toString() { | ||
| 57 | + return UnsignedLongs.toString(labelId); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public int hashCode() { | ||
| 62 | + return Objects.hash(labelId); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public boolean equals(Object obj) { | ||
| 67 | + if (this == obj) { | ||
| 68 | + return true; | ||
| 69 | + } | ||
| 70 | + if (obj instanceof LabelId) { | ||
| 71 | + final LabelId other = (LabelId) obj; | ||
| 72 | + return this.labelId == other.labelId; | ||
| 73 | + } | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.Annotated; | ||
| 19 | +import org.onosproject.net.NetworkResource; | ||
| 20 | +import org.onosproject.net.Provided; | ||
| 21 | +import org.onosproject.net.resource.Bandwidth; | ||
| 22 | + | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Abstraction of a generalized Tunnel entity (bandwidth pipe) for either L3/L2 networks or L1/L0 networks, | ||
| 26 | + * representation of e.g., VLAN, GRE tunnel, MPLS LSP, L1 ODUk connection, WDM OCH, etc.. Each Tunnel is | ||
| 27 | + * associated with at least two Label objects that model the logical ports essentially. | ||
| 28 | + * Note that it supports nested case. | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | +public interface Tunnel extends Annotated, Provided, NetworkResource { | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Coarse representation of the Tunnel types. | ||
| 35 | + */ | ||
| 36 | + public enum Type { | ||
| 37 | + /** | ||
| 38 | + * Signifies that this is a L2 tunnel. | ||
| 39 | + */ | ||
| 40 | + VLAN, | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * Signifies that this is a DC L2 extension tunnel. | ||
| 44 | + */ | ||
| 45 | + VXLAN, | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Signifies that this is a L3 tunnel. | ||
| 49 | + */ | ||
| 50 | + GRE, | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Signifies that this is a MPLS tunnel. | ||
| 54 | + */ | ||
| 55 | + LSP, | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Signifies that this is a L1 OTN tunnel. | ||
| 59 | + */ | ||
| 60 | + ODUk, | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * Signifies that this is a L0 OCH tunnel. | ||
| 64 | + */ | ||
| 65 | + OCH | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * Representation of the tunnel state. | ||
| 70 | + * | ||
| 71 | + */ | ||
| 72 | + public enum State { | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * Signifies that a tunnel is currently in a initialized state. | ||
| 76 | + */ | ||
| 77 | + INIT, | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * Signifies that a tunnel is currently established but no traffic. | ||
| 81 | + */ | ||
| 82 | + ESTABLISHED, | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * Signifies that a tunnel is currently serving the traffic. | ||
| 86 | + */ | ||
| 87 | + ACTIVE, | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * Signifies that a tunnel is currently out of service. | ||
| 91 | + */ | ||
| 92 | + FAILED, | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Signifies that a tunnel is currently in maintenance state. | ||
| 96 | + */ | ||
| 97 | + INACTIVE | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + TunnelId id(); | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * Returns the tunnel source point (source Label object). | ||
| 106 | + * | ||
| 107 | + * @return source Label object | ||
| 108 | + */ | ||
| 109 | + Label src(); | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * Returns the tunnel destination point (destination Label object). | ||
| 113 | + * | ||
| 114 | + * @return destination Label object | ||
| 115 | + */ | ||
| 116 | + Label dst(); | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * Returns the tunnel type. | ||
| 120 | + * | ||
| 121 | + * @return tunnel type | ||
| 122 | + */ | ||
| 123 | + Type type(); | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * Returns the tunnel state. | ||
| 127 | + * | ||
| 128 | + * @return tunnel state | ||
| 129 | + */ | ||
| 130 | + State state(); | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * Indicates if the tunnel is to be considered durable. | ||
| 134 | + * | ||
| 135 | + * @return true if the tunnel is durable | ||
| 136 | + */ | ||
| 137 | + boolean isDurable(); | ||
| 138 | + | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * Indicates if the tunnel is to be considered Bidirectional. | ||
| 142 | + * | ||
| 143 | + * @return true if the tunnel is Bidirectional | ||
| 144 | + */ | ||
| 145 | + boolean isBidirectional(); | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * Return the tunnel bandwidth. | ||
| 149 | + * | ||
| 150 | + * @return tunnel bandwidth | ||
| 151 | + */ | ||
| 152 | + Bandwidth bandwidth(); | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | + | ||
| 156 | + | ||
| 157 | + | ||
| 158 | + |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.ConnectPoint; | ||
| 19 | +import org.onosproject.net.DeviceId; | ||
| 20 | +import org.onosproject.net.Path; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Service for administering the inventory of provisioned tunnels. | ||
| 24 | + */ | ||
| 25 | +public interface TunnelAdminService { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * Removes the provisioned tunnel. | ||
| 29 | + * | ||
| 30 | + * @param tunnelId tunnel ID | ||
| 31 | + */ | ||
| 32 | + void removeTunnel(TunnelId tunnelId); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * Removes the provisioned tunnel leading to and from the | ||
| 36 | + * specified labels. | ||
| 37 | + * | ||
| 38 | + * @param src source label | ||
| 39 | + * @param dst destination label | ||
| 40 | + */ | ||
| 41 | + void removeTunnels(Label src, Label dst); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Removes all provisioned tunnels leading to and from the | ||
| 45 | + * specified connection point. | ||
| 46 | + * | ||
| 47 | + * @param src source connection point | ||
| 48 | + * @param dst destination connection point | ||
| 49 | + */ | ||
| 50 | + void removeTunnels(ConnectPoint src, ConnectPoint dst); | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Removes all provisioned tunnels leading to and from the | ||
| 54 | + * specified connection point. | ||
| 55 | + * | ||
| 56 | + * @param src source connection point | ||
| 57 | + * @param dst destination connection point | ||
| 58 | + * @param type tunnel type | ||
| 59 | + */ | ||
| 60 | + void removeTunnels(ConnectPoint src, ConnectPoint dst, Tunnel.Type type); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * Removes all provisioned tunnels leading to and from the | ||
| 64 | + * specified connection point. | ||
| 65 | + * | ||
| 66 | + * @param connectPoint connection point | ||
| 67 | + */ | ||
| 68 | + void removeTunnels(ConnectPoint connectPoint); | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * Removes all provisioned tunnels leading to and from the | ||
| 72 | + * specified device. | ||
| 73 | + * | ||
| 74 | + * @param deviceId device identifier | ||
| 75 | + */ | ||
| 76 | + void removeTunnels(DeviceId deviceId); | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * Invokes the core to update a tunnel based on specified tunnel parameters. | ||
| 80 | + * | ||
| 81 | + * @param tunnel Tunnel | ||
| 82 | + * @param path explicit route (path changed) or null (path not changed) for the tunnel | ||
| 83 | + */ | ||
| 84 | + void updateTunnel(Tunnel tunnel, Path path); | ||
| 85 | + | ||
| 86 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.ConnectPoint; | ||
| 19 | +import org.onosproject.net.Description; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * Describes the tunnel. | ||
| 23 | + */ | ||
| 24 | +public interface TunnelDescription extends Description { | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Returns the tunnel id. | ||
| 28 | + * | ||
| 29 | + * @return tunnelId | ||
| 30 | + */ | ||
| 31 | + TunnelId id(); | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Returns the connection point source. | ||
| 35 | + * | ||
| 36 | + * @return tunnel source ConnectionPoint | ||
| 37 | + */ | ||
| 38 | + ConnectPoint src(); | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * Returns the connection point destination. | ||
| 42 | + * | ||
| 43 | + * @return tunnel destination | ||
| 44 | + */ | ||
| 45 | + ConnectPoint dst(); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Returns the tunnel type. | ||
| 49 | + * | ||
| 50 | + * @return tunnel type | ||
| 51 | + */ | ||
| 52 | + Tunnel.Type type(); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * Returns if the tunnel is bidirectional. | ||
| 56 | + * | ||
| 57 | + * @return true if bidirectional, otherwise false | ||
| 58 | + */ | ||
| 59 | + boolean isBidirectional(); | ||
| 60 | + | ||
| 61 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.event.AbstractEvent; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Describes tunnel events. | ||
| 22 | + */ | ||
| 23 | +public class TunnelEvent extends AbstractEvent<TunnelEvent.Type, Tunnel> { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Type of tunnel events. | ||
| 27 | + */ | ||
| 28 | + public enum Type { | ||
| 29 | + /** | ||
| 30 | + * Signifies that a new tunnel has been added. | ||
| 31 | + */ | ||
| 32 | + TUNNEL_ADDED, | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * Signifies that a tunnel has been updated or changed state. | ||
| 36 | + */ | ||
| 37 | + TUNNEL_UPDATED, | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Signifies that a tunnel has been removed. | ||
| 41 | + */ | ||
| 42 | + TUNNEL_REMOVED | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * Creates an event of a given type and for the specified tunnel. | ||
| 47 | + * | ||
| 48 | + * @param type tunnel event type | ||
| 49 | + * @param tunnel event tunnel subject | ||
| 50 | + */ | ||
| 51 | + public TunnelEvent(Type type, Tunnel tunnel) { | ||
| 52 | + super(type, tunnel); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * Creates an event of a given type and for the specified link and | ||
| 57 | + * the current time. | ||
| 58 | + * | ||
| 59 | + * @param type tunnel event type | ||
| 60 | + * @param tunnel event tunnel subject | ||
| 61 | + * @param time occurrence time | ||
| 62 | + */ | ||
| 63 | + public TunnelEvent(Type type, Tunnel tunnel, long time) { | ||
| 64 | + super(type, tunnel, time); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import static com.google.common.base.Preconditions.checkArgument; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Representation of a Tunnel Id. | ||
| 22 | + */ | ||
| 23 | +public final class TunnelId { | ||
| 24 | + private final long value; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Creates an tunnel identifier from the specified tunnel. | ||
| 28 | + * | ||
| 29 | + * @param value long value | ||
| 30 | + * @return tunnel identifier | ||
| 31 | + */ | ||
| 32 | + public static TunnelId valueOf(long value) { | ||
| 33 | + return new TunnelId(value); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public static TunnelId valueOf(String value) { | ||
| 37 | + checkArgument(value.startsWith("0x")); | ||
| 38 | + return new TunnelId(Long.parseLong(value.substring("0x".length()), 16)); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * Constructor for serializer. | ||
| 43 | + */ | ||
| 44 | + TunnelId() { | ||
| 45 | + this.value = 0; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Constructs the ID corresponding to a given long value. | ||
| 50 | + * | ||
| 51 | + * @param value the underlying value of this ID | ||
| 52 | + */ | ||
| 53 | + TunnelId(long value) { | ||
| 54 | + this.value = value; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Returns the backing value. | ||
| 59 | + * | ||
| 60 | + * @return the value | ||
| 61 | + */ | ||
| 62 | + public long id() { | ||
| 63 | + return value; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public int hashCode() { | ||
| 68 | + return (int) (value ^ (value >>> 32)); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Override | ||
| 72 | + public boolean equals(Object obj) { | ||
| 73 | + if (obj == this) { | ||
| 74 | + return true; | ||
| 75 | + } | ||
| 76 | + if (!(obj instanceof TunnelId)) { | ||
| 77 | + return false; | ||
| 78 | + } | ||
| 79 | + TunnelId that = (TunnelId) obj; | ||
| 80 | + return this.value == that.value; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public String toString() { | ||
| 85 | + return "0x" + Long.toHexString(value); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | +} |
| 1 | /* | 1 | /* |
| 2 | - * Copyright 2014 Open Networking Laboratory | 2 | + * Copyright 2015 Open Networking Laboratory |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| ... | @@ -13,25 +13,12 @@ | ... | @@ -13,25 +13,12 @@ |
| 13 | * See the License for the specific language governing permissions and | 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | -package org.onosproject.net; | 16 | +package org.onosproject.net.tunnel; |
| 17 | + | ||
| 18 | +import org.onosproject.event.EventListener; | ||
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| 19 | - * Abstraction of a generalized network tunnel. | 21 | + * Entity capable of receiving tunnel related events. |
| 20 | */ | 22 | */ |
| 21 | -public interface Tunnel extends Link { | 23 | +public interface TunnelListener extends EventListener<TunnelEvent> { |
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * Tunnel technology type. | ||
| 25 | - */ | ||
| 26 | - enum Type { | ||
| 27 | - MPLS, VLAN, VXLAN, GRE, OPTICAL | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - /** | ||
| 31 | - * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag. | ||
| 32 | - * | ||
| 33 | - * @return backing resource | ||
| 34 | - */ | ||
| 35 | - NetworkResource resource(); | ||
| 36 | - | ||
| 37 | } | 24 | } | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.ElementId; | ||
| 19 | +import org.onosproject.net.Path; | ||
| 20 | +import org.onosproject.net.provider.Provider; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Abstraction of an entity providing tunnel setup/release services to the core. | ||
| 24 | + */ | ||
| 25 | +public interface TunnelProvider extends Provider { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * Instructs the provider to setup a tunnel. | ||
| 29 | + * | ||
| 30 | + * @param tunnel Tunnel | ||
| 31 | + * @param path explicit route or null for the tunnel | ||
| 32 | + */ | ||
| 33 | + void setupTunnel(Tunnel tunnel, Path path); | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * Instructs the provider to setup a tunnel given the respective device. | ||
| 37 | + * | ||
| 38 | + * @param srcElement device | ||
| 39 | + * @param tunnel Tunnel | ||
| 40 | + * @param path explicit route (not null) for the tunnel | ||
| 41 | + */ | ||
| 42 | + void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Instructs the provider to release a tunnel. | ||
| 46 | + * | ||
| 47 | + * @param tunnel Tunnel | ||
| 48 | + */ | ||
| 49 | + void releaseTunnel(Tunnel tunnel); | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * Instructs the provider to release a tunnel given the respective device. | ||
| 53 | + * | ||
| 54 | + * @param srcElement device | ||
| 55 | + * @param tunnel Tunnel | ||
| 56 | + */ | ||
| 57 | + void releaseTunnel(ElementId srcElement, Tunnel tunnel); | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * Instructs the provider to update a tunnel. | ||
| 61 | + * | ||
| 62 | + * @param tunnel Tunnel | ||
| 63 | + * @param path explicit route (path changed) or null (path not changed) for the tunnel | ||
| 64 | + */ | ||
| 65 | + void updateTunnel(Tunnel tunnel, Path path); | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * Instructs the provider to update a tunnel given the respective device. | ||
| 69 | + * | ||
| 70 | + * @param srcElement device | ||
| 71 | + * @param tunnel Tunnel | ||
| 72 | + * @param path explicit route (path changed) or null (path not changed) for the tunnel | ||
| 73 | + */ | ||
| 74 | + void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path); | ||
| 75 | + | ||
| 76 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.provider.ProviderRegistry; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Abstraction of an tunnel provider registry. | ||
| 22 | + */ | ||
| 23 | +public interface TunnelProviderRegistry | ||
| 24 | + extends ProviderRegistry<TunnelProvider, TunnelProviderService> { | ||
| 25 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.provider.ProviderService; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * APIs for tunnel provider to notify the tunnel subSystem. | ||
| 22 | + */ | ||
| 23 | +public interface TunnelProviderService extends ProviderService<TunnelProvider> { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Signals that the provider has added a tunnel. | ||
| 27 | + * | ||
| 28 | + * @param tunnel tunnel information | ||
| 29 | + */ | ||
| 30 | + void tunnelAdded(TunnelDescription tunnel); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * Signals that the provider has removed a tunnel. | ||
| 34 | + * | ||
| 35 | + * @param tunnel tunnel information | ||
| 36 | + */ | ||
| 37 | + void tunnelRemoved(TunnelDescription tunnel); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Signals that the a tunnel was changed (e.g., sensing changes of tunnel). | ||
| 41 | + * | ||
| 42 | + * @param tunnel tunnel information | ||
| 43 | + */ | ||
| 44 | + void tunnelUpdated(TunnelDescription tunnel); | ||
| 45 | + | ||
| 46 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import java.util.Collection; | ||
| 19 | + | ||
| 20 | +import org.onosproject.net.ConnectPoint; | ||
| 21 | +import org.onosproject.net.Path; | ||
| 22 | +import org.onosproject.net.resource.Bandwidth; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Service for interacting with the tunnel inventory. | ||
| 26 | + */ | ||
| 27 | +public interface TunnelService { | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Invokes the core to create a tunnel based on specified parameters. | ||
| 31 | + * | ||
| 32 | + * @param src sourcePoint | ||
| 33 | + * @param dst destinationPoint | ||
| 34 | + * @param bw bandwidth | ||
| 35 | + * @param path explicit path or null | ||
| 36 | + */ | ||
| 37 | + void requestTunnel(ConnectPoint src, ConnectPoint dst, Bandwidth bw, Path path); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Invokes the core to create a tunnel based on specified parameters with a tunnel type. | ||
| 41 | + * | ||
| 42 | + * @param src sourcePoint | ||
| 43 | + * @param dst destinationPoint | ||
| 44 | + * @param type tunnelType | ||
| 45 | + * @param bw bandwidth | ||
| 46 | + * @param path explicit path or null | ||
| 47 | + */ | ||
| 48 | + void requestTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type, Bandwidth bw, Path path); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * Returns the count of all known tunnels in the dataStore. | ||
| 52 | + * | ||
| 53 | + * @return number of tunnels | ||
| 54 | + */ | ||
| 55 | + int getTunnelCount(); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Returns a collection of all known tunnel based on the type. | ||
| 59 | + * | ||
| 60 | + * @return all tunnels for a specific type | ||
| 61 | + */ | ||
| 62 | + Collection<Tunnel> getTunnels(Tunnel.Type type); | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * Returns set of all tunnels from the | ||
| 66 | + * specified connectpoint. | ||
| 67 | + * | ||
| 68 | + * @return set of tunnels | ||
| 69 | + */ | ||
| 70 | + Collection<Tunnel> getTunnels(ConnectPoint connectPoint, Tunnel.Type type); | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * Returns set of all tunnels from the | ||
| 74 | + * specified source connectpoint and destination connectpoint. | ||
| 75 | + * | ||
| 76 | + * @param src sourcePoint | ||
| 77 | + * @param dst destinationPoint | ||
| 78 | + * @param type tunnel type | ||
| 79 | + * @return set of tunnels | ||
| 80 | + */ | ||
| 81 | + Collection<Tunnel> getTunnels(ConnectPoint src, ConnectPoint dst, Tunnel.Type type); | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * Returns the tunnel between the specified source | ||
| 85 | + * and destination connection points. | ||
| 86 | + * | ||
| 87 | + * @param src source label | ||
| 88 | + * @param dst destination label | ||
| 89 | + * @return tunnel from source to destination; null if none found | ||
| 90 | + */ | ||
| 91 | + Tunnel getTunnel(Label src, Label dst); | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * Returns the tunnel based on the Id. | ||
| 95 | + * | ||
| 96 | + * @param id tunnelId | ||
| 97 | + * @return tunnel with specified Id | ||
| 98 | + */ | ||
| 99 | + Tunnel getTunnel(TunnelId id); | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * Adds the specified tunnel listener. | ||
| 103 | + * | ||
| 104 | + * @param listener tunnel listener | ||
| 105 | + */ | ||
| 106 | + void addListener(TunnelListener listener); | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * Removes the specified tunnel listener. | ||
| 110 | + * | ||
| 111 | + * @param listener tunnel listener | ||
| 112 | + */ | ||
| 113 | + void removeListener(TunnelListener listener); | ||
| 114 | + | ||
| 115 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.ConnectPoint; | ||
| 19 | +import org.onosproject.net.DeviceId; | ||
| 20 | +import org.onosproject.net.provider.ProviderId; | ||
| 21 | +import org.onosproject.store.Store; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * Manages inventory of tunnels. | ||
| 25 | + */ | ||
| 26 | +public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> { | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * Returns the number of tunnels in the store. | ||
| 30 | + * | ||
| 31 | + * @return number of tunnels | ||
| 32 | + */ | ||
| 33 | + int getTunnelCount(); | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * Returns an iterable collection of all tunnel in the inventory. | ||
| 37 | + * | ||
| 38 | + * @return collection of all tunnels | ||
| 39 | + */ | ||
| 40 | + Iterable<Tunnel> getTunnels(); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * Returns all tunnels egressing from the specified device. | ||
| 44 | + * | ||
| 45 | + * @param deviceId device identifier | ||
| 46 | + * @return set of device tunnels | ||
| 47 | + */ | ||
| 48 | + Iterable<Tunnel> getDeviceEgressTunnels(DeviceId deviceId); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * Returns all tunnels ingressing from the specified device. | ||
| 52 | + * | ||
| 53 | + * @param deviceId device identifier | ||
| 54 | + * @return set of device tunnels | ||
| 55 | + */ | ||
| 56 | + Iterable<Tunnel> getDeviceIngressTunnels(DeviceId deviceId); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * Returns the tunnel between the two end-points and the tunnel type. | ||
| 60 | + * | ||
| 61 | + * @param src source connection point | ||
| 62 | + * @param dst destination connection point | ||
| 63 | + * @param type tunnel type | ||
| 64 | + * @return tunnels or null if one not found between the end-points | ||
| 65 | + */ | ||
| 66 | + Iterable<Tunnel> getTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type); | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * Returns all tunnels egressing from the specified connection point. | ||
| 70 | + * | ||
| 71 | + * @param src source connection point | ||
| 72 | + * @return set of connection point tunnels | ||
| 73 | + */ | ||
| 74 | + Iterable<Tunnel> getEgressTunnels(ConnectPoint src); | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * Returns all tunnels ingressing to the specified connection point. | ||
| 78 | + * | ||
| 79 | + * @param dst destination connection point | ||
| 80 | + * @return set of connection point tunnels | ||
| 81 | + */ | ||
| 82 | + Iterable<Tunnel> getIngressTunnels(ConnectPoint dst); | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * Creates a new tunnel based on the given information. | ||
| 86 | + * | ||
| 87 | + * @param providerId provider identity (e.g., PCEP provider) | ||
| 88 | + * @param tunnel tunnel information | ||
| 89 | + * @return create tunnel event | ||
| 90 | + */ | ||
| 91 | + public TunnelEvent addTunnel(ProviderId providerId, | ||
| 92 | + Tunnel tunnel); | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Updates a new tunnel based on the given information. | ||
| 96 | + * | ||
| 97 | + * @param providerId provider identity (e.g., PCEP provider) | ||
| 98 | + * @param tunnel tunnel | ||
| 99 | + * @return update tunnel event | ||
| 100 | + */ | ||
| 101 | + public TunnelEvent updateTunnel(ProviderId providerId, | ||
| 102 | + Tunnel tunnel); | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * Removes a new tunnel based on the given information. | ||
| 106 | + * | ||
| 107 | + * @param providerId provider identity (e.g., PCEP provider) | ||
| 108 | + * @param tunnel tunnel | ||
| 109 | + * @return remove tunnel event | ||
| 110 | + */ | ||
| 111 | + TunnelEvent removeTunnel(ProviderId providerId, | ||
| 112 | + Tunnel tunnel); | ||
| 113 | + | ||
| 114 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel; | ||
| 17 | + | ||
| 18 | +import org.onosproject.store.StoreDelegate; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Tunnel store delegate abstraction. | ||
| 22 | + */ | ||
| 23 | +public interface TunnelStoreDelegate extends StoreDelegate<TunnelEvent> { | ||
| 24 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +/** | ||
| 18 | + * Tunnel model related services and providers API definitions. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.net.tunnel; |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +package org.onosproject.net.tunnel.impl; | ||
| 17 | + | ||
| 18 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 19 | + | ||
| 20 | +import java.util.Collection; | ||
| 21 | +import java.util.Set; | ||
| 22 | +import java.util.concurrent.ExecutorService; | ||
| 23 | + | ||
| 24 | +import org.apache.felix.scr.annotations.Activate; | ||
| 25 | +import org.apache.felix.scr.annotations.Component; | ||
| 26 | +import org.apache.felix.scr.annotations.Deactivate; | ||
| 27 | +import org.apache.felix.scr.annotations.Reference; | ||
| 28 | +import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
| 29 | +import org.apache.felix.scr.annotations.Service; | ||
| 30 | +import org.onosproject.core.CoreService; | ||
| 31 | +import org.onosproject.event.AbstractListenerRegistry; | ||
| 32 | +import org.onosproject.event.EventDeliveryService; | ||
| 33 | +import org.onosproject.net.ConnectPoint; | ||
| 34 | +import org.onosproject.net.DeviceId; | ||
| 35 | +import org.onosproject.net.Path; | ||
| 36 | +import org.onosproject.net.link.LinkEvent; | ||
| 37 | +import org.onosproject.net.link.LinkListener; | ||
| 38 | +import org.onosproject.net.provider.AbstractProviderRegistry; | ||
| 39 | +import org.onosproject.net.provider.AbstractProviderService; | ||
| 40 | +import org.onosproject.net.provider.ProviderId; | ||
| 41 | +import org.onosproject.net.resource.Bandwidth; | ||
| 42 | +import org.onosproject.net.tunnel.Label; | ||
| 43 | +import org.onosproject.net.tunnel.Tunnel; | ||
| 44 | +import org.onosproject.net.tunnel.TunnelAdminService; | ||
| 45 | +import org.onosproject.net.tunnel.TunnelDescription; | ||
| 46 | +import org.onosproject.net.tunnel.TunnelEvent; | ||
| 47 | +import org.onosproject.net.tunnel.TunnelId; | ||
| 48 | +import org.onosproject.net.tunnel.TunnelListener; | ||
| 49 | +import org.onosproject.net.tunnel.TunnelProvider; | ||
| 50 | +import org.onosproject.net.tunnel.TunnelProviderRegistry; | ||
| 51 | +import org.onosproject.net.tunnel.TunnelProviderService; | ||
| 52 | +import org.onosproject.net.tunnel.TunnelService; | ||
| 53 | +import org.onosproject.net.tunnel.TunnelStore; | ||
| 54 | +import org.onosproject.net.tunnel.TunnelStoreDelegate; | ||
| 55 | +import org.onosproject.net.tunnel.Tunnel.Type; | ||
| 56 | +import org.slf4j.Logger; | ||
| 57 | + | ||
| 58 | +/** | ||
| 59 | + * Provides implementation of the tunnel NB/SB APIs. | ||
| 60 | + */ | ||
| 61 | +@Component(immediate = true, enabled = true) | ||
| 62 | +@Service | ||
| 63 | +public class TunnelManager extends AbstractProviderRegistry<TunnelProvider, TunnelProviderService> | ||
| 64 | + implements TunnelService, TunnelAdminService, TunnelProviderRegistry { | ||
| 65 | + | ||
| 66 | + private static final String TUNNNEL_ID_NULL = "Tunnel ID cannot be null"; | ||
| 67 | + | ||
| 68 | + private final Logger log = getLogger(getClass()); | ||
| 69 | + | ||
| 70 | + protected final AbstractListenerRegistry<TunnelEvent, TunnelListener> | ||
| 71 | + listenerRegistry = new AbstractListenerRegistry<>(); | ||
| 72 | + | ||
| 73 | + private final TunnelStoreDelegate delegate = new InternalStoreDelegate(); | ||
| 74 | + private final InternalTunnelListener tunnelListener = new InternalTunnelListener(); | ||
| 75 | + private InternalLinkListener linkListener = new InternalLinkListener(); | ||
| 76 | + | ||
| 77 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 78 | + protected TunnelStore store; | ||
| 79 | + | ||
| 80 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 81 | + protected EventDeliveryService eventDispatcher; | ||
| 82 | + | ||
| 83 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 84 | + protected CoreService coreService; | ||
| 85 | + | ||
| 86 | + private ExecutorService futureService; | ||
| 87 | + | ||
| 88 | + @Activate | ||
| 89 | + public void activate() { | ||
| 90 | + // TODO Auto-generated method stub | ||
| 91 | + log.info("Started"); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @Deactivate | ||
| 95 | + public void deactivate() { | ||
| 96 | + // TODO Auto-generated method stub | ||
| 97 | + log.info("Stopped"); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 101 | + protected TunnelProviderService createProviderService(TunnelProvider provider) { | ||
| 102 | + // TODO Auto-generated method stub | ||
| 103 | + return new InternalTunnelProviderService(provider); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + @Override | ||
| 107 | + public TunnelProviderService register(TunnelProvider provider) { | ||
| 108 | + // TODO Auto-generated method stub | ||
| 109 | + return null; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @Override | ||
| 113 | + public void unregister(TunnelProvider provider) { | ||
| 114 | + // TODO Auto-generated method stub | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + @Override | ||
| 119 | + public Set<ProviderId> getProviders() { | ||
| 120 | + // TODO Auto-generated method stub | ||
| 121 | + return null; | ||
| 122 | + } | ||
| 123 | + @Override | ||
| 124 | + public void removeTunnels(Label src, Label dst) { | ||
| 125 | + // TODO Auto-generated method stub | ||
| 126 | + | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + @Override | ||
| 130 | + public void removeTunnels(ConnectPoint connectPoint) { | ||
| 131 | + // TODO Auto-generated method stub | ||
| 132 | + | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @Override | ||
| 136 | + public void removeTunnels(DeviceId deviceId) { | ||
| 137 | + // TODO Auto-generated method stub | ||
| 138 | + | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + @Override | ||
| 142 | + public int getTunnelCount() { | ||
| 143 | + // TODO Auto-generated method stub | ||
| 144 | + return 0; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + @Override | ||
| 148 | + public Collection<Tunnel> getTunnels(Type type) { | ||
| 149 | + // TODO Auto-generated method stub | ||
| 150 | + return null; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + @Override | ||
| 154 | + public Set<Tunnel> getTunnels(ConnectPoint connectPoint, Type type) { | ||
| 155 | + // TODO Auto-generated method stub | ||
| 156 | + return null; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + @Override | ||
| 160 | + public Tunnel getTunnel(Label src, Label dst) { | ||
| 161 | + // TODO Auto-generated method stub | ||
| 162 | + return null; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + @Override | ||
| 166 | + public Tunnel getTunnel(TunnelId id) { | ||
| 167 | + // TODO Auto-generated method stub | ||
| 168 | + return null; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @Override | ||
| 172 | + public void addListener(TunnelListener listener) { | ||
| 173 | + // TODO Auto-generated method stub | ||
| 174 | + | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + @Override | ||
| 178 | + public void removeListener(TunnelListener listener) { | ||
| 179 | + // TODO Auto-generated method stub | ||
| 180 | + | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + private class InternalTunnelListener implements TunnelListener { | ||
| 184 | + @Override | ||
| 185 | + public void event(TunnelEvent event) { | ||
| 186 | + // TODO Auto-generated method stub | ||
| 187 | + | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + private class InternalLinkListener implements LinkListener { | ||
| 192 | + @Override | ||
| 193 | + public void event(LinkEvent event) { | ||
| 194 | + // TODO Auto-generated method stub | ||
| 195 | + | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + private class InternalTunnelProviderService | ||
| 200 | + extends AbstractProviderService<TunnelProvider> | ||
| 201 | + implements TunnelProviderService { | ||
| 202 | + protected InternalTunnelProviderService(TunnelProvider provider) { | ||
| 203 | + super(provider); | ||
| 204 | + // TODO Auto-generated constructor stub | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + @Override | ||
| 208 | + public void tunnelAdded(TunnelDescription tunnel) { | ||
| 209 | + // TODO Auto-generated method stub | ||
| 210 | + | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + @Override | ||
| 214 | + public void tunnelUpdated(TunnelDescription tunnel) { | ||
| 215 | + // TODO Auto-generated method stub | ||
| 216 | + | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + @Override | ||
| 220 | + public void tunnelRemoved(TunnelDescription tunnel) { | ||
| 221 | + // TODO Auto-generated method stub | ||
| 222 | + | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + private class InternalStoreDelegate implements TunnelStoreDelegate { | ||
| 228 | + @Override | ||
| 229 | + public void notify(TunnelEvent event) { | ||
| 230 | + // TODO Auto-generated method stub | ||
| 231 | + if (event != null) { | ||
| 232 | + eventDispatcher.post(event); | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + @Override | ||
| 238 | + public void requestTunnel(ConnectPoint src, ConnectPoint dst, | ||
| 239 | + Bandwidth bw, Path path) { | ||
| 240 | + // TODO Auto-generated method stub | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + | ||
| 244 | + @Override | ||
| 245 | + public void requestTunnel(ConnectPoint src, ConnectPoint dst, Type type, | ||
| 246 | + Bandwidth bw, Path path) { | ||
| 247 | + // TODO Auto-generated method stub | ||
| 248 | + | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + @Override | ||
| 252 | + public void removeTunnel(TunnelId tunnelId) { | ||
| 253 | + // TODO Auto-generated method stub | ||
| 254 | + | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + @Override | ||
| 258 | + public void removeTunnels(ConnectPoint src, ConnectPoint dst) { | ||
| 259 | + // TODO Auto-generated method stub | ||
| 260 | + | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + @Override | ||
| 264 | + public void removeTunnels(ConnectPoint src, ConnectPoint dst, Type type) { | ||
| 265 | + // TODO Auto-generated method stub | ||
| 266 | + | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + @Override | ||
| 270 | + public void updateTunnel(Tunnel tunnel, Path path) { | ||
| 271 | + // TODO Auto-generated method stub | ||
| 272 | + | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + @Override | ||
| 276 | + public Collection<Tunnel> getTunnels(ConnectPoint src, ConnectPoint dst, | ||
| 277 | + Type type) { | ||
| 278 | + // TODO Auto-generated method stub | ||
| 279 | + return null; | ||
| 280 | + } | ||
| 281 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 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 | +/** | ||
| 18 | + * Core subsystem for tracking global inventory of tunnels. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.net.tunnel.impl; |
-
Please register or login to post a comment