tom

Corrected some javadocs.

Showing 24 changed files with 193 additions and 116 deletions
......@@ -18,9 +18,9 @@ public class DefaultEdgeLink extends DefaultLink implements EdgeLink {
* @param providerId provider identity
* @param hostPoint host-side connection point
* @param hostLocation location where host attaches to the network
* @param isIngress true to indicated host-to-network direction; false
* @param isIngress true to indicate host-to-network direction; false
* for network-to-host direction
* @param annotations optional key/value annotations
* @param annotations optional key/value annotations
*/
public DefaultEdgeLink(ProviderId providerId, ConnectPoint hostPoint,
HostLocation hostLocation, boolean isIngress,
......@@ -42,4 +42,20 @@ public class DefaultEdgeLink extends DefaultLink implements EdgeLink {
public HostLocation hostLocation() {
return hostLocation;
}
/**
* Creates a phantom edge link, to an unspecified end-station. This link
* does not represent any actually discovered link stored in the system.
*
* @param edgePort network edge port
* @param isIngress true to indicate host-to-network direction; false
* for network-to-host direction
* @return new phantom edge link
*/
public static DefaultEdgeLink createEdgeLink(HostLocation edgePort,
boolean isIngress) {
return new DefaultEdgeLink(ProviderId.NONE,
new ConnectPoint(HostId.NONE, PortNumber.P0),
edgePort, isIngress);
}
}
......
......@@ -10,6 +10,14 @@ import java.net.URI;
*/
public final class HostId extends ElementId {
private static final String NIC = "nic";
/**
* Represents either no host, or an unspecified host; used for creating
* open ingress/egress edge links.
*/
public static final HostId NONE = hostId(NIC + ":none-0");
// Public construction is prohibited
private HostId(URI uri) {
super(uri);
......@@ -43,8 +51,7 @@ public final class HostId extends ElementId {
* @return host identifier
*/
public static HostId hostId(MacAddress mac, VlanId vlanId) {
// FIXME: use more efficient means of encoding
return hostId("nic" + ":" + mac + "-" + vlanId);
return hostId(NIC + ":" + mac + "-" + vlanId);
}
/**
......
......@@ -9,6 +9,8 @@ import com.google.common.primitives.UnsignedLongs;
*/
public final class PortNumber {
public static final PortNumber P0 = portNumber(0);
// TODO: revisit the max and the logical port value assignments
private static final long MAX_NUMBER = (2L * Integer.MAX_VALUE) + 1;
......
package org.onlab.onos.net.intent;
//TODO is this the right package?
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A list of BatchOperationEntry.
*
* @param <T> the enum of operators <br>
* This enum must be defined in each sub-classes.
*
* This enum must be defined in each sub-classes.
*/
public abstract class BatchOperation<T extends BatchOperationEntry<?, ?>> {
private List<T> ops;
/**
......
package org.onlab.onos.net.intent;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import com.google.common.base.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Abstraction of connectivity intent for traffic matching some criteria.
......@@ -26,17 +25,18 @@ public abstract class ConnectivityIntent extends AbstractIntent {
/**
* Creates a connectivity intent that matches on the specified intent
* and applies the specified action.
* and applies the specified treatement.
*
* @param id intent identifier
* @param match traffic match
* @param action action
* @throws NullPointerException if the match or action is null
* @param intentId intent identifier
* @param selector traffic selector
* @param treatement treatement
* @throws NullPointerException if the selector or treatement is null
*/
protected ConnectivityIntent(IntentId id, TrafficSelector match, TrafficTreatment action) {
super(id);
this.selector = checkNotNull(match);
this.treatment = checkNotNull(action);
protected ConnectivityIntent(IntentId intentId, TrafficSelector selector,
TrafficTreatment treatement) {
super(intentId);
this.selector = checkNotNull(selector);
this.treatment = checkNotNull(treatement);
}
/**
......
package org.onlab.onos.net.intent;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.onlab.onos.net.HostId;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import com.google.common.base.MoreObjects;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Abstraction of point-to-point connectivity.
* Abstraction of end-station to end-station connectivity.
*/
public class HostToHostIntent extends ConnectivityIntent {
......@@ -22,17 +21,15 @@ public class HostToHostIntent extends ConnectivityIntent {
* Creates a new point-to-point intent with the supplied ingress/egress
* ports.
*
* @param id intent identifier
* @param match traffic match
* @param action action
* @param ingressPort ingress port
* @param egressPort egress port
* @param intentId intent identifier
* @param selector action
* @param treatment ingress port
* @throws NullPointerException if {@code ingressPort} or {@code egressPort}
* is null.
* is null.
*/
public HostToHostIntent(IntentId id, HostId src, HostId dst,
TrafficSelector selector, TrafficTreatment treatment) {
super(id, selector, treatment);
public HostToHostIntent(IntentId intentId, HostId src, HostId dst,
TrafficSelector selector, TrafficTreatment treatment) {
super(intentId, selector, treatment);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
}
......
......@@ -2,7 +2,7 @@ package org.onlab.onos.net.intent;
/**
* Abstraction of an application level intent.
*
* <p/>
* Make sure that an Intent should be immutable when a new type is defined.
*/
public interface Intent extends BatchOperationTarget {
......
package org.onlab.onos.net.intent;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.MoreObjects;
import org.onlab.onos.event.AbstractEvent;
import java.util.Objects;
import org.onlab.onos.event.AbstractEvent;
import com.google.common.base.MoreObjects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A class to represent an intent related event.
......@@ -24,10 +23,10 @@ public class IntentEvent extends AbstractEvent<IntentState, Intent> {
/**
* Creates an event describing a state change of an intent.
*
* @param intent subject intent
* @param state new intent state
* @param intent subject intent
* @param state new intent state
* @param previous previous intent state
* @param time time the event created in milliseconds since start of epoch
* @param time time the event created in milliseconds since start of epoch
* @throws NullPointerException if the intent or state is null
*/
public IntentEvent(Intent intent, IntentState state, IntentState previous, long time) {
......
......@@ -26,7 +26,7 @@ public class IntentException extends RuntimeException {
* Constructs an exception with the specified message and the underlying cause.
*
* @param message the message describing the specific nature of the error
* @param cause the underlying cause of this error
* @param cause the underlying cause of this error
*/
public IntentException(String message, Throwable cause) {
super(message, cause);
......
......@@ -10,9 +10,9 @@ public interface IntentExtensionService {
/**
* Registers the specified compiler for the given intent class.
*
* @param cls intent class
* @param cls intent class
* @param compiler intent compiler
* @param <T> the type of intent
* @param <T> the type of intent
*/
<T extends Intent> void registerCompiler(Class<T> cls, IntentCompiler<T> compiler);
......@@ -34,9 +34,9 @@ public interface IntentExtensionService {
/**
* Registers the specified installer for the given installable intent class.
*
* @param cls installable intent class
* @param cls installable intent class
* @param installer intent installer
* @param <T> the type of installable intent
* @param <T> the type of installable intent
*/
<T extends InstallableIntent> void registerInstaller(Class<T> cls, IntentInstaller<T> installer);
......
......@@ -2,7 +2,7 @@ package org.onlab.onos.net.intent;
/**
* Intent identifier suitable as an external key.
*
* <p/>
* This class is immutable.
*/
public final class IntentId implements BatchOperationTarget {
......
......@@ -7,7 +7,7 @@ package org.onlab.onos.net.intent;
public interface IntentService {
/**
* Submits an intent into the system.
*
* <p/>
* This is an asynchronous request meaning that any compiling or
* installation activities may be done at later time.
*
......@@ -17,7 +17,7 @@ public interface IntentService {
/**
* Withdraws an intent from the system.
*
* <p/>
* This is an asynchronous request meaning that the environment may be
* affected at later time.
*
......@@ -28,7 +28,7 @@ public interface IntentService {
/**
* Submits a batch of submit &amp; withdraw operations. Such a batch is
* assumed to be processed together.
*
* <p/>
* This is an asynchronous request meaning that the environment may be
* affected at later time.
*
......@@ -63,7 +63,7 @@ public interface IntentService {
*
* @param id intent identifier
* @return the intent state or null if one with the given identifier is not
* found
* found
*/
IntentState getIntentState(IntentId id);
......
package org.onlab.onos.net.intent;
import java.util.List;
import org.onlab.onos.store.Store;
import java.util.List;
/**
* Manages inventory of end-station intents; not intended for direct use.
*/
......@@ -21,13 +21,12 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
* Removes the specified intent from the inventory.
*
* @param intentId intent identification
* @return remove event or null if intent was not found
* @return removed state transition event or null if intent was not found
*/
IntentEvent removeIntent(IntentId intent);
IntentEvent removeIntent(IntentId intentId);
/**
* Returns the number of intents in the store.
*
*/
long getIntentCount();
......@@ -46,19 +45,52 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
*/
Intent getIntent(IntentId intentId);
IntentState getIntentState(IntentId id);
/**
* Returns the state of the specified intent.
*
* @param intentId intent identification
* @return current intent state
*/
IntentState getIntentState(IntentId intentId);
/**
* Sets the state of the specified intent to the new state.
*
* @param intent intent whose state is to be changed
* @param intent intent whose state is to be changed
* @param newState new state
* @return state transition event
*/
IntentEvent setState(Intent intent, IntentState newState);
IntentEvent addInstallableIntents(IntentId intentId, List<InstallableIntent> result);
/**
* Adds the installable intents which resulted from compilation of the
* specified original intent.
*
* @param intentId original intent identifier
* @param installableIntents compiled installable intents
* @return compiled state transition event
*/
IntentEvent addInstallableIntents(IntentId intentId,
List<InstallableIntent> installableIntents);
/**
* Returns the list of the installable events associated with the specified
* original intent.
*
* @param intentId original intent identifier
* @return compiled installable intents
*/
List<InstallableIntent> getInstallableIntents(IntentId intentId);
// TODO: this should be triggered from with the store as a result of removeIntent call
/**
* Removes any installable intents which resulted from compilation of the
* specified original intent.
*
* @param intentId original intent identifier
* @return compiled state transition event
*/
void removeInstalledIntents(IntentId intentId);
}
......
......@@ -3,7 +3,7 @@ package org.onlab.onos.net.intent;
import org.onlab.onos.store.StoreDelegate;
/**
* Infrastructure link store delegate abstraction.
* Intent store delegate abstraction.
*/
public interface IntentStoreDelegate extends StoreDelegate<IntentEvent> {
}
......
......@@ -30,18 +30,20 @@ public class MultiPointToSinglePointIntent extends ConnectivityIntent {
* @param action action
* @param ingressPorts set of ports from which ingress traffic originates
* @param egressPort port to which traffic will egress
* @throws NullPointerException if {@code ingressPorts} or
* {@code egressPort} is null.
* @throws NullPointerException if {@code ingressPorts} or
* {@code egressPort} is null.
* @throws IllegalArgumentException if the size of {@code ingressPorts} is
* not more than 1
* not more than 1
*/
public MultiPointToSinglePointIntent(IntentId id, TrafficSelector match, TrafficTreatment action,
Set<ConnectPoint> ingressPorts, ConnectPoint egressPort) {
public MultiPointToSinglePointIntent(IntentId id, TrafficSelector match,
TrafficTreatment action,
Set<ConnectPoint> ingressPorts,
ConnectPoint egressPort) {
super(id, match, action);
checkNotNull(ingressPorts);
checkArgument(!ingressPorts.isEmpty(),
"there should be at least one ingress port");
"there should be at least one ingress port");
this.ingressPorts = Sets.newHashSet(ingressPorts);
this.egressPort = checkNotNull(egressPort);
......
......@@ -3,30 +3,30 @@ package org.onlab.onos.net.intent;
import org.onlab.onos.net.ConnectPoint;
// TODO: consider if this intent should be sub-class of ConnectivityIntent
/**
* An optical layer Intent for a connectivity from a transponder port to another
* transponder port.
* <p>
* <p/>
* This class doesn't accepts lambda specifier. This class computes path between
* ports and assign lambda automatically. The lambda can be specified using
* OpticalPathFlow class.
*/
public class OpticalConnectivityIntent extends AbstractIntent {
protected ConnectPoint srcConnectPoint;
protected ConnectPoint dstConnectPoint;
protected ConnectPoint src;
protected ConnectPoint dst;
/**
* Constructor.
*
* @param id ID for this new Intent object.
* @param srcConnectPoint The source transponder port.
* @param dstConnectPoint The destination transponder port.
* @param id ID for this new Intent object.
* @param src The source transponder port.
* @param dst The destination transponder port.
*/
public OpticalConnectivityIntent(IntentId id,
ConnectPoint srcConnectPoint, ConnectPoint dstConnectPoint) {
public OpticalConnectivityIntent(IntentId id, ConnectPoint src, ConnectPoint dst) {
super(id);
this.srcConnectPoint = srcConnectPoint;
this.dstConnectPoint = dstConnectPoint;
this.src = src;
this.dst = dst;
}
/**
......@@ -34,8 +34,8 @@ public class OpticalConnectivityIntent extends AbstractIntent {
*/
protected OpticalConnectivityIntent() {
super();
this.srcConnectPoint = null;
this.dstConnectPoint = null;
this.src = null;
this.dst = null;
}
/**
......@@ -44,7 +44,7 @@ public class OpticalConnectivityIntent extends AbstractIntent {
* @return The source transponder port.
*/
public ConnectPoint getSrcConnectPoint() {
return srcConnectPoint;
return src;
}
/**
......@@ -52,7 +52,7 @@ public class OpticalConnectivityIntent extends AbstractIntent {
*
* @return The source transponder port.
*/
public ConnectPoint getDstConnectPoint() {
return dstConnectPoint;
public ConnectPoint getDst() {
return dst;
}
}
......
package org.onlab.onos.net.intent;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import com.google.common.base.MoreObjects;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Abstraction of point-to-point connectivity.
......@@ -23,15 +22,17 @@ public class PointToPointIntent extends ConnectivityIntent {
* ports.
*
* @param id intent identifier
* @param match traffic match
* @param action action
* @param selector traffic selector
* @param treatment treatment
* @param ingressPort ingress port
* @param egressPort egress port
* @throws NullPointerException if {@code ingressPort} or {@code egressPort} is null.
*/
public PointToPointIntent(IntentId id, TrafficSelector match, TrafficTreatment action,
ConnectPoint ingressPort, ConnectPoint egressPort) {
super(id, match, action);
public PointToPointIntent(IntentId id, TrafficSelector selector,
TrafficTreatment treatment,
ConnectPoint ingressPort,
ConnectPoint egressPort) {
super(id, selector, treatment);
this.ingressPort = checkNotNull(ingressPort);
this.egressPort = checkNotNull(egressPort);
}
......
package org.onlab.onos.net.intent;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import java.util.Set;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Sets;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Sets;
import java.util.Objects;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Abstraction of single source, multiple destination connectivity intent.
......@@ -25,23 +24,24 @@ public class SinglePointToMultiPointIntent extends ConnectivityIntent {
* Creates a new single-to-multi point connectivity intent.
*
* @param id intent identifier
* @param match traffic match
* @param action action
* @param selector traffic selector
* @param treatment treatment
* @param ingressPort port on which traffic will ingress
* @param egressPorts set of ports on which traffic will egress
* @throws NullPointerException if {@code ingressPort} or
* {@code egressPorts} is null
* @throws NullPointerException if {@code ingressPort} or
* {@code egressPorts} is null
* @throws IllegalArgumentException if the size of {@code egressPorts} is
* not more than 1
* not more than 1
*/
public SinglePointToMultiPointIntent(IntentId id, TrafficSelector match, TrafficTreatment action,
public SinglePointToMultiPointIntent(IntentId id, TrafficSelector selector,
TrafficTreatment treatment,
ConnectPoint ingressPort,
Set<ConnectPoint> egressPorts) {
super(id, match, action);
super(id, selector, treatment);
checkNotNull(egressPorts);
checkArgument(!egressPorts.isEmpty(),
"there should be at least one egress port");
"there should be at least one egress port");
this.ingressPort = checkNotNull(ingressPort);
this.egressPorts = Sets.newHashSet(egressPorts);
......
/**
* Intent Package. TODO
* Set of abstractions for conveying high-level intents for treatment of
* selected network traffic by allowing applications to express the
* <em>what</em> rather than the <em>how</em>. This makes such instructions
* largely independent of topology and device specifics, thus allowing them to
* survive topology mutations.
*/
package org.onlab.onos.net.intent;
\ No newline at end of file
......
......@@ -3,6 +3,7 @@ package org.onlab.onos.net.provider;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* External identity of a {@link org.onlab.onos.net.provider.Provider} family.
......@@ -19,10 +20,22 @@ import static com.google.common.base.MoreObjects.toStringHelper;
*/
public class ProviderId {
/**
* Represents no provider ID.
*/
public static final ProviderId NONE = new ProviderId();
private final String scheme;
private final String id;
private final boolean ancillary;
// For serialization
private ProviderId() {
scheme = null;
id = null;
ancillary = false;
}
/**
* Creates a new primary provider identifier from the specified string.
* The providers are expected to follow the reverse DNS convention, e.g.
......@@ -45,8 +58,8 @@ public class ProviderId {
* @param ancillary ancillary provider indicator
*/
public ProviderId(String scheme, String id, boolean ancillary) {
this.scheme = scheme;
this.id = id;
this.scheme = checkNotNull(scheme, "Scheme cannot be null");
this.id = checkNotNull(id, "ID cannot be null");
this.ancillary = ancillary;
}
......
......@@ -3,7 +3,7 @@ package org.onlab.onos.net.intent.impl;
import org.onlab.onos.net.intent.IntentId;
/**
* An implementation of {@link net.onrc.onos.core.util.IdGenerator} of intent ID,
* An implementation of {@link org.onlab.onos.net.intent.IdGenerator} of intent ID,
* which uses {@link IdBlockAllocator}.
*/
public class IdBlockAllocatorBasedIntentIdGenerator extends AbstractBlockAllocatorBasedIdGenerator<IntentId> {
......
/**
* Intent Service Implementation. TODO
* Core subsystem for tracking high-level intents for treatment of selected
* network traffic.
*/
package org.onlab.onos.net.intent.impl;
\ No newline at end of file
......
/**
* Implementation of the cluster messaging mechanism.
*/
package org.onlab.onos.store.cluster.messaging.impl;
\ No newline at end of file
......@@ -480,7 +480,7 @@
<group>
<title>Core Subsystems</title>
<packages>
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.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
</packages>
</group>
<group>
......