diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:15:21 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:15:21 -0700 |
commit | 13d05bc8458758ee39cb829098241e89616717ee (patch) | |
tree | 22a4d1ce65f15952f07a3df5af4b462b4697cb3a /framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour | |
parent | 6139282e1e93c2322076de4b91b1c85d0bc4a8b3 (diff) |
ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60
Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour')
23 files changed, 1227 insertions, 0 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java new file mode 100644 index 00000000..7f157e95 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java @@ -0,0 +1,87 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import java.util.Collection; +import java.util.List; +import java.util.Set; + +import org.onosproject.net.PortNumber; +import org.onosproject.net.device.PortDescription; +import org.onosproject.net.driver.HandlerBehaviour; + +/** + * Behaviour for handling various drivers for bridge configurations. + */ +public interface BridgeConfig extends HandlerBehaviour { + + /** + * Add a bridge. + * + * @param bridgeName bridge name + */ + void addBridge(BridgeName bridgeName); + + /** + * Remove a bridge. + * + * @param bridgeName bridge name + */ + void deleteBridge(BridgeName bridgeName); + + /** + * Remove a bridge. + * + * @return bridge collection + */ + Collection<BridgeDescription> getBridges(); + + /** + * Add a logical/virtual port. + * + * @param port port number + */ + void addPort(PortDescription port); + + /** + * Delete a logical/virtual port. + * + * @param port port number + */ + void deletePort(PortDescription port); + + /** + * Delete a logical/virtual port. + * + * @return collection of port + */ + Collection<PortDescription> getPorts(); + + /** + * Get a collection of port. + * + * @return portNumbers set of PortNumber + */ + Set<PortNumber> getPortNumbers(); + + /** + * Get logical/virtual ports by ifaceIds. + * + * @param ifaceIds the ifaceid that needed + * @return list of PortNumber + */ + List<PortNumber> getLocalPorts(Iterable<String> ifaceIds); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeDescription.java new file mode 100644 index 00000000..3c1d5542 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeDescription.java @@ -0,0 +1,46 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onosproject.net.Description; +import org.onosproject.net.DeviceId; + +/** + * The abstraction of bridge in OVSDB protocol. + */ +public interface BridgeDescription extends Description { + + /** + * Returns bridge name. + * + * @return bridge name + */ + BridgeName bridgeName(); + + /** + * Returns controller identifier that this bridge belongs to. + * + * @return controller identifier + */ + DeviceId cotrollerDeviceId(); + + /** + * Returns bridge identifier . + * + * @return bridge identifier + */ + DeviceId deviceId(); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java new file mode 100644 index 00000000..3f782954 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java @@ -0,0 +1,78 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import java.util.Objects; + +import com.google.common.base.MoreObjects; + +/** + * Represents for a bridge name. + */ +public final class BridgeName { + + private final String name; + + // Public construction is prohibited + private BridgeName(String name) { + this.name = name; + } + + /** + * Creates a bridge name using the supplied string. + * + * @param name bridge name + * @return BridgeName + */ + public static BridgeName bridgeName(String name) { + return new BridgeName(name); + } + + /** + * Returns the bridge name string. + * + * @return name string + */ + public String name() { + return name; + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof BridgeName) { + final BridgeName that = (BridgeName) obj; + return this.getClass() == that.getClass() && + Objects.equals(this.name, that.name); + } + return false; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()) + .add("name", name) + .toString(); + } + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java new file mode 100644 index 00000000..bb8a788b --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import java.util.List; + +/** + * Device behaviour to obtain and set controllers at the device. + */ +public interface ControllerConfig { + + //TODO: add other controller parameters as needed. + + /** + * Obtain the list of controller which are currently configured. + * @return a list for controller descriptions + */ + List<ControllerInfo> getControllers(); + + /** + * Set a list of controllers on a device. + * @param controllers a list of controller descriptions + */ + void setControllers(List<ControllerInfo> controllers); + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java new file mode 100644 index 00000000..9ff808a9 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onlab.packet.IpAddress; + +/** + * Represents information for a device to connect to a controller. + */ +public class ControllerInfo { + + public final IpAddress ip; + public final int tcpPort; + + /** + * Information for contacting the controller. + * + * @param ip the ip address + * @param tcpPort the tcp port + */ + public ControllerInfo(IpAddress ip, int tcpPort) { + this.ip = ip; + this.tcpPort = tcpPort; + } +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultBridgeDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultBridgeDescription.java new file mode 100644 index 00000000..6a6f670f --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultBridgeDescription.java @@ -0,0 +1,87 @@ +/* + * Copyright 2014-2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import java.util.Objects; + +import org.onosproject.net.AbstractDescription; +import org.onosproject.net.DeviceId; +import org.onosproject.net.SparseAnnotations; + +import com.google.common.base.MoreObjects; + +/** + * The default implementation of bridge. + */ +public final class DefaultBridgeDescription extends AbstractDescription + implements BridgeDescription { + + private final BridgeName name; + private final DeviceId deviceId; + private final DeviceId controllerId; + + public DefaultBridgeDescription(BridgeName name, DeviceId controllerId, + DeviceId deviceId, + SparseAnnotations... annotations) { + super(annotations); + this.name = name; + this.deviceId = deviceId; + this.controllerId = controllerId; + } + + @Override + public BridgeName bridgeName() { + return name; + } + + @Override + public DeviceId deviceId() { + return deviceId; + } + + @Override + public DeviceId cotrollerDeviceId() { + return controllerId; + } + + @Override + public int hashCode() { + return Objects.hash(name, deviceId, controllerId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof DefaultBridgeDescription) { + final DefaultBridgeDescription that = (DefaultBridgeDescription) obj; + return this.getClass() == that.getClass() + && Objects.equals(this.name, that.name) + && Objects.equals(this.deviceId, that.deviceId) + && Objects.equals(this.controllerId, that.controllerId); + } + return false; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).add("name", name) + .add("deviceId", deviceId).add("controllerId", controllerId) + .toString(); + } + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultNextGroup.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultNextGroup.java new file mode 100644 index 00000000..ef1f9de7 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultNextGroup.java @@ -0,0 +1,33 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +/** + * Default implementation of a next group. + */ +public class DefaultNextGroup implements NextGroup { + + private final byte[] data; + + public DefaultNextGroup(byte[] data) { + this.data = data; + } + + @Override + public byte[] data() { + return data; + } +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java new file mode 100644 index 00000000..7554a3cb --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java @@ -0,0 +1,87 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onosproject.net.AbstractDescription; +import org.onosproject.net.SparseAnnotations; + +import com.google.common.annotations.Beta; +import com.google.common.base.MoreObjects; + +/** + * Default implementation of immutable tunnel description entity. + */ +@Beta +public class DefaultTunnelDescription extends AbstractDescription + implements TunnelDescription { + + private final TunnelEndPoint src; + private final TunnelEndPoint dst; + private final Type type; + // which a tunnel match up + // tunnel producer + private final TunnelName tunnelName; // name of a tunnel + + /** + * Creates a tunnel description using the supplied information. + * + * @param src TunnelPoint source + * @param dst TunnelPoint destination + * @param type tunnel type + * @param tunnelName tunnel name + * @param annotations optional key/value annotations + */ + public DefaultTunnelDescription(TunnelEndPoint src, + TunnelEndPoint dst, Type type, + TunnelName tunnelName, + SparseAnnotations... annotations) { + super(annotations); + this.src = src; + this.dst = dst; + this.type = type; + this.tunnelName = tunnelName; + } + + @Override + public TunnelEndPoint src() { + return src; + } + + @Override + public TunnelEndPoint dst() { + return dst; + } + + @Override + public Type type() { + return type; + } + + @Override + public TunnelName tunnelName() { + return tunnelName; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("src", src()) + .add("dst", dst()) + .add("type", type()) + .add("tunnelName", tunnelName()) + .toString(); + } +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/IpTunnelEndPoint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/IpTunnelEndPoint.java new file mode 100644 index 00000000..83ad4756 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/IpTunnelEndPoint.java @@ -0,0 +1,80 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.net.behaviour; + +import java.util.Objects; + +import com.google.common.annotations.Beta; +import org.onlab.packet.IpAddress; + +import com.google.common.base.MoreObjects; + +/** + * Represent for a tunnel point using ip address. + */ +@Beta +public final class IpTunnelEndPoint implements TunnelEndPoint { + + private final IpAddress ip; + + /** + * Public construction is prohibited. + * @param ip ip address + */ + private IpTunnelEndPoint(IpAddress ip) { + this.ip = ip; + } + + /** + * Create a IP tunnel end point. + * @param ip IP address + * @return IpTunnelEndPoint + */ + public static IpTunnelEndPoint ipTunnelPoint(IpAddress ip) { + return new IpTunnelEndPoint(ip); + } + + /** + * Returns IP address. + * @return IP address + */ + public IpAddress ip() { + return ip; + } + + @Override + public int hashCode() { + return Objects.hash(ip); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof IpTunnelEndPoint) { + final IpTunnelEndPoint other = (IpTunnelEndPoint) obj; + return Objects.equals(this.ip, other.ip); + } + return false; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(getClass()).add("ip", ip).toString(); + } +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/MplsQuery.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/MplsQuery.java new file mode 100644 index 00000000..0e9f466d --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/MplsQuery.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import com.google.common.annotations.Beta; +import org.onosproject.net.PortNumber; +import org.onosproject.net.driver.HandlerBehaviour; + +/** + * A HandlerBehaviour to check the capability of MPLS. + */ +@Beta +public interface MplsQuery extends HandlerBehaviour { + + /** + * Indicates if MPLS can be used at the port. + + * @param port port to be checked for the capability + * @return true if MPLS can be used at the port, false otherwise. + */ + boolean isEnabled(PortNumber port); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/NextGroup.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/NextGroup.java new file mode 100644 index 00000000..b5a3891c --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/NextGroup.java @@ -0,0 +1,30 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +/** + * Opaque data type for carrying group-like information. + * Only relevant to a pipeliner driver. + */ +public interface NextGroup { + + /** + * Serialized form of the next group. + * @return a byte array. + */ + byte[] data(); + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/Pipeliner.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/Pipeliner.java new file mode 100644 index 00000000..dcfc5883 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/Pipeliner.java @@ -0,0 +1,57 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onosproject.net.DeviceId; +import org.onosproject.net.driver.HandlerBehaviour; +import org.onosproject.net.flowobjective.FilteringObjective; +import org.onosproject.net.flowobjective.ForwardingObjective; +import org.onosproject.net.flowobjective.NextObjective; + +/** + * Behaviour for handling various pipelines. + */ +public interface Pipeliner extends HandlerBehaviour { + + /** + * Initializes the driver with context required for its operation. + * + * @param deviceId the deviceId + * @param context processing context + */ + void init(DeviceId deviceId, PipelinerContext context); + + /** + * Installs the filtering rules onto the device. + * + * @param filterObjective a filtering objective + */ + void filter(FilteringObjective filterObjective); + + /** + * Installs the forwarding rules onto the device. + * + * @param forwardObjective a forwarding objective + */ + void forward(ForwardingObjective forwardObjective); + + /** + * Installs the next hop elements into the device. + * + * @param nextObjective a next objectives + */ + void next(NextObjective nextObjective); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PipelinerContext.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PipelinerContext.java new file mode 100644 index 00000000..d0ca42b1 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PipelinerContext.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onlab.osgi.ServiceDirectory; +import org.onosproject.net.flowobjective.FlowObjectiveStore; + +/** + * Processing context and supporting services for the pipeline behaviour. + */ +public interface PipelinerContext { + + /** + * Returns the service directory which can be used to obtain references + * to various supporting services. + * + * @return service directory + */ + ServiceDirectory directory(); + + /** + * Returns the Objective Store where data can be stored and retrieved. + * @return the flow objective store + */ + FlowObjectiveStore store(); + + // TODO: add means to store and access shared state +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PortAdmin.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PortAdmin.java new file mode 100644 index 00000000..141e27dc --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PortAdmin.java @@ -0,0 +1,33 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onosproject.net.device.PortDescription; +import org.onosproject.net.driver.HandlerBehaviour; + +/** + * Means to administratively enable/disable a logical port at the device. + */ +public interface PortAdmin extends HandlerBehaviour { + + /** + * Enable/disable administratively a port. + * + * @param port a port description containing the desired port state + */ + void enable(PortDescription port); + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java new file mode 100644 index 00000000..83dd99d8 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java @@ -0,0 +1,40 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import com.google.common.primitives.UnsignedInteger; +import org.onosproject.net.device.PortDescription; +import org.onosproject.net.driver.HandlerBehaviour; + +/** + * Means to configure a logical port at the device. + */ +public interface PortConfig extends HandlerBehaviour { + + /** + * Apply QoS configuration on a device. + * @param port a port description + * @param queueId an unsigned integer + */ + void applyQoS(PortDescription port, UnsignedInteger queueId); + + /** + * Remove a QoS configuration. + * @param port a port description + */ + void removeQoS(PortDescription port); + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java new file mode 100644 index 00000000..22f3ecb7 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java @@ -0,0 +1,56 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import com.google.common.primitives.UnsignedInteger; + +import java.util.Set; + +/** + * Means to alter a device's dataplane queues. + */ +public interface QueueConfig { + + /** + * Obtain all queues configured on a device. + * + * @return a list of queue descriptions + */ + Set<QueueInfo> getQueues(); + + /** + * Obtain a specific queue given a queue id. + * + * @param queueId an unsigned integer representing a queue id + * @return a queue description + */ + QueueInfo getQueue(UnsignedInteger queueId); + + /** + * Add a queue to a device. + * + * @param queue a queue description + */ + void addQueue(QueueInfo queue); + + /** + * Remove a queue from a device. + * + * @param queueId an unsigned integer + */ + void removeQueue(UnsignedInteger queueId); + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java new file mode 100644 index 00000000..25852b36 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java @@ -0,0 +1,56 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import com.google.common.primitives.UnsignedInteger; + +/** + * Represents a dataplane queue. + */ +public class QueueInfo { + + public enum Type { + /** + * Supports burst and priority as well as min and max rates. + */ + FULL, + + /** + * Only support min and max rates. + */ + MINMAX + } + + private final UnsignedInteger queueId; + private final Type type; + private final long minRate; + private final long maxRate; + private final long burst; + private final long priority; + + public QueueInfo(UnsignedInteger queueId, Type type, long minRate, + long maxRate, long burst, long priority) { + this.queueId = queueId; + this.type = type; + this.minRate = minRate; + this.maxRate = maxRate; + this.burst = burst; + this.priority = priority; + } + + //TODO builder + // public static QueueInfoBuilder builder() {} +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelConfig.java new file mode 100644 index 00000000..7e79a57e --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelConfig.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import java.util.Collection; + +import org.onosproject.net.driver.HandlerBehaviour; + +/** + * Behaviour for handling various drivers for tunnel configuration. + */ +public interface TunnelConfig extends HandlerBehaviour { + + /** + * Creates a tunnel on this device. + * + * @param tunnel tunnel descriptor + */ + void createTunnel(TunnelDescription tunnel); + + /** + * Removes a tunnel on this device. + * + * @param tunnel tunnel descriptor + */ + void removeTunnel(TunnelDescription tunnel); + + /** + * Updates a tunnel on this device. + * + * @param tunnel tunnel descriptor + */ + void updateTunnel(TunnelDescription tunnel); + + /** + * Returns tunnels created on this device. + * + * @return collection of tunnels + */ + Collection<TunnelDescription> getTunnels(); + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java new file mode 100755 index 00000000..b2fb6996 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java @@ -0,0 +1,86 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import org.onosproject.net.Annotated; +import org.onosproject.net.Description; + +import com.google.common.annotations.Beta; + +/** + * Describes a tunnel. + */ +@Beta +public interface TunnelDescription extends Description, Annotated { + + /** + * Tunnel technology type. + */ + enum Type { + /** + * Signifies that this is a MPLS tunnel. + */ + MPLS, + /** + * Signifies that this is a L2 tunnel. + */ + VLAN, + /** + * Signifies that this is a DC L2 extension tunnel. + */ + VXLAN, + /** + * Signifies that this is a L3 tunnel. + */ + GRE, + /** + * Signifies that this is a L1 OTN tunnel. + */ + ODUK, + /** + * Signifies that this is a L0 OCH tunnel. + */ + OCH + } + + /** + * Returns the connection point source. + * + * @return tunnel source ConnectionPoint + */ + TunnelEndPoint src(); + + /** + * Returns the connection point destination. + * + * @return tunnel destination + */ + TunnelEndPoint dst(); + + /** + * Returns the tunnel type. + * + * @return tunnel type + */ + Type type(); + + /** + * Return the name of a tunnel. + * + * @return Tunnel Name + */ + TunnelName tunnelName(); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelEndPoint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelEndPoint.java new file mode 100644 index 00000000..c354c38d --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelEndPoint.java @@ -0,0 +1,28 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.net.behaviour; + +import com.google.common.annotations.Beta; + +/** + * Represents for source end point or destination end point of a tunnel. Maybe a tunnel + * based on ConnectPoint, IpAddress, MacAddress and so on is built. + */ +@Beta +public interface TunnelEndPoint { + +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelName.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelName.java new file mode 100644 index 00000000..9be26549 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/TunnelName.java @@ -0,0 +1,79 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onosproject.net.behaviour; + +import com.google.common.annotations.Beta; + +import java.util.Objects; + +/** + * Represents for a unique tunnel name. TunnelId is generated by ONOS while + * TunnelName is given by producer. The consumer can borrow tunnels with + * TunnelId or TunnelName. + */ +@Beta +public final class TunnelName { + private final String str; + + // Default constructor for serialization + private TunnelName(String tunnelName) { + this.str = tunnelName; + } + + + /** + * Creates a tunnel name using the supplied URI string. + * + * @param tunnelName tunnel name string + * @return tunnel name object + */ + public static TunnelName tunnelName(String tunnelName) { + return new TunnelName(tunnelName); + } + + /** + * The string of tunnel name. + * + * @return the string of tunnel name + */ + public String value() { + return str; + } + + @Override + public int hashCode() { + return Objects.hash(str); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof TunnelName) { + final TunnelName that = (TunnelName) obj; + return this.getClass() == that.getClass() + && Objects.equals(this.str, that.str); + } + return false; + } + + @Override + public String toString() { + return str; + } +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/VlanQuery.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/VlanQuery.java new file mode 100644 index 00000000..a1057c90 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/VlanQuery.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onosproject.net.behaviour; + +import com.google.common.annotations.Beta; +import org.onosproject.net.PortNumber; +import org.onosproject.net.driver.HandlerBehaviour; + +/** + * A HandlerBehaviour to check the capability of VLAN. + */ +@Beta +public interface VlanQuery extends HandlerBehaviour { + + /** + * Indicates if VLAN can be used at the port. + * + * @param port port to be checked for the capability + * @return true if VLAN can be used at the port, false otherwise. + */ + boolean isEnabled(PortNumber port); +} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/package-info.java new file mode 100644 index 00000000..f0a9a5e5 --- /dev/null +++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Abstractions of various device configuration or device adaptation behaviours; + * counterpart to the device driver subsystem. + */ +package org.onosproject.net.behaviour;
\ No newline at end of file |