alshabib

added of packet provider - unimplemented

...@@ -95,4 +95,4 @@ implements PacketService, PacketProviderRegistry { ...@@ -95,4 +95,4 @@ implements PacketService, PacketProviderRegistry {
95 } 95 }
96 96
97 } 97 }
98 -}
...\ No newline at end of file ...\ No newline at end of file
98 +}
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5 + <modelVersion>4.0.0</modelVersion>
6 +
7 + <parent>
8 + <groupId>org.onlab.onos</groupId>
9 + <artifactId>onos-of-providers</artifactId>
10 + <version>1.0.0-SNAPSHOT</version>
11 + <relativePath>../pom.xml</relativePath>
12 + </parent>
13 +
14 + <artifactId>onos-of-provider-packet</artifactId>
15 + <packaging>bundle</packaging>
16 +
17 + <description>ONOS OpenFlow protocol packet provider</description>
18 +
19 +</project>
1 +package org.onlab.onos.provider.of.packet.impl;
2 +
3 +import static org.slf4j.LoggerFactory.getLogger;
4 +
5 +import org.apache.felix.scr.annotations.Activate;
6 +import org.apache.felix.scr.annotations.Component;
7 +import org.apache.felix.scr.annotations.Deactivate;
8 +import org.apache.felix.scr.annotations.Reference;
9 +import org.apache.felix.scr.annotations.ReferenceCardinality;
10 +import org.onlab.onos.net.packet.OutboundPacket;
11 +import org.onlab.onos.net.packet.PacketProvider;
12 +import org.onlab.onos.net.packet.PacketProviderRegistry;
13 +import org.onlab.onos.net.packet.PacketProviderService;
14 +import org.onlab.onos.net.provider.AbstractProvider;
15 +import org.onlab.onos.net.provider.ProviderId;
16 +import org.onlab.onos.of.controller.OpenFlowController;
17 +import org.onlab.onos.of.controller.OpenFlowPacketContext;
18 +import org.onlab.onos.of.controller.PacketListener;
19 +import org.slf4j.Logger;
20 +
21 +/**
22 + * Provider which uses an OpenFlow controller to detect network
23 + * infrastructure links.
24 + */
25 +@Component(immediate = true)
26 +public class OpenFlowPacketProvider extends AbstractProvider implements PacketProvider {
27 +
28 + private final Logger log = getLogger(getClass());
29 +
30 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
31 + protected PacketProviderRegistry providerRegistry;
32 +
33 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
34 + protected OpenFlowController controller;
35 +
36 + private PacketProviderService providerService;
37 +
38 + private final boolean useBDDP = true;
39 +
40 + private final InternalPacketProvider listener = new InternalPacketProvider();
41 +
42 +
43 +
44 + /**
45 + * Creates an OpenFlow link provider.
46 + */
47 + public OpenFlowPacketProvider() {
48 + super(new ProviderId("org.onlab.onos.provider.openflow"));
49 + }
50 +
51 + @Activate
52 + public void activate() {
53 + providerService = providerRegistry.register(this);
54 + controller.addPacketListener(0, listener);
55 + log.info("Started");
56 + }
57 +
58 + @Deactivate
59 + public void deactivate() {
60 + providerRegistry.unregister(this);
61 + controller.removePacketListener(listener);
62 + providerService = null;
63 + log.info("Stopped");
64 + }
65 +
66 + @Override
67 + public void emit(OutboundPacket packet) {
68 + // TODO Auto-generated method stub
69 +
70 + }
71 +
72 +
73 + private class InternalPacketProvider implements PacketListener {
74 +
75 +
76 + @Override
77 + public void handlePacket(OpenFlowPacketContext pktCtx) {
78 +
79 +
80 + }
81 +
82 + }
83 +
84 +
85 +}
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
20 <module>device</module> 20 <module>device</module>
21 <module>link</module> 21 <module>link</module>
22 <module>host</module> 22 <module>host</module>
23 + <module>packet</module>
23 </modules> 24 </modules>
24 25
25 <dependencies> 26 <dependencies>
......