Merge "New features"
authorMartin Sunal <msunal@cisco.com>
Fri, 6 Nov 2015 19:44:58 +0000 (19:44 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 6 Nov 2015 19:44:58 +0000 (19:44 +0000)
groupbasedpolicy/pom.xml
neutron-mapper/pom.xml
neutron-ovsdb/pom.xml
renderers/faas/pom.xml
renderers/ofoverlay/pom.xml
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/GroupTable.java
ui-backend/pom.xml

index 4d16a74bf50f4325e5e8772e4d8736955c59d0ad..bdb7d6fbad04ea543d2b69fff48c1c98000915ab 100644 (file)
       <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>
-
index 0f76a2a07eda2fb5bb4d569c14d2a7178acc6103..e563cb0dcc587348e2bd9236b4d8ffb2b461ef80 100644 (file)
@@ -25,6 +25,7 @@
   </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
index 8311b9c888c5f83ac0688b3e033e1d0849d35836..9accd0b81161cfd41f6a82689949bf4535f60f78 100644 (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
index 8cea0bcadde348ecb50ef74a8573a219084add5b..a99a73b861d0dcc00a6ea55bd39abeb08d134eea 100644 (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>
@@ -44,7 +40,7 @@
     </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
index 80f58720ef8dc7870e8499529f57ab3cd5fbf341..f9d4b39494e44e9b4407dab2500cce779b3f547e 100644 (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
index 99b07671dc0ea0989b7c8eb2100df788b9c8fe3d..3bed5c02cda56589b6d94575b6417c52af9dae7f 100644 (file)
@@ -14,10 +14,12 @@ import static org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtil
 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;
@@ -30,7 +32,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 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;
@@ -104,30 +105,31 @@ public class GroupTable extends OfTable {
 
                 // 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 ||
@@ -150,4 +152,28 @@ public class GroupTable extends OfTable {
         }
     }
 
+    /**
+     * @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;
+    }
 }
index db8586013b5e8c747debe3feb97c43477879f4e0..c1750c8651c170837ebb3fa6c4bea9b2b150b1da 100644 (file)
   <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