WIP: proxy NDP for IPv6.
ONOS-924
Need to implement test cases.
Change-Id: I86b0cb8c3c8d75f7276778e04c1a7166c9bb2f59
diff --git a/apps/pom.xml b/apps/pom.xml
index 851fa8b..ca64e5f 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -37,6 +37,7 @@
<module>ifwd</module>
<module>mobility</module>
<module>proxyarp</module>
+ <module>proxyndp</module>
<module>config</module>
<module>sdnip</module>
<module>calendar</module>
diff --git a/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java b/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
index 01018fd..f0dce52 100644
--- a/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
+++ b/apps/proxyarp/src/main/java/org/onosproject/proxyarp/ProxyArp.java
@@ -91,7 +91,7 @@
}
//handle the arp packet.
- proxyArpService.handleArp(context);
+ proxyArpService.handlePacket(context);
}
}
}
diff --git a/apps/proxyndp/pom.xml b/apps/proxyndp/pom.xml
new file mode 100644
index 0000000..688710e
--- /dev/null
+++ b/apps/proxyndp/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2014 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-apps</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-app-proxyndp</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS simple proxy neighbor discovery for IPv6 module</description>
+
+</project>
diff --git a/apps/proxyndp/src/main/java/org/onosproject/proxyndp/ProxyNdp.java b/apps/proxyndp/src/main/java/org/onosproject/proxyndp/ProxyNdp.java
new file mode 100644
index 0000000..5a1c240
--- /dev/null
+++ b/apps/proxyndp/src/main/java/org/onosproject/proxyndp/ProxyNdp.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2014 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.proxyndp;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+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.packet.Ethernet;
+import org.onlab.packet.IPv6;
+import org.onlab.packet.ICMP6;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.packet.PacketContext;
+import org.onosproject.net.packet.PacketPriority;
+import org.onosproject.net.packet.PacketProcessor;
+import org.onosproject.net.packet.PacketService;
+import org.onosproject.net.proxyarp.ProxyArpService;
+import org.slf4j.Logger;
+
+/**
+ * Sample reactive proxy ndp application.
+ */
+@Component(immediate = true)
+public class ProxyNdp {
+
+ private final Logger log = getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected PacketService packetService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected ProxyArpService proxyArpService;
+
+ private ProxyNdpProcessor processor = new ProxyNdpProcessor();
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected CoreService coreService;
+
+ private ApplicationId appId;
+
+ @Activate
+ public void activate() {
+ appId = coreService.registerApplication("org.onosproject.proxyndp");
+ packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 1);
+
+ TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
+ selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
+ selectorBuilder.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
+ selectorBuilder.matchIcmpv6Type(ICMP6.NEIGHBOR_SOLICITATION);
+ packetService.requestPackets(selectorBuilder.build(),
+ PacketPriority.CONTROL, appId);
+
+ selectorBuilder = DefaultTrafficSelector.builder();
+ selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
+ selectorBuilder.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
+ selectorBuilder.matchIcmpv6Type(ICMP6.NEIGHBOR_ADVERTISEMENT);
+ packetService.requestPackets(selectorBuilder.build(),
+ PacketPriority.CONTROL, appId);
+
+ log.info("Started with Application ID {}", appId.id());
+ }
+
+ @Deactivate
+ public void deactivate() {
+ packetService.removeProcessor(processor);
+ processor = null;
+ log.info("Stopped");
+ }
+
+
+ /**
+ * Packet processor responsible for forwarding packets along their paths.
+ */
+ private class ProxyNdpProcessor implements PacketProcessor {
+
+ @Override
+ public void process(PacketContext context) {
+ // Stop processing if the packet has been handled, since we
+ // can't do any more to it.
+ if (context.isHandled()) {
+ return;
+ }
+
+ // Handle the neighbor discovery packet.
+ proxyArpService.handlePacket(context);
+ }
+ }
+}
+
+
diff --git a/apps/proxyndp/src/main/java/org/onosproject/proxyndp/package-info.java b/apps/proxyndp/src/main/java/org/onosproject/proxyndp/package-info.java
new file mode 100644
index 0000000..10c6134
--- /dev/null
+++ b/apps/proxyndp/src/main/java/org/onosproject/proxyndp/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014 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.
+ */
+
+/**
+ * Proxy Ndp application that handles IPv6 neighbor resolution for you.
+ */
+package org.onosproject.proxyndp;