tom

Added cubby-holes for new projects.

Showing 1000 changed files with 3271 additions and 98 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

*~
*.class
.classpath
.project
.pydevproject
.settings
.javacp*
target
*.iml
.idea
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onlab.onos</groupId>
<artifactId>onos</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-cli</artifactId>
<packaging>bundle</packaging>
<description>ONOS administrative console command-line extensions
</description>
<dependencies>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-api</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package org.onlab.onos.cli;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
/**
* Base abstraction of Karaf shell commands.
*/
public abstract class AbstractShellCommand extends OsgiCommandSupport {
/**
* Returns the reference to the implementaiton of the specified service.
*
* @param serviceClass service class
* @param <T> type of service
* @return service implementation
*/
static <T> T get(Class<T> serviceClass) {
BundleContext bc = FrameworkUtil.getBundle(AbstractShellCommand.class).getBundleContext();
return bc.getService(bc.getServiceReference(serviceClass));
}
}
package org.onlab.onos.cli;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.onlab.onos.net.GreetService;
/**
* Simple command example to demonstrate use of Karaf shell extensions; shows
* use of an optional parameter as well.
*/
@Command(scope = "onos", name = "greet", description = "Issues a greeting")
public class GreetCommand extends OsgiCommandSupport {
@Argument(index = 0, name = "name", description = "Name to greet",
required = false, multiValued = false)
String name = "dude";
@Override
protected Object doExecute() throws Exception {
System.out.println(getService(GreetService.class).yo(name));
return null;
}
}
package org.onlab.onos.cli;
import org.apache.karaf.shell.console.Completer;
import org.apache.karaf.shell.console.completer.StringsCompleter;
import org.onlab.onos.net.GreetService;
import java.util.Iterator;
import java.util.List;
import java.util.SortedSet;
/**
* Simple example of a command-line parameter completer.
* For a more open-ended sets a more efficient implementation would be required.
*/
public class NameCompleter implements Completer {
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
// Fetch our service and feed it's offerings to the string completer
GreetService greetService = AbstractShellCommand.get(GreetService.class);
Iterator<String> it = greetService.names().iterator();
SortedSet<String> strings = delegate.getStrings();
while (it.hasNext()) {
strings.add(it.next());
}
// Now let the completer do the work for figuring out what to offer.
return delegate.complete(buffer, cursor, candidates);
}
}
<body>
Administrative console command-line extensions.
</body>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
<action class="org.onlab.onos.cli.GreetCommand"/>
<completers>
<ref component-id="nameCompleter"/>
</completers>
</command>
</command-bundle>
<bean id="nameCompleter" class="org.onlab.onos.cli.NameCompleter"/>
</blueprint>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
name="net.onrc.onos-1.0.0">
<repository>mvn:net.onrc.onos/onos-features/1.0.0-SNAPSHOT/xml/features</repository>
name="onos-1.0.0">
<repository>mvn:org.onlab.onos/onos-features/1.0.0-SNAPSHOT/xml/features</repository>
<feature name="onos-thirdparty" version="1.0.0"
<feature name="onos-thirdparty-base" version="1.0.0"
description="ONOS 3rd party dependencies">
<bundle>mvn:com.google.code.findbugs/annotations/2.0.2</bundle>
<bundle>mvn:com.google.guava/guava/17.0</bundle>
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
<bundle>mvn:com.google.guava/guava/17.0</bundle>
<bundle>mvn:com.google.guava/guava/15.0</bundle>
</feature>
<feature name="onos-of-ctl" version="1.0.0"
description="ONOS OpenFlow Libraries &amp; Controller">
<feature name="onos-thirdparty-web" version="1.0.0"
description="ONOS 3rd party dependencies">
<feature>war</feature>
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.4.2</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.2</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.4.2</bundle>
<bundle>mvn:com.sun.jersey/jersey-core/1.18.1</bundle>
<bundle>mvn:com.sun.jersey/jersey-server/1.18.1</bundle>
<bundle>mvn:com.sun.jersey/jersey-servlet/1.18.1</bundle>
</feature>
<feature name="onos-core" version="1.0.0"
description="ONOS core components">
<feature>scr</feature>
<feature>thirdparty</feature>
<bundle>mvn:net.onrc.onos.sb/onos-sb/0.0.1</bundle>
<bundle>mvn:org.projectfloodlight/openflowj/0.3.6-SNAPSHOT</bundle>
<feature>onos-thirdparty-base</feature>
<bundle>mvn:org.onlab.onos/onos-utils-osgi/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onos-utils-rest/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onos-api/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onos-core/1.0.0-SNAPSHOT</bundle>
</feature>
<feature name="onos-rest" version="1.0.0"
description="ONOS REST API components">
<feature>onos-core</feature>
<feature>onos-thirdparty-web</feature>
<bundle>mvn:org.onlab.onos/onos-rest/1.0.0-SNAPSHOT</bundle>
</feature>
<feature name="onos-gui" version="1.0.0"
description="ONOS GUI console components">
<feature>onos-core</feature>
<feature>onos-thirdparty-web</feature>
<bundle>mvn:org.onlab.onos/onos-gui/1.0.0-SNAPSHOT</bundle>
</feature>
<feature name="onos-cli" version="1.0.0"
description="ONOS admin command console components">
<feature>onos-core</feature>
<bundle>mvn:org.onlab.onos/onos-cli/1.0.0-SNAPSHOT</bundle>
</feature>
<feature name="onos-openflow" version="1.0.0"
description="ONOS OpenFlow API, Controller &amp; Providers">
<feature>onos-core</feature>
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
<bundle>mvn:com.google.guava/guava/15.0</bundle>
<bundle>mvn:org.onlab.onos/openflow-api/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/openflow-ctl/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onos-of-providers/1.0.0-SNAPSHOT</bundle>
</feature>
</features>
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
~ and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
name="net.onrc.onos-1.0.0">
<repository>mvn:net.onrc.onos/onos-features/1.0.0-SNAPSHOT/xml/features</repository>
<feature name="thirdparty" version="1.0.0"
description="ONOS 3rd party dependencies">
<bundle>mvn:com.google.code.findbugs/annotations/2.0.2</bundle>
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
<bundle>mvn:com.google.guava/guava/17.0</bundle>
<bundle>mvn:com.google.guava/guava/15.0</bundle>
</feature>
<feature name="base" version="1.0.0"
description="ONOS Base">
<feature>scr</feature>
<feature>thirdparty</feature>
<bundle>mvn:net.onrc.onos.sb/onos-sb/0.0.1</bundle>
<bundle>mvn:org.projectfloodlight/openflowj/0.3.6-SNAPSHOT</bundle>
</feature>
</features>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
~ and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
name="net.onrc.onos-1.0.0">
<repository>mvn:net.onrc.onos/onos-features/1.0.0-SNAPSHOT/xml/features</repository>
<feature name="thirdparty" version="1.0.0"
description="ONOS 3rd party dependencies">
<bundle>mvn:com.google.code.findbugs/annotations/2.0.2</bundle>
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
<bundle>mvn:com.google.guava/guava/17.0</bundle>
<bundle>mvn:com.google.guava/guava/15.0</bundle>
</feature>
<feature name="base" version="1.0.0"
description="ONOS Base">
<feature>scr</feature>
<feature>thirdparty</feature>
<bundle>mvn:net.onrc.onos.sb/onos-sb/0.0.1</bundle>
<bundle>mvn:org.projectfloodlight/openflowj/0.3.6-SNAPSHOT</bundle>
</feature>
</features>
......
......@@ -5,16 +5,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.onrc.onos</groupId>
<groupId>org.onlab.onos</groupId>
<artifactId>onos</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-features</artifactId>
<packaging>jar</packaging>
<packaging>pom</packaging>
<name>onos-features</name>
<description>ONOS Apache Karaf feature definitions</description>
<build>
......@@ -22,7 +21,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.3</version>
<version>1.9</version>
<executions>
<execution>
<id>attach-artifacts</id>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-net</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-api</artifactId>
<packaging>bundle</packaging>
<description>ONOS network control API</description>
</project>
package net.onrc.onos.api;
package org.onlab.onos.net;
/**
* Base abstraction of a piece of information about network elements.
......
package org.onlab.onos.net;
/**
* Example of a simple service that provides greetings and it
* remembers the names which were greeted.
*/
public interface GreetService {
/**
* Returns a greeting tailored to the specified name.
*
* @param name some name
* @return greeting
*/
String yo(String name);
/**
* Returns an iterable of names encountered thus far.
*
* @return iterable of names
*/
Iterable<String> names();
}
package net.onrc.onos.api;
package org.onlab.onos.net;
/**
* Representation of a port number.
......
package net.onrc.onos.api;
package org.onlab.onos.net;
/**
* Abstraction of a provider of information about network environment.
......
package net.onrc.onos.api;
package org.onlab.onos.net;
/**
* Broker used for registering/unregistering information providers with the core.
......
package net.onrc.onos.api;
package org.onlab.onos.net;
/**
* Notion of provider identity.
......
package net.onrc.onos.api;
package org.onlab.onos.net;
/**
* Abstraction of a service through which providers can inject information
......
package net.onrc.onos.api.device;
package org.onlab.onos.net.device;
import net.onrc.onos.api.Description;
import org.onlab.onos.net.Description;
import java.net.URI;
......@@ -18,4 +18,4 @@ public interface DeviceDescription extends Description {
*/
URI deviceURI();
}
\ No newline at end of file
}
......
package net.onrc.onos.api.device;
package org.onlab.onos.net.device;
import net.onrc.onos.api.Provider;
import org.onlab.onos.net.Provider;
/**
* Abstraction of a device information provider.
......
package net.onrc.onos.api.device;
package org.onlab.onos.net.device;
import net.onrc.onos.api.ProviderBroker;
import org.onlab.onos.net.ProviderBroker;
/**
* Abstraction of a device provider brokerage.
......
package net.onrc.onos.api.device;
package org.onlab.onos.net.device;
import net.onrc.onos.api.ProviderService;
import org.onlab.onos.net.ProviderService;
import java.util.List;
......
package net.onrc.onos.api.device;
package org.onlab.onos.net.device;
/**
* Information about a port.
......
package net.onrc.onos.api.flow;
package org.onlab.onos.net.flow;
package net.onrc.onos.api.Description;
import org.onlab.onos.net.Description;
/**
* Information about a flow rule.
......
package net.onrc.onos.api.flow;
package org.onlab.onos.net.flow;
import net.onrc.onos.api.Provider;
import org.onlab.onos.net.Provider;
/**
* Abstraction of a flow rule provider.
*/
public interface FlowRuleProvider extends Provider {
}
\ No newline at end of file
}
......
package net.onrc.onos.api.flow;
package org.onlab.onos.net.flow;
import net.onrc.onos.api.ProviderBroker;
import org.onlab.onos.net.ProviderBroker;
/**
* Abstraction for a flow rule provider brokerage.
......
package net.onrc.onos.api.flow;
package org.onlab.onos.net.flow;
import net.onrc.onos.api.ProviderService;
import org.onlab.onos.net.ProviderService;
/**
* Service through which flowrule providers can inject flowrule information into
......@@ -32,4 +32,4 @@ public interface FlowRuleProviderService extends ProviderService {
*/
void flowAdded(FlowDescription flowDescription);
}
\ No newline at end of file
}
......
package net.onrc.onos.api.host;
package org.onlab.onos.net.host;
/**
* Information describing host and its location.
......@@ -6,6 +6,6 @@ package net.onrc.onos.api.host;
public interface HostDescription {
// IP, MAC, VLAN-ID, HostLocation -> (ConnectionPoint + timestamp)
}
......
package net.onrc.onos.api.host;
package org.onlab.onos.net.host;
import net.onrc.onos.api.Provider;
import org.onlab.onos.net.Provider;
/**
* Provider of information about hosts and their location on the network.
......
package net.onrc.onos.api.host;
package org.onlab.onos.net.host;
import net.onrc.onos.api.ProviderBroker;
import org.onlab.onos.net.ProviderBroker;
/**
* Abstraction of a host provider brokerage.
......
package net.onrc.onos.api.host;
package org.onlab.onos.net.host;
import net.onrc.onos.api.ProviderService;
import org.onlab.onos.net.ProviderService;
/**
* Means of conveying host information to the core.
*/
public interface HostProviderService extends ProviderService {
void hostDetected(HostDescription hostDescription);
}
......
package net.onrc.onos.api.link;
package org.onlab.onos.net.link;
/**
* Describes an infrastructure link.
......
package net.onrc.onos.api.link;
package org.onlab.onos.net.link;
import net.onrc.onos.api.Provider;
import org.onlab.onos.net.Provider;
/**
* Abstraction of an entity providing information about infrastructure links
......
package net.onrc.onos.api.link;
package org.onlab.onos.net.link;
import net.onrc.onos.api.ProviderBroker;
import org.onlab.onos.net.ProviderBroker;
/**
* Abstraction of an infrastructure link provider brokerage.
......
package net.onrc.onos.api.link;
package org.onlab.onos.net.link;
import net.onrc.onos.api.ProviderService;
import org.onlab.onos.net.ProviderService;
/**
* Means for injecting link information into the core.
......
package net.onrc.onos.api.topology;
package org.onlab.onos.net.topology;
import net.onrc.onos.api.Description;
import org.onlab.onos.net.Description;
import java.util.Collection;
......@@ -17,4 +17,4 @@ public interface TopologyDescription extends Description {
*/
Collection<Description> details();
}
\ No newline at end of file
}
......
package net.onrc.onos.api.topology;
package org.onlab.onos.net.topology;
import net.onrc.onos.api.Provider;
import org.onlab.onos.net.Provider;
/**
* Means for injecting topology information into the core.
......
package net.onrc.onos.api.topology;
package org.onlab.onos.net.topology;
import net.onrc.onos.api.ProviderBroker;
import org.onlab.onos.net.ProviderBroker;
/**
* Abstraction of a network topology provider brokerage.
......
package net.onrc.onos.api.topology;
package org.onlab.onos.net.topology;
import net.onrc.onos.api.ProviderService;
import org.onlab.onos.net.ProviderService;
/**
* Means for injecting topology information into the core.
......
<body>
ONOS API definitions.
</body>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-net</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-core</artifactId>
<packaging>bundle</packaging>
<description>ONOS network control core subsystems</description>
<dependencies>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package org.onlab.onos.net.impl;
import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.net.GreetService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashSet;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Trivial implementation of the seed service to demonstrate component and
* service annotations.
*/
@Component(immediate = true)
@Service
public class GreetManager implements GreetService {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Set<String> names = new HashSet<>();
@Override
public synchronized String yo(String name) {
checkNotNull(name, "Name cannot be null");
names.add(name);
log.info("Greeted '{}'", name);
return "Whazup " + name + "?";
}
@Override
public synchronized Iterable<String> names() {
return ImmutableSet.copyOf(names);
}
@Activate
public void activate() {
log.info("SeedManager started");
}
@Deactivate
public void deactivate() {
log.info("SeedManager stopped");
}
}
package org.onlab.onos.net.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.onos.net.GreetService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Example of a component that does not provide any service, but consumes one.
*/
@Component(immediate = true)
public class SomeOtherComponent {
private final Logger log = LoggerFactory.getLogger(SomeOtherComponent.class);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected GreetService service;
// protected to allow injection for testing;
// alternative is to write bindSeedService and unbindSeedService, which is more code
@Activate
public void activate() {
log.info("SomeOtherComponent started");
service.yo("neighbour");
}
@Deactivate
public void deactivate() {
log.info("SomeOtherComponent stopped");
}
}
<body>
ONOS core implementations.
</body>
\ No newline at end of file
package org.onlab.onos.net.impl;
import org.junit.Test;
import org.onlab.onos.net.GreetService;
import java.util.Iterator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
/**
* Example of a component &amp; service implementation unit test.
*/
public class GreetManagerTest {
@Test
public void basics() {
GreetService service = new GreetManager();
assertEquals("incorrect greeting", "Whazup dude?", service.yo("dude"));
Iterator<String> names = service.names().iterator();
assertEquals("incorrect name", "dude", names.next());
assertFalse("no more names expected", names.hasNext());
}
@Test(expected = NullPointerException.class)
public void nullArg() {
new GreetManager().yo(null);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onlab.onos</groupId>
<artifactId>onos</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-net</artifactId>
<packaging>pom</packaging>
<description>ONOS Core root project</description>
<modules>
<module>api</module>
<module>core</module>
</modules>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
# See: http://rolf-engelhard.de/2011/04/using-the-same-suppression-filter-for-checkstyle-in-eclipse-and-maven/
config_loc=conf/checkstyle
This diff is collapsed. Click to expand it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<!--
Note: Exclusion definition exists in multiple places.
- In file ${findbugs.excludeFilterFile} defined at top of pom.xml
- In file conf/checkstyle/onos_suppressions.xml (this file)
- maven-pmd-plugin configuration in pom.xml
(under build and reporting)
-->
<suppress files=".*" checks="FinalParametersCheck"/>
<suppress files=".*" checks="MagicNumbersCheck"/>
<suppress files=".*" checks="DesignForExtensionCheck"/>
<suppress files=".*" checks="TodoCommentCheck"/>
<suppress files=".*" checks="AvoidInlineConditionalsCheck"/>
<suppress files=".*" checks="OperatorWrapCheck"/>
</suppressions>
<FindBugsFilter>
<!--
Note: Exclusion definition exists in multiple places.
- In file ${findbugs.excludeFilterFile} defined at top of pom.xml (this file)
- In file conf/checkstyle/onos_suppressions.xml
- maven-pmd-plugin configuration in pom.xml
(under build and reporting)
-->
<Match>
<Class name="~net\.onrc\.onos\.core\.datastore\.serializers\..*" />
</Match>
<Match>
<Class name="~.*edu\.stanford\..*"/>
</Match>
<Match>
<Class name="~.org\.projectfloodlight\..*"/>
</Match>
</FindBugsFilter>
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
package net.onrc.onos.of.ctl;
import org.projectfloodlight.openflow.protocol.OFVersion;
import net.onrc.onos.of.ctl.registry.IControllerRegistry;
/**
* Interface to passed to controller class in order to allow
* it to spawn the appropriate type of switch and furthermore
* specify a registry object (ie. ZooKeeper).
*
*/
public interface IOFSwitchManager {
/**
* Given a description string for a switch spawn the
* concrete representation of that switch.
*
* @param mfr manufacturer description
* @param hwDesc hardware description
* @param swDesc software description
* @param ofv openflow version
* @return A switch of type IOFSwitch.
*/
public IOFSwitch getSwitchImpl(String mfr, String hwDesc, String swDesc, OFVersion ofv);
/**
* Returns the mastership registry used during controller-switch role election.
* @return the registry
*/
public IControllerRegistry getRegistry();
}
package net.onrc.onos.of.ctl;
import org.projectfloodlight.openflow.protocol.OFControllerRole;
/**
* The role of the controller as it pertains to a particular switch.
* Note that this definition of the role enum is different from the
* OF1.3 definition. It is maintained here to be backward compatible to
* earlier versions of the controller code. This enum is translated
* to the OF1.3 enum, before role messages are sent to the switch.
* See sendRoleRequestMessage method in OFSwitchImpl
*/
public enum Role {
EQUAL(OFControllerRole.ROLE_EQUAL),
MASTER(OFControllerRole.ROLE_MASTER),
SLAVE(OFControllerRole.ROLE_SLAVE);
private Role(OFControllerRole nxRole) {
nxRole.ordinal();
}
/*
private static Map<Integer,Role> nxRoleToEnum
= new HashMap<Integer,Role>();
static {
for(Role r: Role.values())
nxRoleToEnum.put(r.toNxRole(), r);
}
public int toNxRole() {
return nxRole;
}
// Return the enum representing the given nxRole or null if no
// such role exists
public static Role fromNxRole(int nxRole) {
return nxRoleToEnum.get(nxRole);
}*/
}
/**
* Copyright 2012, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
/**
* Annotation used to set the category for log messages for a class.
*
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
public @interface LogMessageCategory {
/**
* The category for the log messages for this class.
*
* @return
*/
String value() default "Core";
}
/**
* Copyright 2012, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
/**
* Annotation used to document log messages. This can be used to generate
* documentation on syslog output.
*
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
public @interface LogMessageDoc {
public static final String NO_ACTION = "No action is required.";
public static final String UNKNOWN_ERROR = "An unknown error occured";
public static final String GENERIC_ACTION =
"Examine the returned error or exception and take " +
"appropriate action.";
public static final String CHECK_SWITCH =
"Check the health of the indicated switch. " +
"Test and troubleshoot IP connectivity.";
public static final String CHECK_CONTROLLER =
"Verify controller system health, CPU usage, and memory. " +
"Rebooting the controller node may help if the controller " +
"node is in a distressed state.";
public static final String REPORT_CONTROLLER_BUG =
"This is likely a defect in the controller. Please report this " +
"issue. Restarting the controller or switch may help to " +
"alleviate.";
public static final String REPORT_SWITCH_BUG =
"This is likely a defect in the switch. Please report this " +
"issue. Restarting the controller or switch may help to " +
"alleviate.";
/**
* The log level for the log message.
*
* @return the log level as a tring
*/
String level() default "INFO";
/**
* The message that will be printed.
*
* @return the message
*/
String message() default UNKNOWN_ERROR;
/**
* An explanation of the meaning of the log message.
*
* @return the explanation
*/
String explanation() default UNKNOWN_ERROR;
/**
* The recommendated action associated with the log message.
*
* @return the recommendation
*/
String recommendation() default NO_ACTION;
}
/**
* Copyright 2012, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
/**
* Annotation used to document log messages. This can be used to generate
* documentation on syslog output. This version allows multiple log messages
* to be documentated on an interface.
*
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
public @interface LogMessageDocs {
/**
* A list of {@link LogMessageDoc} elements.
*
* @return the list of log message doc
*/
LogMessageDoc[] value();
}
package net.onrc.onos.of.ctl.debugcounter;
public interface IDebugCounter {
/**
* Increments the counter by 1 thread-locally, and immediately flushes to
* the global counter storage. This method should be used for counters that
* are updated outside the OF message processing pipeline.
*/
void updateCounterWithFlush();
/**
* Increments the counter by 1 thread-locally. Flushing to the global
* counter storage is delayed (happens with flushCounters() in IDebugCounterService),
* resulting in higher performance. This method should be used for counters
* updated in the OF message processing pipeline.
*/
void updateCounterNoFlush();
/**
* Increments the counter thread-locally by the 'incr' specified, and immediately
* flushes to the global counter storage. This method should be used for counters
* that are updated outside the OF message processing pipeline.
*/
void updateCounterWithFlush(int incr);
/**
* Increments the counter thread-locally by the 'incr' specified. Flushing to the global
* counter storage is delayed (happens with flushCounters() in IDebugCounterService),
* resulting in higher performance. This method should be used for counters
* updated in the OF message processing pipeline.
*/
void updateCounterNoFlush(int incr);
/**
* Retrieve the value of the counter from the global counter store.
*/
long getCounterValue();
}
package net.onrc.onos.of.ctl.debugcounter;
import java.util.Collections;
import java.util.List;
import net.onrc.onos.of.ctl.debugcounter.DebugCounter.DebugCounterInfo;
public class NullDebugCounter implements IDebugCounterService {
@Override
public void flushCounters() {
}
@Override
public void resetAllCounters() {
}
@Override
public void resetAllModuleCounters(String moduleName) {
}
@Override
public void resetCounterHierarchy(String moduleName, String counterHierarchy) {
}
@Override
public void enableCtrOnDemand(String moduleName, String counterHierarchy) {
}
@Override
public void disableCtrOnDemand(String moduleName, String counterHierarchy) {
}
@Override
public List<DebugCounterInfo> getCounterHierarchy(String moduleName,
String counterHierarchy) {
return Collections.emptyList();
}
@Override
public List<DebugCounterInfo> getAllCounterValues() {
return Collections.emptyList();
}
@Override
public List<DebugCounterInfo> getModuleCounterValues(String moduleName) {
return Collections.emptyList();
}
@Override
public boolean containsModuleCounterHierarchy(String moduleName,
String counterHierarchy) {
return false;
}
@Override
public boolean containsModuleName(String moduleName) {
return false;
}
@Override
public
IDebugCounter
registerCounter(String moduleName, String counterHierarchy,
String counterDescription,
CounterType counterType, String... metaData)
throws MaxCountersRegistered {
return new NullCounterImpl();
}
@Override
public List<String> getModuleList() {
return Collections.emptyList();
}
@Override
public List<String> getModuleCounterList(String moduleName) {
return Collections.emptyList();
}
public static class NullCounterImpl implements IDebugCounter {
@Override
public void updateCounterWithFlush() {
}
@Override
public void updateCounterNoFlush() {
}
@Override
public void updateCounterWithFlush(int incr) {
}
@Override
public void updateCounterNoFlush(int incr) {
}
@Override
public long getCounterValue() {
return -1;
}
}
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
/**
* Exception is thrown when the handshake fails to complete.
* before a specified time
*
*/
public class HandshakeTimeoutException extends Exception {
private static final long serialVersionUID = 6859880268940337312L;
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
import java.util.concurrent.TimeUnit;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
import org.jboss.netty.util.Timeout;
import org.jboss.netty.util.Timer;
import org.jboss.netty.util.TimerTask;
/**
* Trigger a timeout if a switch fails to complete handshake soon enough.
*/
public class HandshakeTimeoutHandler
extends SimpleChannelUpstreamHandler {
static final HandshakeTimeoutException EXCEPTION =
new HandshakeTimeoutException();
final OFChannelHandler channelHandler;
final Timer timer;
final long timeoutNanos;
volatile Timeout timeout;
public HandshakeTimeoutHandler(OFChannelHandler channelHandler,
Timer timer,
long timeoutSeconds) {
super();
this.channelHandler = channelHandler;
this.timer = timer;
this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);
}
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
if (timeoutNanos > 0) {
timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx),
timeoutNanos, TimeUnit.NANOSECONDS);
}
ctx.sendUpstream(e);
}
@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
if (timeout != null) {
timeout.cancel();
timeout = null;
}
}
private final class HandshakeTimeoutTask implements TimerTask {
private final ChannelHandlerContext ctx;
HandshakeTimeoutTask(ChannelHandlerContext ctx) {
this.ctx = ctx;
}
@Override
public void run(Timeout t) throws Exception {
if (t.isCancelled()) {
return;
}
if (!ctx.getChannel().isOpen()) {
return;
}
if (!channelHandler.isHandshakeComplete()) {
Channels.fireExceptionCaught(ctx, EXCEPTION);
}
}
}
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.projectfloodlight.openflow.protocol.OFFactories;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFMessageReader;
/**
* Decode an openflow message from a Channel, for use in a netty pipeline.
*/
public class OFMessageDecoder extends FrameDecoder {
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buffer) throws Exception {
if (!channel.isConnected()) {
// In testing, I see decode being called AFTER decode last.
// This check avoids that from reading corrupted frames
return null;
}
// Note that a single call to decode results in reading a single
// OFMessage from the channel buffer, which is passed on to, and processed
// by, the controller (in OFChannelHandler).
// This is different from earlier behavior (with the original openflowj),
// where we parsed all the messages in the buffer, before passing on
// a list of the parsed messages to the controller.
// The performance *may or may not* not be as good as before.
OFMessageReader<OFMessage> reader = OFFactories.getGenericReader();
OFMessage message = reader.readFrom(buffer);
return message;
}
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
import java.util.List;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
import org.projectfloodlight.openflow.protocol.OFMessage;
/**
* Encode an openflow message for output into a ChannelBuffer, for use in a
* netty pipeline.
*/
public class OFMessageEncoder extends OneToOneEncoder {
@Override
protected Object encode(ChannelHandlerContext ctx, Channel channel,
Object msg) throws Exception {
if (!(msg instanceof List)) {
return msg;
}
@SuppressWarnings("unchecked")
List<OFMessage> msglist = (List<OFMessage>) msg;
/* XXX S can't get length of OFMessage in loxigen's openflowj??
int size = 0;
for (OFMessage ofm : msglist) {
size += ofm.getLengthU();
}*/
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
for (OFMessage ofm : msglist) {
ofm.writeTo(buf);
}
return buf;
}
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
import java.util.concurrent.ThreadPoolExecutor;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.handler.execution.ExecutionHandler;
import org.jboss.netty.handler.timeout.IdleStateHandler;
import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
import org.jboss.netty.util.ExternalResourceReleasable;
import org.jboss.netty.util.HashedWheelTimer;
import org.jboss.netty.util.Timer;
/**
* Creates a ChannelPipeline for a server-side openflow channel.
*/
public class OpenflowPipelineFactory
implements ChannelPipelineFactory, ExternalResourceReleasable {
protected Controller controller;
protected ThreadPoolExecutor pipelineExecutor;
protected Timer timer;
protected IdleStateHandler idleHandler;
protected ReadTimeoutHandler readTimeoutHandler;
public OpenflowPipelineFactory(Controller controller,
ThreadPoolExecutor pipelineExecutor) {
super();
this.controller = controller;
this.pipelineExecutor = pipelineExecutor;
this.timer = new HashedWheelTimer();
this.idleHandler = new IdleStateHandler(timer, 20, 25, 0);
this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
}
@Override
public ChannelPipeline getPipeline() throws Exception {
OFChannelHandler handler = new OFChannelHandler(controller);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("ofmessagedecoder", new OFMessageDecoder());
pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
pipeline.addLast("idle", idleHandler);
pipeline.addLast("timeout", readTimeoutHandler);
// XXX S ONOS: was 15 increased it to fix Issue #296
pipeline.addLast("handshaketimeout",
new HandshakeTimeoutHandler(handler, timer, 60));
if (pipelineExecutor != null) {
pipeline.addLast("pipelineExecutor",
new ExecutionHandler(pipelineExecutor));
}
pipeline.addLast("handler", handler);
return pipeline;
}
@Override
public void releaseExternalResources() {
timer.stop();
}
}
package net.onrc.onos.of.ctl.internal;
/**
* Thrown when IOFSwitch.startDriverHandshake() is called more than once.
*
*/
public class SwitchDriverSubHandshakeAlreadyStarted extends
SwitchDriverSubHandshakeException {
private static final long serialVersionUID = -5491845708752443501L;
public SwitchDriverSubHandshakeAlreadyStarted() {
super();
}
}
package net.onrc.onos.of.ctl.internal;
import org.projectfloodlight.openflow.protocol.OFMessage;
/**
* Indicates that a message was passed to a switch driver's subhandshake
* handling code but the driver has already completed the sub-handshake.
*
*/
public class SwitchDriverSubHandshakeCompleted
extends SwitchDriverSubHandshakeException {
private static final long serialVersionUID = -8817822245846375995L;
public SwitchDriverSubHandshakeCompleted(OFMessage m) {
super("Sub-Handshake is already complete but received message "
+ m.getType());
}
}
package net.onrc.onos.of.ctl.internal;
/**
* Base class for exception thrown by switch driver sub-handshake processing.
*
*/
public class SwitchDriverSubHandshakeException extends RuntimeException {
private static final long serialVersionUID = -6257836781419604438L;
protected SwitchDriverSubHandshakeException() {
super();
}
protected SwitchDriverSubHandshakeException(String arg0, Throwable arg1) {
super(arg0, arg1);
}
protected SwitchDriverSubHandshakeException(String arg0) {
super(arg0);
}
protected SwitchDriverSubHandshakeException(Throwable arg0) {
super(arg0);
}
}
package net.onrc.onos.of.ctl.internal;
/**
* Thrown when a switch driver's sub-handshake has not been started but an
* operation requiring the sub-handshake has been attempted.
*
*/
public class SwitchDriverSubHandshakeNotStarted extends
SwitchDriverSubHandshakeException {
private static final long serialVersionUID = -5491845708752443501L;
public SwitchDriverSubHandshakeNotStarted() {
super();
}
}
package net.onrc.onos.of.ctl.internal;
/**
* Thrown when a switch driver's sub-handshake state-machine receives an
* unexpected OFMessage and/or is in an invald state.
*
*/
public class SwitchDriverSubHandshakeStateException extends
SwitchDriverSubHandshakeException {
private static final long serialVersionUID = -8249926069195147051L;
public SwitchDriverSubHandshakeStateException(String msg) {
super(msg);
}
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
/**
* This exception indicates an error or unexpected message during
* message handling. E.g., if an OFMessage is received that is illegal or
* unexpected given the current handshake state.
*
* We don't allow wrapping other exception in a switch state exception. We
* only log the SwitchStateExceptions message so the causing exceptions
* stack trace is generally not available.
*
*/
public class SwitchStateException extends Exception {
private static final long serialVersionUID = 9153954512470002631L;
public SwitchStateException() {
super();
}
public SwitchStateException(String arg0, Throwable arg1) {
super(arg0, arg1);
}
public SwitchStateException(String arg0) {
super(arg0);
}
public SwitchStateException(Throwable arg0) {
super(arg0);
}
}
package net.onrc.onos.of.ctl.registry;
public class ControllerRegistryEntry implements Comparable<ControllerRegistryEntry> {
//
// TODO: Refactor the implementation and decide whether controllerId
// is needed. If "yes", we might need to consider it inside the
// compareTo(), equals() and hashCode() implementations.
//
private final String controllerId;
private final int sequenceNumber;
public ControllerRegistryEntry(String controllerId, int sequenceNumber) {
this.controllerId = controllerId;
this.sequenceNumber = sequenceNumber;
}
public String getControllerId() {
return controllerId;
}
/**
* Compares this object with the specified object for order.
* NOTE: the test is based on ControllerRegistryEntry sequence numbers,
* and doesn't include the controllerId.
*
* @param o the object to be compared.
* @return a negative integer, zero, or a positive integer as this object
* is less than, equal to, or greater than the specified object.
*/
@Override
public int compareTo(ControllerRegistryEntry o) {
return this.sequenceNumber - o.sequenceNumber;
}
/**
* Test whether some other object is "equal to" this one.
* NOTE: the test is based on ControllerRegistryEntry sequence numbers,
* and doesn't include the controllerId.
*
* @param obj the reference object with which to compare.
* @return true if this object is the same as the obj argument; false
* otherwise.
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof ControllerRegistryEntry) {
ControllerRegistryEntry other = (ControllerRegistryEntry) obj;
return this.sequenceNumber == other.sequenceNumber;
}
return false;
}
/**
* Get the hash code for the object.
* NOTE: the computation is based on ControllerRegistryEntry sequence
* numbers, and doesn't include the controller ID.
*
* @return a hash code value for this object.
*/
@Override
public int hashCode() {
return Integer.valueOf(this.sequenceNumber).hashCode();
}
}
package net.onrc.onos.of.ctl.registry;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.onrc.onos.of.ctl.util.InstanceId;
/**
* A registry service that allows ONOS to register controllers and switches in a
* way that is global to the entire ONOS cluster. The registry is the arbiter
* for allowing controllers to control switches.
* <p/>
* The OVS/OF1.{2,3} fault tolerance model is a switch connects to multiple
* controllers, and the controllers send role requests to tell the switch their
* role in controlling the switch.
* <p/>
* The ONOS fault tolerance model allows only a single controller to have
* control of a switch (MASTER role) at once. Controllers therefore need a
* mechanism that enables them to decide who should control a each switch. The
* registry service provides this mechanism.
*/
public interface IControllerRegistry {
/**
* Callback interface for control change events.
*/
public interface ControlChangeCallback {
/**
* Called whenever the control changes from the point of view of the
* registry. The callee can check whether they have control or not using
* the hasControl parameter.
*
* @param dpid The switch that control has changed for
* @param hasControl Whether the listener now has control or not
*/
void controlChanged(long dpid, boolean hasControl);
}
/**
* Request for control of a switch. This method does not block. When control
* for a switch changes, the controlChanged method on the callback object
* will be called. This happens any time the control changes while the
* request is still active (until releaseControl is called)
*
* @param dpid Switch to request control for
* @param cb Callback that will be used to notify caller of control changes
* @throws RegistryException Errors contacting the registry service
*/
public void requestControl(long dpid, ControlChangeCallback cb)
throws RegistryException;
/**
* Stop trying to take control of a switch. This removes the entry for this
* controller requesting this switch in the registry. If the controller had
* control when this is called, another controller will now gain control of
* the switch. This call doesn't block.
*
* @param dpid Switch to release control of
*/
public void releaseControl(long dpid);
/**
* Check whether the controller has control of the switch This call doesn't
* block.
*
* @param dpid Switch to check control of
* @return true if controller has control of the switch.
*/
public boolean hasControl(long dpid);
/**
* Check whether this instance is the leader for the cluster. This call
* doesn't block.
*
* @return true if the instance is the leader for the cluster, otherwise
* false.
*/
public boolean isClusterLeader();
/**
* Gets the unique ID used to identify this ONOS instance in the cluster.
*
* @return Instance ID.
*/
public InstanceId getOnosInstanceId();
/**
* Register a controller to the ONOS cluster. Must be called before the
* registry can be used to take control of any switches.
*
* @param controllerId A unique string ID identifying this controller in the
* cluster
* @throws RegistryException for errors connecting to registry service,
* controllerId already registered
*/
public void registerController(String controllerId)
throws RegistryException;
/**
* Get all controllers in the cluster.
*
* @return Collection of controller IDs
* @throws RegistryException on error
*/
public Collection<String> getAllControllers() throws RegistryException;
/**
* Get all switches in the cluster, along with which controller is in
* control of them (if any) and any other controllers that have requested
* control.
*
* @return Map of all switches.
*/
public Map<String, List<ControllerRegistryEntry>> getAllSwitches();
/**
* Get the controller that has control of a given switch.
*
* @param dpid Switch to find controller for
* @return controller ID
* @throws RegistryException Errors contacting registry service
*/
public String getControllerForSwitch(long dpid) throws RegistryException;
/**
* Get all switches controlled by a given controller.
*
* @param controllerId ID of the controller
* @return Collection of dpids
*/
public Collection<Long> getSwitchesControlledByController(String controllerId);
/**
* Get a unique Id Block.
*
* @return Id Block.
*/
public IdBlock allocateUniqueIdBlock();
/**
* Get next unique id and retrieve a new range of ids if needed.
*
* @param range range to use for the identifier
* @return Id Block.
*/
public IdBlock allocateUniqueIdBlock(long range);
/**
* Get a globally unique ID.
*
* @return a globally unique ID.
*/
public long getNextUniqueId();
}
package net.onrc.onos.of.ctl.registry;
public class IdBlock {
private final long start;
private final long end;
private final long size;
public IdBlock(long start, long end, long size) {
this.start = start;
this.end = end;
this.size = size;
}
public long getStart() {
return start;
}
public long getEnd() {
return end;
}
public long getSize() {
return size;
}
@Override
public String toString() {
return "IdBlock [start=" + start + ", end=" + end + ", size=" + size
+ "]";
}
}
package net.onrc.onos.of.ctl.registry;
public class RegistryException extends Exception {
private static final long serialVersionUID = -8276300722010217913L;
public RegistryException(String message) {
super(message);
}
public RegistryException(String message, Throwable cause) {
super(message, cause);
}
}
package net.onrc.onos.of.ctl.util;
import org.projectfloodlight.openflow.util.HexString;
/**
* The class representing a network switch DPID.
* This class is immutable.
*/
public final class Dpid {
private static final long UNKNOWN = 0;
private final long value;
/**
* Default constructor.
*/
public Dpid() {
this.value = Dpid.UNKNOWN;
}
/**
* Constructor from a long value.
*
* @param value the value to use.
*/
public Dpid(long value) {
this.value = value;
}
/**
* Constructor from a string.
*
* @param value the value to use.
*/
public Dpid(String value) {
this.value = HexString.toLong(value);
}
/**
* Get the value of the DPID.
*
* @return the value of the DPID.
*/
public long value() {
return value;
}
/**
* Convert the DPID value to a ':' separated hexadecimal string.
*
* @return the DPID value as a ':' separated hexadecimal string.
*/
@Override
public String toString() {
return HexString.toHexString(this.value);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Dpid)) {
return false;
}
Dpid otherDpid = (Dpid) other;
return value == otherDpid.value;
}
@Override
public int hashCode() {
int hash = 17;
hash += 31 * hash + (int) (value ^ value >>> 32);
return hash;
}
}
package net.onrc.onos.of.ctl.util;
import java.io.IOException;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
import org.jboss.netty.channel.Channel;
import org.projectfloodlight.openflow.protocol.OFActionType;
import org.projectfloodlight.openflow.protocol.OFCapabilities;
import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
import org.projectfloodlight.openflow.protocol.OFPortStatus;
import org.projectfloodlight.openflow.protocol.OFStatsReply;
import org.projectfloodlight.openflow.protocol.OFStatsRequest;
import org.projectfloodlight.openflow.protocol.OFVersion;
import org.projectfloodlight.openflow.types.DatapathId;
import org.projectfloodlight.openflow.types.U64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.onrc.onos.of.ctl.IOFSwitch;
import net.onrc.onos.of.ctl.Role;
import net.onrc.onos.of.ctl.debugcounter.IDebugCounterService;
import net.onrc.onos.of.ctl.debugcounter.IDebugCounterService.CounterException;
public class DummySwitchForTesting implements IOFSwitch {
protected static final Logger log = LoggerFactory.getLogger(DummySwitchForTesting.class);
private Channel channel;
private boolean connected = false;
private OFVersion ofv = OFVersion.OF_10;
private Collection<OFPortDesc> ports;
private DatapathId datapathId;
private Set<OFCapabilities> capabilities;
private int buffers;
private byte tables;
private String stringId;
private Role role;
@Override
public void disconnectSwitch() {
this.channel.close();
}
@Override
public void write(OFMessage m) throws IOException {
this.channel.write(m);
}
@Override
public void write(List<OFMessage> msglist) throws IOException {
for (OFMessage m : msglist) {
this.channel.write(m);
}
}
@Override
public Date getConnectedSince() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getNextTransactionId() {
return 0;
}
@Override
public boolean isConnected() {
return this.connected;
}
@Override
public void setConnected(boolean connected) {
this.connected = connected;
}
@Override
public void flush() {
// TODO Auto-generated method stub
}
@Override
public void setChannel(Channel channel) {
this.channel = channel;
}
@Override
public long getId() {
if (this.stringId == null) {
throw new RuntimeException("Features reply has not yet been set");
}
return this.datapathId.getLong();
}
@Override
public String getStringId() {
// TODO Auto-generated method stub
return "DummySwitch";
}
@Override
public int getNumBuffers() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Set<OFCapabilities> getCapabilities() {
// TODO Auto-generated method stub
return null;
}
@Override
public byte getNumTables() {
// TODO Auto-generated method stub
return 0;
}
@Override
public OFDescStatsReply getSwitchDescription() {
// TODO Auto-generated method stub
return null;
}
@Override
public void cancelFeaturesReply(int transactionId) {
// TODO Auto-generated method stub
}
@Override
public Set<OFActionType> getActions() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setOFVersion(OFVersion version) {
// TODO Auto-generated method stub
}
@Override
public OFVersion getOFVersion() {
return this.ofv;
}
@Override
public Collection<OFPortDesc> getEnabledPorts() {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<Integer> getEnabledPortNumbers() {
// TODO Auto-generated method stub
return null;
}
@Override
public OFPortDesc getPort(int portNumber) {
// TODO Auto-generated method stub
return null;
}
@Override
public OFPortDesc getPort(String portName) {
// TODO Auto-generated method stub
return null;
}
@Override
public OrderedCollection<PortChangeEvent> processOFPortStatus(
OFPortStatus ps) {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<OFPortDesc> getPorts() {
return ports;
}
@Override
public boolean portEnabled(int portName) {
// TODO Auto-generated method stub
return false;
}
@Override
public OrderedCollection<PortChangeEvent> setPorts(
Collection<OFPortDesc> p) {
this.ports = p;
return null;
}
@Override
public Map<Object, Object> getAttributes() {
return null;
}
@Override
public boolean hasAttribute(String name) {
// TODO Auto-generated method stub
return false;
}
@Override
public Object getAttribute(String name) {
return Boolean.FALSE;
}
@Override
public void setAttribute(String name, Object value) {
// TODO Auto-generated method stub
}
@Override
public Object removeAttribute(String name) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deliverStatisticsReply(OFMessage reply) {
// TODO Auto-generated method stub
}
@Override
public void cancelStatisticsReply(int transactionId) {
// TODO Auto-generated method stub
}
@Override
public void cancelAllStatisticsReplies() {
// TODO Auto-generated method stub
}
@Override
public Future<List<OFStatsReply>> getStatistics(OFStatsRequest<?> request)
throws IOException {
// TODO Auto-generated method stub
return null;
}
@Override
public void clearAllFlowMods() {
// TODO Auto-generated method stub
}
@Override
public Role getRole() {
return this.role;
}
@Override
public void setRole(Role role) {
this.role = role;
}
@Override
public U64 getNextGenerationId() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setDebugCounterService(IDebugCounterService debugCounter)
throws CounterException {
// TODO Auto-generated method stub
}
@Override
public void startDriverHandshake() throws IOException {
// TODO Auto-generated method stub
}
@Override
public boolean isDriverHandshakeComplete() {
return true;
}
@Override
public void processDriverHandshakeMessage(OFMessage m) {
}
@Override
public void setTableFull(boolean isFull) {
// TODO Auto-generated method stub
}
@Override
public void setFeaturesReply(OFFeaturesReply featuresReply) {
if (featuresReply == null) {
log.error("Error setting featuresReply for switch: {}", getStringId());
return;
}
this.datapathId = featuresReply.getDatapathId();
this.capabilities = featuresReply.getCapabilities();
this.buffers = (int) featuresReply.getNBuffers();
this.tables = (byte) featuresReply.getNTables();
this.stringId = this.datapathId.toString();
}
@Override
public void setPortDescReply(OFPortDescStatsReply portDescReply) {
// TODO Auto-generated method stub
}
@Override
public void handleMessage(OFMessage m) {
log.info("Got packet {} but I am dumb so I don't know what to do.", m);
}
@Override
public boolean portEnabled(String portName) {
// TODO Auto-generated method stub
return false;
}
@Override
public OrderedCollection<PortChangeEvent> comparePorts(
Collection<OFPortDesc> p) {
// TODO Auto-generated method stub
return null;
}
}
package net.onrc.onos.of.ctl.util;
import java.util.EnumSet;
import java.util.Set;
/**
* A utility class to convert between integer based bitmaps for (OpenFlow)
* flags and Enum and EnumSet based representations.
*
* The enum used to represent individual flags needs to implement the
* BitmapableEnum interface.
*
* Example:
* {@code
* int bitmap = 0x11; // OFPPC_PORT_DOWN | OFPPC_NO_STP
* EnumSet<OFPortConfig> s = toEnumSet(OFPortConfig.class, bitmap);
* // s will contain OFPPC_PORT_DOWN and OFPPC_NO_STP
* }
*
* {@code
* EnumSet<OFPortConfig> s = EnumSet.of(OFPPC_NO_STP, OFPPC_PORT_DOWN);
* int bitmap = toBitmap(s); // returns 0x11
* }
*
*/
public final class EnumBitmaps {
private EnumBitmaps() { }
/**
* Enums used to represent individual flags needs to implement this
* interface.
*/
public interface BitmapableEnum {
/** Return the value in the bitmap that the enum constant represents.
* The returned value must have only a single bit set. E.g.,1 << 3
*/
int getValue();
}
/**
* Convert an integer bitmap to an EnumSet.
*
* See class description for example
* @param type The Enum class to use. Must implement BitmapableEnum
* @param bitmap The integer bitmap
* @return A newly allocated EnumSet representing the bits set in the
* bitmap
* @throws NullPointerException if type is null
* @throws IllegalArgumentException if any enum constant from type has
* more than one bit set.
* @throws IllegalArgumentException if the bitmap has any bits set not
* represented by an enum constant.
*/
public static <E extends Enum<E> & BitmapableEnum>
EnumSet<E> toEnumSet(Class<E> type, int bitmap) {
if (type == null) {
throw new NullPointerException("Given enum type must not be null");
}
EnumSet<E> s = EnumSet.noneOf(type);
// allSetBitmap will eventually have all valid bits for the given
// type set.
int allSetBitmap = 0;
for (E element: type.getEnumConstants()) {
if (Integer.bitCount(element.getValue()) != 1) {
String msg = String.format("The %s (%x) constant of the " +
"enum %s is supposed to represent a bitmap entry but " +
"has more than one bit set.",
element.toString(), element.getValue(), type.getName());
throw new IllegalArgumentException(msg);
}
allSetBitmap |= element.getValue();
if ((bitmap & element.getValue()) != 0) {
s.add(element);
}
}
if (((~allSetBitmap) & bitmap) != 0) {
// check if only valid flags are set in the given bitmap
String msg = String.format("The bitmap %x for enum %s has " +
"bits set that are presented by any enum constant",
bitmap, type.getName());
throw new IllegalArgumentException(msg);
}
return s;
}
/**
* Return the bitmap mask with all possible bits set. E.g., If a bitmap
* has the individual flags 0x1, 0x2, and 0x8 (note the missing 0x4) then
* the mask will be 0xb (1011 binary)
*
* @param type The Enum class to use. Must implement BitmapableEnum
* @throws NullPointerException if type is null
* @throws IllegalArgumentException if any enum constant from type has
* more than one bit set
* @return an integer with all possible bits for the given bitmap enum
* type set.
*/
public static <E extends Enum<E> & BitmapableEnum>
int getMask(Class<E> type) {
if (type == null) {
throw new NullPointerException("Given enum type must not be null");
}
// allSetBitmap will eventually have all valid bits for the given
// type set.
int allSetBitmap = 0;
for (E element: type.getEnumConstants()) {
if (Integer.bitCount(element.getValue()) != 1) {
String msg = String.format("The %s (%x) constant of the " +
"enum %s is supposed to represent a bitmap entry but " +
"has more than one bit set.",
element.toString(), element.getValue(), type.getName());
throw new IllegalArgumentException(msg);
}
allSetBitmap |= element.getValue();
}
return allSetBitmap;
}
/**
* Convert the given EnumSet to the integer bitmap representation.
* @param set The EnumSet to convert. The enum must implement
* BitmapableEnum
* @return the integer bitmap
* @throws IllegalArgumentException if an enum constant from the set (!) has
* more than one bit set
* @throws NullPointerException if the set is null
*/
public static <E extends Enum<E> & BitmapableEnum>
int toBitmap(Set<E> set) {
if (set == null) {
throw new NullPointerException("Given set must not be null");
}
int bitmap = 0;
for (E element: set) {
if (Integer.bitCount(element.getValue()) != 1) {
String msg = String.format("The %s (%x) constant in the set " +
"is supposed to represent a bitmap entry but " +
"has more than one bit set.",
element.toString(), element.getValue());
throw new IllegalArgumentException(msg);
}
bitmap |= element.getValue();
}
return bitmap;
}
}
/**
* Copyright 2012, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.util;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* An iterator that will filter values from an iterator and return only
* those values that match the predicate.
*/
public abstract class FilterIterator<T> implements Iterator<T> {
protected Iterator<T> subIterator;
protected T next;
/**
* Construct a filter iterator from the given sub iterator.
*
* @param subIterator the sub iterator over which we'll filter
*/
public FilterIterator(Iterator<T> subIterator) {
super();
this.subIterator = subIterator;
}
/**
* Check whether the given value should be returned by the
* filter.
*
* @param value the value to check
* @return true if the value should be included
*/
protected abstract boolean matches(T value);
// ***********
// Iterator<T>
// ***********
@Override
public boolean hasNext() {
if (next != null) {
return true;
}
while (subIterator.hasNext()) {
next = subIterator.next();
if (matches(next)) {
return true;
}
}
next = null;
return false;
}
@Override
public T next() {
if (hasNext()) {
T cur = next;
next = null;
return cur;
}
throw new NoSuchElementException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
package net.onrc.onos.of.ctl.util;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkArgument;
/**
* The class representing an ONOS Instance ID.
*
* This class is immutable.
*/
public final class InstanceId {
private final String id;
/**
* Constructor from a string value.
*
* @param id the value to use.
*/
public InstanceId(String id) {
this.id = checkNotNull(id);
checkArgument(!id.isEmpty(), "Empty ONOS Instance ID");
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof InstanceId)) {
return false;
}
InstanceId that = (InstanceId) obj;
return this.id.equals(that.id);
}
@Override
public String toString() {
return id;
}
}
/**
* Copyright 2012 Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.util;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Iterator over all values in an iterator of iterators.
*
* @param <T> the type of elements returned by this iterator
*/
public class IterableIterator<T> implements Iterator<T> {
Iterator<? extends Iterable<T>> subIterator;
Iterator<T> current = null;
public IterableIterator(Iterator<? extends Iterable<T>> subIterator) {
super();
this.subIterator = subIterator;
}
@Override
public boolean hasNext() {
if (current == null) {
if (subIterator.hasNext()) {
current = subIterator.next().iterator();
} else {
return false;
}
}
while (!current.hasNext() && subIterator.hasNext()) {
current = subIterator.next().iterator();
}
return current.hasNext();
}
@Override
public T next() {
if (hasNext()) {
return current.next();
}
throw new NoSuchElementException();
}
@Override
public void remove() {
if (hasNext()) {
current.remove();
}
throw new NoSuchElementException();
}
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.util;
import java.util.LinkedHashMap;
import java.util.Map;
public class LRUHashMap<K, V> extends LinkedHashMap<K, V> {
private static final long serialVersionUID = 1L;
private final int capacity;
public LRUHashMap(int capacity) {
super(capacity + 1, 0.75f, true);
this.capacity = capacity;
}
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
return size() > capacity;
}
}
package net.onrc.onos.of.ctl.util;
import java.util.Collection;
import java.util.LinkedHashSet;
import com.google.common.collect.ForwardingCollection;
/**
* A simple wrapper / forwarder that forwards all calls to a LinkedHashSet.
* This wrappers sole reason for existence is to implement the
* OrderedCollection marker interface.
*
*/
public class LinkedHashSetWrapper<E>
extends ForwardingCollection<E> implements OrderedCollection<E> {
private final Collection<E> delegate;
public LinkedHashSetWrapper() {
super();
this.delegate = new LinkedHashSet<E>();
}
public LinkedHashSetWrapper(Collection<? extends E> c) {
super();
this.delegate = new LinkedHashSet<E>(c);
}
@Override
protected Collection<E> delegate() {
return this.delegate;
}
}
/**
* Copyright 2012 Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.util;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Iterator over all values in an iterator of iterators.
*
* @param <T> the type of elements returned by this iterator
*/
public class MultiIterator<T> implements Iterator<T> {
Iterator<Iterator<T>> subIterator;
Iterator<T> current = null;
public MultiIterator(Iterator<Iterator<T>> subIterator) {
super();
this.subIterator = subIterator;
}
@Override
public boolean hasNext() {
if (current == null) {
if (subIterator.hasNext()) {
current = subIterator.next();
} else {
return false;
}
}
while (!current.hasNext() && subIterator.hasNext()) {
current = subIterator.next();
}
return current.hasNext();
}
@Override
public T next() {
if (hasNext()) {
return current.next();
}
throw new NoSuchElementException();
}
@Override
public void remove() {
if (hasNext()) {
current.remove();
}
throw new NoSuchElementException();
}
}
package net.onrc.onos.of.ctl.util;
import java.util.Collection;
/**
* A marker interface indicating that this Collection defines a particular
* iteration order. The details about the iteration order are specified by
* the concrete implementation.
*
* @param <E>
*/
public interface OrderedCollection<E> extends Collection<E> {
}
/**
* Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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.
**/
package net.onrc.onos.of.ctl.internal;
import junit.framework.TestCase;
import net.onrc.onos.of.ctl.IOFSwitch;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class ControllerTest extends TestCase {
private Controller controller;
private IOFSwitch sw;
private OFChannelHandler h;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
sw = EasyMock.createMock(IOFSwitch.class);
h = EasyMock.createMock(OFChannelHandler.class);
controller = new Controller();
ControllerRunThread t = new ControllerRunThread();
t.start();
/*
* Making sure the thread is properly started before making calls
* to controller class.
*/
Thread.sleep(200);
}
/**
* Starts the base mocks used in these tests.
*/
private void startMocks() {
EasyMock.replay(sw, h);
}
/**
* Reset the mocks to a known state.
* Automatically called after tests.
*/
@After
private void resetMocks() {
EasyMock.reset(sw);
}
/**
* Fetches the controller instance.
* @return the controller
*/
public Controller getController() {
return controller;
}
/**
* Run the controller's main loop so that updates are processed.
*/
protected class ControllerRunThread extends Thread {
@Override
public void run() {
controller.openFlowPort = 0; // Don't listen
controller.activate();
}
}
/**
* Verify that we are able to add a switch that just connected.
* If it already exists then this should fail
*
* @throws Exception error
*/
@Test
public void testAddConnectedSwitches() throws Exception {
startMocks();
assertTrue(controller.addConnectedSwitch(0, h));
assertFalse(controller.addConnectedSwitch(0, h));
}
/**
* Add active master but cannot re-add active master.
* @throws Exception an error occurred.
*/
@Test
public void testAddActivatedMasterSwitch() throws Exception {
startMocks();
controller.addConnectedSwitch(0, h);
assertTrue(controller.addActivatedMasterSwitch(0, sw));
assertFalse(controller.addActivatedMasterSwitch(0, sw));
}
/**
* Tests that an activated switch can be added but cannot be re-added.
*
* @throws Exception an error occurred
*/
@Test
public void testAddActivatedEqualSwitch() throws Exception {
startMocks();
controller.addConnectedSwitch(0, h);
assertTrue(controller.addActivatedEqualSwitch(0, sw));
assertFalse(controller.addActivatedEqualSwitch(0, sw));
}
/**
* Move an equal switch to master.
* @throws Exception an error occurred
*/
@Test
public void testTranstitionToMaster() throws Exception {
startMocks();
controller.addConnectedSwitch(0, h);
controller.addActivatedEqualSwitch(0, sw);
controller.transitionToMasterSwitch(0);
assertNotNull(controller.getMasterSwitch(0));
}
/**
* Transition a master switch to equal state.
* @throws Exception an error occurred
*/
@Test
public void testTranstitionToEqual() throws Exception {
startMocks();
controller.addConnectedSwitch(0, h);
controller.addActivatedMasterSwitch(0, sw);
controller.transitionToEqualSwitch(0);
assertNotNull(controller.getEqualSwitch(0));
}
/**
* Remove the switch from the controller instance.
* @throws Exception an error occurred
*/
@Test
public void testRemoveSwitch() throws Exception {
sw.cancelAllStatisticsReplies();
EasyMock.expectLastCall().once();
sw.setConnected(false);
EasyMock.expectLastCall().once();
startMocks();
controller.addConnectedSwitch(0, h);
controller.addActivatedMasterSwitch(0, sw);
controller.removeConnectedSwitch(0);
assertNull(controller.getSwitch(0));
EasyMock.verify(sw, h);
}
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template const.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
public enum OFActionType {
OUTPUT,
SET_VLAN_VID,
SET_VLAN_PCP,
STRIP_VLAN,
SET_DL_SRC,
SET_DL_DST,
SET_NW_SRC,
SET_NW_DST,
SET_NW_TOS,
SET_TP_SRC,
SET_TP_DST,
ENQUEUE,
EXPERIMENTER,
SET_NW_ECN,
COPY_TTL_OUT,
COPY_TTL_IN,
SET_MPLS_LABEL,
SET_MPLS_TC,
SET_MPLS_TTL,
DEC_MPLS_TTL,
PUSH_VLAN,
POP_VLAN,
PUSH_MPLS,
POP_MPLS,
SET_QUEUE,
GROUP,
SET_NW_TTL,
DEC_NW_TTL,
SET_FIELD,
PUSH_PBB,
POP_PBB;
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_interface.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
public interface OFAggregateStatsReply extends OFObject, OFStatsReply {
OFVersion getVersion();
OFType getType();
long getXid();
OFStatsType getStatsType();
Set<OFStatsReplyFlags> getFlags();
U64 getPacketCount();
U64 getByteCount();
long getFlowCount();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFStatsReply.Builder {
OFAggregateStatsReply build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
OFStatsType getStatsType();
Set<OFStatsReplyFlags> getFlags();
Builder setFlags(Set<OFStatsReplyFlags> flags);
U64 getPacketCount();
Builder setPacketCount(U64 packetCount);
U64 getByteCount();
Builder setByteCount(U64 byteCount);
long getFlowCount();
Builder setFlowCount(long flowCount);
}
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_interface.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
public interface OFAggregateStatsRequest extends OFObject, OFStatsRequest<OFAggregateStatsReply>, OFRequest<OFAggregateStatsReply> {
OFVersion getVersion();
OFType getType();
long getXid();
OFStatsType getStatsType();
Set<OFStatsRequestFlags> getFlags();
TableId getTableId();
OFPort getOutPort();
OFGroup getOutGroup() throws UnsupportedOperationException;
U64 getCookie() throws UnsupportedOperationException;
U64 getCookieMask() throws UnsupportedOperationException;
Match getMatch();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFStatsRequest.Builder<OFAggregateStatsReply> {
OFAggregateStatsRequest build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
OFStatsType getStatsType();
Set<OFStatsRequestFlags> getFlags();
Builder setFlags(Set<OFStatsRequestFlags> flags);
TableId getTableId();
Builder setTableId(TableId tableId);
OFPort getOutPort();
Builder setOutPort(OFPort outPort);
OFGroup getOutGroup() throws UnsupportedOperationException;
Builder setOutGroup(OFGroup outGroup) throws UnsupportedOperationException;
U64 getCookie() throws UnsupportedOperationException;
Builder setCookie(U64 cookie) throws UnsupportedOperationException;
U64 getCookieMask() throws UnsupportedOperationException;
Builder setCookieMask(U64 cookieMask) throws UnsupportedOperationException;
Match getMatch();
Builder setMatch(Match match);
}
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_interface.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.jboss.netty.buffer.ChannelBuffer;
public interface OFAsyncGetReply extends OFObject, OFMessage {
OFVersion getVersion();
OFType getType();
long getXid();
long getPacketInMaskEqualMaster();
long getPacketInMaskSlave();
long getPortStatusMaskEqualMaster();
long getPortStatusMaskSlave();
long getFlowRemovedMaskEqualMaster();
long getFlowRemovedMaskSlave();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFMessage.Builder {
OFAsyncGetReply build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getPacketInMaskEqualMaster();
Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
long getPacketInMaskSlave();
Builder setPacketInMaskSlave(long packetInMaskSlave);
long getPortStatusMaskEqualMaster();
Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
long getPortStatusMaskSlave();
Builder setPortStatusMaskSlave(long portStatusMaskSlave);
long getFlowRemovedMaskEqualMaster();
Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
long getFlowRemovedMaskSlave();
Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
}
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_interface.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.jboss.netty.buffer.ChannelBuffer;
public interface OFAsyncGetRequest extends OFObject, OFMessage, OFRequest<OFAsyncGetReply> {
OFVersion getVersion();
OFType getType();
long getXid();
long getPacketInMaskEqualMaster();
long getPacketInMaskSlave();
long getPortStatusMaskEqualMaster();
long getPortStatusMaskSlave();
long getFlowRemovedMaskEqualMaster();
long getFlowRemovedMaskSlave();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFMessage.Builder {
OFAsyncGetRequest build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getPacketInMaskEqualMaster();
Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
long getPacketInMaskSlave();
Builder setPacketInMaskSlave(long packetInMaskSlave);
long getPortStatusMaskEqualMaster();
Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
long getPortStatusMaskSlave();
Builder setPortStatusMaskSlave(long portStatusMaskSlave);
long getFlowRemovedMaskEqualMaster();
Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
long getFlowRemovedMaskSlave();
Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
}
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_interface.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
public interface OFAsyncSet extends OFObject, OFMessage {
OFVersion getVersion();
OFType getType();
long getXid();
long getPacketInMaskEqualMaster();
long getPacketInMaskSlave();
long getPortStatusMaskEqualMaster();
long getPortStatusMaskSlave();
long getFlowRemovedMaskEqualMaster();
long getFlowRemovedMaskSlave();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFMessage.Builder {
OFAsyncSet build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getPacketInMaskEqualMaster();
Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
long getPacketInMaskSlave();
Builder setPacketInMaskSlave(long packetInMaskSlave);
long getPortStatusMaskEqualMaster();
Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
long getPortStatusMaskSlave();
Builder setPortStatusMaskSlave(long portStatusMaskSlave);
long getFlowRemovedMaskEqualMaster();
Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
long getFlowRemovedMaskSlave();
Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
}
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template const.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
public enum OFBadActionCode {
BAD_TYPE,
BAD_LEN,
BAD_EXPERIMENTER,
BAD_EXPERIMENTER_TYPE,
BAD_OUT_PORT,
BAD_ARGUMENT,
EPERM,
TOO_MANY,
BAD_QUEUE,
BAD_OUT_GROUP,
MATCH_INCONSISTENT,
UNSUPPORTED_ORDER,
BAD_TAG,
BAD_SET_TYPE,
BAD_SET_LEN,
BAD_SET_ARGUMENT;
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template const.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
public enum OFBadInstructionCode {
UNKNOWN_INST,
UNSUP_INST,
BAD_TABLE_ID,
UNSUP_METADATA,
UNSUP_METADATA_MASK,
UNSUP_EXP_INST,
BAD_EXPERIMENTER,
BAD_EXPERIMENTER_TYPE,
BAD_LEN,
EPERM;
}
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template const.java
// Do not modify
package org.projectfloodlight.openflow.protocol;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
public enum OFBadMatchCode {
BAD_TYPE,
BAD_LEN,
BAD_TAG,
BAD_DL_ADDR_MASK,
BAD_NW_ADDR_MASK,
BAD_WILDCARDS,
BAD_FIELD,
BAD_VALUE,
BAD_MASK,
BAD_PREREQ,
DUP_FIELD,
EPERM;
}