Aaron Kruglikov
Committed by Gerrit Code Review

Added getter needed for a usage in onos-app-samples

Change-Id: Idd5b2102d96a6a526bd08eb12de6edc64efcb443
......@@ -29,6 +29,7 @@ import java.util.Objects;
*/
@Beta
public class DomainEdge extends AbstractEdge<DomainVertex> {
ConnectPoint connectPoint;
public DomainEdge(DomainVertex src, DomainVertex dst, ConnectPoint connectPoint) {
......@@ -62,4 +63,13 @@ public class DomainEdge extends AbstractEdge<DomainVertex> {
.add("connectPoint", connectPoint)
.toString();
}
/**
* Returns the connect point associated with the domain edge.
*
* @return this edges connect point
*/
public ConnectPoint connectPoint() {
return connectPoint;
}
}
......
......@@ -33,6 +33,7 @@ public class DomainVertex implements Vertex {
// A domain vertex is either an intent domain or a device:
private final IntentDomainId domainId;
// ----- or -----
private final DeviceId deviceId;
// Serialization constructor
......@@ -66,4 +67,22 @@ public class DomainVertex implements Vertex {
.toString();
}
}
/**
* Returns the device ID of this vertex if it is a device, returns null if it is a domain.
*
* @return the device ID of this vertex if applicable, else null
*/
public DeviceId deviceId() {
return deviceId;
}
/**
* Returns the domain ID of this vertex if it is a domain, returns null if it is a device.
*
* @return the domain ID of this vertex if applicable, else null
*/
public IntentDomainId domainId() {
return domainId;
}
}
......
......@@ -29,4 +29,13 @@ public abstract class IntentPrimitive {
public IntentPrimitive(ApplicationId appId) {
this.appId = appId;
}
}
/**
* The getter for the application ID associated with the intent primitive upon creation.
*
* @return the application ID associated with the intent primitive
*/
public ApplicationId appId() {
return appId;
}
}
\ No newline at end of file
......
......@@ -25,23 +25,44 @@ public class IntentResource {
private final IntentPrimitive primitive;
private final long tunnelId;
private final IntentDomainId domainId;
// TODO add other common fields
//String ingressTag;
//String egressTag;
//etc.
public IntentResource(IntentPrimitive primitive, long tunnelId) {
public IntentResource(IntentPrimitive primitive, long tunnelId, IntentDomainId domainId) {
this.primitive = primitive;
this.tunnelId = tunnelId;
this.domainId = domainId;
}
/**
* Returns the intent primitive associated with this resource as creation.
*
* @return this resource's intent primitive
*/
public IntentPrimitive primitive() {
return primitive;
}
/**
* Returns the tunnel ID associated with this resource as creation.
*
* @return this resource's tunnel ID
*/
public long tunnelId() {
return tunnelId;
}
/**
* Returns the domain ID associated with this resource as creation.
*
* @return this resource's domain ID
*/
public IntentDomainId domainId() {
return domainId;
}
}
......
......@@ -16,6 +16,7 @@
package org.onosproject.incubator.net.domain;
import com.google.common.annotations.Beta;
import org.onosproject.net.Path;
/**
* Context for intent primitive requests to an intent domain provider. A context
......@@ -29,12 +30,14 @@ import com.google.common.annotations.Beta;
public class RequestContext {
private final IntentDomain domain;
private final IntentResource resource;
private final Path path;
//TODO other common parameters:
//String cost;
public RequestContext(IntentDomain domain, IntentResource resource) {
public RequestContext(IntentDomain domain, IntentResource resource, Path path) {
this.domain = domain;
this.resource = resource;
this.path = path;
}
public IntentDomain domain() {
......@@ -44,4 +47,8 @@ public class RequestContext {
public IntentResource resource() {
return resource;
}
public Path path() {
return path;
}
}
......
......@@ -31,4 +31,21 @@ public class TunnelPrimitive extends IntentPrimitive {
this.one = one;
this.two = two;
}
/**
* The getter for the first connection point associated with a tunnel.
*
* @return the first connection point
*/
public ConnectPoint one() {
return one;
}
/**
* The getter for the second connection point associated with a tunnel.
* @return the second connection point
*/
public ConnectPoint two() {
return two;
}
}
......