[ONOS-5750] Add skeleton code of LISP mapping provider
This commit also enables LISP mapping and messsage providers.
Change-Id: I06ff330ba6144bff472c2ede49d9e477aa38880b
diff --git a/providers/lisp/BUCK b/providers/lisp/BUCK
index f37abbd..86fc304 100644
--- a/providers/lisp/BUCK
+++ b/providers/lisp/BUCK
@@ -1,5 +1,7 @@
BUNDLES = [
'//providers/lisp/device:onos-providers-lisp-device',
+ '//providers/lisp/mapping:onos-providers-lisp-mapping',
+ '//providers/lisp/message:onos-providers-lisp-message',
'//protocols/lisp/api:onos-protocols-lisp-api',
'//protocols/lisp/ctl:onos-protocols-lisp-ctl',
'//protocols/lisp/msg:onos-protocols-lisp-msg',
diff --git a/providers/lisp/app/app.xml b/providers/lisp/app/app.xml
index c30de3e..f213b25 100644
--- a/providers/lisp/app/app.xml
+++ b/providers/lisp/app/app.xml
@@ -24,5 +24,6 @@
<artifact>mvn:${project.groupId}/onos-lisp-msg/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-lisp-provider-device/${project.version}</artifact>
-
+ <artifact>mvn:${project.groupId}/onos-lisp-provider-mapping/${project.version}</artifact>
+ <artifact>mvn:${project.groupId}/onos-lisp-provider-message/${project.version}</artifact>
</app>
diff --git a/providers/lisp/app/features.xml b/providers/lisp/app/features.xml
index 88b4f5e..e583ce8 100644
--- a/providers/lisp/app/features.xml
+++ b/providers/lisp/app/features.xml
@@ -23,6 +23,8 @@
<bundle>mvn:${project.groupId}/onos-lisp-msg/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-lisp-provider-device/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-lisp-provider-mapping/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-lisp-provider-message/${project.version}</bundle>
</feature>
</features>
diff --git a/providers/lisp/app/pom.xml b/providers/lisp/app/pom.xml
index 3d48dd7..0e54620 100644
--- a/providers/lisp/app/pom.xml
+++ b/providers/lisp/app/pom.xml
@@ -42,6 +42,16 @@
<artifactId>onos-lisp-provider-device</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-lisp-provider-message</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-lisp-provider-mapping</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/providers/lisp/mapping/BUCK b/providers/lisp/mapping/BUCK
new file mode 100644
index 0000000..a711177
--- /dev/null
+++ b/providers/lisp/mapping/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/mapping/pom.xml b/providers/lisp/mapping/pom.xml
new file mode 100644
index 0000000..2cea3c2
--- /dev/null
+++ b/providers/lisp/mapping/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-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-mapping</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS LISP protocol mapping provider</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </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>
+ </dependencies>
+</project>
diff --git a/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java b/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java
new file mode 100644
index 0000000..7c6d016
--- /dev/null
+++ b/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017-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.mapping.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.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 a LISP controller to manage EID-RLOC mapping.
+ */
+@Component(immediate = true)
+public class LispMappingProvider extends AbstractProvider {
+
+ private static final Logger log = LoggerFactory.getLogger(LispMappingProvider.class);
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected LispController controller;
+
+ private static final String SCHEME_NAME = "lisp";
+ private static final String MAPPING_PROVIDER_PACKAGE =
+ "org.onosproject.lisp.provider.mapping";
+
+ private final InternalMappingProvider listener = new InternalMappingProvider();
+
+ /**
+ * Creates a LISP mapping provider with the supplier identifier.
+ */
+ public LispMappingProvider() {
+ super(new ProviderId(SCHEME_NAME, MAPPING_PROVIDER_PACKAGE));
+ }
+
+ @Activate
+ public void activate() {
+
+ // listens all LISP router related events
+ controller.addRouterListener(listener);
+
+ // listens all LISP control message
+ controller.addMessageListener(listener);
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+
+ // stops listening all LISP router related events
+ controller.removeRouterListener(listener);
+
+ // stops listening all LISP control messages
+ controller.removeMessageListener(listener);
+
+ log.info("Stopped");
+ }
+
+ /**
+ * A listener for LISP router events and control messages.
+ */
+ private class InternalMappingProvider implements LispRouterListener,
+ LispMessageListener {
+
+ @Override
+ public void routerAdded(LispRouterId routerId) {
+
+ }
+
+ @Override
+ public void routerRemoved(LispRouterId routerId) {
+
+ }
+
+ @Override
+ public void routerChanged(LispRouterId routerId) {
+
+ }
+
+ @Override
+ public void handleIncomingMessage(LispRouterId routerId, LispMessage msg) {
+
+ }
+
+ @Override
+ public void handleOutgoingMessage(LispRouterId routerId, LispMessage msg) {
+
+ }
+ }
+}
diff --git a/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/package-info.java b/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/package-info.java
new file mode 100644
index 0000000..9d945ed
--- /dev/null
+++ b/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-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 mapping provider.
+ */
+package org.onosproject.provider.lisp.mapping.impl;
\ No newline at end of file
diff --git a/providers/lisp/pom.xml b/providers/lisp/pom.xml
index 08062da..b83bedc 100644
--- a/providers/lisp/pom.xml
+++ b/providers/lisp/pom.xml
@@ -31,9 +31,10 @@
<description>ONOS LISP protocol adapters</description>
<modules>
- <module>device</module>
<module>app</module>
+ <module>device</module>
<module>message</module>
+ <module>mapping</module>
</modules>
<dependencies>