Jian Li
Committed by Gerrit Code Review

Add skeletal code for control message provider

Change-Id: I29e28ae268693f62631f2d70a5e6f74e482a4643
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!--
3 + ~ Copyright 2016 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 + <parent>
22 + <groupId>org.onosproject</groupId>
23 + <artifactId>onos-of-providers</artifactId>
24 + <version>1.5.0-SNAPSHOT</version>
25 + <relativePath>../pom.xml</relativePath>
26 + </parent>
27 +
28 + <artifactId>onos-of-provider-message</artifactId>
29 + <packaging>bundle</packaging>
30 +
31 + <description>ONOS OpenFlow control message provider</description>
32 +
33 + <dependencies>
34 + <dependency>
35 + <groupId>org.onosproject</groupId>
36 + <artifactId>onos-app-cpman-api</artifactId>
37 + <version>${project.version}</version>
38 + </dependency>
39 + </dependencies>
40 +</project>
1 +/*
2 + * Copyright 2016 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.provider.of.message.impl;
17 +
18 +import org.apache.felix.scr.annotations.Activate;
19 +import org.apache.felix.scr.annotations.Component;
20 +import org.apache.felix.scr.annotations.Deactivate;
21 +import org.apache.felix.scr.annotations.Reference;
22 +import org.apache.felix.scr.annotations.ReferenceCardinality;
23 +import org.onosproject.cpman.message.ControlMessageProvider;
24 +import org.onosproject.cpman.message.ControlMessageProviderRegistry;
25 +import org.onosproject.cpman.message.ControlMessageProviderService;
26 +import org.onosproject.net.provider.AbstractProvider;
27 +import org.onosproject.net.provider.ProviderId;
28 +import org.slf4j.Logger;
29 +
30 +import static org.slf4j.LoggerFactory.getLogger;
31 +
32 +/**
33 + * Provider which uses an OpenFlow controller to collect control message.
34 + */
35 +@Component(immediate = true)
36 +public class OpenFlowControlMessageProvider extends AbstractProvider
37 + implements ControlMessageProvider {
38 +
39 + private static final Logger LOG = getLogger(OpenFlowControlMessageProvider.class);
40 +
41 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
42 + protected ControlMessageProviderRegistry providerRegistry;
43 +
44 + private ControlMessageProviderService providerService;
45 +
46 + /**
47 + * Creates a provider with the supplier identifier.
48 + */
49 + public OpenFlowControlMessageProvider() {
50 + super(new ProviderId("of", "org.onosproject.provider.openflow"));
51 + }
52 +
53 + @Activate
54 + protected void activate() {
55 + providerService = providerRegistry.register(this);
56 + LOG.info("Started");
57 + }
58 +
59 + @Deactivate
60 + protected void deactivate() {
61 + providerRegistry.unregister(this);
62 + providerService = null;
63 + LOG.info("Stopped");
64 + }
65 +}
1 +/*
2 + * Copyright 2016 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 + * Provider which uses an OpenFlow controller to collect control message.
18 + */
19 +package org.onosproject.provider.of.message.impl;
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016 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.provider.of.message.impl;
17 +
18 +/**
19 + * OpenFlow control message provider test class.
20 + */
21 +public class OpenFlowControlMessageProviderTest {
22 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
39 <module>meter</module> 39 <module>meter</module>
40 <module>base</module> 40 <module>base</module>
41 <module>app</module> 41 <module>app</module>
42 +
43 + <!-- optional -->
44 + <module>message</module>
42 </modules> 45 </modules>
43 46
44 <dependencies> 47 <dependencies>
......