[ONOS-5750] Add skeleton code of LISP message provider
Change-Id: Idb9c96902ca30e2bd9c549ab58fae32962e74fee
diff --git a/providers/lisp/message/BUCK b/providers/lisp/message/BUCK
new file mode 100644
index 0000000..a711177
--- /dev/null
+++ b/providers/lisp/message/BUCK
@@ -0,0 +1,9 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//protocols/lisp/api:onos-protocols-lisp-api',
+ '//protocols/lisp/msg:onos-protocols-lisp-msg',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+)
diff --git a/providers/lisp/message/pom.xml b/providers/lisp/message/pom.xml
new file mode 100644
index 0000000..9f368fc
--- /dev/null
+++ b/providers/lisp/message/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016-present Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-lisp-providers</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>onos-lisp-provider-message</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS LISP protocol message provider</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-lisp-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-lisp-ctl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-lisp-msg</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/providers/lisp/message/src/main/java/org/onosproject/provider/lisp/message/impl/LispMessageProvider.java b/providers/lisp/message/src/main/java/org/onosproject/provider/lisp/message/impl/LispMessageProvider.java
new file mode 100644
index 0000000..c33827e
--- /dev/null
+++ b/providers/lisp/message/src/main/java/org/onosproject/provider/lisp/message/impl/LispMessageProvider.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.provider.lisp.message.impl;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.metrics.MetricsService;
+import org.onosproject.lisp.ctl.LispController;
+import org.onosproject.lisp.ctl.LispMessageListener;
+import org.onosproject.lisp.ctl.LispRouterId;
+import org.onosproject.lisp.ctl.LispRouterListener;
+import org.onosproject.lisp.msg.protocols.LispMessage;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provider which uses an LISP controller to detect device.
+ */
+@Component(immediate = true)
+public class LispMessageProvider extends AbstractProvider {
+
+ private static final Logger log = LoggerFactory.getLogger(LispMessageProvider.class);
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected LispController controller;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected MetricsService metricsService;
+
+ private static final String SCHEME_NAME = "lisp";
+ private static final String MESSAGE_PROVIDER_PACKAGE =
+ "org.onosproject.lisp.provider.message";
+
+ private final InternalDeviceProvider routerListener = new InternalDeviceProvider();
+
+ private final InternalControlMessageListener messageListener =
+ new InternalControlMessageListener();
+
+ /**
+ * Creates a LISP device provider with the supplier identifier.
+ */
+ public LispMessageProvider() {
+ super(new ProviderId(SCHEME_NAME, MESSAGE_PROVIDER_PACKAGE));
+ }
+
+ @Activate
+ public void activate() {
+
+ // listens all LISP router related events
+ controller.addRouterListener(routerListener);
+
+ // listens all LISP control messages
+ controller.addMessageListener(messageListener);
+
+ attachRouters();
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+
+ detachRouters();
+
+ // stops listening all LISP router related events
+ controller.removeRouterListener(routerListener);
+
+ // stops listening all LISP control messages
+ controller.removeMessageListener(messageListener);
+
+ log.info("Stopped");
+ }
+
+ /**
+ * Attaches all discovered LISP router to listen the router events.
+ */
+ private void attachRouters() {
+
+ }
+
+ /**
+ * Detaches all LISP routers from listener.
+ */
+ private void detachRouters() {
+
+ }
+
+ /**
+ * A routerListener for LISP router agent.
+ */
+ private class InternalDeviceProvider implements LispRouterListener {
+
+ @Override
+ public void routerAdded(LispRouterId routerId) {
+ }
+
+ @Override
+ public void routerRemoved(LispRouterId routerId) {
+ }
+
+ @Override
+ public void routerChanged(LispRouterId routerId) {
+ }
+ }
+
+ /**
+ * A routerListener for all LISP control messages.
+ */
+ private class InternalControlMessageListener implements LispMessageListener {
+
+ @Override
+ public void handleIncomingMessage(LispRouterId routerId, LispMessage msg) {
+ }
+
+ @Override
+ public void handleOutgoingMessage(LispRouterId routerId, LispMessage msg) {
+ }
+ }
+}
diff --git a/providers/lisp/message/src/main/java/org/onosproject/provider/lisp/message/impl/package-info.java b/providers/lisp/message/src/main/java/org/onosproject/provider/lisp/message/impl/package-info.java
new file mode 100644
index 0000000..85c9390
--- /dev/null
+++ b/providers/lisp/message/src/main/java/org/onosproject/provider/lisp/message/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.
+ */
+
+/**
+ * LISP Provider.
+ */
+package org.onosproject.provider.lisp.message.impl;
\ No newline at end of file
diff --git a/providers/lisp/pom.xml b/providers/lisp/pom.xml
index 0032bee..08062da 100644
--- a/providers/lisp/pom.xml
+++ b/providers/lisp/pom.xml
@@ -33,6 +33,7 @@
<modules>
<module>device</module>
<module>app</module>
+ <module>message</module>
</modules>
<dependencies>