Detangling incubator: virtual nets, tunnels, resource labels, oh my

- virtual networking moved to /apps/virtual; with CLI & REST API
- tunnels and labels moved to /apps/tunnel; with CLI & REST API; UI disabled for now
- protobuf/models moved to /core/protobuf/models
- defunct grpc/rpc registry stuff left under /graveyard
- compile dependencies on /incubator moved to respective modules for compilation
- run-time dependencies will need to be re-tested for dependent apps

- /graveyard will be removed in not-too-distant future

Change-Id: I0a0b995c635487edcf95a352f50dd162186b0b39
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/ExtraSubjectFactories.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/ExtraSubjectFactories.java
new file mode 100644
index 0000000..08737d6
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/ExtraSubjectFactories.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.config.SubjectFactory;
+
+/**
+ * Set of subject factories for potential configuration subjects.
+ */
+@Beta
+public final class ExtraSubjectFactories {
+
+    // Construction forbidden
+    private ExtraSubjectFactories() {
+    }
+
+    public static final SubjectFactory<IntentDomainId> INTENT_DOMAIN_SUBJECT_FACTORY =
+            new SubjectFactory<IntentDomainId>(IntentDomainId.class, "domains") {
+                @Override
+                public IntentDomainId createSubject(String key) {
+                    return IntentDomainId.valueOf(key);
+                }
+            };
+
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java
new file mode 100644
index 0000000..7060104
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+
+import java.util.Set;
+
+/**
+ * Representation of an intent domain which includes the set of internal devices,
+ * the set of edge ports, and the implementation of the domain provider.
+ */
+@Beta
+public class IntentDomain {
+
+    private final IntentDomainId id;
+    private String name;
+
+    private Set<DeviceId> internalDevices;
+    private Set<ConnectPoint> edgePorts;
+
+    private IntentDomainProvider provider;
+
+    public IntentDomain(IntentDomainId id, String name,
+                 Set<DeviceId> internalDevices,
+                 Set<ConnectPoint> edgePorts) {
+        this.id = id;
+        this.name = name;
+        this.internalDevices = internalDevices;
+        this.edgePorts = edgePorts;
+    }
+
+    /**
+     * Returns the id for the intent domain.
+     *
+     * @return intent domain id
+     */
+    public IntentDomainId id() {
+        return id;
+    }
+
+    /**
+     * Returns the friendly name for the intent domain.
+     *
+     * @return intent domain name
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Returns the set of internal devices for the intent domain (devices under
+     * exclusive control of the intent domain).
+     *
+     * @return set of internal devices
+     */
+    public Set<DeviceId> internalDevices() {
+        return internalDevices;
+    }
+
+    /**
+     * Returns the set of edge ports for the intent domain.
+     *
+     * @return set of edge ports
+     */
+    public Set<ConnectPoint> edgePorts() {
+        return edgePorts;
+    }
+
+    /**
+     * Returns the provider for the intent domain.
+     *
+     * @return intent domain provider
+     */
+    public IntentDomainProvider provider() {
+        return provider;
+    }
+
+    /**
+     * Returns the status of the intent domain. An intent domain is active if it
+     * has an intent domain provider bound, and it is inactive if one is not bound.
+     *
+     * @return true if active; false otherwise
+     */
+    public boolean isActive() {
+        return provider != null;
+    }
+
+    /**
+     * Sets the provider for the intent domain if one is not already set.
+     *
+     * @param provider new intent domain provider
+     */
+    public void setProvider(IntentDomainProvider provider) {
+        // TODO consider checkState depending on caller
+        if (this.provider == null) {
+            this.provider = provider;
+        }
+    }
+
+    /**
+     * Unsets the provider for the intent domain.
+     */
+    public void unsetProvider() {
+        this.provider = null;
+    }
+
+    //TODO add remaining setters (we will probably want to link this to the network config)
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainEvent.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainEvent.java
new file mode 100644
index 0000000..c34e80e
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainEvent.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import org.onosproject.event.AbstractEvent;
+
+/**
+ * Describes an intent domain event.
+ */
+public class IntentDomainEvent
+        extends AbstractEvent<IntentDomainEvent.Type, IntentDomain> {
+
+    public enum Type {
+        DOMAIN_ADDED,
+        DOMAIN_MODIFIED,
+        DOMAIN_REMOVED
+    }
+
+    protected IntentDomainEvent(Type type, IntentDomain subject) {
+        super(type, subject);
+    }
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java
new file mode 100644
index 0000000..5140762
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onlab.util.Identifier;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Intent domain identifier.
+ */
+@Beta
+public class IntentDomainId extends Identifier<String> {
+    /**
+     * Creates an intent domain identifier from the specified string representation.
+     *
+     * @param value string value
+     * @return intent identifier
+     */
+    public static IntentDomainId valueOf(String value) {
+        return new IntentDomainId(value);
+    }
+
+    /**
+     * Constructor for serializer.
+     */
+    IntentDomainId() {
+        super(null);
+    }
+
+    /**
+     * Constructs the ID corresponding to a given string value.
+     *
+     * @param value the underlying value of this ID
+     */
+    IntentDomainId(String value) {
+        super(checkNotNull(value, "Intent domain ID cannot be null."));
+    }
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java
new file mode 100644
index 0000000..c03b904
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.event.EventListener;
+
+/**
+ * Listener for intent domain events.
+ */
+@Beta
+public interface IntentDomainListener
+    extends EventListener<IntentDomainEvent> {
+}
\ No newline at end of file
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java
new file mode 100644
index 0000000..7c44521
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.provider.Provider;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * FIXME.
+ */
+@Beta
+public interface IntentDomainProvider extends Provider {
+
+    /**
+     * Requests that the provider attempt to satisfy the intent primitive.
+     * The application must apply the context before the intent resource
+     * can be used. Request contexts can be explictly cancelled, or they will
+     * eventually time out so that resources can be reused.
+     *
+     * @param domain intent domain for the request
+     * @param primitive intent primitive
+     * @return intent resources that specify paths that satisfy the request.
+     */
+    //TODO Consider an iterable and/or holds (only hold one or two reservation(s) at a time)
+    List<IntentResource> request(IntentDomain domain, IntentPrimitive primitive);
+
+    /**
+     * Request that the provider attempt to modify an existing resource to satisfy
+     * a new intent primitive. The application must apply the context before
+     * the intent resource can be used.
+     *
+     * @param oldResource the resource to be replaced
+     * @param newResource the resource to be applied
+     * @return request contexts that contain resources to satisfy the intent
+     */
+    IntentResource modify(IntentResource oldResource, IntentResource newResource);
+
+    /**
+     * Requests that the provider release an intent resource.
+     *
+     * @param resource intent resource
+     */
+    void release(IntentResource resource);
+
+    /**
+     * Requests that the provider apply the path from the intent resource.
+     *
+     * @param domainIntentResource request context
+     * @return intent resource that satisfies the intent
+     */
+    IntentResource apply(IntentResource domainIntentResource);
+
+    /**
+     * Requests that the provider cancel the path. Requests that are not applied
+     * will be eventually timed out by the provider.
+     *
+     * @param domainIntentResource the intent resource whose path should be cancelled.
+     */
+    void cancel(IntentResource domainIntentResource);
+
+    /**
+     * Returns all intent resources held by the provider.
+     *
+     * @return set of intent resources
+     */
+    Set<IntentResource> getResources();
+}
+
+
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProviderRegistry.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProviderRegistry.java
new file mode 100644
index 0000000..c3c597d
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProviderRegistry.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import org.onosproject.net.provider.ProviderRegistry;
+
+/**
+ * Abstraction of a intent domain provider registry.
+ */
+public interface IntentDomainProviderRegistry
+        extends ProviderRegistry<IntentDomainProvider, IntentDomainProviderService> {
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProviderService.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProviderService.java
new file mode 100644
index 0000000..c74b483
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProviderService.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import org.onosproject.net.provider.ProviderService;
+
+/**
+ * Service through which intent domain providers can report intent domain updates.
+ */
+public interface IntentDomainProviderService
+        extends ProviderService<IntentDomainProvider> {
+
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java
new file mode 100644
index 0000000..0c010de
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.event.ListenerService;
+import org.onosproject.net.DeviceId;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Service for that maintains a graph of intent domains and a registry of intent
+ * domain providers.
+ */
+@Beta
+public interface IntentDomainService
+        extends ListenerService<IntentDomainEvent, IntentDomainListener> {
+
+    /**
+     * Returns the intent domain for the given id.
+     *
+     * @param id id to look up
+     * @return the intent domain; null if none found
+     */
+    IntentDomain getDomain(IntentDomainId id);
+
+    /**
+     * Returns a set of all intent domains.
+     *
+     * @return set of intent domains
+     */
+    Set<IntentDomain> getDomains();
+
+    /**
+     * Returns any network domains associated with the given device id.
+     *
+     * @param deviceId device id to look up
+     * @return set of intent domain
+     */
+    Set<IntentDomain> getDomains(DeviceId deviceId);
+
+    /**
+     * Requests an intent primitive from the intent domain.
+     *
+     * @param domainId id of target domain
+     * @param primitive intent primitive
+     * @return set of intent resources that satisfy the primitive
+     */
+    List<IntentResource> request(IntentDomainId domainId, IntentPrimitive primitive);
+
+    /**
+     * Submits an intent resource to the intent domain for installation.
+     *
+     * @param domainId id of target domain
+     * @param resource intent resource
+     */
+    void submit(IntentDomainId domainId, IntentResource resource);
+}
+
+
+
+
+
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java
new file mode 100644
index 0000000..04164b5
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.core.ApplicationId;
+
+/**
+ * Abstract base class for intent primitives.
+ */
+@Beta
+public abstract class IntentPrimitive {
+
+    private final ApplicationId appId;
+
+    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
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java
new file mode 100644
index 0000000..aa6aef4
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.ConnectPoint;
+
+
+/**
+ * The abstract base class for the resource that satisfies an intent primitive.
+ */
+@Beta
+public abstract class IntentResource {
+
+    private final IntentPrimitive primitive;
+
+    private final ApplicationId appId;
+    private final ConnectPoint ingress;
+    private final ConnectPoint egress;
+
+    //* QUESTIONABLE ADDITIONS *//
+
+    // TODO add other common fields
+    //String ingressTag;
+    //String egressTag;
+    //etc.
+
+    public IntentResource(IntentPrimitive primitive, ApplicationId appId,
+                          ConnectPoint ingress, ConnectPoint egress) {
+        this.appId = appId;
+        this.ingress = ingress;
+        this.egress = egress;
+        this.primitive = primitive;
+    }
+
+    //TODO when is same package tunnelID should be of type tunnelID and netTunnelId not long.
+
+
+    /**
+     * Returns the intent primitive associated with this resource at creation.
+     *
+     * @return this resource's intent primitive.
+     */
+    public IntentPrimitive primitive() {
+        return primitive;
+    }
+
+    /**
+     * Returns the application ID associated with this resource at creation.
+     *
+     * @return this resource's application ID.
+     */
+    public ApplicationId appId() {
+        return appId;
+    }
+
+    /**
+     * Returns the ingress connect point associated with this resource at creation.
+     *
+     * @return this resource's ingress connect point.
+     */
+    public ConnectPoint ingress() {
+        return ingress;
+    }
+
+    /**
+     * Returns the egress connect point associated with this resource at creation.
+     *
+     * @return this resource's connect point.
+     */
+    public ConnectPoint egress() {
+        return egress;
+    }
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java
new file mode 100644
index 0000000..5a5518e
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.domain;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.ConnectPoint;
+
+/**
+ * Provides connectivity through a domain.
+ */
+@Beta
+public class TunnelPrimitive extends IntentPrimitive {
+
+    private final ConnectPoint one;
+    private final ConnectPoint two;
+
+    public TunnelPrimitive(ApplicationId appId, ConnectPoint one, ConnectPoint two) {
+        super(appId);
+        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;
+    }
+}
diff --git a/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java
new file mode 100644
index 0000000..c4092aa
--- /dev/null
+++ b/apps/tunnel/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Subsystem for network intent domains.
+ */
+package org.onosproject.incubator.net.domain;
\ No newline at end of file