Brian O'Connor

Adding experimental tunnel primitive and small API tweaks

Change-Id: Id7a950ab7b2e001d0527e935c077c538dfede7fd
...@@ -32,11 +32,12 @@ public interface IntentDomainProvider { ...@@ -32,11 +32,12 @@ public interface IntentDomainProvider {
32 * can be used. Request contexts can be explictly cancelled, or they will 32 * can be used. Request contexts can be explictly cancelled, or they will
33 * eventually time out so that resources can be reused. 33 * eventually time out so that resources can be reused.
34 * 34 *
35 + * @param domain intent domain for the request
35 * @param primitive intent primitive 36 * @param primitive intent primitive
36 * @return request contexts that contain resources to satisfy the intent 37 * @return request contexts that contain resources to satisfy the intent
37 */ 38 */
38 //TODO Consider an iterable and/or holds (only hold one or two reservation(s) at a time) 39 //TODO Consider an iterable and/or holds (only hold one or two reservation(s) at a time)
39 - List<RequestContext> request(IntentPrimitive primitive); 40 + List<RequestContext> request(IntentDomain domain, IntentPrimitive primitive);
40 41
41 /** 42 /**
42 * Request that the provider attempt to modify an existing resource to satisfy 43 * Request that the provider attempt to modify an existing resource to satisfy
......
...@@ -21,21 +21,27 @@ import com.google.common.annotations.Beta; ...@@ -21,21 +21,27 @@ import com.google.common.annotations.Beta;
21 * The abstract base class for the resource that satisfies an intent primitive. 21 * The abstract base class for the resource that satisfies an intent primitive.
22 */ 22 */
23 @Beta 23 @Beta
24 -public abstract class IntentResource { 24 +public class IntentResource {
25 25
26 private final IntentPrimitive primitive; 26 private final IntentPrimitive primitive;
27 + private final long tunnelId;
27 28
28 // TODO add other common fields 29 // TODO add other common fields
29 //String ingressTag; 30 //String ingressTag;
30 //String egressTag; 31 //String egressTag;
31 //etc. 32 //etc.
32 33
33 - IntentResource(IntentPrimitive primitive) { 34 + public IntentResource(IntentPrimitive primitive, long tunnelId) {
34 this.primitive = primitive; 35 this.primitive = primitive;
36 + this.tunnelId = tunnelId;
35 } 37 }
36 38
37 public IntentPrimitive primitive() { 39 public IntentPrimitive primitive() {
38 return primitive; 40 return primitive;
39 } 41 }
40 42
43 + public long tunnelId() {
44 + return tunnelId;
45 + }
46 +
41 } 47 }
......
...@@ -27,10 +27,21 @@ import com.google.common.annotations.Beta; ...@@ -27,10 +27,21 @@ import com.google.common.annotations.Beta;
27 */ 27 */
28 @Beta 28 @Beta
29 public class RequestContext { 29 public class RequestContext {
30 - IntentDomain domain; 30 + private final IntentDomain domain;
31 - IntentResource resource; 31 + private final IntentResource resource;
32 //TODO other common parameters: 32 //TODO other common parameters:
33 //String cost; 33 //String cost;
34 34
35 - //TODO getters/setters 35 + public RequestContext(IntentDomain domain, IntentResource resource) {
36 + this.domain = domain;
37 + this.resource = resource;
38 + }
39 +
40 + public IntentDomain domain() {
41 + return domain;
42 + }
43 +
44 + public IntentResource resource() {
45 + return resource;
46 + }
36 } 47 }
......
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.incubator.net.domain;
17 +
18 +import org.onosproject.core.ApplicationId;
19 +import org.onosproject.net.ConnectPoint;
20 +
21 +/**
22 + * Provides connectivity through a domain.
23 + */
24 +public class TunnelPrimitive extends IntentPrimitive {
25 +
26 + private final ConnectPoint one;
27 + private final ConnectPoint two;
28 +
29 + public TunnelPrimitive(ApplicationId appId, ConnectPoint one, ConnectPoint two) {
30 + super(appId);
31 + this.one = one;
32 + this.two = two;
33 + }
34 +}