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; ...@@ -29,6 +29,7 @@ import java.util.Objects;
29 */ 29 */
30 @Beta 30 @Beta
31 public class DomainEdge extends AbstractEdge<DomainVertex> { 31 public class DomainEdge extends AbstractEdge<DomainVertex> {
32 +
32 ConnectPoint connectPoint; 33 ConnectPoint connectPoint;
33 34
34 public DomainEdge(DomainVertex src, DomainVertex dst, ConnectPoint connectPoint) { 35 public DomainEdge(DomainVertex src, DomainVertex dst, ConnectPoint connectPoint) {
...@@ -62,4 +63,13 @@ public class DomainEdge extends AbstractEdge<DomainVertex> { ...@@ -62,4 +63,13 @@ public class DomainEdge extends AbstractEdge<DomainVertex> {
62 .add("connectPoint", connectPoint) 63 .add("connectPoint", connectPoint)
63 .toString(); 64 .toString();
64 } 65 }
66 +
67 + /**
68 + * Returns the connect point associated with the domain edge.
69 + *
70 + * @return this edges connect point
71 + */
72 + public ConnectPoint connectPoint() {
73 + return connectPoint;
74 + }
65 } 75 }
......
...@@ -33,6 +33,7 @@ public class DomainVertex implements Vertex { ...@@ -33,6 +33,7 @@ public class DomainVertex implements Vertex {
33 // A domain vertex is either an intent domain or a device: 33 // A domain vertex is either an intent domain or a device:
34 private final IntentDomainId domainId; 34 private final IntentDomainId domainId;
35 // ----- or ----- 35 // ----- or -----
36 +
36 private final DeviceId deviceId; 37 private final DeviceId deviceId;
37 38
38 // Serialization constructor 39 // Serialization constructor
...@@ -66,4 +67,22 @@ public class DomainVertex implements Vertex { ...@@ -66,4 +67,22 @@ public class DomainVertex implements Vertex {
66 .toString(); 67 .toString();
67 } 68 }
68 } 69 }
70 +
71 + /**
72 + * Returns the device ID of this vertex if it is a device, returns null if it is a domain.
73 + *
74 + * @return the device ID of this vertex if applicable, else null
75 + */
76 + public DeviceId deviceId() {
77 + return deviceId;
78 + }
79 +
80 + /**
81 + * Returns the domain ID of this vertex if it is a domain, returns null if it is a device.
82 + *
83 + * @return the domain ID of this vertex if applicable, else null
84 + */
85 + public IntentDomainId domainId() {
86 + return domainId;
87 + }
69 } 88 }
......
...@@ -29,4 +29,13 @@ public abstract class IntentPrimitive { ...@@ -29,4 +29,13 @@ public abstract class IntentPrimitive {
29 public IntentPrimitive(ApplicationId appId) { 29 public IntentPrimitive(ApplicationId appId) {
30 this.appId = appId; 30 this.appId = appId;
31 } 31 }
32 -} 32 +
33 + /**
34 + * The getter for the application ID associated with the intent primitive upon creation.
35 + *
36 + * @return the application ID associated with the intent primitive
37 + */
38 + public ApplicationId appId() {
39 + return appId;
40 + }
41 +}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -25,23 +25,44 @@ public class IntentResource { ...@@ -25,23 +25,44 @@ public class IntentResource {
25 25
26 private final IntentPrimitive primitive; 26 private final IntentPrimitive primitive;
27 private final long tunnelId; 27 private final long tunnelId;
28 + private final IntentDomainId domainId;
28 29
29 // TODO add other common fields 30 // TODO add other common fields
30 //String ingressTag; 31 //String ingressTag;
31 //String egressTag; 32 //String egressTag;
32 //etc. 33 //etc.
33 34
34 - public IntentResource(IntentPrimitive primitive, long tunnelId) { 35 + public IntentResource(IntentPrimitive primitive, long tunnelId, IntentDomainId domainId) {
35 this.primitive = primitive; 36 this.primitive = primitive;
36 this.tunnelId = tunnelId; 37 this.tunnelId = tunnelId;
38 + this.domainId = domainId;
37 } 39 }
38 40
41 + /**
42 + * Returns the intent primitive associated with this resource as creation.
43 + *
44 + * @return this resource's intent primitive
45 + */
39 public IntentPrimitive primitive() { 46 public IntentPrimitive primitive() {
40 return primitive; 47 return primitive;
41 } 48 }
42 49
50 + /**
51 + * Returns the tunnel ID associated with this resource as creation.
52 + *
53 + * @return this resource's tunnel ID
54 + */
43 public long tunnelId() { 55 public long tunnelId() {
44 return tunnelId; 56 return tunnelId;
45 } 57 }
46 58
59 + /**
60 + * Returns the domain ID associated with this resource as creation.
61 + *
62 + * @return this resource's domain ID
63 + */
64 + public IntentDomainId domainId() {
65 + return domainId;
66 + }
67 +
47 } 68 }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
16 package org.onosproject.incubator.net.domain; 16 package org.onosproject.incubator.net.domain;
17 17
18 import com.google.common.annotations.Beta; 18 import com.google.common.annotations.Beta;
19 +import org.onosproject.net.Path;
19 20
20 /** 21 /**
21 * Context for intent primitive requests to an intent domain provider. A context 22 * Context for intent primitive requests to an intent domain provider. A context
...@@ -29,12 +30,14 @@ import com.google.common.annotations.Beta; ...@@ -29,12 +30,14 @@ import com.google.common.annotations.Beta;
29 public class RequestContext { 30 public class RequestContext {
30 private final IntentDomain domain; 31 private final IntentDomain domain;
31 private final IntentResource resource; 32 private final IntentResource resource;
33 + private final Path path;
32 //TODO other common parameters: 34 //TODO other common parameters:
33 //String cost; 35 //String cost;
34 36
35 - public RequestContext(IntentDomain domain, IntentResource resource) { 37 + public RequestContext(IntentDomain domain, IntentResource resource, Path path) {
36 this.domain = domain; 38 this.domain = domain;
37 this.resource = resource; 39 this.resource = resource;
40 + this.path = path;
38 } 41 }
39 42
40 public IntentDomain domain() { 43 public IntentDomain domain() {
...@@ -44,4 +47,8 @@ public class RequestContext { ...@@ -44,4 +47,8 @@ public class RequestContext {
44 public IntentResource resource() { 47 public IntentResource resource() {
45 return resource; 48 return resource;
46 } 49 }
50 +
51 + public Path path() {
52 + return path;
53 + }
47 } 54 }
......
...@@ -31,4 +31,21 @@ public class TunnelPrimitive extends IntentPrimitive { ...@@ -31,4 +31,21 @@ public class TunnelPrimitive extends IntentPrimitive {
31 this.one = one; 31 this.one = one;
32 this.two = two; 32 this.two = two;
33 } 33 }
34 +
35 + /**
36 + * The getter for the first connection point associated with a tunnel.
37 + *
38 + * @return the first connection point
39 + */
40 + public ConnectPoint one() {
41 + return one;
42 + }
43 +
44 + /**
45 + * The getter for the second connection point associated with a tunnel.
46 + * @return the second connection point
47 + */
48 + public ConnectPoint two() {
49 + return two;
50 + }
34 } 51 }
......