Thomas Vachuska

Defined edge-port subsystem interface.

Change-Id: I4d376ea50292c0d2ab313e7d07a2aa0209a739c1
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.edge;
17 +
18 +import org.onosproject.event.AbstractEvent;
19 +import org.onosproject.net.ConnectPoint;
20 +
21 +/**
22 + * Describes an event pertaining to edge-port inventory.
23 + */
24 +public class EdgePortEvent extends AbstractEvent<EdgePortEvent.Type, ConnectPoint> {
25 +
26 + public enum Type {
27 + /**
28 + * Signifies that a new edge port was detected.
29 + */
30 + EDGE_PORT_ADDED,
31 +
32 + /**
33 + * Signifies that a new edge port vanished.
34 + */
35 + EDGE_PORT_REMOVED
36 + }
37 +
38 + /**
39 + * Creates a new edge port event.
40 + *
41 + * @param type event type
42 + * @param subject connection point subject
43 + */
44 + protected EdgePortEvent(Type type, ConnectPoint subject) {
45 + super(type, subject);
46 + }
47 +
48 + /**
49 + * Creates a new edge port event.
50 + *
51 + * @param type event type
52 + * @param subject connection point subject
53 + * @param time occurrence time
54 + */
55 + protected EdgePortEvent(Type type, ConnectPoint subject, long time) {
56 + super(type, subject, time);
57 + }
58 +
59 +}
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.edge;
17 +
18 +import org.onosproject.event.EventListener;
19 +
20 +/**
21 + * Entity capable of receiving edge port events.
22 + */
23 +public interface EdgePortListener extends EventListener<EdgePortEvent> {
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.edge;
17 +
18 +import org.onosproject.net.ConnectPoint;
19 +import org.onosproject.net.DeviceId;
20 +import org.onosproject.net.flow.TrafficTreatment;
21 +
22 +import java.nio.ByteBuffer;
23 +import java.util.Optional;
24 +
25 +/**
26 + * Service for interacting with an inventory of network edge ports.
27 + */
28 +public interface EdgePortService {
29 +
30 + /**
31 + * Indicates whether or not the specified connection point is an edge point.
32 + *
33 + * @param point connection point
34 + * @return true if edge point
35 + */
36 + boolean isEdgePoint(ConnectPoint point);
37 +
38 + /**
39 + * Returns a collection of all edge point within the current topology.
40 + *
41 + * @return iterable collection of all edge points
42 + */
43 + Iterable<ConnectPoint> getEdgePoint();
44 +
45 + /**
46 + * Returns a collection of all edge point for the specified device.
47 + *
48 + * @return iterable collection of all edge points for the device
49 + */
50 + Iterable<ConnectPoint> getEdgePoint(DeviceId deviceId);
51 +
52 + /**
53 + * Emits the specified packet, with optional treatment to all edge ports.
54 + *
55 + * @param data packet data
56 + * @param treatment optional traffic treatment to apply to the packet
57 + */
58 + void emitPacket(ByteBuffer data, Optional<TrafficTreatment> treatment);
59 +
60 + /**
61 + * Emits the specified packet, with optional treatment to all edge ports.
62 + *
63 + * @param deviceId device where to send the packet out
64 + * @param data packet data
65 + * @param treatment optional traffic treatment to apply to the packet
66 + */
67 + void emitPacket(DeviceId deviceId, ByteBuffer data,
68 + Optional<TrafficTreatment> treatment);
69 +
70 + /**
71 + * Adds a listener for edge port events.
72 + *
73 + * @param listener listener to be added
74 + */
75 + void addListener(EdgePortListener listener);
76 +
77 + /**
78 + * Removes the listener for edge port events.
79 + *
80 + * @param listener listener to be removed
81 + */
82 + void removeListener(EdgePortListener listener);
83 +
84 +}
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 + * Service for interacting with network edge.
19 + */
20 +package org.onosproject.net.edge;
...\ No newline at end of file ...\ No newline at end of file