[ONOS-7683] Initial commit of openstacktelemetry with service interfaces
Change-Id: Ic1d40107fbdf2e77fd5e52c83d06f04251e868ba
diff --git a/apps/openstacktelemetry/api/BUCK b/apps/openstacktelemetry/api/BUCK
index 9fde222..e09f293 100644
--- a/apps/openstacktelemetry/api/BUCK
+++ b/apps/openstacktelemetry/api/BUCK
@@ -1,5 +1,9 @@
COMPILE_DEPS = [
'//lib:CORE_DEPS',
+ '//lib:kafka-clients',
+ '//lib:jersey-client',
+ '//lib:javax.ws.rs-api',
+ '//lib:influxdb-java',
]
TEST_DEPS = [
diff --git a/apps/openstacktelemetry/api/pom.xml b/apps/openstacktelemetry/api/pom.xml
index 7c96a2a..e6b046a 100644
--- a/apps/openstacktelemetry/api/pom.xml
+++ b/apps/openstacktelemetry/api/pom.xml
@@ -36,5 +36,28 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.kafka-clients</artifactId>
+ <version>0.8.2.2_1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.influxdb</groupId>
+ <artifactId>influxdb-java</artifactId>
+ <version>2.2</version>
+ </dependency>
+
</dependencies>
</project>
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/ByteBufferCodec.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/ByteBufferCodec.java
new file mode 100644
index 0000000..fc5c5407
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/ByteBufferCodec.java
@@ -0,0 +1,46 @@
+/*
+ * 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.openstacktelemetry.api;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Abstraction of a codec capable for encoding/decoding arbitrary objects to/from ByteBuffer.
+ */
+public abstract class ByteBufferCodec<T> {
+
+ /**
+ * Encodes the specified entity into ByteBuffer.
+ *
+ * @param entity entity to encode
+ * @return ByteBuffer
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
+ public ByteBuffer encode(T entity) {
+ throw new UnsupportedOperationException("encode() not supported");
+ }
+
+ /**
+ * Decodes the specified entity from ByteBuffer.
+ *
+ * @param buffer ByteBuffer to decode
+ * @return decoded entity
+ */
+ public T decode(ByteBuffer buffer) {
+ throw new UnsupportedOperationException("decode() not supported");
+ }
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/Constants.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/Constants.java
new file mode 100644
index 0000000..0f969de
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/Constants.java
@@ -0,0 +1,45 @@
+/*
+ * 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.openstacktelemetry.api;
+
+import org.apache.kafka.common.serialization.ByteArraySerializer;
+import org.apache.kafka.common.serialization.StringSerializer;
+
+/**
+ * Provides constants used in OpenstackTelemetry.
+ */
+public final class Constants {
+
+ private Constants() {
+ }
+
+ public static final String OPENSTACK_TELEMETRY_APP_ID = "org.onosproject.openstacktelemetry";
+
+ private static final String DEFAULT_SERVER_IP = "localhost";
+
+ public static final String DEFAULT_KAFKA_SERVER_IP = DEFAULT_SERVER_IP;
+ public static final int DEFAULT_KAFKA_SERVER_PORT = 9092;
+ public static final int DEFAULT_KAFKA_RETRIES = 0;
+ public static final String DEFAULT_KAFKA_REQUIRED_ACKS = "all";
+ public static final int DEFAULT_KAFKA_BATCH_SIZE = 16384;
+ public static final int DEFAULT_KAFKA_LINGER_MS = 1;
+ public static final int DEFAULT_KAFKA_MEMORY_BUFFER = 33554432;
+ public static final String DEFAULT_KAFKA_KEY_SERIALIZER = StringSerializer.class.toString();
+ public static final String DEFAULT_KAFKA_VALUE_SERIALIZER = ByteArraySerializer.class.toString();
+
+ public static final String DEFAULT_REST_SERVER_IP = DEFAULT_SERVER_IP;
+ public static final int DEFAULT_REST_SERVER_PORT = 80;
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/GrpcTelemetryService.java
similarity index 69%
copy from apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
copy to apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/GrpcTelemetryService.java
index 443c715..942e64b 100644
--- a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/GrpcTelemetryService.java
@@ -16,12 +16,15 @@
package org.onosproject.openstacktelemetry.api;
/**
- * Openstack telemetry interface.
+ * Service API for publishing openstack telemetry through gRPC producer.
*/
-public interface OpenstackTelemetry {
+public interface GrpcTelemetryService {
/**
- * A dummy interface method.
+ * Publishes openstack telemetry to gRPC server.
+ *
+ * @param record a network metric to be published
+ * @return a response from gRPC server
*/
- void dummy();
+ Object publish(Object record);
}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/InfluxDbTelemetryService.java
similarity index 70%
copy from apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
copy to apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/InfluxDbTelemetryService.java
index 443c715..81b5d12 100644
--- a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/InfluxDbTelemetryService.java
@@ -16,12 +16,14 @@
package org.onosproject.openstacktelemetry.api;
/**
- * Openstack telemetry interface.
+ * Service API for publishing openstack telemetry through InfluxDB producer.
*/
-public interface OpenstackTelemetry {
+public interface InfluxDbTelemetryService {
/**
- * A dummy interface method.
+ * Publishes openstack telemetry to InfluxDB server.
+ *
+ * @param record a network metric to be published
*/
- void dummy();
+ void publish(InfluxRecord<String, Object> record);
}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/InfluxRecord.java
similarity index 82%
rename from apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
rename to apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/InfluxRecord.java
index 443c715..57f2285 100644
--- a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/InfluxRecord.java
@@ -16,12 +16,8 @@
package org.onosproject.openstacktelemetry.api;
/**
- * Openstack telemetry interface.
+ * A record which contains influx topic and network metric data.
*/
-public interface OpenstackTelemetry {
+public interface InfluxRecord<K, V> {
- /**
- * A dummy interface method.
- */
- void dummy();
}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/KafkaTelemetryService.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/KafkaTelemetryService.java
new file mode 100644
index 0000000..60179c6
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/KafkaTelemetryService.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.openstacktelemetry.api;
+
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.clients.producer.RecordMetadata;
+
+import java.util.concurrent.Future;
+
+/**
+ * Service API for publishing openstack telemetry through kafka producer.
+ */
+public interface KafkaTelemetryService {
+
+ /**
+ * Publishes openstack telemetry to Kafka server.
+ *
+ * @param record a network metric to be published
+ * @return metadata for a record that has been acknowledged
+ */
+ Future<RecordMetadata> publish(ProducerRecord<String, byte[]> record);
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/RestTelemetryService.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/RestTelemetryService.java
new file mode 100644
index 0000000..ab0aae7
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/RestTelemetryService.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.openstacktelemetry.api;
+
+import javax.ws.rs.core.Response;
+
+/**
+ * Service API for publishing openstack telemetry through REST producer.
+ */
+public interface RestTelemetryService {
+
+ /**
+ * Publishes openstack telemetry to REST server.
+ *
+ * @param endpoint an endpoint URL
+ * @param method HTTP method
+ * @param record network metrics
+ * @return response from REST server
+ */
+ Response publish(String endpoint, String method, String record);
+
+ /**
+ * Publishes openstack telemetry to REST server.
+ *
+ * @param method HTTP method
+ * @param record network metrics
+ * @return response from REST server
+ */
+ Response publish(String method, String record);
+
+ /**
+ * Publishes openstack telemetry to REST server.
+ * By default, the client sends record using the HTTP method configured in
+ * RestTelemetryConfig.
+ *
+ * @param record network metrics
+ * @return response from REST server
+ */
+ Response publish(String record);
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/GrpcTelemetryConfig.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/GrpcTelemetryConfig.java
new file mode 100644
index 0000000..56a364e
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/GrpcTelemetryConfig.java
@@ -0,0 +1,112 @@
+/*
+ * 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.openstacktelemetry.api.config;
+
+import java.util.Map;
+
+/**
+ * Configuration API of gRPC for publishing openstack telemetry.
+ */
+public interface GrpcTelemetryConfig {
+
+ /**
+ * Obtains gRPC server IP address.
+ *
+ * @return gRPC server IP address
+ */
+ String address();
+
+ /**
+ * Obtains gRPC server port number.
+ *
+ * @return gRPC server port number
+ */
+ int port();
+
+ /**
+ * Obtains usePlaintext gRPC config flag.
+ *
+ * @return usePlaintext gRPC config flag
+ */
+ boolean usePlaintext();
+
+ /**
+ * Obtains max inbound message size.
+ *
+ * @return max inbound message size
+ */
+ int maxInboundMsgSize();
+
+ /**
+ * Obtains kafka config maps.
+ *
+ * @return kafka config map
+ */
+ Map<String, Object> configMap();
+
+ /**
+ * Builder class of GrpcTelemetryConfig.
+ */
+ interface Builder {
+
+ /**
+ * Sets gRPC server IP address.
+ *
+ * @param address gRPC server IP address
+ * @return builder instances
+ */
+ Builder withAddress(String address);
+
+ /**
+ * Sets gRPC server port number.
+ *
+ * @param port gRPC server port number
+ * @return builder instance
+ */
+ Builder withPort(int port);
+
+ /**
+ * Sets usePlaintext config flag.
+ *
+ * @param usePlaintext usePlaintext config flag
+ * @return builder instance
+ */
+ Builder withUsePlaintext(boolean usePlaintext);
+
+ /**
+ * Sets maximum inbound message size.
+ *
+ * @param maxInboundMsgSize maximum inbound message size
+ * @return builder instance
+ */
+ Builder withMaxInboundMsgSize(int maxInboundMsgSize);
+
+ /**
+ * Sets other gRPC configuration map.
+ *
+ * @param configMap gRPC configuration map
+ * @return builder instance
+ */
+ Builder withConfigMap(Map<String, Object> configMap);
+
+ /**
+ * Creates a gRPC telemetry config instance.
+ *
+ * @return gRPC telemetry config instance
+ */
+ GrpcTelemetryConfig build();
+ }
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/InfluxDbTelemetryConfig.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/InfluxDbTelemetryConfig.java
new file mode 100644
index 0000000..f0c34ca
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/InfluxDbTelemetryConfig.java
@@ -0,0 +1,142 @@
+/*
+ * 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.openstacktelemetry.api.config;
+
+import java.util.Map;
+
+/**
+ * Configuration API of InfluxDB for publishing openstack telemetry.
+ */
+public interface InfluxDbTelemetryConfig {
+
+ /**
+ * Obtains InfluxDB server IP address.
+ *
+ * @return InfluxDB server IP address
+ */
+ String address();
+
+ /**
+ * Obtains InfluxDB server port number.
+ *
+ * @return InfluxDB server port number
+ */
+ int port();
+
+ /**
+ * Obtains InfluxDB username for accessing.
+ *
+ * @return InfluxDB username
+ */
+ String username();
+
+ /**
+ * Obtains InfluxDB password for accessing.
+ *
+ * @return InfluxDB password
+ */
+ String password();
+
+ /**
+ * Obtains InfluxDB database name.
+ *
+ * @return InfluxDB database name
+ */
+ String database();
+
+ /**
+ * Obtains InfluxDB enable batch flag.
+ *
+ * @return InfluxDB enable batch flag
+ */
+ boolean enableBatch();
+
+ /**
+ * Obtains InfluxDB config maps.
+ *
+ * @return InfluxDB config map
+ */
+ Map<String, Object> configMap();
+
+ /**
+ * Builder class of InfluxDbTelemetryConfig.
+ */
+ interface Builder {
+
+ /**
+ * Sets InfluxDB server IP address.
+ *
+ * @param address InfluxDB server IP address
+ * @return builder instances
+ */
+ Builder withAddress(String address);
+
+ /**
+ * Sets InfluxDB server port number.
+ *
+ * @param port InfluxDB server port number
+ * @return builder instance
+ */
+ Builder withPort(int port);
+
+ /**
+ * Sets InfluxDB username.
+ *
+ * @param username InfluxDB username
+ * @return builder instance
+ */
+ Builder withUsername(String username);
+
+ /**
+ * Sets InfluxDB password.
+ *
+ * @param password InfluxDB password
+ * @return builder instance
+ */
+ Builder withPassword(String password);
+
+ /**
+ * Sets InfluxDB database.
+ *
+ * @param database InfluxDB database
+ * @return builder instance
+ */
+ Builder withDatabase(String database);
+
+ /**
+ * Sets InfluxDB enable batch flag.
+ *
+ * @param enableBatch enable batch flag
+ * @return builder instance
+ */
+ Builder withEnableBatch(boolean enableBatch);
+
+ /**
+ * Sets other InfluxDB configuration map.
+ *
+ * @param configMap InfluxDB configuration map
+ * @return builder instance
+ */
+ Builder withConfigMap(Map<String, Object> configMap);
+
+ /**
+ * Creates a InfluxDB telemetry config instance.
+ *
+ * @return InfluxDB telemetry config instance
+ */
+ InfluxDbTelemetryConfig build();
+ }
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/KafkaTelemetryConfig.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/KafkaTelemetryConfig.java
new file mode 100644
index 0000000..d3731bb
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/KafkaTelemetryConfig.java
@@ -0,0 +1,187 @@
+/*
+ * 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.openstacktelemetry.api.config;
+
+import java.util.Map;
+
+/**
+ * Configuration API of Kafka for publishing openstack telemetry.
+ */
+public interface KafkaTelemetryConfig {
+
+ /**
+ * Obtains kafka IP address.
+ *
+ * @return kafka IP address
+ */
+ String address();
+
+ /**
+ * Obtains kafka port number.
+ *
+ * @return kafka port number
+ */
+ int port();
+
+ /**
+ * Obtains numbers of request retries.
+ *
+ * @return number of request retries
+ */
+ int retries();
+
+ /**
+ * Obtains required acknowledgement.
+ *
+ * @return required acknowledgement
+ */
+ String requiredAcks();
+
+ /**
+ * Obtains batch size.
+ *
+ * @return batch size
+ */
+ int batchSize();
+
+ /**
+ * Obtains linger.
+ *
+ * @return linger
+ */
+ int lingerMs();
+
+ /**
+ * Obtains memory buffer size.
+ *
+ * @return memory buffer size
+ */
+ int memoryBuffer();
+
+ /**
+ * Obtains kafka key serializer.
+ *
+ * @return kafka key serializer
+ */
+ String keySerializer();
+
+ /**
+ * Obtains kafka value serializer.
+ *
+ * @return kafka value serializer
+ */
+ String valueSerializer();
+
+ /**
+ * Obtains kafka config maps.
+ *
+ * @return kafka config map
+ */
+ Map<String, Object> configMap();
+
+ /**
+ * Builder class of KafkaTelemetryConfig.
+ */
+ interface Builder {
+
+ /**
+ * Sets kafka IP address.
+ *
+ * @param address kafka IP address
+ * @return builder instances
+ */
+ Builder withAddress(String address);
+
+ /**
+ * Sets kafka port number.
+ *
+ * @param port kafka port number
+ * @return builder instance
+ */
+ Builder withPort(int port);
+
+ /**
+ * Sets number of request retries.
+ *
+ * @param retries number of request retries
+ * @return builder instance
+ */
+ Builder withRetries(int retries);
+
+ /**
+ * Sets the required acknowledgment.
+ *
+ * @param requiredAcks required acknowledgement
+ * @return builder instance
+ */
+ Builder withRequiredAcks(String requiredAcks);
+
+ /**
+ * Sets batch size.
+ *
+ * @param batchSize batch size
+ * @return builder instance
+ */
+ Builder withBatchSize(int batchSize);
+
+ /**
+ * Sets linger ms.
+ *
+ * @param lingerMs linger ms
+ * @return builder instance
+ */
+ Builder withLingerMs(int lingerMs);
+
+ /**
+ * Sets memory buffer size.
+ *
+ * @param memoryBuffer memory buffer size
+ * @return builder instance
+ */
+ Builder withMemoryBuffer(int memoryBuffer);
+
+ /**
+ * Sets kafka key serializer.
+ *
+ * @param keySerializer kafka key serializer
+ * @return builder instance
+ */
+ Builder withKeySerializer(String keySerializer);
+
+ /**
+ * Sets kafka value serializer.
+ *
+ * @param valueSerializer kafka value serializer
+ * @return builder instance
+ */
+ Builder withValueSerializer(String valueSerializer);
+
+ /**
+ * Sets other kafka configuration map.
+ *
+ * @param configMap kafka configuration map
+ * @return builder instance
+ */
+ Builder withConfigMap(Map<String, Object> configMap);
+
+ /**
+ * Creates a kafka telemetry config instance.
+ *
+ * @return kafka telemetry config instance
+ */
+ KafkaTelemetryConfig build();
+ }
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/RestTelemetryConfig.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/RestTelemetryConfig.java
new file mode 100644
index 0000000..50643db2
--- /dev/null
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/RestTelemetryConfig.java
@@ -0,0 +1,142 @@
+/*
+ * 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.openstacktelemetry.api.config;
+
+import java.util.Map;
+
+/**
+ * Configuration API of REST for publishing openstack telemetry.
+ */
+public interface RestTelemetryConfig {
+
+ /**
+ * Obtains REST IP address.
+ *
+ * @return REST IP address
+ */
+ String address();
+
+ /**
+ * Obtains REST port number.
+ *
+ * @return REST port number
+ */
+ int port();
+
+ /**
+ * Obtains default REST server endpoint.
+ *
+ * @return default REST server endpoint
+ */
+ String endpoint();
+
+ /**
+ * Obtains HTTP method for publishing network metrics.
+ *
+ * @return HTTP method
+ */
+ String method();
+
+ /**
+ * Obtains request media type.
+ *
+ * @return request media type
+ */
+ String requestMediaType();
+
+ /**
+ * Obtains response media type.
+ *
+ * @return response media type
+ */
+ String responseMediaType();
+
+ /**
+ * Obtains REST config maps.
+ *
+ * @return REST config map
+ */
+ Map<String, Object> configMap();
+
+ /**
+ * Builder class for RestTelemetryConfig.
+ */
+ interface Builder {
+
+ /**
+ * Sets REST server IP address.
+ *
+ * @param address REST server IP address
+ * @return builder instance
+ */
+ Builder withAddress(String address);
+
+ /**
+ * Sets REST server port number.
+ *
+ * @param port REST server port number
+ * @return builder instance
+ */
+ Builder withPort(int port);
+
+ /**
+ * Sets REST server default endpoint.
+ *
+ * @param endpoint REST server default endpoint
+ * @return builder instance
+ */
+ Builder withEndpoint(String endpoint);
+
+ /**
+ * Sets HTTP method.
+ *
+ * @param method HTTP method
+ * @return builder instance
+ */
+ Builder withMethod(String method);
+
+ /**
+ * Sets REST request media type.
+ *
+ * @param mediaType REST request media type
+ * @return builder instance
+ */
+ Builder withRequestMediaType(String mediaType);
+
+ /**
+ * Sets REST response media type.
+ *
+ * @param mediaType REST response media type
+ * @return builder instance
+ */
+ Builder withResponseMediaType(String mediaType);
+
+ /**
+ * Sets REST config map.
+ *
+ * @param configMap REST config map
+ * @return builder instance
+ */
+ Builder withConfigMap(Map<String, Object> configMap);
+
+ /**
+ * Creates a REST telemetry config instance.
+ *
+ * @return REST telemetry config instance
+ */
+ RestTelemetryConfig build();
+ }
+}
diff --git a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/package-info.java
similarity index 76%
copy from apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
copy to apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/package-info.java
index 443c715..2c69ed9 100644
--- a/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/OpenstackTelemetry.java
+++ b/apps/openstacktelemetry/api/src/main/java/org/onosproject/openstacktelemetry/api/config/package-info.java
@@ -13,15 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.openstacktelemetry.api;
/**
- * Openstack telemetry interface.
+ * Configuration API for Openstack Telemetry.
*/
-public interface OpenstackTelemetry {
-
- /**
- * A dummy interface method.
- */
- void dummy();
-}
+package org.onosproject.openstacktelemetry.api.config;
\ No newline at end of file