<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
<configuration>
<destFile>../implementation/target/jacoco-it.exec</destFile>
<includes>org.opendaylight.controller.*</includes>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
<sample-toaster.version>1.0-SNAPSHOT</sample-toaster.version>
<releaseplugin.version>2.3.2</releaseplugin.version>
<commons.lang.version>3.1</commons.lang.version>
+ <jacoco.version>0.5.3.201107060350</jacoco.version>
</properties>
<pluginRepositories>
config.getName()));
}
}
+ } else {
+ // Check for conflicting names with existing cFlows
+ List<String> conflicting = new ArrayList<String>(existingNames);
+ conflicting.retainAll(proposedNames);
+ if (!conflicting.isEmpty()) {
+ return new Status(StatusCode.CONFLICT,
+ "Invalid Flow Spec configuration: flow spec name(s) conflict with existing flow specs: "
+ + conflicting.toString());
+ }
+
+ /*
+ * Check for conflicting flow spec match (we only check for strict
+ * equality). Remove this in case (*) is reintroduced
+ */
+ if (this.containerFlows != null && !this.containerFlows.isEmpty()) {
+ Set<Match> existingMatches = new HashSet<Match>();
+ for (ContainerFlowConfig existing : this.containerFlows) {
+ existingMatches.addAll(existing.getMatches());
+ }
+ for (ContainerFlowConfig proposed : cFlowConfigs) {
+ if (existingMatches.removeAll(proposed.getMatches())) {
+ return new Status(StatusCode.CONFLICT, String.format(
+ "Invalid Flow Spec configuration: %s conflicts with existing flow spec",
+ proposed.getName()));
+ }
+ }
+ }
}
+
/*
* Revisit the following flow-spec confict validation later based on more testing.
- */
- /*
+ * (*)
if (!delete) {
// Check for overlapping container flows in the request
int size = cFlowConfigs.size();
@Override
public boolean doesContainerExist(String ContainerId) {
- // TODO Auto-generated method stub
- return false;
+ return GlobalConstants.DEFAULT.toString().equalsIgnoreCase(ContainerId);
}
@Override
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
}
}
if (target != null) {
- // Program the network node
- Status status = (target.installInHw()) ? this.uninstallFlowEntry(target.getFlowEntry()) : this
- .installFlowEntry(target.getFlowEntry());
+ Status status = target.validate(container);
+ if (!status.isSuccess()) {
+ log.warn(status.getDescription());
+ return status;
+ }
+ status = (target.installInHw()) ? this.uninstallFlowEntry(target.getFlowEntry()) : this
+ .installFlowEntry(target.getFlowEntry());
if (status.isSuccess()) {
// Update Configuration database
target.setStatus(SUCCESS);
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
<configuration>
<destFile>../implementation/target/jacoco-it.exec</destFile>
<includes>org.opendaylight.controller.*</includes>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugin>\r
<groupId>org.jacoco</groupId>\r
<artifactId>jacoco-maven-plugin</artifactId>\r
- <version>0.5.3.201107060350</version>\r
+ <version>${jacoco.version}</version>\r
<configuration>\r
<destFile>../implementation/target/jacoco-it.exec</destFile>\r
<includes>org.opendaylight.controller.*</includes>\r
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
* until the Barrier reply arrives.
*/
public Object asyncSendBarrierMessage();
+
+ /**
+ * Send a FLOW_MOD message with a wildcard match and action=DELETE.
+ */
+ public void deleteAllFlows();
}
// send feature request
OFMessage featureRequest = factory.getMessage(OFType.FEATURES_REQUEST);
asyncFastSend(featureRequest);
- // delete all pre-existing flows
- OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
- OFFlowMod flowMod = (OFFlowMod) factory.getMessage(OFType.FLOW_MOD);
- flowMod.setMatch(match).setCommand(OFFlowMod.OFPFC_DELETE).setOutPort(OFPort.OFPP_NONE)
- .setLength((short) OFFlowMod.MINIMUM_LENGTH);
- asyncFastSend(flowMod);
this.state = SwitchState.WAIT_FEATURES_REPLY;
startSwitchTimer();
break;
return result;
}
}
+
+ @Override
+ public void deleteAllFlows() {
+ logger.trace("deleteAllFlows on switch {}", HexString.toHexString(this.sid));
+ OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
+ OFFlowMod flowMod = (OFFlowMod) factory.getMessage(OFType.FLOW_MOD);
+ flowMod.setMatch(match).setCommand(OFFlowMod.OFPFC_DELETE).setOutPort(OFPort.OFPP_NONE)
+ .setLength((short) OFFlowMod.MINIMUM_LENGTH);
+ asyncFastSend(flowMod);
+ }
}
flow.setPriority(ofFlowStat.getPriority());
flow.setIdleTimeout(ofFlowStat.getIdleTimeout());
flow.setHardTimeout(ofFlowStat.getHardTimeout());
+ flow.setId(ofFlowStat.getCookie());
flowOnNode = new FlowOnNode(flow);
flowOnNode.setByteCount(ofFlowStat.getByteCount());
flowOnNode.setPacketCount(ofFlowStat.getPacketCount());
flow.setPriority(v6StatsReply.getPriority());
flow.setIdleTimeout(v6StatsReply.getIdleTimeout());
flow.setHardTimeout(v6StatsReply.getHardTimeout());
+ flow.setId(v6StatsReply.getCookie());
flowOnNode = new FlowOnNode(flow);
flowOnNode.setByteCount(v6StatsReply.getByteCount());
flowOnNode.setPacketCount(v6StatsReply.getPacketCount());
if (sw == null) {
return;
}
+ Node node = NodeCreator.createOFNode(sw.getId());
+ if ((nodeProps.get(node) != null) && (connectionOutService.isLocal(node))) {
+ logger.debug("Ignore switchAdded {}", sw);
+ return;
+ }
// Add all the nodeConnectors of this switch
Map<NodeConnector, Set<Property>> ncProps = InventoryServiceHelper
for (String container : containers) {
notifyInventoryShimInternalListener(container, node, type, props);
}
-
// Notify external listener
notifyInventoryShimExternalListener(node, type, props);
props.add(b);
}
+ if ((nodeProps.get(node) == null) && (connectionOutService.isLocal(node))) {
+ // The switch is connected for the first time, flush all flows
+ // that may exist on this switch
+ sw.deleteAllFlows();
+ }
nodeProps.put(node, props);
// Notify all internal and external listeners
notifyInventoryShimListener(node, type, props);
Flow flow = new Flow(match, actions);
flow.setPriority((short) 100);
flow.setHardTimeout((short) 360);
+ flow.setId(1234L);
return flow;
}
Flow flow = new Flow(match, actions);
flow.setPriority((short) 300);
flow.setHardTimeout((short) 240);
+ flow.setId(65536L);
return flow;
}
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
<configuration>
<destFile>../implementation/target/jacoco-it.exec</destFile>
<includes>org.opendaylight.controller.*</includes>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
import org.opendaylight.controller.sal.utils.GUIField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
public ArrayList<NodeConnector> getPortArrayList() {
- Node node = Node.fromString(nodeId);
ArrayList<NodeConnector> portList = new ArrayList<NodeConnector>();
String[] elemArray = spanPort.split(",");
for (String elem : elemArray) {
- if (elem.contains("-")) {
- String[] limits = elem.split("-");
- for (short j = Short.valueOf(limits[0]); j <= Short
- .valueOf(limits[1]); j++) {
- try {
- portList.add(new NodeConnector(
- NodeConnectorIDType.OPENFLOW, Short.valueOf(j),
- node));
- } catch (ConstructionException e) {
- logger.error("",e);
- }
- }
- } else {
- try {
- portList.add(new NodeConnector(
- NodeConnectorIDType.OPENFLOW, Short.valueOf(elem),
- node));
- } catch (NumberFormatException e) {
- logger.error("",e);
- } catch (ConstructionException e) {
- logger.error("",e);
- }
+ NodeConnector nodeConnector = NodeConnector.fromString(elem);
+ if (nodeConnector != null) {
+ portList.add(nodeConnector);
}
}
return portList;
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
</plugin>
</plugins>
</pluginManagement>
</properties>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
- </plugin>
- </plugins>
- </pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.5.3.201107060350</version>
+ <version>${jacoco.version}</version>
<configuration>
<destFile>../implementation/target/jacoco-it.exec</destFile>
<includes>org.opendaylight.controller.*</includes>