diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/packet')
19 files changed, 0 insertions, 1135 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultInboundPacket.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultInboundPacket.java deleted file mode 100644 index 96f872f5..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultInboundPacket.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.ConnectPoint; -import org.onlab.packet.Ethernet; - -import java.nio.ByteBuffer; -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Default implementation of an immutable inbound packet. - */ -public final class DefaultInboundPacket implements InboundPacket { - - private final ConnectPoint receivedFrom; - private final Ethernet parsed; - private final ByteBuffer unparsed; - - /** - * Creates an immutable inbound packet. - * - * @param receivedFrom connection point where received - * @param parsed parsed ethernet frame - * @param unparsed unparsed raw bytes - */ - public DefaultInboundPacket(ConnectPoint receivedFrom, Ethernet parsed, - ByteBuffer unparsed) { - this.receivedFrom = receivedFrom; - this.parsed = parsed; - this.unparsed = unparsed; - } - - @Override - public ConnectPoint receivedFrom() { - return receivedFrom; - } - - @Override - public Ethernet parsed() { - return parsed; - } - - @Override - public ByteBuffer unparsed() { - // FIXME: figure out immutability here - return unparsed; - } - - @Override - public int hashCode() { - return Objects.hash(receivedFrom, parsed, unparsed); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof InboundPacket) { - final DefaultInboundPacket other = (DefaultInboundPacket) obj; - return Objects.equals(this.receivedFrom, other.receivedFrom) && - Objects.equals(this.parsed, other.parsed) && - Objects.equals(this.unparsed, other.unparsed); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("receivedFrom", receivedFrom) - .add("parsed", parsed) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultOutboundPacket.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultOutboundPacket.java deleted file mode 100644 index 5bd4c986..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultOutboundPacket.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import java.nio.ByteBuffer; -import java.util.Objects; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.flow.TrafficTreatment; - -import com.google.common.base.MoreObjects; - -/** - * Default implementation of an immutable outbound packet. - */ -public final class DefaultOutboundPacket implements OutboundPacket { - private final DeviceId sendThrough; - private final TrafficTreatment treatment; - private final ByteBuffer data; - - /** - * Creates an immutable outbound packet. - * - * @param sendThrough identifier through which to send the packet - * @param treatment list of packet treatments - * @param data raw packet data - */ - public DefaultOutboundPacket(DeviceId sendThrough, - TrafficTreatment treatment, ByteBuffer data) { - this.sendThrough = sendThrough; - this.treatment = treatment; - this.data = data; - } - - @Override - public DeviceId sendThrough() { - return sendThrough; - } - - @Override - public TrafficTreatment treatment() { - return treatment; - } - - @Override - public ByteBuffer data() { - // FIXME: figure out immutability here - return data; - } - - @Override - public int hashCode() { - return Objects.hash(sendThrough, treatment, data); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof OutboundPacket) { - final DefaultOutboundPacket other = (DefaultOutboundPacket) obj; - return Objects.equals(this.sendThrough, other.sendThrough) && - Objects.equals(this.treatment, other.treatment) && - Objects.equals(this.data, other.data); - } - return false; - } - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("sendThrough", sendThrough) - .add("treatment", treatment) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultPacketContext.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultPacketContext.java deleted file mode 100644 index 166269f9..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultPacketContext.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.packet; - -import org.onosproject.net.flow.DefaultTrafficTreatment; -import org.onosproject.net.flow.TrafficTreatment; -import org.onosproject.net.flow.TrafficTreatment.Builder; - -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.onosproject.security.AppGuard.checkPermission; -import static org.onosproject.security.AppPermission.Type.*; - -/** - * Default implementation of a packet context. - */ -public abstract class DefaultPacketContext implements PacketContext { - - private final long time; - private final InboundPacket inPkt; - private final OutboundPacket outPkt; - private final TrafficTreatment.Builder builder; - - private final AtomicBoolean block; - - /** - * Creates a new packet context. - * - * @param time creation time - * @param inPkt inbound packet - * @param outPkt outbound packet - * @param block whether the context is blocked or not - */ - protected DefaultPacketContext(long time, InboundPacket inPkt, - OutboundPacket outPkt, boolean block) { - super(); - this.time = time; - this.inPkt = inPkt; - this.outPkt = outPkt; - this.block = new AtomicBoolean(block); - this.builder = DefaultTrafficTreatment.builder(); - } - - @Override - public long time() { - checkPermission(PACKET_READ); - return time; - } - - @Override - public InboundPacket inPacket() { - checkPermission(PACKET_READ); - return inPkt; - } - - @Override - public OutboundPacket outPacket() { - checkPermission(PACKET_READ); - return outPkt; - } - - @Override - public Builder treatmentBuilder() { - checkPermission(PACKET_READ); - return builder; - } - - @Override - public abstract void send(); - - @Override - public boolean block() { - checkPermission(PACKET_WRITE); - return this.block.getAndSet(true); - } - - @Override - public boolean isHandled() { - checkPermission(PACKET_READ); - return this.block.get(); - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultPacketRequest.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultPacketRequest.java deleted file mode 100644 index ce2eb118..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/DefaultPacketRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.packet; - -import com.google.common.base.MoreObjects; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficSelector; - -import java.util.Objects; - -/** - * Default implementation of a packet request. - */ -public final class DefaultPacketRequest implements PacketRequest { - private final TrafficSelector selector; - private final PacketPriority priority; - private final ApplicationId appId; - - /** - * Creates a new packet request. - * - * @param selector traffic selector - * @param priority intercept priority - * @param appId application id - */ - public DefaultPacketRequest(TrafficSelector selector, PacketPriority priority, - ApplicationId appId) { - this.selector = selector; - this.priority = priority; - this.appId = appId; - } - - public TrafficSelector selector() { - return selector; - } - - public PacketPriority priority() { - return priority; - } - - public ApplicationId appId() { - return appId; - } - - @Override - public int hashCode() { - return Objects.hash(selector, priority, appId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final DefaultPacketRequest other = (DefaultPacketRequest) obj; - return Objects.equals(this.selector, other.selector) - && Objects.equals(this.priority, other.priority) - && Objects.equals(this.appId, other.appId); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this.getClass()) - .add("selector", selector) - .add("priority", priority) - .add("appId", appId).toString(); - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/InboundPacket.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/InboundPacket.java deleted file mode 100644 index 3fd58149..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/InboundPacket.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.ConnectPoint; -import org.onlab.packet.Ethernet; - -import java.nio.ByteBuffer; - -/** - * Represents a data packet intercepted from an infrastructure device. - */ -public interface InboundPacket { - - /** - * Returns the device and port from where the packet was received. - * - * @return connection point where received - */ - ConnectPoint receivedFrom(); - - /** - * Returns the parsed form of the packet. - * - * @return parsed Ethernet frame; null if the packet is not an Ethernet - * frame or one for which there is no parser - */ - Ethernet parsed(); - - /** - * Unparsed packet data. - * - * @return raw packet bytes - */ - ByteBuffer unparsed(); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/OutboundPacket.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/OutboundPacket.java deleted file mode 100644 index 9e9329fa..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/OutboundPacket.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.flow.TrafficTreatment; - -import java.nio.ByteBuffer; - -/** - * Represents an outbound data packet that is to be emitted to network via - * an infrastructure device. - */ -public interface OutboundPacket { - - /** - * Returns the identity of a device through which this packet should be - * sent. - * - * @return device identity - */ - DeviceId sendThrough(); - - /** - * Returns how the outbound packet should be treated. - * - * @return output treatment - */ - TrafficTreatment treatment(); - - /** - * Returns immutable view of the raw data to be sent. - * - * @return data to emit - */ - ByteBuffer data(); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketContext.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketContext.java deleted file mode 100644 index 004adc87..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketContext.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.flow.TrafficTreatment; - -/** - * Represents context for processing an inbound packet, and (optionally) - * emitting a corresponding outbound packet. - */ -public interface PacketContext { - - /** - * Returns the time when the packet was received. - * - * @return the time in millis since start of epoch - */ - long time(); - - /** - * Returns the inbound packet being processed. - * - * @return inbound packet - */ - InboundPacket inPacket(); - - /** - * Returns the view of the outbound packet. - * - * @return outbound packet - */ - OutboundPacket outPacket(); - - /** - * Returns a builder for constructing traffic treatment. - * - * @return traffic treatment builder - */ - TrafficTreatment.Builder treatmentBuilder(); - - /** - * Triggers the outbound packet to be sent. - */ - void send(); - - /** - * Blocks the outbound packet from being sent from this point onward. - * - * @return whether the outbound packet is blocked. - */ - boolean block(); - - /** - * Indicates whether the outbound packet is handled, i.e. sent or blocked. - * - * @return true uf the packed is handled - */ - boolean isHandled(); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketEvent.java deleted file mode 100644 index 7b0a5ed7..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.event.AbstractEvent; - -/** - * Describes a packet event. - */ -public class PacketEvent extends AbstractEvent<PacketEvent.Type, OutboundPacket> { - - /** - * Type of packet events. - */ - public enum Type { - /** - * Signifies that the packet should be emitted out a local port. - */ - EMIT - } - - /** - * Creates an event of the given type for the specified packet. - * - * @param type the type of the event - * @param packet the packet the event is about - */ - public PacketEvent(Type type, OutboundPacket packet) { - super(type, packet); - } - - /** - * Creates an event of the given type for the specified packet at the given - * time. - * - * @param type the type of the event - * @param packet the packet the event is about - * @param time the time of the event - */ - public PacketEvent(Type type, OutboundPacket packet, long time) { - super(type, packet, time); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketPriority.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketPriority.java deleted file mode 100644 index 3eab9386..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketPriority.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.packet; - -/** - * Priorities available to applications for requests for packets from the data - * plane. - */ -public enum PacketPriority { - /** - * High priority for control traffic. This will result in all traffic - * matching the selector being sent to the controller. - */ - CONTROL(40000), - - /** - * Low priority for reactive applications. Packets are only sent to the - * controller if they fail to match any of the rules installed in the switch. - */ - REACTIVE(5); - - private final int priorityValue; - - PacketPriority(int priorityValue) { - this.priorityValue = priorityValue; - } - - /** - * Returns the integer value of the priority level. - * - * @return priority value - */ - public int priorityValue() { - return priorityValue; - } - - public String toString() { - return String.valueOf(priorityValue); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessor.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessor.java deleted file mode 100644 index 0eba1b4e..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessor.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import static com.google.common.base.Preconditions.checkArgument; - -/** - * Abstraction of an inbound packet processor. - */ -public interface PacketProcessor { - - int ADVISOR_MAX = Integer.MAX_VALUE / 3; - int DIRECTOR_MAX = (Integer.MAX_VALUE / 3) * 2; - int OBSERVER_MAX = Integer.MAX_VALUE; - - /** - * Returns a priority in the ADVISOR range, where processors can take early action and - * influence the packet context. However, they cannot handle the packet (i.e. call send() or block()). - * The valid range is from 1 to ADVISOR_MAX. - * Processors in this range get to see the packet first. - * - * @param priority priority within ADVISOR range - * @return overall priority - */ - static int advisor(int priority) { - int overallPriority = priority + 1; - checkArgument(overallPriority > 0 && overallPriority <= ADVISOR_MAX, - "Priority not within ADVISOR range"); - return overallPriority; - } - - /** - * Returns a priority in the DIRECTOR range, where processors can handle the packet. - * The valid range is from ADVISOR_MAX+1 to DIRECTOR_MAX. - * Processors in this range get to see the packet second, after ADVISORS. - * - * @param priority priority within the DIRECTOR range - * @return overall priority - */ - static int director(int priority) { - int overallPriority = ADVISOR_MAX + priority + 1; - checkArgument(overallPriority > ADVISOR_MAX && overallPriority <= DIRECTOR_MAX, - "Priority not within DIRECTOR range"); - return overallPriority; - } - - /** - * Returns a priority in the OBSERVER range, where processors cannot take any action, - * but can observe what action has been taken until then. - * The valid range is from DIRECTOR_MAX+1 to OBSERVER_MAX. - * Processors in this range get to see the packet last, after ADVISORS and DIRECTORS. - * - * @param priority priority within the OBSERVER range - * @return overall priority - */ - static int observer(int priority) { - int overallPriority = DIRECTOR_MAX + priority + 1; - checkArgument(overallPriority > DIRECTOR_MAX, - "Priority not within OBSERVER range"); - return overallPriority; - } - - /** - * Processes the inbound packet as specified in the given context. - * - * @param context packet processing context - */ - void process(PacketContext context); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java deleted file mode 100644 index 40386fb7..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.packet; - -/** - * Packet processor entry tracking the processor, its priority and - * time consumption. - */ -public interface PacketProcessorEntry { - - /** - * Returns the packet processor. - * - * @return packet processor - */ - PacketProcessor processor(); - - /** - * Returns the packet processor priority. - * - * @return processor priority - */ - int priority(); - - /** - * Returns the number of invocations. - * - * @return number of invocations - */ - long invocations(); - - /** - * Returns the total time, in nanoseconds, spent processing packets. - * - * @return total time in nanos - */ - long totalNanos(); - - /** - * Returns the average time, in nanoseconds, spent processing packets. - * - * @return average time in nanos - */ - long averageNanos(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProvider.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProvider.java deleted file mode 100644 index 8d55f0d1..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of a packet provider capable of emitting packets. - */ -public interface PacketProvider extends Provider { - - /** - * Emits the specified outbound packet onto the network. - * - * @param packet outbound packet - */ - void emit(OutboundPacket packet); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProviderRegistry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProviderRegistry.java deleted file mode 100644 index 6e73253e..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProviderRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of an infrastructure packet provider registry. - */ -public interface PacketProviderRegistry -extends ProviderRegistry<PacketProvider, PacketProviderService> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProviderService.java deleted file mode 100644 index 1aaee65f..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProviderService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.net.provider.ProviderService; - -/** - * Entity capable of processing inbound packets. - */ -public interface PacketProviderService extends ProviderService<PacketProvider> { - - /** - * Submits inbound packet context for processing. This processing will be - * done synchronously, i.e. run-to-completion. - * - * @param context inbound packet context - */ - void processPacket(PacketContext context); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketRequest.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketRequest.java deleted file mode 100644 index dc09219a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.packet; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficSelector; - -/** - * Represents a packet request made to devices. - */ -public interface PacketRequest { - - /** - * Obtain the traffic selector. - * - * @return a traffic selector - */ - TrafficSelector selector(); - - /** - * Obtain the priority. - * - * @return a PacketPriority - */ - PacketPriority priority(); - - /** - * Obtain the application id. - * - * @return an application id - */ - ApplicationId appId(); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java deleted file mode 100644 index 2e7a1b91..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.packet; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficSelector; - -import java.util.List; - -/** - * Service for intercepting data plane packets and for emitting synthetic - * outbound packets. - */ -public interface PacketService { - - // TODO: ponder better ordering scheme that does not require absolute numbers - - /** - * Adds the specified processor to the list of packet processors. - * It will be added into the list in the order of priority. The higher - * numbers will be processing the packets after the lower numbers. - * - * @param processor processor to be added - * @param priority priority in the reverse natural order - * @throws java.lang.IllegalArgumentException if a processor with the - * given priority already exists - */ - void addProcessor(PacketProcessor processor, int priority); - - // TODO allow processors to register for particular types of packets - - /** - * Removes the specified processor from the processing pipeline. - * - * @param processor packet processor - */ - void removeProcessor(PacketProcessor processor); - - /** - * Returns priority bindings of all registered packet processor entries. - * - * @return list of existing packet processor entries - */ - @Beta - List<PacketProcessorEntry> getProcessors(); - - /** - * Requests that packets matching the given selector are punted from the - * dataplane to the controller. - * - * @param selector the traffic selector used to match packets - * @param priority the priority of the rule - * @param appId the application ID of the requester - */ - void requestPackets(TrafficSelector selector, PacketPriority priority, - ApplicationId appId); - - /** - * Cancels previous packet requests for packets matching the given - * selector to be punted from the dataplane to the controller. - * - * @param selector the traffic selector used to match packets - * @param priority the priority of the rule - * @param appId the application ID of the requester - */ - void cancelPackets(TrafficSelector selector, PacketPriority priority, - ApplicationId appId); - - /** - * Returns list of all existing requests ordered by priority. - * - * @return list of existing packet requests - */ - List<PacketRequest> getRequests(); - - /** - * Emits the specified outbound packet onto the network. - * - * @param packet outbound packet - */ - void emit(OutboundPacket packet); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java deleted file mode 100644 index d83fc9a2..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.packet; - -import org.onosproject.store.Store; - -import java.util.List; - -/** - * Manages routing of outbound packets. - */ -public interface PacketStore extends Store<PacketEvent, PacketStoreDelegate> { - - /** - * Decides which instance should emit the packet and forwards the packet to - * that instance. The relevant PacketManager is notified via the - * PacketStoreDelegate that it should emit the packet. - * - * @param packet the packet to emit - */ - void emit(OutboundPacket packet); - - /** - * Requests intercept of packets that match the given selector. - * - * @param request a packet request - */ - void requestPackets(PacketRequest request); - - /** - * Cancels intercept of packets that match the given selector. - * - * @param request a packet request - */ - void cancelPackets(PacketRequest request); - - /** - * Obtains all existing requests in the system. - * - * @return list of packet requests in order of priority - */ - List<PacketRequest> existingRequests(); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java deleted file mode 100644 index 2e59b19d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2014 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.packet; - -import org.onosproject.store.StoreDelegate; - -/** - * Packet store delegate abstraction. - */ -public interface PacketStoreDelegate extends StoreDelegate<PacketEvent> { - - /** - * Requests that packets matching to following request be collected - * from all switches. - * - * @param request packet request - */ - void requestPackets(PacketRequest request); - - /** - * Requests that packets matching to following request no longer be - * collected from any switches. - * - * @param request packet request - */ - void cancelPackets(PacketRequest request); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/package-info.java deleted file mode 100644 index 0b9ea377..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2014 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. - */ - -/** - * Mechanism for processing inbound packets intercepted from the data plane and - * for emitting outbound packets onto the data plane. - */ -package org.onosproject.net.packet; |