Showing
24 changed files
with
170 additions
and
93 deletions
... | @@ -18,7 +18,7 @@ public class DefaultEdgeLink extends DefaultLink implements EdgeLink { | ... | @@ -18,7 +18,7 @@ public class DefaultEdgeLink extends DefaultLink implements EdgeLink { |
18 | * @param providerId provider identity | 18 | * @param providerId provider identity |
19 | * @param hostPoint host-side connection point | 19 | * @param hostPoint host-side connection point |
20 | * @param hostLocation location where host attaches to the network | 20 | * @param hostLocation location where host attaches to the network |
21 | - * @param isIngress true to indicated host-to-network direction; false | 21 | + * @param isIngress true to indicate host-to-network direction; false |
22 | * for network-to-host direction | 22 | * for network-to-host direction |
23 | * @param annotations optional key/value annotations | 23 | * @param annotations optional key/value annotations |
24 | */ | 24 | */ |
... | @@ -42,4 +42,20 @@ public class DefaultEdgeLink extends DefaultLink implements EdgeLink { | ... | @@ -42,4 +42,20 @@ public class DefaultEdgeLink extends DefaultLink implements EdgeLink { |
42 | public HostLocation hostLocation() { | 42 | public HostLocation hostLocation() { |
43 | return hostLocation; | 43 | return hostLocation; |
44 | } | 44 | } |
45 | + | ||
46 | + /** | ||
47 | + * Creates a phantom edge link, to an unspecified end-station. This link | ||
48 | + * does not represent any actually discovered link stored in the system. | ||
49 | + * | ||
50 | + * @param edgePort network edge port | ||
51 | + * @param isIngress true to indicate host-to-network direction; false | ||
52 | + * for network-to-host direction | ||
53 | + * @return new phantom edge link | ||
54 | + */ | ||
55 | + public static DefaultEdgeLink createEdgeLink(HostLocation edgePort, | ||
56 | + boolean isIngress) { | ||
57 | + return new DefaultEdgeLink(ProviderId.NONE, | ||
58 | + new ConnectPoint(HostId.NONE, PortNumber.P0), | ||
59 | + edgePort, isIngress); | ||
60 | + } | ||
45 | } | 61 | } | ... | ... |
... | @@ -10,6 +10,14 @@ import java.net.URI; | ... | @@ -10,6 +10,14 @@ import java.net.URI; |
10 | */ | 10 | */ |
11 | public final class HostId extends ElementId { | 11 | public final class HostId extends ElementId { |
12 | 12 | ||
13 | + private static final String NIC = "nic"; | ||
14 | + | ||
15 | + /** | ||
16 | + * Represents either no host, or an unspecified host; used for creating | ||
17 | + * open ingress/egress edge links. | ||
18 | + */ | ||
19 | + public static final HostId NONE = hostId(NIC + ":none-0"); | ||
20 | + | ||
13 | // Public construction is prohibited | 21 | // Public construction is prohibited |
14 | private HostId(URI uri) { | 22 | private HostId(URI uri) { |
15 | super(uri); | 23 | super(uri); |
... | @@ -43,8 +51,7 @@ public final class HostId extends ElementId { | ... | @@ -43,8 +51,7 @@ public final class HostId extends ElementId { |
43 | * @return host identifier | 51 | * @return host identifier |
44 | */ | 52 | */ |
45 | public static HostId hostId(MacAddress mac, VlanId vlanId) { | 53 | public static HostId hostId(MacAddress mac, VlanId vlanId) { |
46 | - // FIXME: use more efficient means of encoding | 54 | + return hostId(NIC + ":" + mac + "-" + vlanId); |
47 | - return hostId("nic" + ":" + mac + "-" + vlanId); | ||
48 | } | 55 | } |
49 | 56 | ||
50 | /** | 57 | /** | ... | ... |
... | @@ -9,6 +9,8 @@ import com.google.common.primitives.UnsignedLongs; | ... | @@ -9,6 +9,8 @@ import com.google.common.primitives.UnsignedLongs; |
9 | */ | 9 | */ |
10 | public final class PortNumber { | 10 | public final class PortNumber { |
11 | 11 | ||
12 | + public static final PortNumber P0 = portNumber(0); | ||
13 | + | ||
12 | // TODO: revisit the max and the logical port value assignments | 14 | // TODO: revisit the max and the logical port value assignments |
13 | 15 | ||
14 | private static final long MAX_NUMBER = (2L * Integer.MAX_VALUE) + 1; | 16 | private static final long MAX_NUMBER = (2L * Integer.MAX_VALUE) + 1; | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | //TODO is this the right package? | 2 | //TODO is this the right package? |
3 | 3 | ||
4 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
5 | - | ||
6 | import java.util.Collections; | 4 | import java.util.Collections; |
7 | import java.util.LinkedList; | 5 | import java.util.LinkedList; |
8 | import java.util.List; | 6 | import java.util.List; |
9 | 7 | ||
8 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
9 | + | ||
10 | /** | 10 | /** |
11 | * A list of BatchOperationEntry. | 11 | * A list of BatchOperationEntry. |
12 | * | 12 | * |
13 | * @param <T> the enum of operators <br> | 13 | * @param <T> the enum of operators <br> |
14 | * This enum must be defined in each sub-classes. | 14 | * This enum must be defined in each sub-classes. |
15 | - * | ||
16 | */ | 15 | */ |
17 | public abstract class BatchOperation<T extends BatchOperationEntry<?, ?>> { | 16 | public abstract class BatchOperation<T extends BatchOperationEntry<?, ?>> { |
17 | + | ||
18 | private List<T> ops; | 18 | private List<T> ops; |
19 | 19 | ||
20 | /** | 20 | /** | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | -import static com.google.common.base.Preconditions.checkNotNull; | 3 | +import com.google.common.base.Objects; |
4 | - | ||
5 | import org.onlab.onos.net.flow.TrafficSelector; | 4 | import org.onlab.onos.net.flow.TrafficSelector; |
6 | import org.onlab.onos.net.flow.TrafficTreatment; | 5 | import org.onlab.onos.net.flow.TrafficTreatment; |
7 | 6 | ||
8 | -import com.google.common.base.Objects; | 7 | +import static com.google.common.base.Preconditions.checkNotNull; |
9 | 8 | ||
10 | /** | 9 | /** |
11 | * Abstraction of connectivity intent for traffic matching some criteria. | 10 | * Abstraction of connectivity intent for traffic matching some criteria. |
... | @@ -26,17 +25,18 @@ public abstract class ConnectivityIntent extends AbstractIntent { | ... | @@ -26,17 +25,18 @@ public abstract class ConnectivityIntent extends AbstractIntent { |
26 | 25 | ||
27 | /** | 26 | /** |
28 | * Creates a connectivity intent that matches on the specified intent | 27 | * Creates a connectivity intent that matches on the specified intent |
29 | - * and applies the specified action. | 28 | + * and applies the specified treatement. |
30 | * | 29 | * |
31 | - * @param id intent identifier | 30 | + * @param intentId intent identifier |
32 | - * @param match traffic match | 31 | + * @param selector traffic selector |
33 | - * @param action action | 32 | + * @param treatement treatement |
34 | - * @throws NullPointerException if the match or action is null | 33 | + * @throws NullPointerException if the selector or treatement is null |
35 | */ | 34 | */ |
36 | - protected ConnectivityIntent(IntentId id, TrafficSelector match, TrafficTreatment action) { | 35 | + protected ConnectivityIntent(IntentId intentId, TrafficSelector selector, |
37 | - super(id); | 36 | + TrafficTreatment treatement) { |
38 | - this.selector = checkNotNull(match); | 37 | + super(intentId); |
39 | - this.treatment = checkNotNull(action); | 38 | + this.selector = checkNotNull(selector); |
39 | + this.treatment = checkNotNull(treatement); | ||
40 | } | 40 | } |
41 | 41 | ||
42 | /** | 42 | /** | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | -import static com.google.common.base.Preconditions.checkNotNull; | 3 | +import com.google.common.base.MoreObjects; |
4 | - | ||
5 | -import java.util.Objects; | ||
6 | - | ||
7 | import org.onlab.onos.net.HostId; | 4 | import org.onlab.onos.net.HostId; |
8 | import org.onlab.onos.net.flow.TrafficSelector; | 5 | import org.onlab.onos.net.flow.TrafficSelector; |
9 | import org.onlab.onos.net.flow.TrafficTreatment; | 6 | import org.onlab.onos.net.flow.TrafficTreatment; |
10 | 7 | ||
11 | -import com.google.common.base.MoreObjects; | 8 | +import java.util.Objects; |
9 | + | ||
10 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
12 | 11 | ||
13 | /** | 12 | /** |
14 | - * Abstraction of point-to-point connectivity. | 13 | + * Abstraction of end-station to end-station connectivity. |
15 | */ | 14 | */ |
16 | public class HostToHostIntent extends ConnectivityIntent { | 15 | public class HostToHostIntent extends ConnectivityIntent { |
17 | 16 | ||
... | @@ -22,17 +21,15 @@ public class HostToHostIntent extends ConnectivityIntent { | ... | @@ -22,17 +21,15 @@ public class HostToHostIntent extends ConnectivityIntent { |
22 | * Creates a new point-to-point intent with the supplied ingress/egress | 21 | * Creates a new point-to-point intent with the supplied ingress/egress |
23 | * ports. | 22 | * ports. |
24 | * | 23 | * |
25 | - * @param id intent identifier | 24 | + * @param intentId intent identifier |
26 | - * @param match traffic match | 25 | + * @param selector action |
27 | - * @param action action | 26 | + * @param treatment ingress port |
28 | - * @param ingressPort ingress port | ||
29 | - * @param egressPort egress port | ||
30 | * @throws NullPointerException if {@code ingressPort} or {@code egressPort} | 27 | * @throws NullPointerException if {@code ingressPort} or {@code egressPort} |
31 | * is null. | 28 | * is null. |
32 | */ | 29 | */ |
33 | - public HostToHostIntent(IntentId id, HostId src, HostId dst, | 30 | + public HostToHostIntent(IntentId intentId, HostId src, HostId dst, |
34 | TrafficSelector selector, TrafficTreatment treatment) { | 31 | TrafficSelector selector, TrafficTreatment treatment) { |
35 | - super(id, selector, treatment); | 32 | + super(intentId, selector, treatment); |
36 | this.src = checkNotNull(src); | 33 | this.src = checkNotNull(src); |
37 | this.dst = checkNotNull(dst); | 34 | this.dst = checkNotNull(dst); |
38 | } | 35 | } | ... | ... |
... | @@ -2,7 +2,7 @@ package org.onlab.onos.net.intent; | ... | @@ -2,7 +2,7 @@ package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Abstraction of an application level intent. | 4 | * Abstraction of an application level intent. |
5 | - * | 5 | + * <p/> |
6 | * Make sure that an Intent should be immutable when a new type is defined. | 6 | * Make sure that an Intent should be immutable when a new type is defined. |
7 | */ | 7 | */ |
8 | public interface Intent extends BatchOperationTarget { | 8 | public interface Intent extends BatchOperationTarget { | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | -import static com.google.common.base.Preconditions.checkNotNull; | 3 | +import com.google.common.base.MoreObjects; |
4 | +import org.onlab.onos.event.AbstractEvent; | ||
4 | 5 | ||
5 | import java.util.Objects; | 6 | import java.util.Objects; |
6 | 7 | ||
7 | -import org.onlab.onos.event.AbstractEvent; | 8 | +import static com.google.common.base.Preconditions.checkNotNull; |
8 | - | ||
9 | -import com.google.common.base.MoreObjects; | ||
10 | 9 | ||
11 | /** | 10 | /** |
12 | * A class to represent an intent related event. | 11 | * A class to represent an intent related event. | ... | ... |
... | @@ -2,7 +2,7 @@ package org.onlab.onos.net.intent; | ... | @@ -2,7 +2,7 @@ package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * Intent identifier suitable as an external key. | 4 | * Intent identifier suitable as an external key. |
5 | - * | 5 | + * <p/> |
6 | * This class is immutable. | 6 | * This class is immutable. |
7 | */ | 7 | */ |
8 | public final class IntentId implements BatchOperationTarget { | 8 | public final class IntentId implements BatchOperationTarget { | ... | ... |
... | @@ -7,7 +7,7 @@ package org.onlab.onos.net.intent; | ... | @@ -7,7 +7,7 @@ package org.onlab.onos.net.intent; |
7 | public interface IntentService { | 7 | public interface IntentService { |
8 | /** | 8 | /** |
9 | * Submits an intent into the system. | 9 | * Submits an intent into the system. |
10 | - * | 10 | + * <p/> |
11 | * This is an asynchronous request meaning that any compiling or | 11 | * This is an asynchronous request meaning that any compiling or |
12 | * installation activities may be done at later time. | 12 | * installation activities may be done at later time. |
13 | * | 13 | * |
... | @@ -17,7 +17,7 @@ public interface IntentService { | ... | @@ -17,7 +17,7 @@ public interface IntentService { |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Withdraws an intent from the system. | 19 | * Withdraws an intent from the system. |
20 | - * | 20 | + * <p/> |
21 | * This is an asynchronous request meaning that the environment may be | 21 | * This is an asynchronous request meaning that the environment may be |
22 | * affected at later time. | 22 | * affected at later time. |
23 | * | 23 | * |
... | @@ -28,7 +28,7 @@ public interface IntentService { | ... | @@ -28,7 +28,7 @@ public interface IntentService { |
28 | /** | 28 | /** |
29 | * Submits a batch of submit & withdraw operations. Such a batch is | 29 | * Submits a batch of submit & withdraw operations. Such a batch is |
30 | * assumed to be processed together. | 30 | * assumed to be processed together. |
31 | - * | 31 | + * <p/> |
32 | * This is an asynchronous request meaning that the environment may be | 32 | * This is an asynchronous request meaning that the environment may be |
33 | * affected at later time. | 33 | * affected at later time. |
34 | * | 34 | * | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | -import java.util.List; | ||
4 | - | ||
5 | import org.onlab.onos.store.Store; | 3 | import org.onlab.onos.store.Store; |
6 | 4 | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | /** | 7 | /** |
8 | * Manages inventory of end-station intents; not intended for direct use. | 8 | * Manages inventory of end-station intents; not intended for direct use. |
9 | */ | 9 | */ |
... | @@ -21,13 +21,12 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { | ... | @@ -21,13 +21,12 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
21 | * Removes the specified intent from the inventory. | 21 | * Removes the specified intent from the inventory. |
22 | * | 22 | * |
23 | * @param intentId intent identification | 23 | * @param intentId intent identification |
24 | - * @return remove event or null if intent was not found | 24 | + * @return removed state transition event or null if intent was not found |
25 | */ | 25 | */ |
26 | - IntentEvent removeIntent(IntentId intent); | 26 | + IntentEvent removeIntent(IntentId intentId); |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Returns the number of intents in the store. | 29 | * Returns the number of intents in the store. |
30 | - * | ||
31 | */ | 30 | */ |
32 | long getIntentCount(); | 31 | long getIntentCount(); |
33 | 32 | ||
... | @@ -46,19 +45,52 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { | ... | @@ -46,19 +45,52 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
46 | */ | 45 | */ |
47 | Intent getIntent(IntentId intentId); | 46 | Intent getIntent(IntentId intentId); |
48 | 47 | ||
49 | - IntentState getIntentState(IntentId id); | 48 | + /** |
49 | + * Returns the state of the specified intent. | ||
50 | + * | ||
51 | + * @param intentId intent identification | ||
52 | + * @return current intent state | ||
53 | + */ | ||
54 | + IntentState getIntentState(IntentId intentId); | ||
50 | 55 | ||
51 | /** | 56 | /** |
52 | * Sets the state of the specified intent to the new state. | 57 | * Sets the state of the specified intent to the new state. |
53 | * | 58 | * |
54 | * @param intent intent whose state is to be changed | 59 | * @param intent intent whose state is to be changed |
55 | * @param newState new state | 60 | * @param newState new state |
61 | + * @return state transition event | ||
56 | */ | 62 | */ |
57 | IntentEvent setState(Intent intent, IntentState newState); | 63 | IntentEvent setState(Intent intent, IntentState newState); |
58 | 64 | ||
59 | - IntentEvent addInstallableIntents(IntentId intentId, List<InstallableIntent> result); | 65 | + /** |
66 | + * Adds the installable intents which resulted from compilation of the | ||
67 | + * specified original intent. | ||
68 | + * | ||
69 | + * @param intentId original intent identifier | ||
70 | + * @param installableIntents compiled installable intents | ||
71 | + * @return compiled state transition event | ||
72 | + */ | ||
73 | + IntentEvent addInstallableIntents(IntentId intentId, | ||
74 | + List<InstallableIntent> installableIntents); | ||
60 | 75 | ||
76 | + /** | ||
77 | + * Returns the list of the installable events associated with the specified | ||
78 | + * original intent. | ||
79 | + * | ||
80 | + * @param intentId original intent identifier | ||
81 | + * @return compiled installable intents | ||
82 | + */ | ||
61 | List<InstallableIntent> getInstallableIntents(IntentId intentId); | 83 | List<InstallableIntent> getInstallableIntents(IntentId intentId); |
62 | 84 | ||
85 | + // TODO: this should be triggered from with the store as a result of removeIntent call | ||
86 | + | ||
87 | + /** | ||
88 | + * Removes any installable intents which resulted from compilation of the | ||
89 | + * specified original intent. | ||
90 | + * | ||
91 | + * @param intentId original intent identifier | ||
92 | + * @return compiled state transition event | ||
93 | + */ | ||
63 | void removeInstalledIntents(IntentId intentId); | 94 | void removeInstalledIntents(IntentId intentId); |
95 | + | ||
64 | } | 96 | } | ... | ... |
... | @@ -3,7 +3,7 @@ package org.onlab.onos.net.intent; | ... | @@ -3,7 +3,7 @@ package org.onlab.onos.net.intent; |
3 | import org.onlab.onos.store.StoreDelegate; | 3 | import org.onlab.onos.store.StoreDelegate; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * Infrastructure link store delegate abstraction. | 6 | + * Intent store delegate abstraction. |
7 | */ | 7 | */ |
8 | public interface IntentStoreDelegate extends StoreDelegate<IntentEvent> { | 8 | public interface IntentStoreDelegate extends StoreDelegate<IntentEvent> { |
9 | } | 9 | } | ... | ... |
... | @@ -35,8 +35,10 @@ public class MultiPointToSinglePointIntent extends ConnectivityIntent { | ... | @@ -35,8 +35,10 @@ public class MultiPointToSinglePointIntent extends ConnectivityIntent { |
35 | * @throws IllegalArgumentException if the size of {@code ingressPorts} is | 35 | * @throws IllegalArgumentException if the size of {@code ingressPorts} is |
36 | * not more than 1 | 36 | * not more than 1 |
37 | */ | 37 | */ |
38 | - public MultiPointToSinglePointIntent(IntentId id, TrafficSelector match, TrafficTreatment action, | 38 | + public MultiPointToSinglePointIntent(IntentId id, TrafficSelector match, |
39 | - Set<ConnectPoint> ingressPorts, ConnectPoint egressPort) { | 39 | + TrafficTreatment action, |
40 | + Set<ConnectPoint> ingressPorts, | ||
41 | + ConnectPoint egressPort) { | ||
40 | super(id, match, action); | 42 | super(id, match, action); |
41 | 43 | ||
42 | checkNotNull(ingressPorts); | 44 | checkNotNull(ingressPorts); | ... | ... |
... | @@ -3,30 +3,30 @@ package org.onlab.onos.net.intent; | ... | @@ -3,30 +3,30 @@ package org.onlab.onos.net.intent; |
3 | import org.onlab.onos.net.ConnectPoint; | 3 | import org.onlab.onos.net.ConnectPoint; |
4 | 4 | ||
5 | // TODO: consider if this intent should be sub-class of ConnectivityIntent | 5 | // TODO: consider if this intent should be sub-class of ConnectivityIntent |
6 | + | ||
6 | /** | 7 | /** |
7 | * An optical layer Intent for a connectivity from a transponder port to another | 8 | * An optical layer Intent for a connectivity from a transponder port to another |
8 | * transponder port. | 9 | * transponder port. |
9 | - * <p> | 10 | + * <p/> |
10 | * This class doesn't accepts lambda specifier. This class computes path between | 11 | * This class doesn't accepts lambda specifier. This class computes path between |
11 | * ports and assign lambda automatically. The lambda can be specified using | 12 | * ports and assign lambda automatically. The lambda can be specified using |
12 | * OpticalPathFlow class. | 13 | * OpticalPathFlow class. |
13 | */ | 14 | */ |
14 | public class OpticalConnectivityIntent extends AbstractIntent { | 15 | public class OpticalConnectivityIntent extends AbstractIntent { |
15 | - protected ConnectPoint srcConnectPoint; | 16 | + protected ConnectPoint src; |
16 | - protected ConnectPoint dstConnectPoint; | 17 | + protected ConnectPoint dst; |
17 | 18 | ||
18 | /** | 19 | /** |
19 | * Constructor. | 20 | * Constructor. |
20 | * | 21 | * |
21 | * @param id ID for this new Intent object. | 22 | * @param id ID for this new Intent object. |
22 | - * @param srcConnectPoint The source transponder port. | 23 | + * @param src The source transponder port. |
23 | - * @param dstConnectPoint The destination transponder port. | 24 | + * @param dst The destination transponder port. |
24 | */ | 25 | */ |
25 | - public OpticalConnectivityIntent(IntentId id, | 26 | + public OpticalConnectivityIntent(IntentId id, ConnectPoint src, ConnectPoint dst) { |
26 | - ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) { | ||
27 | super(id); | 27 | super(id); |
28 | - this.srcConnectPoint = srcConnectPoint; | 28 | + this.src = src; |
29 | - this.dstConnectPoint = dstConnectPoint; | 29 | + this.dst = dst; |
30 | } | 30 | } |
31 | 31 | ||
32 | /** | 32 | /** |
... | @@ -34,8 +34,8 @@ public class OpticalConnectivityIntent extends AbstractIntent { | ... | @@ -34,8 +34,8 @@ public class OpticalConnectivityIntent extends AbstractIntent { |
34 | */ | 34 | */ |
35 | protected OpticalConnectivityIntent() { | 35 | protected OpticalConnectivityIntent() { |
36 | super(); | 36 | super(); |
37 | - this.srcConnectPoint = null; | 37 | + this.src = null; |
38 | - this.dstConnectPoint = null; | 38 | + this.dst = null; |
39 | } | 39 | } |
40 | 40 | ||
41 | /** | 41 | /** |
... | @@ -44,7 +44,7 @@ public class OpticalConnectivityIntent extends AbstractIntent { | ... | @@ -44,7 +44,7 @@ public class OpticalConnectivityIntent extends AbstractIntent { |
44 | * @return The source transponder port. | 44 | * @return The source transponder port. |
45 | */ | 45 | */ |
46 | public ConnectPoint getSrcConnectPoint() { | 46 | public ConnectPoint getSrcConnectPoint() { |
47 | - return srcConnectPoint; | 47 | + return src; |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
... | @@ -52,7 +52,7 @@ public class OpticalConnectivityIntent extends AbstractIntent { | ... | @@ -52,7 +52,7 @@ public class OpticalConnectivityIntent extends AbstractIntent { |
52 | * | 52 | * |
53 | * @return The source transponder port. | 53 | * @return The source transponder port. |
54 | */ | 54 | */ |
55 | - public ConnectPoint getDstConnectPoint() { | 55 | + public ConnectPoint getDst() { |
56 | - return dstConnectPoint; | 56 | + return dst; |
57 | } | 57 | } |
58 | } | 58 | } | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | -import static com.google.common.base.Preconditions.checkNotNull; | 3 | +import com.google.common.base.MoreObjects; |
4 | - | ||
5 | -import java.util.Objects; | ||
6 | - | ||
7 | import org.onlab.onos.net.ConnectPoint; | 4 | import org.onlab.onos.net.ConnectPoint; |
8 | import org.onlab.onos.net.flow.TrafficSelector; | 5 | import org.onlab.onos.net.flow.TrafficSelector; |
9 | import org.onlab.onos.net.flow.TrafficTreatment; | 6 | import org.onlab.onos.net.flow.TrafficTreatment; |
10 | 7 | ||
11 | -import com.google.common.base.MoreObjects; | 8 | +import java.util.Objects; |
9 | + | ||
10 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
12 | 11 | ||
13 | /** | 12 | /** |
14 | * Abstraction of point-to-point connectivity. | 13 | * Abstraction of point-to-point connectivity. |
... | @@ -23,15 +22,17 @@ public class PointToPointIntent extends ConnectivityIntent { | ... | @@ -23,15 +22,17 @@ public class PointToPointIntent extends ConnectivityIntent { |
23 | * ports. | 22 | * ports. |
24 | * | 23 | * |
25 | * @param id intent identifier | 24 | * @param id intent identifier |
26 | - * @param match traffic match | 25 | + * @param selector traffic selector |
27 | - * @param action action | 26 | + * @param treatment treatment |
28 | * @param ingressPort ingress port | 27 | * @param ingressPort ingress port |
29 | * @param egressPort egress port | 28 | * @param egressPort egress port |
30 | * @throws NullPointerException if {@code ingressPort} or {@code egressPort} is null. | 29 | * @throws NullPointerException if {@code ingressPort} or {@code egressPort} is null. |
31 | */ | 30 | */ |
32 | - public PointToPointIntent(IntentId id, TrafficSelector match, TrafficTreatment action, | 31 | + public PointToPointIntent(IntentId id, TrafficSelector selector, |
33 | - ConnectPoint ingressPort, ConnectPoint egressPort) { | 32 | + TrafficTreatment treatment, |
34 | - super(id, match, action); | 33 | + ConnectPoint ingressPort, |
34 | + ConnectPoint egressPort) { | ||
35 | + super(id, selector, treatment); | ||
35 | this.ingressPort = checkNotNull(ingressPort); | 36 | this.ingressPort = checkNotNull(ingressPort); |
36 | this.egressPort = checkNotNull(egressPort); | 37 | this.egressPort = checkNotNull(egressPort); |
37 | } | 38 | } | ... | ... |
1 | package org.onlab.onos.net.intent; | 1 | package org.onlab.onos.net.intent; |
2 | 2 | ||
3 | -import static com.google.common.base.Preconditions.checkArgument; | 3 | +import com.google.common.base.MoreObjects; |
4 | -import static com.google.common.base.Preconditions.checkNotNull; | 4 | +import com.google.common.collect.Sets; |
5 | - | ||
6 | -import java.util.Objects; | ||
7 | -import java.util.Set; | ||
8 | - | ||
9 | import org.onlab.onos.net.ConnectPoint; | 5 | import org.onlab.onos.net.ConnectPoint; |
10 | import org.onlab.onos.net.flow.TrafficSelector; | 6 | import org.onlab.onos.net.flow.TrafficSelector; |
11 | import org.onlab.onos.net.flow.TrafficTreatment; | 7 | import org.onlab.onos.net.flow.TrafficTreatment; |
12 | 8 | ||
13 | -import com.google.common.base.MoreObjects; | 9 | +import java.util.Objects; |
14 | -import com.google.common.collect.Sets; | 10 | +import java.util.Set; |
11 | + | ||
12 | +import static com.google.common.base.Preconditions.checkArgument; | ||
13 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
15 | 14 | ||
16 | /** | 15 | /** |
17 | * Abstraction of single source, multiple destination connectivity intent. | 16 | * Abstraction of single source, multiple destination connectivity intent. |
... | @@ -25,8 +24,8 @@ public class SinglePointToMultiPointIntent extends ConnectivityIntent { | ... | @@ -25,8 +24,8 @@ public class SinglePointToMultiPointIntent extends ConnectivityIntent { |
25 | * Creates a new single-to-multi point connectivity intent. | 24 | * Creates a new single-to-multi point connectivity intent. |
26 | * | 25 | * |
27 | * @param id intent identifier | 26 | * @param id intent identifier |
28 | - * @param match traffic match | 27 | + * @param selector traffic selector |
29 | - * @param action action | 28 | + * @param treatment treatment |
30 | * @param ingressPort port on which traffic will ingress | 29 | * @param ingressPort port on which traffic will ingress |
31 | * @param egressPorts set of ports on which traffic will egress | 30 | * @param egressPorts set of ports on which traffic will egress |
32 | * @throws NullPointerException if {@code ingressPort} or | 31 | * @throws NullPointerException if {@code ingressPort} or |
... | @@ -34,10 +33,11 @@ public class SinglePointToMultiPointIntent extends ConnectivityIntent { | ... | @@ -34,10 +33,11 @@ public class SinglePointToMultiPointIntent extends ConnectivityIntent { |
34 | * @throws IllegalArgumentException if the size of {@code egressPorts} is | 33 | * @throws IllegalArgumentException if the size of {@code egressPorts} is |
35 | * not more than 1 | 34 | * not more than 1 |
36 | */ | 35 | */ |
37 | - public SinglePointToMultiPointIntent(IntentId id, TrafficSelector match, TrafficTreatment action, | 36 | + public SinglePointToMultiPointIntent(IntentId id, TrafficSelector selector, |
37 | + TrafficTreatment treatment, | ||
38 | ConnectPoint ingressPort, | 38 | ConnectPoint ingressPort, |
39 | Set<ConnectPoint> egressPorts) { | 39 | Set<ConnectPoint> egressPorts) { |
40 | - super(id, match, action); | 40 | + super(id, selector, treatment); |
41 | 41 | ||
42 | checkNotNull(egressPorts); | 42 | checkNotNull(egressPorts); |
43 | checkArgument(!egressPorts.isEmpty(), | 43 | checkArgument(!egressPorts.isEmpty(), | ... | ... |
1 | /** | 1 | /** |
2 | - * Intent Package. TODO | 2 | + * Set of abstractions for conveying high-level intents for treatment of |
3 | + * selected network traffic by allowing applications to express the | ||
4 | + * <em>what</em> rather than the <em>how</em>. This makes such instructions | ||
5 | + * largely independent of topology and device specifics, thus allowing them to | ||
6 | + * survive topology mutations. | ||
3 | */ | 7 | */ |
4 | - | ||
5 | package org.onlab.onos.net.intent; | 8 | package org.onlab.onos.net.intent; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -3,6 +3,7 @@ package org.onlab.onos.net.provider; | ... | @@ -3,6 +3,7 @@ package org.onlab.onos.net.provider; |
3 | import java.util.Objects; | 3 | import java.util.Objects; |
4 | 4 | ||
5 | import static com.google.common.base.MoreObjects.toStringHelper; | 5 | import static com.google.common.base.MoreObjects.toStringHelper; |
6 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * External identity of a {@link org.onlab.onos.net.provider.Provider} family. | 9 | * External identity of a {@link org.onlab.onos.net.provider.Provider} family. |
... | @@ -19,10 +20,22 @@ import static com.google.common.base.MoreObjects.toStringHelper; | ... | @@ -19,10 +20,22 @@ import static com.google.common.base.MoreObjects.toStringHelper; |
19 | */ | 20 | */ |
20 | public class ProviderId { | 21 | public class ProviderId { |
21 | 22 | ||
23 | + /** | ||
24 | + * Represents no provider ID. | ||
25 | + */ | ||
26 | + public static final ProviderId NONE = new ProviderId(); | ||
27 | + | ||
22 | private final String scheme; | 28 | private final String scheme; |
23 | private final String id; | 29 | private final String id; |
24 | private final boolean ancillary; | 30 | private final boolean ancillary; |
25 | 31 | ||
32 | + // For serialization | ||
33 | + private ProviderId() { | ||
34 | + scheme = null; | ||
35 | + id = null; | ||
36 | + ancillary = false; | ||
37 | + } | ||
38 | + | ||
26 | /** | 39 | /** |
27 | * Creates a new primary provider identifier from the specified string. | 40 | * Creates a new primary provider identifier from the specified string. |
28 | * The providers are expected to follow the reverse DNS convention, e.g. | 41 | * The providers are expected to follow the reverse DNS convention, e.g. |
... | @@ -45,8 +58,8 @@ public class ProviderId { | ... | @@ -45,8 +58,8 @@ public class ProviderId { |
45 | * @param ancillary ancillary provider indicator | 58 | * @param ancillary ancillary provider indicator |
46 | */ | 59 | */ |
47 | public ProviderId(String scheme, String id, boolean ancillary) { | 60 | public ProviderId(String scheme, String id, boolean ancillary) { |
48 | - this.scheme = scheme; | 61 | + this.scheme = checkNotNull(scheme, "Scheme cannot be null"); |
49 | - this.id = id; | 62 | + this.id = checkNotNull(id, "ID cannot be null"); |
50 | this.ancillary = ancillary; | 63 | this.ancillary = ancillary; |
51 | } | 64 | } |
52 | 65 | ... | ... |
... | @@ -3,7 +3,7 @@ package org.onlab.onos.net.intent.impl; | ... | @@ -3,7 +3,7 @@ package org.onlab.onos.net.intent.impl; |
3 | import org.onlab.onos.net.intent.IntentId; | 3 | import org.onlab.onos.net.intent.IntentId; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | - * An implementation of {@link net.onrc.onos.core.util.IdGenerator} of intent ID, | 6 | + * An implementation of {@link org.onlab.onos.net.intent.IdGenerator} of intent ID, |
7 | * which uses {@link IdBlockAllocator}. | 7 | * which uses {@link IdBlockAllocator}. |
8 | */ | 8 | */ |
9 | public class IdBlockAllocatorBasedIntentIdGenerator extends AbstractBlockAllocatorBasedIdGenerator<IntentId> { | 9 | public class IdBlockAllocatorBasedIntentIdGenerator extends AbstractBlockAllocatorBasedIdGenerator<IntentId> { | ... | ... |
1 | /** | 1 | /** |
2 | - * Intent Service Implementation. TODO | 2 | + * Core subsystem for tracking high-level intents for treatment of selected |
3 | + * network traffic. | ||
3 | */ | 4 | */ |
4 | package org.onlab.onos.net.intent.impl; | 5 | package org.onlab.onos.net.intent.impl; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -480,7 +480,7 @@ | ... | @@ -480,7 +480,7 @@ |
480 | <group> | 480 | <group> |
481 | <title>Core Subsystems</title> | 481 | <title>Core Subsystems</title> |
482 | <packages> | 482 | <packages> |
483 | - org.onlab.onos.cluster.impl:org.onlab.onos.net.device.impl:org.onlab.onos.net.link.impl:org.onlab.onos.net.host.impl:org.onlab.onos.net.topology.impl:org.onlab.onos.net.packet.impl:org.onlab.onos.net.flow.impl:org.onlab.onos.store.trivial.*:org.onlab.onos.net.*.impl:org.onlab.onos.event.impl:org.onlab.onos.store.* | 483 | + org.onlab.onos.cluster.impl:org.onlab.onos.net.device.impl:org.onlab.onos.net.link.impl:org.onlab.onos.net.host.impl:org.onlab.onos.net.topology.impl:org.onlab.onos.net.packet.impl:org.onlab.onos.net.flow.impl:org.onlab.onos.store.trivial.*:org.onlab.onos.net.*.impl:org.onlab.onos.event.impl:org.onlab.onos.store.*:org.onlab.onos.net.intent.impl |
484 | </packages> | 484 | </packages> |
485 | </group> | 485 | </group> |
486 | <group> | 486 | <group> | ... | ... |
-
Please register or login to post a comment