AETHER-233 Move IntProgrammable behavior to core APIs

Before, the behavior interface and other concrete classes used it by
were part of the inbandtelemetry app. To make this behavior available to
third-party apps (such as the fabric-tna pipeconf), we move it to the
core APIs.

In this process, we do some clean-up of the behavior API. For example,
we remove references to network-level semantics (as behaviors should
only abstract device-level ones). That helps in reducing the number of
classes required to maintain in the core.

Change-Id: I3ba24ea93cdfea115cee454d5e921e15ec17eee9
diff --git a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntConfig.java b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntConfig.java
deleted file mode 100644
index c5af580..0000000
--- a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntConfig.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright 2015-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.inbandtelemetry.api;
-
-import com.google.common.annotations.Beta;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.TpPort;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Network-level INT configuration.
- */
-@Beta
-public final class IntConfig {
-    /**
-     * Represents a type of telemetry spec to collect in the dataplane.
-     */
-    public enum TelemetrySpec {
-        /**
-         * Embeds telemetry metadata according to the INT specification.
-         *
-         * @see <a href="https://github.com/p4lang/p4-applications/blob/master/docs/INT.pdf">
-         *     INT sepcification</a>
-         */
-        INT,
-        /**
-         * Embeds telemetry metadata according to the OAM specification.
-         *
-         * @see <a href="https://tools.ietf.org/html/draft-ietf-ippm-ioam-data">
-         *     Data fields for In-situ OAM</a>
-         */
-        IOAM
-    }
-
-    private final IpAddress collectorIp;
-    private final TpPort collectorPort;
-    private final MacAddress collectorNextHopMac;
-    private final IpAddress sinkIp;
-    private final MacAddress sinkMac;
-    private final TelemetrySpec spec;
-    private boolean enabled;
-
-    private IntConfig(IpAddress collectorIp, TpPort collectorPort, MacAddress collectorNextHopMac,
-                      IpAddress sinkIp, MacAddress sinkMac, TelemetrySpec spec, boolean enabled) {
-        this.collectorIp = collectorIp;
-        this.collectorPort = collectorPort;
-        this.collectorNextHopMac = collectorNextHopMac;
-        this.sinkIp = sinkIp;
-        this.sinkMac = sinkMac;
-        this.spec = spec;
-        this.enabled = enabled;
-    }
-
-    /**
-     * Returns IP address of the collector.
-     * This is the destination IP address that will be used for all INT reports
-     * generated by all sink devices.
-     *
-     * @return collector IP address
-     */
-    public IpAddress collectorIp() {
-        return collectorIp;
-    }
-
-    /**
-     * Returns UDP port number of the collector.
-     * This is the destination UDP port number that will be used for all INT reports
-     * generated by all sink devices.
-     *
-     * @return collector UDP port number
-     */
-    public TpPort collectorPort() {
-        return collectorPort;
-    }
-
-    /**
-     * Returns MAC address of next hop of INT report packets.
-     * This can be either MAC address of the collector or a router.
-     * This is an optional parameter, which means that the usage of this
-     * parameter depends on IntProgrammable implementation.
-     * (e.g., If a report packet needs to be routed to reach the collector,
-     * IntProgrammable will ignore this value and choose next hop router's MAC address.
-     * If a collector itself is the next hop of INT report packets, then
-     * this value will be used as a destination MAC address for all INT report packets.)
-     *
-     * @return MAC address of next hop of INT report packets
-     */
-    public MacAddress collectorNextHopMac() {
-        return collectorNextHopMac;
-    }
-
-    /**
-     * Returns IP address of the sink device.
-     * All sink devices share this address as the source IP address
-     * for all INT reports.
-     *
-     * @return sink device's IP address
-     */
-    public IpAddress sinkIp() {
-        return sinkIp;
-    }
-
-    /**
-     * Returns MAC address of the sink device.
-     * All sink devices share this address as the source MAC address
-     * for all INT reports.
-     *
-     * @return sink device's MAC address
-     */
-    public MacAddress sinkMac() {
-        return sinkMac;
-    }
-
-    /**
-     * Returns the type of telemetry spec as per {@link TelemetrySpec}.
-     *
-     * @return telemetry spec
-     */
-    public TelemetrySpec spec() {
-        return spec;
-    }
-
-    /**
-     * Returns the status of INT functionality.
-     *
-     * @return true if INT is enabled; false otherwise.
-     */
-    public boolean enabled() {
-        return enabled;
-    }
-
-    /**
-     * Returns a new builder.
-     *
-     * @return new builder
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
-    /**
-     * An IntConfig object builder.
-     */
-    public static final class Builder {
-
-        private IpAddress collectorIp;
-        private TpPort collectorPort;
-        private MacAddress collectorNextHopMac;
-        private IpAddress sinkIp;
-        private MacAddress sinkMac;
-        private TelemetrySpec spec = TelemetrySpec.INT;
-        private boolean enabled = false;
-
-        /**
-         * Assigns a collector IP address to the IntConfig object.
-         *
-         * @param collectorIp IP address of the collector
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder withCollectorIp(IpAddress collectorIp) {
-            this.collectorIp = collectorIp;
-            return this;
-        }
-
-        /**
-         * Assigns a collector UDP port to the IntConfig object.
-         *
-         * @param collectorPort UDP port number of the collector
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder withCollectorPort(TpPort collectorPort) {
-            this.collectorPort = collectorPort;
-            return this;
-        }
-
-        /**
-         * Assigns a MAC address of the next hop to the collector
-         * to the IntConfig object.
-         *
-         * @param collectorNextHopMac MAC address of the collector
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder withCollectorNextHopMac(MacAddress collectorNextHopMac) {
-            this.collectorNextHopMac = collectorNextHopMac;
-            return this;
-        }
-
-        /**
-         * Assigns an IP address of the sink device to the IntConfig object.
-         *
-         * @param sinkIp sink device's IP address
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder withSinkIp(IpAddress sinkIp) {
-            this.sinkIp = sinkIp;
-            return this;
-        }
-
-        /**
-         * Assigns a MAC address of the sink device to the IntConfig object.
-         *
-         * @param sinkMac sink device's MAC address
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder withSinkMac(MacAddress sinkMac) {
-            this.sinkMac = sinkMac;
-            return this;
-        }
-
-        /**
-         * Assigns the type of telemetry spec to the IntConfig object.
-         *
-         * @param spec telemetry spec
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder withTelemetrySpec(TelemetrySpec spec) {
-            this.spec = spec;
-            return this;
-        }
-
-        /**
-         * Assigns the status of INT.
-         * True to enable INT functionality, false otherwise.
-         *
-         * @param enabled the status of INT
-         * @return an IntConfig builder
-         */
-        public IntConfig.Builder enabled(boolean enabled) {
-            this.enabled = enabled;
-            return this;
-        }
-
-        /**
-         * Builds the IntConfig object.
-         *
-         * @return an IntConfig object
-         */
-        public IntConfig build() {
-            checkNotNull(collectorIp, "Collector IP should be specified.");
-            checkNotNull(collectorPort, "Collector port number should be specified.");
-            checkNotNull(collectorNextHopMac, "Next hop MAC address for report packets should be provided.");
-            checkNotNull(sinkIp, "Sink IP address for report packets should be specified.");
-            checkNotNull(sinkMac, "Sink MAC address for report packets should be specified.");
-            return new IntConfig(collectorIp, collectorPort, collectorNextHopMac,
-                                 sinkIp, sinkMac, spec, enabled);
-        }
-    }
-}
diff --git a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntIntent.java b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntIntent.java
index 37e1e29..6e2e92b 100644
--- a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntIntent.java
+++ b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntIntent.java
@@ -16,6 +16,7 @@
 package org.onosproject.inbandtelemetry.api;
 
 import com.google.common.annotations.Beta;
+import org.onosproject.net.behaviour.inbandtelemetry.IntMetadataType;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.TrafficSelector;
 
@@ -40,55 +41,17 @@
  */
 @Beta
 public final class IntIntent {
-    /**
-     * Represents a type of INT metadata.
-     */
-    public enum IntMetadataType {
-        /**
-         * The unique ID of a switch.
-         */
-        SWITCH_ID,
-        /**
-         * The ports on which the INT packet was received and sent out.
-         */
-        L1_PORT_ID,
-        /**
-         * Time taken for the INT packet to be switched within the device.
-         */
-        HOP_LATENCY,
-        /**
-         * The build-up of traffic in the queue that the INT packet observes
-         * in the device while being forwarded.
-         */
-        QUEUE_OCCUPANCY,
-        /**
-         * The device local time when the INT packet was received on the ingress port.
-         */
-        INGRESS_TIMESTAMP,
-        /**
-         * The device local time when the INT packet was processed by the egress port.
-         */
-        EGRESS_TIMESTAMP,
-        /**
-         * The logical ports on which the INT packet was received and sent out.
-         */
-        L2_PORT_ID,
-        /**
-         * Current utilization of the egress port via witch the INT packet was sent out.
-         */
-        EGRESS_TX_UTIL
-    }
 
     /**
      * Represents an INT header type.
      */
     public enum IntHeaderType {
         /**
-         * Intemediate devices must process this type of INT header.
+         * Intermediate devices must process this type of INT header.
          */
         HOP_BY_HOP,
         /**
-         * Intemediate devices must ignore this type of INT header.
+         * Intermediate devices must ignore this type of INT header.
          */
         DESTINATION
     }
@@ -102,7 +65,7 @@
          */
         TRACKED_FLOW,
         /**
-         * Reports for all dropeed packets matching a drop watchlist.
+         * Reports for all dropped packets matching a drop watchlist.
          */
         DROPPED_PACKET,
         /**
diff --git a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntObjective.java b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntObjective.java
deleted file mode 100644
index da8dc29..0000000
--- a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntObjective.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.inbandtelemetry.api;
-
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.TrafficSelector;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.inbandtelemetry.api.IntIntent.IntMetadataType;
-import static org.onosproject.inbandtelemetry.api.IntIntent.IntHeaderType;
-
-public final class IntObjective {
-
-    private static final int DEFAULT_PRIORITY = 10;
-
-    // TrafficSelector to describe target flows to monitor
-    private final TrafficSelector selector;
-    // Set of metadata types to collect
-    private final Set<IntMetadataType> metadataTypes;
-    // Type of header (either hop-by-hop or destination)
-    private final IntHeaderType headerType;
-
-    /**
-     * Creates an IntObjective.
-     *
-     * @param selector      the traffic selector that identifies traffic to enable INT
-     * @param metadataTypes a set of metadata types to collect
-     * @param headerType    the type of INT header
-     */
-    private IntObjective(TrafficSelector selector, Set<IntMetadataType> metadataTypes,
-                         IntHeaderType headerType) {
-        this.selector = selector;
-        this.metadataTypes = metadataTypes;
-        this.headerType = headerType;
-    }
-
-    /**
-     * Returns traffic selector of this objective.
-     *
-     * @return traffic selector
-     */
-    public TrafficSelector selector() {
-        return selector;
-    }
-
-    /**
-     * Returns a set of metadata types specified in this objective.
-     *
-     * @return instruction bitmap
-     */
-    public Set<IntMetadataType> metadataTypes() {
-        return metadataTypes;
-    }
-
-    /**
-     * Returns a INT header type specified in this objective.
-     *
-     * @return INT header type
-     */
-    public IntHeaderType headerType() {
-        return headerType;
-    }
-
-    /**
-     * An IntObjective builder.
-     */
-    public static final class Builder {
-        private TrafficSelector selector = DefaultTrafficSelector.emptySelector();
-        private Set<IntMetadataType> metadataTypes = new HashSet<>();
-        private IntHeaderType headerType = IntHeaderType.HOP_BY_HOP;
-
-        /**
-         * Assigns a selector to the IntObjective.
-         *
-         * @param selector a traffic selector
-         * @return an IntObjective builder
-         */
-        public IntObjective.Builder withSelector(TrafficSelector selector) {
-            this.selector = selector;
-            return this;
-        }
-
-        /**
-         * Add a metadata type to the IntObjective.
-         *
-         * @param metadataTypes a set of metadata types
-         * @return an IntObjective builder
-         */
-        public IntObjective.Builder withMetadataTypes(Set<IntMetadataType> metadataTypes) {
-            this.metadataTypes.addAll(metadataTypes);
-            return this;
-        }
-
-        /**
-         * Assigns a header type to the IntObjective.
-         *
-         * @param headerType a header type
-         * @return an IntObjective builder
-         */
-        public IntObjective.Builder withHeaderType(IntHeaderType headerType) {
-            this.headerType = headerType;
-            return this;
-        }
-
-        /**
-         * Builds the IntObjective.
-         *
-         * @return an IntObjective
-         */
-        public IntObjective build() {
-            checkArgument(!selector.criteria().isEmpty(), "Empty selector cannot match any flow.");
-            checkArgument(!metadataTypes.isEmpty(), "Metadata types cannot be empty");
-            checkNotNull(headerType, "Header type cannot be null.");
-
-            return new IntObjective(selector, metadataTypes, headerType);
-        }
-    }
-}
diff --git a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntProgrammable.java b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntProgrammable.java
deleted file mode 100644
index 507f870..0000000
--- a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntProgrammable.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.inbandtelemetry.api;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.driver.HandlerBehaviour;
-
-/**
- * Abstraction of a device implementing In-band Network Telemetry (INT)
- * capabilities.
- */
-@Beta
-public interface IntProgrammable extends HandlerBehaviour {
-
-    /**
-     * INT functionalities that a device can implement.
-     */
-    enum IntFunctionality {
-        /**
-         * Source functionality.
-         */
-        SOURCE,
-        /**
-         * Sink functionality.
-         */
-        SINK,
-        /**
-         * Transit functionality.
-         */
-        TRANSIT
-    }
-
-    /**
-     * Initializes the pipeline, by installing required flow rules not relevant
-     * to specific watchlist, report and event. Returns true if the operation
-     * was successful, false otherwise.
-     *
-     * @return true if successful, false otherwise
-     */
-    boolean init();
-
-    /**
-     * Configures the given port as an INT source port. Packets received via
-     * this port can be modified to add the INT header, if a corresponding  INT
-     * objective is matched. Returns true if the operation was successful, false
-     * otherwise.
-     *
-     * @param port port
-     * @return true if successful, false otherwise
-     */
-    boolean setSourcePort(PortNumber port);
-
-    /**
-     * Configures the given port as an INT sink port. Packets forwarded via this
-     * port will be stripped of the INT header and a corresponding INT report
-     * will be generated. Returns true if the operation was successful, false
-     * otherwise.
-     *
-     * @param port port
-     * @return true if successful, false otherwise
-     */
-    boolean setSinkPort(PortNumber port);
-
-    /**
-     * Adds a given IntObjective to the device.
-     *
-     * @param obj an IntObjective
-     * @return true if the objective is successfully added; false otherwise.
-     */
-    boolean addIntObjective(IntObjective obj);
-
-    /**
-     * Removes a given IntObjective entry from the device.
-     *
-     * @param obj an IntObjective
-     * @return true if the objective is successfully removed; false otherwise.
-     */
-    boolean removeIntObjective(IntObjective obj);
-
-    /**
-     * Set up report-related configuration.
-     *
-     * @param config a configuration regarding to the collector
-     * @return true if the objective is successfully added; false otherwise.
-     */
-    boolean setupIntConfig(IntConfig config);
-
-    /**
-     * Clean up any INT-related configuration from the device.
-     */
-    void cleanup();
-
-    /**
-     * Returns true if this device supports the given INT functionality.
-     *
-     * @param functionality INt functionality
-     * @return true if functionality is supported, false otherwise
-     */
-    boolean supportsFunctionality(IntFunctionality functionality);
-
-    //TODO: [ONOS-7616] Design IntEvent and related APIs
-}
diff --git a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntService.java b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntService.java
index 59e65c3..ba236bb 100644
--- a/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntService.java
+++ b/apps/inbandtelemetry/api/src/main/java/org/onosproject/inbandtelemetry/api/IntService.java
@@ -16,6 +16,7 @@
 package org.onosproject.inbandtelemetry.api;
 
 import com.google.common.annotations.Beta;
+import org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig;
 import org.onosproject.net.DeviceId;
 
 import java.util.Map;
@@ -76,14 +77,14 @@
      *
      * @param cfg configuration to set up
      */
-    void setConfig(IntConfig cfg);
+    void setConfig(IntDeviceConfig cfg);
 
     /**
      * Retrieves the INT configuration.
      *
      * @return configuration
      */
-    IntConfig getConfig();
+    IntDeviceConfig getConfig();
 
     /**
      * Installs an IntIntent to devices.
diff --git a/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppTableMessageHandler.java b/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppTableMessageHandler.java
index fafd4b4..a0df5a9 100644
--- a/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppTableMessageHandler.java
+++ b/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppTableMessageHandler.java
@@ -19,6 +19,7 @@
 import com.google.common.collect.ImmutableSet;
 import org.onosproject.inbandtelemetry.api.IntIntent;
 import org.onosproject.inbandtelemetry.api.IntIntentId;
+import org.onosproject.net.behaviour.inbandtelemetry.IntMetadataType;
 import org.onosproject.inbandtelemetry.api.IntService;
 import org.onosproject.net.flow.criteria.Criterion;
 import org.onosproject.net.flow.criteria.IPCriterion;
@@ -105,7 +106,7 @@
             TcpPortCriterion tcpDstPort = (TcpPortCriterion) intent.selector().getCriterion(Criterion.Type.TCP_DST);
             UdpPortCriterion udpSrcPort = (UdpPortCriterion) intent.selector().getCriterion(Criterion.Type.UDP_SRC);
             UdpPortCriterion udpDstPort = (UdpPortCriterion) intent.selector().getCriterion(Criterion.Type.UDP_DST);
-            Set<IntIntent.IntMetadataType> metadataTypes = intent.metadataTypes();
+            Set<IntMetadataType> metadataTypes = intent.metadataTypes();
             row.cell(ID, intentId.toString())
                     .cell(SRC_ADDR, ip4Src == null ? "N/A" : ip4Src.ip().toString())
                     .cell(DST_ADDR, ip4Dst == null ? "N/A" : ip4Dst.ip().toString());
@@ -123,7 +124,7 @@
                         .cell(DST_PORT, "N/A");
             }
             String metaStr = "";
-            for (IntIntent.IntMetadataType metadataType : metadataTypes) {
+            for (IntMetadataType metadataType : metadataTypes) {
                 metaStr += metadataType.toString();
                 metaStr += ", ";
             }
diff --git a/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppUiMessageHandler.java b/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppUiMessageHandler.java
index 0dc18a4..226c428 100644
--- a/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppUiMessageHandler.java
+++ b/apps/inbandtelemetry/app/src/main/java/org/onosproject/inbandtelemetry/app/ui/IntAppUiMessageHandler.java
@@ -25,8 +25,9 @@
 import org.onlab.packet.TpPort;
 import org.onosproject.inbandtelemetry.api.IntIntent;
 import org.onosproject.inbandtelemetry.api.IntIntentId;
+import org.onosproject.net.behaviour.inbandtelemetry.IntMetadataType;
 import org.onosproject.inbandtelemetry.api.IntService;
-import org.onosproject.inbandtelemetry.api.IntConfig;
+import org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.ui.RequestHandler;
@@ -67,7 +68,7 @@
             log.info("intConfigAddRequest: {}", payload);
 
             intService = get(IntService.class);
-            IntConfig.Builder builder = IntConfig.builder();
+            IntDeviceConfig.Builder builder = IntDeviceConfig.builder();
 
             if (payload.get("collectorIp") != null) {
                 builder.withCollectorIp(IpAddress.valueOf(payload.get("collectorIp").asText()));
@@ -152,25 +153,25 @@
                     for (final JsonNode json : meta) {
                         switch (json.asText()) {
                             case "SWITCH_ID":
-                                builder.withMetadataType(IntIntent.IntMetadataType.SWITCH_ID);
+                                builder.withMetadataType(IntMetadataType.SWITCH_ID);
                                 break;
                             case "PORT_ID":
-                                builder.withMetadataType(IntIntent.IntMetadataType.L1_PORT_ID);
+                                builder.withMetadataType(IntMetadataType.L1_PORT_ID);
                                 break;
                             case "HOP_LATENCY":
-                                builder.withMetadataType(IntIntent.IntMetadataType.HOP_LATENCY);
+                                builder.withMetadataType(IntMetadataType.HOP_LATENCY);
                                 break;
                             case "QUEUE_OCCUPANCY":
-                                builder.withMetadataType(IntIntent.IntMetadataType.QUEUE_OCCUPANCY);
+                                builder.withMetadataType(IntMetadataType.QUEUE_OCCUPANCY);
                                 break;
                             case "INGRESS_TIMESTAMP":
-                                builder.withMetadataType(IntIntent.IntMetadataType.INGRESS_TIMESTAMP);
+                                builder.withMetadataType(IntMetadataType.INGRESS_TIMESTAMP);
                                 break;
                             case "EGRESS_TIMESTAMP":
-                                builder.withMetadataType(IntIntent.IntMetadataType.EGRESS_TIMESTAMP);
+                                builder.withMetadataType(IntMetadataType.EGRESS_TIMESTAMP);
                                 break;
                             case "EGRESS_TX_UTIL":
-                                builder.withMetadataType(IntIntent.IntMetadataType.EGRESS_TX_UTIL);
+                                builder.withMetadataType(IntMetadataType.EGRESS_TX_UTIL);
                                 break;
                             default:
                                 break;
diff --git a/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java b/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java
index 5481997..906efd8 100644
--- a/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java
+++ b/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java
@@ -21,11 +21,12 @@
 import org.onlab.util.SharedScheduledExecutors;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.inbandtelemetry.api.IntConfig;
+import org.onosproject.net.behaviour.inbandtelemetry.IntMetadataType;
+import org.onosproject.net.behaviour.inbandtelemetry.IntDeviceConfig;
 import org.onosproject.inbandtelemetry.api.IntIntent;
 import org.onosproject.inbandtelemetry.api.IntIntentId;
-import org.onosproject.inbandtelemetry.api.IntObjective;
-import org.onosproject.inbandtelemetry.api.IntProgrammable;
+import org.onosproject.net.behaviour.inbandtelemetry.IntObjective;
+import org.onosproject.net.behaviour.inbandtelemetry.IntProgrammable;
 import org.onosproject.inbandtelemetry.api.IntService;
 import org.onosproject.mastership.MastershipService;
 import org.onosproject.net.ConnectPoint;
@@ -114,7 +115,7 @@
     // Distributed state.
     private ConsistentMap<IntIntentId, IntIntent> intentMap;
     private ConsistentMap<DeviceId, Long> devicesToConfigure;
-    private AtomicValue<IntConfig> intConfig;
+    private AtomicValue<IntDeviceConfig> intConfig;
     private AtomicValue<Boolean> intStarted;
     private AtomicIdGenerator intentIds;
 
@@ -138,11 +139,11 @@
                 .register(IntIntentId.class)
                 .register(IntDeviceRole.class)
                 .register(IntIntent.IntHeaderType.class)
-                .register(IntIntent.IntMetadataType.class)
+                .register(IntMetadataType.class)
                 .register(IntIntent.IntReportType.class)
                 .register(IntIntent.TelemetryMode.class)
-                .register(IntConfig.class)
-                .register(IntConfig.TelemetrySpec.class);
+                .register(IntDeviceConfig.class)
+                .register(IntDeviceConfig.TelemetrySpec.class);
 
         devicesToConfigure = storageService.<DeviceId, Long>consistentMapBuilder()
                 .withSerializer(Serializer.using(serializer.build()))
@@ -168,7 +169,7 @@
                 .asAtomicValue();
         intStarted.addListener(intStartedListener);
 
-        intConfig = storageService.<IntConfig>atomicValueBuilder()
+        intConfig = storageService.<IntDeviceConfig>atomicValueBuilder()
                 .withSerializer(Serializer.using(serializer.build()))
                 .withName("onos-int-config")
                 .withApplicationId(appId)
@@ -241,14 +242,14 @@
     }
 
     @Override
-    public void setConfig(IntConfig cfg) {
+    public void setConfig(IntDeviceConfig cfg) {
         checkNotNull(cfg);
         // Atomic value event will trigger device configure.
         intConfig.set(cfg);
     }
 
     @Override
-    public IntConfig getConfig() {
+    public IntDeviceConfig getConfig() {
         return intConfig.get();
     }
 
@@ -438,10 +439,11 @@
     }
 
     private IntObjective getIntObjective(IntIntent intent) {
+        // FIXME: we are ignore intent.headerType()
+        //  what should we do with it?
         return new IntObjective.Builder()
                 .withSelector(intent.selector())
                 .withMetadataTypes(intent.metadataTypes())
-                .withHeaderType(intent.headerType())
                 .build();
     }
 
@@ -486,9 +488,9 @@
     }
 
     private class InternalIntConfigListener
-            implements AtomicValueEventListener<IntConfig> {
+            implements AtomicValueEventListener<IntDeviceConfig> {
         @Override
-        public void event(AtomicValueEvent<IntConfig> event) {
+        public void event(AtomicValueEvent<IntDeviceConfig> event) {
             triggerAllDeviceConfigure();
         }
     }