<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-yang-types</artifactId>
</dependency>
-
- <!-- controller dependencies -->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
-
- <!-- project specific dependencies -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
-
<!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
- <!-- Sonar -->
- <dependency>
- <groupId>org.codehaus.sonar-plugins.java</groupId>
- <artifactId>sonar-jacoco-listeners</artifactId>
- <version>${sonar-jacoco-listeners.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
- <!-- project build -->
+<!-- project build -->
<build>
<plugins>
<plugin>
org.opendaylight.groupbasedpolicy.util,
</Export-Package>
</instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <versionRange>[0.6,)</versionRange>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
</project>
-
</properties>
<dependencies>
+ <!-- project specific dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>groupbasedpolicy</artifactId>
<artifactId>neutron-spi</artifactId>
<version>${neutron.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
<!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <!-- Sonar -->
- <dependency>
- <groupId>org.codehaus.sonar-plugins.java</groupId>
- <artifactId>sonar-jacoco-listeners</artifactId>
- <version>${sonar-jacoco-listeners.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
- <build>
+ <build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <versionRange>[0.6,)</versionRange>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
-</project>
+</project>
\ No newline at end of file
<artifactId>neutron-ovsdb</artifactId>
<version>0.3.0-SNAPSHOT</version>
<packaging>bundle</packaging>
-
+
<properties>
<ovsdb.version>1.2.1-SNAPSHOT</ovsdb.version>
</properties>
<dependencies>
+ <!-- project specific dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>groupbasedpolicy</artifactId>
<artifactId>neutron-mapper</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-config</artifactId>
- </dependency>
+ <!-- OVSDB dependencies -->
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-api</artifactId>
<artifactId>southbound-impl</artifactId>
<version>${ovsdb.version}</version>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
+ <!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
- <!-- Sonar -->
- <dependency>
- <groupId>org.codehaus.sonar-plugins.java</groupId>
- <artifactId>sonar-jacoco-listeners</artifactId>
- <version>${sonar-jacoco-listeners.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <versionRange>[0.6,)</versionRange>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
-</project>
+</project>
\ No newline at end of file
</properties>
<dependencies>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-extension-nicira</artifactId>
</dependency>
</dependencies>
- <!-- project build -->
+ <!-- project build -->
<build>
<plugins>
<plugin>
org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.faas.rev151009.*
</Export-Package>
</instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
</configuration>
</plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
<dependencies>
<!-- model dependencies -->
<dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>yang-ext</artifactId>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>southbound-api</artifactId>
+ <version>${ovsdb.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>southbound-api</artifactId>
- <version>${ovsdb.version}</version>
- </dependency>
<!-- project specific dependencies -->
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
- <!-- Sonar -->
- <dependency>
- <groupId>org.codehaus.sonar-plugins.java</groupId>
- <artifactId>sonar-jacoco-listeners</artifactId>
- <version>${sonar-jacoco-listeners.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<!-- project build -->
org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.ofoverlay.rev140528.*
</Export-Package>
</instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <versionRange>[0.6,)</versionRange>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
-</project>
-
+</project>
\ No newline at end of file
import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.nxLoadTunIPv4Action;
import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.outputAction;
-import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import com.google.common.base.Optional;
+
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.OfContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.Endpoint;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.ofoverlay.rev140528.EndpointLocation.LocationType;
// we'll use the fdId with the high bit set for remote bucket
// and just the local port number for local bucket
- for (NodeId destNode : ctx.getEndpointManager().getNodesForGroup(epg)) {
+ for (NodeId destNode : findPeerNodesForGroup(policyInfo, epg)) {
if (nodeId.equals(destNode))
continue;
- long bucketId = OrdinalFactory.getContextOrdinal(destNode);
- bucketId |= 1L << 31;
-
- IpAddress tunDst = ctx.getSwitchManager().getTunnelIP(destNode, TunnelTypeVxlan.class);
- NodeConnectorId tunPort = ctx.getSwitchManager().getTunnelPort(nodeId, TunnelTypeVxlan.class);
- if (tunDst == null || tunPort == null)
- continue;
- Action tundstAction = null;
- if (tunDst.getIpv4Address() != null) {
- String nextHop = tunDst.getIpv4Address().getValue();
- tundstAction = nxLoadTunIPv4Action(nextHop, true);
- } else {
- LOG.error("IPv6 tunnel destination {} for {} not supported", tunDst.getIpv6Address().getValue(),
- destNode);
- continue;
+ if(isFloodDomainOnNode(localEpFwdCtxOrds.getFdId(), destNode, policyInfo)) {
+ long bucketId = OrdinalFactory.getContextOrdinal(destNode);
+ bucketId |= 1L << 31;
+
+ IpAddress tunDst = ctx.getSwitchManager().getTunnelIP(destNode, TunnelTypeVxlan.class);
+ NodeConnectorId tunPort = ctx.getSwitchManager().getTunnelPort(nodeId, TunnelTypeVxlan.class);
+ if (tunDst == null || tunPort == null)
+ continue;
+ Action tundstAction = null;
+ if (tunDst.getIpv4Address() != null) {
+ String nextHop = tunDst.getIpv4Address().getValue();
+ tundstAction = nxLoadTunIPv4Action(nextHop, true);
+ } else {
+ LOG.error("IPv6 tunnel destination {} for {} not supported", tunDst.getIpv6Address().getValue(),
+ destNode);
+ continue;
+ }
+ BucketBuilder bb = new BucketBuilder().setBucketId(new BucketId(Long.valueOf(bucketId)))
+ .setAction(actionList(tundstAction, outputAction(tunPort)));
+ ofWriter.writeBucket(nodeId, gid, bb.build());
}
- BucketBuilder bb = new BucketBuilder().setBucketId(new BucketId(Long.valueOf(bucketId)))
- .setAction(actionList(tundstAction, outputAction(tunPort)));
-
- ofWriter.writeBucket(nodeId, gid, bb.build());
}
OfOverlayContext ofc = localEp.getAugmentation(OfOverlayContext.class);
if (ofc == null || ofc.getNodeConnectorId() == null ||
}
}
+ /**
+ * @param policyInfo to read peer groups for a group
+ * @param sourceEpgKey a key of source group
+ * @return all the nodes on which endpoints are either in groups that have policy with source
+ * group, or are in the source group
+ */
+ private Set<NodeId> findPeerNodesForGroup(PolicyInfo policyInfo, EgKey sourceEpgKey) {
+ Set<NodeId> nodes = new HashSet<NodeId>();
+ nodes.addAll(ctx.getEndpointManager().getNodesForGroup(sourceEpgKey));
+ for (EgKey dstEpgs : policyInfo.getPeers(sourceEpgKey)) {
+ nodes.addAll(ctx.getEndpointManager().getNodesForGroup(dstEpgs));
+ }
+ return nodes;
+ }
+
+ private boolean isFloodDomainOnNode(int fdId, NodeId node, PolicyInfo policyInfo) throws Exception {
+ for (Endpoint ep : ctx.getEndpointManager().getEndpointsForNode(node)) {
+ int epFdId = OrdinalFactory.getEndpointFwdCtxOrdinals(ctx, policyInfo, ep).getFdId();
+ if (fdId == epFdId) {
+ return true;
+ }
+ }
+ return false;
+ }
}
<version>0.3.0-SNAPSHOT</version>
<packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.groupbasedpolicy</groupId>
+ <artifactId>groupbasedpolicy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
<!-- project build -->
<build>
<plugins>
<manifestLocation>${project.basedir}/META-INF</manifestLocation>
</configuration>
</plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- </configuration>
- </plugin>
</plugins>
</build>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.groupbasedpolicy</groupId>
- <artifactId>groupbasedpolicy</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
+</project>
\ No newline at end of file