[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/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