diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-22 10:02:05 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-22 10:02:05 -0800 |
commit | 77ce3be7567bd01c66d8ee88a93b485666723501 (patch) | |
tree | 283e7f39a501750bbd705fbb91645b20198900f1 /framework/src/onos/providers/openflow | |
parent | 00e6500d0813dcbccaaa741ef38cc1eae6d11e07 (diff) |
Removed patch path since changes have been merged upstream to a different path. Updated README with directions.
Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/providers/openflow')
8 files changed, 131 insertions, 139 deletions
diff --git a/framework/src/onos/providers/openflow/app/app.xml b/framework/src/onos/providers/openflow/app/app.xml deleted file mode 100644 index e54d1a8a..00000000 --- a/framework/src/onos/providers/openflow/app/app.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2015 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. - --> -<app name="org.onosproject.openflow" origin="ON.Lab" version="${project.version}" - featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" - features="${project.artifactId}"> - <description>${project.description}</description> - - <artifact>mvn:${project.groupId}/onos-of-api/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-of-ctl/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-drivers/${project.version}</artifact> - - <artifact>mvn:${project.groupId}/onos-lldp-provider/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-host-provider/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-of-provider-device/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-of-provider-packet/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-of-provider-flow/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-of-provider-group/${project.version}</artifact> - <artifact>mvn:${project.groupId}/onos-of-provider-meter/${project.version}</artifact> -</app> diff --git a/framework/src/onos/providers/openflow/app/features.xml b/framework/src/onos/providers/openflow/app/features.xml deleted file mode 100644 index 9dbae8af..00000000 --- a/framework/src/onos/providers/openflow/app/features.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<!-- - ~ Copyright 2015 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. - --> -<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> - <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository> - <feature name="${project.artifactId}" version="${project.version}" - description="${project.description}"> - <feature>onos-api</feature> - <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> - <bundle>mvn:${project.groupId}/onos-of-api/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-of-ctl/${project.version}</bundle> - - <bundle>mvn:${project.groupId}/onos-lldp-provider/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-host-provider/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-of-provider-device/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-of-provider-packet/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-of-provider-flow/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-of-provider-group/${project.version}</bundle> - <bundle>mvn:${project.groupId}/onos-of-provider-meter/${project.version}</bundle> - </feature> -</features> diff --git a/framework/src/onos/providers/openflow/app/pom.xml b/framework/src/onos/providers/openflow/app/pom.xml index cb55463b..ac5f6eee 100644 --- a/framework/src/onos/providers/openflow/app/pom.xml +++ b/framework/src/onos/providers/openflow/app/pom.xml @@ -27,55 +27,23 @@ </parent> <artifactId>onos-openflow</artifactId> - <packaging>pom</packaging> + <packaging>bundle</packaging> - <description>OpenFlow protocol southbound providers</description> + <properties> + <onos.app.name>org.onosproject.openflow</onos.app.name> + <onos.app.requires> + org.onosproject.openflow-base, + org.onosproject.hostprovider, + org.onosproject.lldpprovider + </onos.app.requires> + </properties> + + <description>OpenFlow southbound meta application</description> <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-of-api</artifactId> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-of-ctl</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-drivers</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-of-provider-device</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-of-provider-packet</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-of-provider-flow</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-of-provider-group</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-lldp-provider</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-host-provider</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onosproject</groupId> + <artifactId>onos-of-api</artifactId> + </dependency> </dependencies> - </project> diff --git a/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java b/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java index c591f47d..f4ab0173 100644 --- a/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java +++ b/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java @@ -707,10 +707,13 @@ public class FlowEntryBuilder { long tunnelId = match.get(MatchField.TUNNEL_ID).getValue(); builder.matchTunnelId(tunnelId); break; + case ARP_THA: + mac = MacAddress.valueOf(match.get(MatchField.ARP_THA).getLong()); + builder.matchArpTha(mac); + break; case ARP_OP: case ARP_SHA: case ARP_SPA: - case ARP_THA: case ARP_TPA: case MPLS_TC: default: diff --git a/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java b/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java index 010d7e7c..2e5be654 100644 --- a/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java +++ b/framework/src/onos/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java @@ -24,6 +24,7 @@ import org.onosproject.net.OchSignal; import org.onosproject.net.driver.DriverService; import org.onosproject.net.flow.FlowRule; import org.onosproject.net.flow.TrafficSelector; +import org.onosproject.net.flow.criteria.ArpHaCriterion; import org.onosproject.net.flow.criteria.Criterion; import org.onosproject.net.flow.criteria.EthCriterion; import org.onosproject.net.flow.criteria.EthTypeCriterion; @@ -178,6 +179,7 @@ public abstract class FlowModBuilder { UdpPortCriterion udpPortCriterion; SctpPortCriterion sctpPortCriterion; IPv6NDLinkLayerAddressCriterion llAddressCriterion; + ArpHaCriterion arpHaCriterion; for (Criterion c : selector.criteria()) { switch (c.type()) { @@ -415,10 +417,14 @@ public abstract class FlowModBuilder { mplsBos.mplsBos() ? OFBooleanValue.TRUE : OFBooleanValue.FALSE); break; + case ARP_THA: + arpHaCriterion = (ArpHaCriterion) c; + mBuilder.setExact(MatchField.ARP_THA, + MacAddress.of(arpHaCriterion.mac().toLong())); + break; case ARP_OP: case ARP_SHA: case ARP_SPA: - case ARP_THA: case ARP_TPA: case MPLS_TC: case PBB_ISID: diff --git a/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java b/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java index d5804f44..c91616df 100644 --- a/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java +++ b/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/GroupModBuilder.java @@ -15,11 +15,25 @@ */ package org.onosproject.provider.of.group.impl; +import static org.slf4j.LoggerFactory.getLogger; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; + import org.onlab.packet.Ip4Address; import org.onlab.packet.Ip6Address; import org.onosproject.core.GroupId; +import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber; +import org.onosproject.net.driver.DefaultDriverData; +import org.onosproject.net.driver.DefaultDriverHandler; +import org.onosproject.net.driver.Driver; +import org.onosproject.net.driver.DriverService; import org.onosproject.net.flow.TrafficTreatment; +import org.onosproject.net.flow.instructions.ExtensionInstruction; import org.onosproject.net.flow.instructions.Instruction; import org.onosproject.net.flow.instructions.Instructions; import org.onosproject.net.flow.instructions.L0ModificationInstruction; @@ -28,6 +42,7 @@ import org.onosproject.net.flow.instructions.L3ModificationInstruction; import org.onosproject.net.group.GroupBucket; import org.onosproject.net.group.GroupBuckets; import org.onosproject.net.group.GroupDescription; +import org.onosproject.openflow.controller.ExtensionInterpreter; import org.projectfloodlight.openflow.protocol.OFBucket; import org.projectfloodlight.openflow.protocol.OFFactory; import org.projectfloodlight.openflow.protocol.OFGroupAdd; @@ -52,14 +67,6 @@ import org.projectfloodlight.openflow.types.U32; import org.projectfloodlight.openflow.types.VlanPcp; import org.slf4j.Logger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; - -import static org.slf4j.LoggerFactory.getLogger; - /* * Builder for GroupMod. */ @@ -70,6 +77,7 @@ public final class GroupModBuilder { private GroupDescription.Type type; private OFFactory factory; private Long xid; + private Optional<DriverService> driverService; private final Logger log = getLogger(getClass()); @@ -85,6 +93,16 @@ public final class GroupModBuilder { this.xid = xid.orElse((long) 0); } + private GroupModBuilder(GroupBuckets buckets, GroupId groupId, + GroupDescription.Type type, OFFactory factory, + Optional<Long> xid, Optional<DriverService> driverService) { + this.buckets = buckets; + this.groupId = groupId; + this.type = type; + this.factory = factory; + this.xid = xid.orElse((long) 0); + this.driverService = driverService; + } /** * Creates a builder for GroupMod. * @@ -103,6 +121,24 @@ public final class GroupModBuilder { } /** + * Creates a builder for GroupMod. + * + * @param buckets GroupBuckets object + * @param groupId Group Id to create + * @param type Group type + * @param factory OFFactory object + * @param xid transaction ID + * @param driverService driver Service + * @return GroupModBuilder object + */ + public static GroupModBuilder builder(GroupBuckets buckets, GroupId groupId, + GroupDescription.Type type, OFFactory factory, + Optional<Long> xid, Optional<DriverService> driverService) { + + return new GroupModBuilder(buckets, groupId, type, factory, xid, driverService); + } + + /** * Builds the GroupAdd OF message. * * @return GroupAdd OF message @@ -118,8 +154,17 @@ public final class GroupModBuilder { if (type == GroupDescription.Type.SELECT) { bucketBuilder.setWeight(1); } - bucketBuilder.setWatchGroup(OFGroup.ANY); - bucketBuilder.setWatchPort(OFPort.ANY); + + if (type == GroupDescription.Type.FAILOVER && bucket.watchPort() != null) { + bucketBuilder.setWatchPort(OFPort.of((int) bucket.watchPort().toLong())); + } else { + bucketBuilder.setWatchPort(OFPort.ANY); + } + if (type == GroupDescription.Type.FAILOVER && bucket.watchGroup() != null) { + bucketBuilder.setWatchGroup(OFGroup.of(bucket.watchGroup().id())); + } else { + bucketBuilder.setWatchGroup(OFGroup.ANY); + } OFBucket ofBucket = bucketBuilder.build(); ofBuckets.add(ofBucket); } @@ -218,6 +263,12 @@ public final class GroupModBuilder { .setGroup(OFGroup.of(grp.groupId().id())); actions.add(actgrp.build()); break; + case EXTENSION: + Instructions.ExtensionInstructionWrapper wrapper = + (Instructions.ExtensionInstructionWrapper) i; + actions.add(buildExtensionAction( + wrapper.extensionInstruction(), wrapper.deviceId())); + break; default: log.warn("Instruction type {} not yet implemented.", i.type()); } @@ -372,5 +423,21 @@ public final class GroupModBuilder { } return null; } + + private OFAction buildExtensionAction(ExtensionInstruction i, DeviceId deviceId) { + if (!driverService.isPresent()) { + log.error("No driver service present"); + return null; + } + Driver driver = driverService.get().getDriver(deviceId); + if (driver.hasBehaviour(ExtensionInterpreter.class)) { + DefaultDriverHandler handler = + new DefaultDriverHandler(new DefaultDriverData(driver, deviceId)); + ExtensionInterpreter interpreter = handler.behaviour(ExtensionInterpreter.class); + return interpreter.mapInstruction(factory, i); + } + + return null; + } } diff --git a/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/OpenFlowGroupProvider.java b/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/OpenFlowGroupProvider.java index 5783c842..e69fd6b9 100644 --- a/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/OpenFlowGroupProvider.java +++ b/framework/src/onos/providers/openflow/group/src/main/java/org/onosproject/provider/of/group/impl/OpenFlowGroupProvider.java @@ -16,7 +16,12 @@ package org.onosproject.provider.of.group.impl; -import com.google.common.collect.Maps; +import static org.slf4j.LoggerFactory.getLogger; + +import java.util.Collection; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicLong; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; @@ -26,6 +31,7 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; import org.onosproject.core.DefaultGroupId; import org.onosproject.core.GroupId; import org.onosproject.net.DeviceId; +import org.onosproject.net.driver.DriverService; import org.onosproject.net.group.DefaultGroup; import org.onosproject.net.group.Group; import org.onosproject.net.group.GroupBuckets; @@ -60,12 +66,7 @@ import org.projectfloodlight.openflow.protocol.OFStatsType; import org.projectfloodlight.openflow.protocol.OFVersion; import org.slf4j.Logger; -import java.util.Collection; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicLong; - -import static org.slf4j.LoggerFactory.getLogger; +import com.google.common.collect.Maps; /** * Provider which uses an OpenFlow controller to handle Group. @@ -81,6 +82,9 @@ public class OpenFlowGroupProvider extends AbstractProvider implements GroupProv @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) protected GroupProviderRegistry providerRegistry; + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) + protected DriverService driverService; + private GroupProviderService providerService; static final int POLL_INTERVAL = 10; @@ -139,12 +143,21 @@ public class OpenFlowGroupProvider extends AbstractProvider implements GroupProv return; } final Long groupModXid = XID_COUNTER.getAndIncrement(); - GroupModBuilder builder = - GroupModBuilder.builder(groupOperation.buckets(), - groupOperation.groupId(), - groupOperation.groupType(), - sw.factory(), - Optional.of(groupModXid)); + GroupModBuilder builder = null; + if (driverService == null) { + builder = GroupModBuilder.builder(groupOperation.buckets(), + groupOperation.groupId(), + groupOperation.groupType(), + sw.factory(), + Optional.of(groupModXid)); + } else { + builder = GroupModBuilder.builder(groupOperation.buckets(), + groupOperation.groupId(), + groupOperation.groupType(), + sw.factory(), + Optional.of(groupModXid), + Optional.of(driverService)); + } OFGroupMod groupMod = null; switch (groupOperation.opType()) { case ADD: @@ -158,6 +171,7 @@ public class OpenFlowGroupProvider extends AbstractProvider implements GroupProv break; default: log.error("Unsupported Group operation"); + return; } sw.sendMsg(groupMod); GroupId groudId = new DefaultGroupId(groupMod.getGroup().getGroupNumber()); diff --git a/framework/src/onos/providers/openflow/pom.xml b/framework/src/onos/providers/openflow/pom.xml index c098a609..1250af61 100644 --- a/framework/src/onos/providers/openflow/pom.xml +++ b/framework/src/onos/providers/openflow/pom.xml @@ -37,6 +37,7 @@ <module>flow</module> <module>group</module> <module>meter</module> + <module>base</module> <module>app</module> </modules> |