Committed by
Gerrit Code Review
[ONOS-3855] - Implement BGP flow spec provider framework
Change-Id: I356a1f80790d9fa08aea9bcbf635a8b11c7ccac7
Showing
4 changed files
with
171 additions
and
0 deletions
providers/bgp/flow/pom.xml
0 → 100755
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-bgp-providers</artifactId> | ||
25 | + <version>1.5.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-bgp-provider-flow</artifactId> | ||
30 | + <packaging>bundle</packaging> | ||
31 | + | ||
32 | + <description>ONOS BGP protocol flow provider</description> | ||
33 | + | ||
34 | + <dependencies> | ||
35 | + <dependency> | ||
36 | + <groupId>org.osgi</groupId> | ||
37 | + <artifactId>org.osgi.compendium</artifactId> | ||
38 | + </dependency> | ||
39 | + </dependencies> | ||
40 | +</project> |
providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/BgpFlowRuleProvider.java
0 → 100755
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.bgp.flow.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.bgp.controller.BgpController; | ||
24 | +import org.onosproject.cfg.ComponentConfigService; | ||
25 | +import org.onosproject.core.ApplicationId; | ||
26 | +import org.onosproject.net.flow.FlowRule; | ||
27 | +import org.onosproject.net.flow.FlowRuleBatchOperation; | ||
28 | +import org.onosproject.net.flow.FlowRuleProvider; | ||
29 | +import org.onosproject.net.flow.FlowRuleProviderRegistry; | ||
30 | +import org.onosproject.net.flow.FlowRuleProviderService; | ||
31 | +import org.onosproject.net.provider.AbstractProvider; | ||
32 | +import org.onosproject.net.provider.ProviderId; | ||
33 | +import org.osgi.service.component.ComponentContext; | ||
34 | +import org.slf4j.Logger; | ||
35 | + | ||
36 | +import static org.slf4j.LoggerFactory.getLogger; | ||
37 | + | ||
38 | +/** | ||
39 | + * Bgp Flow provider. | ||
40 | + */ | ||
41 | +@Component(immediate = true) | ||
42 | +public class BgpFlowRuleProvider extends AbstractProvider | ||
43 | + implements FlowRuleProvider { | ||
44 | + | ||
45 | + private final Logger log = getLogger(getClass()); | ||
46 | + | ||
47 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
48 | + protected FlowRuleProviderRegistry providerRegistry; | ||
49 | + | ||
50 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
51 | + protected ComponentConfigService cfgService; | ||
52 | + | ||
53 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
54 | + protected BgpController bgpController; | ||
55 | + | ||
56 | + private FlowRuleProviderService providerService; | ||
57 | + | ||
58 | + /** | ||
59 | + * Creates an BgpFlow host provider. | ||
60 | + */ | ||
61 | + public BgpFlowRuleProvider() { | ||
62 | + super(new ProviderId("bgp", "org.onosproject.provider.bgp")); | ||
63 | + } | ||
64 | + | ||
65 | + @Activate | ||
66 | + public void activate(ComponentContext context) { | ||
67 | + cfgService.registerProperties(getClass()); | ||
68 | + providerService = providerRegistry.register(this); | ||
69 | + } | ||
70 | + | ||
71 | + @Deactivate | ||
72 | + public void deactivate(ComponentContext context) { | ||
73 | + cfgService.unregisterProperties(getClass(), false); | ||
74 | + providerRegistry.unregister(this); | ||
75 | + providerService = null; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public void applyFlowRule(FlowRule... flowRules) { | ||
80 | + for (FlowRule flowRule : flowRules) { | ||
81 | + applyRule(flowRule); | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + private void applyRule(FlowRule flowRule) { | ||
86 | + //TODO | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public void removeFlowRule(FlowRule... flowRules) { | ||
91 | + for (FlowRule flowRule : flowRules) { | ||
92 | + removeRule(flowRule); | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + private void removeRule(FlowRule flowRule) { | ||
97 | + //TODO | ||
98 | + } | ||
99 | + | ||
100 | + @Override | ||
101 | + public void removeRulesById(ApplicationId id, FlowRule... flowRules) { | ||
102 | + // TODO | ||
103 | + removeFlowRule(flowRules); | ||
104 | + } | ||
105 | + | ||
106 | + @Override | ||
107 | + public void executeBatch(FlowRuleBatchOperation batch) { | ||
108 | + //TODO | ||
109 | + } | ||
110 | +} |
providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/package-info.java
0 → 100755
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 | +/** | ||
18 | + * Bgp Flow provider. | ||
19 | + */ | ||
20 | +package org.onosproject.provider.bgp.flow.impl; |
-
Please register or login to post a comment