Kunihiro Ishiguro
Committed by Pavlin Radoslavov

Merge onos-app-proxyarp with onos-app-proxyndp.

Change-Id: I6e25c4575544e159ac9f7749fe07a742bfd6f748
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
37 <module>ifwd</module> 37 <module>ifwd</module>
38 <module>mobility</module> 38 <module>mobility</module>
39 <module>proxyarp</module> 39 <module>proxyarp</module>
40 - <module>proxyndp</module>
41 <module>config</module> 40 <module>config</module>
42 <module>sdnip</module> 41 <module>sdnip</module>
43 <module>calendar</module> 42 <module>calendar</module>
......
...@@ -23,6 +23,8 @@ import org.apache.felix.scr.annotations.Deactivate; ...@@ -23,6 +23,8 @@ import org.apache.felix.scr.annotations.Deactivate;
23 import org.apache.felix.scr.annotations.Reference; 23 import org.apache.felix.scr.annotations.Reference;
24 import org.apache.felix.scr.annotations.ReferenceCardinality; 24 import org.apache.felix.scr.annotations.ReferenceCardinality;
25 import org.onlab.packet.Ethernet; 25 import org.onlab.packet.Ethernet;
26 +import org.onlab.packet.IPv6;
27 +import org.onlab.packet.ICMP6;
26 import org.onosproject.core.ApplicationId; 28 import org.onosproject.core.ApplicationId;
27 import org.onosproject.core.CoreService; 29 import org.onosproject.core.CoreService;
28 import org.onosproject.net.flow.DefaultTrafficSelector; 30 import org.onosproject.net.flow.DefaultTrafficSelector;
...@@ -66,6 +68,22 @@ public class ProxyArp { ...@@ -66,6 +68,22 @@ public class ProxyArp {
66 packetService.requestPackets(selectorBuilder.build(), 68 packetService.requestPackets(selectorBuilder.build(),
67 PacketPriority.CONTROL, appId); 69 PacketPriority.CONTROL, appId);
68 70
71 + // IPv6 Neighbor Solicitation packet.
72 + selectorBuilder = DefaultTrafficSelector.builder();
73 + selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
74 + selectorBuilder.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
75 + selectorBuilder.matchIcmpv6Type(ICMP6.NEIGHBOR_SOLICITATION);
76 + packetService.requestPackets(selectorBuilder.build(),
77 + PacketPriority.CONTROL, appId);
78 +
79 + // IPv6 Neighbor Advertisement packet.
80 + selectorBuilder = DefaultTrafficSelector.builder();
81 + selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
82 + selectorBuilder.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
83 + selectorBuilder.matchIcmpv6Type(ICMP6.NEIGHBOR_ADVERTISEMENT);
84 + packetService.requestPackets(selectorBuilder.build(),
85 + PacketPriority.CONTROL, appId);
86 +
69 log.info("Started with Application ID {}", appId.id()); 87 log.info("Started with Application ID {}", appId.id());
70 } 88 }
71 89
......
1 -<?xml version="1.0" encoding="UTF-8"?>
2 -<!--
3 - ~ Copyright 2014 Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -<project xmlns="http://maven.apache.org/POM/4.0.0"
18 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
20 - <modelVersion>4.0.0</modelVersion>
21 -
22 - <parent>
23 - <groupId>org.onosproject</groupId>
24 - <artifactId>onos-apps</artifactId>
25 - <version>1.1.0-SNAPSHOT</version>
26 - <relativePath>../pom.xml</relativePath>
27 - </parent>
28 -
29 - <artifactId>onos-app-proxyndp</artifactId>
30 - <packaging>bundle</packaging>
31 -
32 - <description>ONOS simple proxy neighbor discovery for IPv6 module</description>
33 -
34 -</project>
1 -/*
2 - * Copyright 2014 Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package org.onosproject.proxyndp;
17 -
18 -import static org.slf4j.LoggerFactory.getLogger;
19 -
20 -import org.apache.felix.scr.annotations.Activate;
21 -import org.apache.felix.scr.annotations.Component;
22 -import org.apache.felix.scr.annotations.Deactivate;
23 -import org.apache.felix.scr.annotations.Reference;
24 -import org.apache.felix.scr.annotations.ReferenceCardinality;
25 -import org.onlab.packet.Ethernet;
26 -import org.onlab.packet.IPv6;
27 -import org.onlab.packet.ICMP6;
28 -import org.onosproject.core.ApplicationId;
29 -import org.onosproject.core.CoreService;
30 -import org.onosproject.net.flow.DefaultTrafficSelector;
31 -import org.onosproject.net.flow.TrafficSelector;
32 -import org.onosproject.net.packet.PacketContext;
33 -import org.onosproject.net.packet.PacketPriority;
34 -import org.onosproject.net.packet.PacketProcessor;
35 -import org.onosproject.net.packet.PacketService;
36 -import org.onosproject.net.proxyarp.ProxyArpService;
37 -import org.slf4j.Logger;
38 -
39 -/**
40 - * Sample reactive proxy ndp application.
41 - */
42 -@Component(immediate = true)
43 -public class ProxyNdp {
44 -
45 - private final Logger log = getLogger(getClass());
46 -
47 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
48 - protected PacketService packetService;
49 -
50 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
51 - protected ProxyArpService proxyArpService;
52 -
53 - private ProxyNdpProcessor processor = new ProxyNdpProcessor();
54 -
55 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
56 - protected CoreService coreService;
57 -
58 - private ApplicationId appId;
59 -
60 - @Activate
61 - public void activate() {
62 - appId = coreService.registerApplication("org.onosproject.proxyndp");
63 - packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 1);
64 -
65 - TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
66 - selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
67 - selectorBuilder.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
68 - selectorBuilder.matchIcmpv6Type(ICMP6.NEIGHBOR_SOLICITATION);
69 - packetService.requestPackets(selectorBuilder.build(),
70 - PacketPriority.CONTROL, appId);
71 -
72 - selectorBuilder = DefaultTrafficSelector.builder();
73 - selectorBuilder.matchEthType(Ethernet.TYPE_IPV6);
74 - selectorBuilder.matchIPProtocol(IPv6.PROTOCOL_ICMP6);
75 - selectorBuilder.matchIcmpv6Type(ICMP6.NEIGHBOR_ADVERTISEMENT);
76 - packetService.requestPackets(selectorBuilder.build(),
77 - PacketPriority.CONTROL, appId);
78 -
79 - log.info("Started with Application ID {}", appId.id());
80 - }
81 -
82 - @Deactivate
83 - public void deactivate() {
84 - packetService.removeProcessor(processor);
85 - processor = null;
86 - log.info("Stopped");
87 - }
88 -
89 -
90 - /**
91 - * Packet processor responsible for forwarding packets along their paths.
92 - */
93 - private class ProxyNdpProcessor implements PacketProcessor {
94 -
95 - @Override
96 - public void process(PacketContext context) {
97 - // Stop processing if the packet has been handled, since we
98 - // can't do any more to it.
99 - if (context.isHandled()) {
100 - return;
101 - }
102 -
103 - // Handle the neighbor discovery packet.
104 - proxyArpService.handlePacket(context);
105 - }
106 - }
107 -}
108 -
109 -
1 -/*
2 - * Copyright 2014 Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -
17 -/**
18 - * Proxy Ndp application that handles IPv6 neighbor resolution for you.
19 - */
20 -package org.onosproject.proxyndp;
...@@ -185,12 +185,6 @@ ...@@ -185,12 +185,6 @@
185 <bundle>mvn:org.onosproject/onos-app-proxyarp/@ONOS-VERSION</bundle> 185 <bundle>mvn:org.onosproject/onos-app-proxyarp/@ONOS-VERSION</bundle>
186 </feature> 186 </feature>
187 187
188 - <feature name="onos-app-proxyndp" version="@FEATURE-VERSION"
189 - description="ONOS sample proxyndp application">
190 - <feature>onos-api</feature>
191 - <bundle>mvn:org.onosproject/onos-app-proxyndp/@ONOS-VERSION</bundle>
192 - </feature>
193 -
194 <feature name="onos-app-foo" version="@FEATURE-VERSION" 188 <feature name="onos-app-foo" version="@FEATURE-VERSION"
195 description="ONOS sample playground application"> 189 description="ONOS sample playground application">
196 <feature>onos-api</feature> 190 <feature>onos-api</feature>
......