alshabib

Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next

Showing 1000 changed files with 539 additions and 3448 deletions

Too many changes to show.

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

......@@ -3,7 +3,7 @@ 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;
import org.onlab.onos.GreetService;
/**
* Simple command example to demonstrate use of Karaf shell extensions; shows
......
......@@ -2,7 +2,7 @@ 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 org.onlab.onos.GreetService;
import java.util.Iterator;
import java.util.List;
......
......@@ -23,8 +23,9 @@
description="ONOS services and model API">
<feature>scr</feature>
<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/onlab-misc/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onlab-osgi/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onlab-rest/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onos-api/1.0.0-SNAPSHOT</bundle>
</feature>
......
package org.onlab.onos.net;
package org.onlab.onos;
/**
* Example of a simple service that provides greetings and it
......
package org.onlab.onos.event;
/**
* Base abstraction of an event.
* Base event implementation.
*/
public class AbstractEvent<T extends Enum, S extends Object> implements Event<T, S> {
......
package org.onlab.onos.event;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Base implementation of a manager capable of tracking listeners and
* dispatching events to them.
* Base implementation of an event sink and a registry capable of tracking
* listeners and dispatching events to them as part of event sink processing.
*/
public class AbstractListenerManager<E extends Event, L extends EventListener<E>>
public class AbstractListenerRegistry<E extends Event, L extends EventListener<E>>
implements EventSink<E> {
protected Logger log = LoggerFactory.getLogger(AbstractListenerManager.class);
private final Logger log = getLogger(getClass());
private final Set<L> listeners = new CopyOnWriteArraySet<>();
......
......@@ -10,12 +10,12 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Base implementation of event sink broker.
* Base implementation of event sink registry.
*/
public class DefaultEventSinkBroker implements EventSinkBroker {
public class DefaultEventSinkRegistry implements EventSinkRegistry {
private final Map<Class<? extends Event>, EventSink<? extends Event>> sinks =
new ConcurrentHashMap<>();
private final Map<Class<? extends Event>, EventSink<? extends Event>>
sinks = new ConcurrentHashMap<>();
@Override
public <E extends Event> void addSink(Class<E> eventClass, EventSink<E> sink) {
......
package org.onlab.onos.event;
/**
* Abstraction of an event.
* Abstraction of an of a time-stamped event pertaining to an arbitrary subject.
*/
public interface Event<T extends Enum, S extends Object> {
......
package org.onlab.onos.event;
/**
* Abstraction of an entity capable of accepting events to be posted and
* then dispatching them to the appropriate event sink.
*/
public interface EventDeliveryService extends EventDispatcher, EventSinkRegistry {
}
......@@ -6,13 +6,13 @@ package org.onlab.onos.event;
* Similarly, whether the events are accepted and dispatched synchronously
* or asynchronously is unspecified as well.
*/
public interface EventDispatcher<E extends Event> {
public interface EventDispatcher {
/**
* Posts the specified event for dispatching.
*
* @param event event to be posted
*/
void post(E event);
void post(Event event);
}
......
......@@ -3,10 +3,10 @@ package org.onlab.onos.event;
import java.util.Set;
/**
* Abstraction of an event sink broker capable of tracking sinks based on
* Abstraction of an event sink registry capable of tracking sinks based on
* their event class.
*/
public interface EventSinkBroker {
public interface EventSinkRegistry {
/**
* Adds the specified sink for the given event class.
......
package org.onlab.onos.net.device;
import org.onlab.onos.net.provider.ProviderBroker;
import org.onlab.onos.net.provider.ProviderRegistry;
/**
* Abstraction of a device provider brokerage.
* Abstraction of a device provider registry.
*/
public interface DeviceProviderBroker
extends ProviderBroker<DeviceProvider, DeviceProviderService> {
public interface DeviceProviderRegistry
extends ProviderRegistry<DeviceProvider, DeviceProviderService> {
}
......
......@@ -34,17 +34,17 @@ public interface DeviceProviderService extends ProviderService<DeviceProvider> {
* determine what has changed.
* <p/>
*
* @param deviceId identity of the device
* @param ports list of device ports
* @param deviceId identity of the device
* @param portDescriptions list of device ports
*/
void updatePorts(DeviceId deviceId, List<PortDescription> ports);
void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions);
/**
* Used to notify the core about port status change of a single port.
*
* @param deviceId identity of the device
* @param port description of the port that changed
* @param deviceId identity of the device
* @param portDescription description of the port that changed
*/
void portStatusChanged(DeviceId deviceId, PortDescription port);
void portStatusChanged(DeviceId deviceId, PortDescription portDescription);
}
......
package org.onlab.onos.net.flow;
import org.onlab.onos.net.provider.ProviderBroker;
import org.onlab.onos.net.provider.ProviderRegistry;
/**
* Abstraction for a flow rule provider brokerage.
* Abstraction for a flow rule provider registry.
*/
public interface FlowRuleProviderBroker
extends ProviderBroker<FlowRuleProvider, FlowRuleProviderService> {
public interface FlowRuleProviderRegistry
extends ProviderRegistry<FlowRuleProvider, FlowRuleProviderService> {
}
......
package org.onlab.onos.net.host;
import org.onlab.onos.net.provider.ProviderBroker;
import org.onlab.onos.net.provider.ProviderRegistry;
/**
* Abstraction of a host provider brokerage.
* Abstraction of a host provider registry.
*/
public interface HostProviderBroker
extends ProviderBroker<HostProvider, HostProviderService> {
public interface HostProviderRegistry
extends ProviderRegistry<HostProvider, HostProviderService> {
}
......
package org.onlab.onos.net.link;
import org.onlab.onos.net.provider.ProviderBroker;
import org.onlab.onos.net.provider.ProviderRegistry;
/**
* Abstraction of an infrastructure link provider brokerage.
* Abstraction of an infrastructure link provider registry.
*/
public interface LinkProviderBroker
extends ProviderBroker<LinkProvider, LinkProviderService> {
public interface LinkProviderRegistry
extends ProviderRegistry<LinkProvider, LinkProviderService> {
}
......
package org.onlab.onos.net.provider;
import com.google.common.collect.ImmutableSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
/**
* Base implementation of provider broker.
* Base implementation of provider registry.
*
* @param <P> type of the information provider
* @param <S> type of the provider service
*/
public abstract class AbstractProviderBroker<P extends Provider, S extends ProviderService<P>>
implements ProviderBroker<P, S> {
public abstract class AbstractProviderRegistry<P extends Provider, S extends ProviderService<P>>
implements ProviderRegistry<P, S> {
private final Map<ProviderId, S> services = new HashMap<>();
......@@ -28,7 +31,7 @@ public abstract class AbstractProviderBroker<P extends Provider, S extends Provi
@Override
public synchronized S register(P provider) {
checkNotNull(provider, "Provider cannot be null");
checkArgument(!services.containsKey(provider), "Provider %s already registered", provider.id());
checkState(!services.containsKey(provider.id()), "Provider %s already registered", provider.id());
S service = createProviderService(provider);
services.put(provider.id(), service);
return service;
......@@ -37,10 +40,16 @@ public abstract class AbstractProviderBroker<P extends Provider, S extends Provi
@Override
public synchronized void unregister(P provider) {
checkNotNull(provider, "Provider cannot be null");
S service = services.get(provider);
S service = services.get(provider.id());
if (service != null && service instanceof AbstractProviderService) {
((AbstractProviderService) service).invalidate();
services.remove(provider);
services.remove(provider.id());
}
}
@Override
public synchronized Set<ProviderId> getProviders() {
return ImmutableSet.copyOf(services.keySet());
}
}
......
package org.onlab.onos.net.provider;
import java.util.Set;
/**
* Broker used for registering/unregistering information providers with the core.
* Registry for tracking information providers with the core.
*
* @param <P> type of the information provider
* @param <S> type of the provider service
*/
public interface ProviderBroker<P extends Provider, S extends ProviderService<P>> {
public interface ProviderRegistry<P extends Provider, S extends ProviderService<P>> {
/**
* Registers the supplied provider with the core.
......@@ -29,4 +31,11 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P>
*/
void unregister(P provider);
/**
* Returns a set of currently registered provider identities.
*
* @return set of provider identifiers
*/
Set<ProviderId> getProviders();
}
......
package org.onlab.onos.net.topology;
import org.onlab.onos.net.provider.ProviderBroker;
import org.onlab.onos.net.provider.ProviderRegistry;
/**
* Abstraction of a network topology provider brokerage.
* Abstraction of a network topology provider registry.
*/
public interface TopologyProviderBroker extends
ProviderBroker<TopologyProvider, TopologyProviderService> {
public interface TopologyProviderRegistry extends
ProviderRegistry<TopologyProvider, TopologyProviderService> {
}
......
<body>
ONOS Core API definitions.
</body>
\ No newline at end of file
......@@ -8,13 +8,13 @@ import static org.junit.Assert.assertTrue;
/**
* Tests of the base listener manager.
*/
public class AbstractListenerManagerTest {
public class AbstractListenerRegistryTest {
@Test
public void basics() {
TestListener listener = new TestListener();
TestListener secondListener = new TestListener();
TestListenerManager manager = new TestListenerManager();
TestListenerRegistry manager = new TestListenerRegistry();
manager.addListener(listener);
manager.addListener(secondListener);
......@@ -35,7 +35,7 @@ public class AbstractListenerManagerTest {
public void badListener() {
TestListener listener = new BrokenListener();
TestListener secondListener = new TestListener();
TestListenerManager manager = new TestListenerManager();
TestListenerRegistry manager = new TestListenerRegistry();
manager.addListener(listener);
manager.addListener(secondListener);
......
......@@ -6,11 +6,11 @@ import org.junit.Test;
import static org.junit.Assert.*;
/**
* Tests of the default event sink broker.
* Tests of the default event sink registry.
*/
public class DefaultEventSinkBrokerTest {
public class DefaultEventSinkRegistryTest {
private DefaultEventSinkBroker broker;
private DefaultEventSinkRegistry registry;
private static class FooEvent extends TestEvent {
public FooEvent(String subject) { super(Type.FOO, subject); }
......@@ -30,23 +30,23 @@ public class DefaultEventSinkBrokerTest {
@Before
public void setUp() {
broker = new DefaultEventSinkBroker();
registry = new DefaultEventSinkRegistry();
}
@Test
public void basics() {
FooSink fooSink = new FooSink();
BarSink barSink = new BarSink();
broker.addSink(FooEvent.class, fooSink);
broker.addSink(BarEvent.class, barSink);
registry.addSink(FooEvent.class, fooSink);
registry.addSink(BarEvent.class, barSink);
assertEquals("incorrect sink count", 2, broker.getSinks().size());
assertEquals("incorrect sink", fooSink, broker.getSink(FooEvent.class));
assertEquals("incorrect sink", barSink, broker.getSink(BarEvent.class));
assertEquals("incorrect sink count", 2, registry.getSinks().size());
assertEquals("incorrect sink", fooSink, registry.getSink(FooEvent.class));
assertEquals("incorrect sink", barSink, registry.getSink(BarEvent.class));
broker.removeSink(FooEvent.class);
assertNull("incorrect sink", broker.getSink(FooEvent.class));
assertEquals("incorrect sink", barSink, broker.getSink(BarEvent.class));
registry.removeSink(FooEvent.class);
assertNull("incorrect sink", registry.getSink(FooEvent.class));
assertEquals("incorrect sink", barSink, registry.getSink(BarEvent.class));
}
}
......
......@@ -6,8 +6,8 @@ import java.util.List;
/**
* Test event listener manager fixture.
*/
public class TestListenerManager
extends AbstractListenerManager<TestEvent, TestListener> {
public class TestListenerRegistry
extends AbstractListenerRegistry<TestEvent, TestListener> {
public final List<Throwable> errors = new ArrayList<>();
......
package org.onlab.onos.net.provider;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
/**
* Test of the base provider registry.
*/
public class AbstractProviderRegistryTest {
private class TestProviderService extends AbstractProviderService<TestProvider> {
protected TestProviderService(TestProvider provider) {
super(provider);
}
}
private class TestProviderRegistry extends AbstractProviderRegistry<TestProvider, TestProviderService> {
@Override
protected TestProviderService createProviderService(TestProvider provider) {
return new TestProviderService(provider);
}
}
@Test
public void basics() {
TestProviderRegistry registry = new TestProviderRegistry();
assertEquals("incorrect provider count", 0, registry.getProviders().size());
ProviderId fooId = new ProviderId("foo");
TestProvider pFoo = new TestProvider(fooId);
TestProviderService psFoo = registry.register(pFoo);
assertEquals("incorrect provider count", 1, registry.getProviders().size());
assertThat("provider not found", registry.getProviders().contains(fooId));
assertEquals("incorrect provider", psFoo.provider(), pFoo);
ProviderId barId = new ProviderId("bar");
TestProvider pBar = new TestProvider(barId);
TestProviderService psBar = registry.register(pBar);
assertEquals("incorrect provider count", 2, registry.getProviders().size());
assertThat("provider not found", registry.getProviders().contains(barId));
assertEquals("incorrect provider", psBar.provider(), pBar);
psFoo.checkValidity();
registry.unregister(pFoo);
psBar.checkValidity();
assertEquals("incorrect provider count", 1, registry.getProviders().size());
assertThat("provider not found", registry.getProviders().contains(barId));
}
@Test(expected = IllegalStateException.class)
public void duplicateRegistration() {
TestProviderRegistry registry = new TestProviderRegistry();
TestProvider pFoo = new TestProvider(new ProviderId("foo"));
registry.register(pFoo);
registry.register(pFoo);
}
@Test
public void voidUnregistration() {
TestProviderRegistry registry = new TestProviderRegistry();
registry.unregister(new TestProvider(new ProviderId("foo")));
}
@Test(expected = IllegalStateException.class)
public void unregistration() {
TestProviderRegistry registry = new TestProviderRegistry();
TestProvider pFoo = new TestProvider(new ProviderId("foo"));
TestProviderService psFoo = registry.register(pFoo);
registry.unregister(pFoo);
psFoo.checkValidity();
}
}
package org.onlab.onos.event.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.Service;
import org.onlab.onos.event.AbstractEvent;
import org.onlab.onos.event.DefaultEventSinkRegistry;
import org.onlab.onos.event.Event;
import org.onlab.onos.event.EventDeliveryService;
import org.onlab.onos.event.EventSink;
import org.slf4j.Logger;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static org.onlab.util.Tools.namedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Simple implementation of an event dispatching service.
*/
@Component(immediate = true)
@Service
public class SimpleEventDispatcher extends DefaultEventSinkRegistry
implements EventDeliveryService {
private final Logger log = getLogger(getClass());
private final ExecutorService executor =
newSingleThreadExecutor(namedThreads("event-dispatch-%d"));
@SuppressWarnings("unchecked")
private static final Event KILL_PILL = new AbstractEvent(null, 0) {
};
private final BlockingQueue<Event> events = new LinkedBlockingQueue<>();
private volatile boolean stopped = false;
@Override
public void post(Event event) {
events.add(event);
}
@Activate
public void activate() {
stopped = false;
executor.execute(new DispatchLoop());
log.info("Started");
}
@Deactivate
public void deactivate() {
stopped = true;
post(KILL_PILL);
log.info("Stopped");
}
// Auxiliary event dispatching loop that feeds off the events queue.
private class DispatchLoop implements Runnable {
@Override
@SuppressWarnings("unchecked")
public void run() {
log.info("Dispatch loop initiated");
while (!stopped) {
try {
// Fetch the next event and if it is the kill-pill, bail
Event event = events.take();
if (event == KILL_PILL) {
break;
}
// Locate the sink for the event class and use it to
// process the event
EventSink sink = getSink(event.getClass());
if (sink != null) {
sink.process(event);
} else {
log.warn("No sink registered for event class {}",
event.getClass());
}
} catch (Throwable e) {
log.warn("Error encountered while dispatching event:", e);
}
}
log.info("Dispatch loop terminated");
}
}
}
package org.onlab.onos.net.trivial.impl;
package org.onlab.onos.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.onlab.onos.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;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Trivial implementation of the seed service to demonstrate component and
......@@ -22,7 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
@Service
public class GreetManager implements GreetService {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Logger log = getLogger(getClass());
private final Set<String> names = new HashSet<>();
......
package org.onlab.onos.net.trivial.impl;
package org.onlab.onos.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.onlab.onos.GreetService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Example of a component that does not provide any service, but consumes one.
......@@ -15,7 +16,7 @@ import org.slf4j.LoggerFactory;
@Component(immediate = true)
public class SomeOtherComponent {
private final Logger log = LoggerFactory.getLogger(SomeOtherComponent.class);
private final Logger log = getLogger(getClass());
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected GreetService service;
......
package org.onlab.onos.net.trivial.impl;
import org.onlab.onos.net.Device;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Port;
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.device.DeviceDescription;
import org.onlab.onos.net.device.DeviceEvent;
import org.onlab.onos.net.device.PortDescription;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Manages inventory of infrastructure devices.
*/
public class DeviceStore {
private final Map<DeviceId, Device> devices = new ConcurrentHashMap<>();
/**
* Creates a new infrastructure device, or updates an existing one using
* the supplied device description.
*
* @param deviceId device identifier
* @param deviceDescription device description
* @return ready to send event describing what occurred; null if no change
*/
public DeviceEvent createOrUpdateDevice(DeviceId deviceId,
DeviceDescription deviceDescription) {
return null;
}
/**
* Removes the specified infrastructure device.
*
* @param deviceId device identifier
* @return ready to send event describing what occurred; null if no change
*/
public DeviceEvent removeDevice(DeviceId deviceId) {
return null;
}
/**
* Updates the ports of the specified infrastructure device using the given
* list of port descriptions. The list is assumed to be comprehensive.
*
* @param deviceId device identifier
* @param portDescriptions list of port descriptions
* @return ready to send events describing what occurred; empty list if no change
*/
public List<DeviceEvent> updatePorts(DeviceId deviceId,
List<PortDescription> portDescriptions) {
return new ArrayList<>();
}
/**
* Updates the port status of the specified infrastructure device using the
* given port description.
*
* @param deviceId device identifier
* @param portDescription port description
* @return ready to send event describing what occurred; null if no change
*/
public DeviceEvent updatePortStatus(DeviceId deviceId,
PortDescription portDescription) {
return null;
}
/**
* Returns the device with the specified identifier.
*
* @param deviceId device identifier
* @return device
*/
public Device getDevice(DeviceId deviceId) {
return null;
}
/**
* Returns the list of ports that belong to the specified device.
*
* @param deviceId device identifier
* @return list of device ports
*/
public List<Port> getPorts(DeviceId deviceId) {
return null;
}
/**
* Returns the specified device port.
*
* @param deviceId device identifier
* @param portNumber port number
* @return device port
*/
public Port getPort(DeviceId deviceId, PortNumber portNumber) {
return null;
}
}
......@@ -3,62 +3,112 @@ package org.onlab.onos.net.trivial.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.apache.felix.scr.annotations.Service;
import org.onlab.onos.event.AbstractListenerRegistry;
import org.onlab.onos.event.EventDeliveryService;
import org.onlab.onos.net.Device;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.MastershipRole;
import org.onlab.onos.net.Port;
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.device.DeviceDescription;
import org.onlab.onos.net.device.DeviceEvent;
import org.onlab.onos.net.device.DeviceListener;
import org.onlab.onos.net.device.DeviceProvider;
import org.onlab.onos.net.device.DeviceProviderBroker;
import org.onlab.onos.net.device.DeviceProviderRegistry;
import org.onlab.onos.net.device.DeviceProviderService;
import org.onlab.onos.net.device.DeviceService;
import org.onlab.onos.net.device.PortDescription;
import org.onlab.onos.net.provider.AbstractProviderBroker;
import org.onlab.onos.net.provider.AbstractProviderRegistry;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides basic implementation of the device SB &amp; NB APIs.
*/
@Component(immediate = true)
@Service
public class SimpleDeviceManager implements DeviceProviderBroker {
public class SimpleDeviceManager
extends AbstractProviderRegistry<DeviceProvider, DeviceProviderService>
implements DeviceService, DeviceProviderRegistry {
public static final String DEVICE_ID_NULL = "Device ID cannot be null";
public static final String PORT_NUMBER_NULL = "Port number cannot be null";
public static final String DEVICE_DESCRIPTION_NULL = "Device description cannot be null";
public static final String PORT_DESCRIPTION_NULL = "Port description cannot be null";
private final Logger log = getLogger(getClass());
private final AbstractListenerRegistry<DeviceEvent, DeviceListener>
listenerRegistry = new AbstractListenerRegistry<>();
private Logger log = LoggerFactory.getLogger(SimpleDeviceManager.class);
private final DeviceStore store = new DeviceStore();
private final DeviceProviderBroker broker = new InternalBroker();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private EventDeliveryService eventDispatcher;
@Activate
public void activate() {
eventDispatcher.addSink(DeviceEvent.class, listenerRegistry);
log.info("Started");
}
@Deactivate
public void deactivate() {
eventDispatcher.removeSink(DeviceEvent.class);
log.info("Stopped");
}
@Override
public DeviceProviderService register(DeviceProvider provider) {
log.info("Registering provider {}", provider.id());
return broker.register(provider);
public MastershipRole getRole(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
return null;
}
@Override
public void unregister(DeviceProvider provider) {
log.info("Unregistering provider {}", provider.id());
broker.unregister(provider);
public Iterable<Device> getDevices() {
return null;
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private class InternalBroker extends AbstractProviderBroker<DeviceProvider, DeviceProviderService>
implements DeviceProviderBroker {
@Override
protected DeviceProviderService createProviderService(DeviceProvider provider) {
return new InternalDeviceProviderService(provider);
}
@Override
public Device getDevice(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
return store.getDevice(deviceId);
}
@Override
public List<Port> getPorts(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
return store.getPorts(deviceId);
}
@Override
public Port getPort(DeviceId deviceId, PortNumber portNumber) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(portNumber, PORT_NUMBER_NULL);
return store.getPort(deviceId, portNumber);
}
@Override
public void addListener(DeviceListener listener) {
listenerRegistry.addListener(listener);
}
@Override
public void removeListener(DeviceListener listener) {
listenerRegistry.removeListener(listener);
}
@Override
protected DeviceProviderService createProviderService(DeviceProvider provider) {
return new InternalDeviceProviderService(provider);
}
// Personalized device provider service issued to the supplied provider.
......@@ -71,26 +121,49 @@ public class SimpleDeviceManager implements DeviceProviderBroker {
@Override
public MastershipRole deviceConnected(DeviceId deviceId, DeviceDescription deviceDescription) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(deviceDescription, DEVICE_DESCRIPTION_NULL);
log.info("Device {} connected: {}", deviceId, deviceDescription);
DeviceEvent event = store.createOrUpdateDevice(deviceId, deviceDescription);
post(event);
return MastershipRole.MASTER;
}
@Override
public void deviceDisconnected(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
log.info("Device {} disconnected", deviceId);
DeviceEvent event = store.removeDevice(deviceId);
post(event);
}
@Override
public void updatePorts(DeviceId deviceId, List<PortDescription> ports) {
public void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(portDescriptions, "Port descriptions list cannot be null");
// FIXME: fix the interface to accept DeviceId separately
log.info("Device {} ports updated: {}", ports);
log.info("Device {} ports updated: {}", portDescriptions);
List<DeviceEvent> events = store.updatePorts(deviceId, portDescriptions);
for (DeviceEvent event : events) {
post(event);
}
}
@Override
public void portStatusChanged(DeviceId deviceId, PortDescription port) {
log.info("Device {} port status changed: {}", deviceId, port);
public void portStatusChanged(DeviceId deviceId, PortDescription portDescription) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(portDescription, PORT_DESCRIPTION_NULL);
log.info("Device {} port status changed: {}", deviceId, portDescription);
DeviceEvent event = store.updatePortStatus(deviceId, portDescription);
post(event);
}
}
// Posts the specified event to a local event dispatcher
private void post(DeviceEvent event) {
if (event != null && eventDispatcher != null) {
eventDispatcher.post(event);
}
}
}
......
......@@ -3,57 +3,56 @@ package org.onlab.onos.net.trivial.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.apache.felix.scr.annotations.Service;
import org.onlab.onos.event.AbstractListenerRegistry;
import org.onlab.onos.event.EventDeliveryService;
import org.onlab.onos.net.host.HostDescription;
import org.onlab.onos.net.host.HostEvent;
import org.onlab.onos.net.host.HostListener;
import org.onlab.onos.net.host.HostProvider;
import org.onlab.onos.net.host.HostProviderBroker;
import org.onlab.onos.net.host.HostProviderRegistry;
import org.onlab.onos.net.host.HostProviderService;
import org.onlab.onos.net.provider.AbstractProviderBroker;
import org.onlab.onos.net.provider.AbstractProviderRegistry;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides basic implementation of the host SB &amp; NB APIs.
*/
@Component(immediate = true)
@Service
public class SimpleHostManager implements HostProviderBroker {
public class SimpleHostManager
extends AbstractProviderRegistry<HostProvider, HostProviderService>
implements HostProviderRegistry {
private final Logger log = getLogger(getClass());
private final AbstractListenerRegistry<HostEvent, HostListener>
listenerRegistry = new AbstractListenerRegistry<>();
private Logger log = LoggerFactory.getLogger(SimpleHostManager.class);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private EventDeliveryService eventDispatcher;
private final HostProviderBroker broker = new InternalBroker();
@Activate
public void activate() {
eventDispatcher.addSink(HostEvent.class, listenerRegistry);
log.info("Started");
}
@Deactivate
public void deactivate() {
eventDispatcher.removeSink(HostEvent.class);
log.info("Stopped");
}
@Override
public HostProviderService register(HostProvider provider) {
log.info("Registering provider {}", provider.id());
return broker.register(provider);
}
@Override
public void unregister(HostProvider provider) {
log.info("Unregistering provider {}", provider.id());
broker.unregister(provider);
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private class InternalBroker extends AbstractProviderBroker<HostProvider, HostProviderService>
implements HostProviderBroker {
@Override
protected HostProviderService createProviderService(HostProvider provider) {
return new InternalHostProviderService(provider);
}
protected HostProviderService createProviderService(HostProvider provider) {
return new InternalHostProviderService(provider);
}
// Personalized host provider service issued to the supplied provider.
......
......@@ -3,57 +3,55 @@ package org.onlab.onos.net.trivial.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.apache.felix.scr.annotations.Service;
import org.onlab.onos.event.AbstractListenerRegistry;
import org.onlab.onos.event.EventDeliveryService;
import org.onlab.onos.net.link.LinkDescription;
import org.onlab.onos.net.link.LinkEvent;
import org.onlab.onos.net.link.LinkListener;
import org.onlab.onos.net.link.LinkProvider;
import org.onlab.onos.net.link.LinkProviderBroker;
import org.onlab.onos.net.link.LinkProviderRegistry;
import org.onlab.onos.net.link.LinkProviderService;
import org.onlab.onos.net.provider.AbstractProviderBroker;
import org.onlab.onos.net.provider.AbstractProviderRegistry;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides basic implementation of the link SB &amp; NB APIs.
*/
@Component(immediate = true)
@Service
public class SimpleLinkManager implements LinkProviderBroker {
public class SimpleLinkManager
extends AbstractProviderRegistry<LinkProvider, LinkProviderService>
implements LinkProviderRegistry {
private final Logger log = getLogger(getClass());
private Logger log = LoggerFactory.getLogger(SimpleLinkManager.class);
private final AbstractListenerRegistry<LinkEvent, LinkListener>
listenerRegistry = new AbstractListenerRegistry<>();
private final LinkProviderBroker broker = new InternalBroker();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private EventDeliveryService eventDispatcher;
@Activate
public void activate() {
eventDispatcher.addSink(LinkEvent.class, listenerRegistry);
log.info("Started");
}
@Deactivate
public void deactivate() {
eventDispatcher.removeSink(LinkEvent.class);
log.info("Stopped");
}
@Override
public LinkProviderService register(LinkProvider provider) {
log.info("Registering provider {}", provider.id());
return broker.register(provider);
}
@Override
public void unregister(LinkProvider provider) {
log.info("Unregistering provider {}", provider.id());
broker.unregister(provider);
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private class InternalBroker extends AbstractProviderBroker<LinkProvider, LinkProviderService>
implements LinkProviderBroker {
@Override
protected LinkProviderService createProviderService(LinkProvider provider) {
return new InternalLinkProviderService(provider);
}
protected LinkProviderService createProviderService(LinkProvider provider) {
return new InternalLinkProviderService(provider);
}
// Personalized link provider service issued to the supplied provider.
......
<body>
ONOS local event dispatching mechanism.
</body>
\ No newline at end of file
<body>
ONOS Core infrastructure implementations.
</body>
\ No newline at end of file
package org.onlab.onos.net.trivial.impl;
package org.onlab.onos.impl;
import org.junit.Test;
import org.onlab.onos.net.GreetService;
import org.onlab.onos.GreetService;
import java.util.Iterator;
......
......@@ -26,6 +26,11 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onlab-misc</artifactId>
</dependency>
</dependencies>
<build>
......
# 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.
package net.onrc.onos.of.ctl;
import org.projectfloodlight.openflow.protocol.OFVersion;
import org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.debugcounter;
import java.util.Collections;
import java.util.List;
import org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.registry;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.debugcounter.IDebugCounterService;
import org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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 org.onlab.onos.of.controller.impl.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;
}
// 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 OFBadRequestCode {
BAD_VERSION,
BAD_TYPE,
BAD_STAT,
BAD_EXPERIMENTER,
BAD_SUBTYPE,
EPERM,
BAD_LEN,
BUFFER_EMPTY,
BUFFER_UNKNOWN,
BAD_TABLE_ID,
BAD_EXPERIMENTER_TYPE,
IS_SLAVE,
BAD_PORT,
BAD_PACKET,
MULTIPART_BUFFER_OVERFLOW;
}
// 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 OFBarrierReply extends OFObject, OFMessage {
OFVersion getVersion();
OFType getType();
long getXid();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFMessage.Builder {
OFBarrierReply build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
}
}
// 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 OFBarrierRequest extends OFObject, OFMessage, OFRequest<OFBarrierReply> {
OFVersion getVersion();
OFType getType();
long getXid();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFMessage.Builder {
OFBarrierRequest build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
}
}
// 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 OFBsnArpIdle extends OFObject, OFBsnHeader {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
int getVlanVid();
IPv4Address getIpv4Addr();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnArpIdle build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
int getVlanVid();
Builder setVlanVid(int vlanVid);
IPv4Address getIpv4Addr();
Builder setIpv4Addr(IPv4Address ipv4Addr);
}
}
// 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 OFBsnBwClearDataReply extends OFObject, OFBsnHeader {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
long getStatus();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnBwClearDataReply build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
long getStatus();
Builder setStatus(long status);
}
}
// 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 OFBsnBwClearDataRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnBwClearDataReply> {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnBwClearDataRequest build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
}
}
// 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 OFBsnBwEnableGetReply extends OFObject, OFBsnHeader {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
long getEnabled();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnBwEnableGetReply build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
long getEnabled();
Builder setEnabled(long enabled);
}
}
// 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 OFBsnBwEnableGetRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnBwEnableGetReply> {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnBwEnableGetRequest build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
}
}
// 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 OFBsnBwEnableSetReply extends OFObject, OFBsnHeader {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
long getEnable();
long getStatus();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnBwEnableSetReply build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
long getEnable();
Builder setEnable(long enable);
long getStatus();
Builder setStatus(long status);
}
}
// 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 OFBsnBwEnableSetRequest extends OFObject, OFBsnHeader, OFRequest<OFBsnBwEnableSetReply> {
OFVersion getVersion();
OFType getType();
long getXid();
long getExperimenter();
long getSubtype();
long getEnable();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder extends OFBsnHeader.Builder {
OFBsnBwEnableSetRequest build();
OFVersion getVersion();
OFType getType();
long getXid();
Builder setXid(long xid);
long getExperimenter();
long getSubtype();
long getEnable();
Builder setEnable(long enable);
}
}
// 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 OFBsnControllerConnection extends OFObject {
OFBsnControllerConnectionState getState();
OFAuxId getAuxiliaryId();
OFControllerRole getRole();
String getUri();
OFVersion getVersion();
void writeTo(ChannelBuffer channelBuffer);
Builder createBuilder();
public interface Builder {
OFBsnControllerConnection build();
OFBsnControllerConnectionState getState();
Builder setState(OFBsnControllerConnectionState state);
OFAuxId getAuxiliaryId();
Builder setAuxiliaryId(OFAuxId auxiliaryId);
OFControllerRole getRole();
Builder setRole(OFControllerRole role);
String getUri();
Builder setUri(String uri);
OFVersion getVersion();
}
}
// 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 OFBsnControllerConnectionState {
BSN_CONTROLLER_CONNECTION_STATE_DISCONNECTED,
BSN_CONTROLLER_CONNECTION_STATE_CONNECTED;
}