本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitchDriver类的典型用法代码示例。如果您正苦于以下问题:Java IOFSwitchDriver类的具体用法?Java IOFSwitchDriver怎么用?Java IOFSwitchDriver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOFSwitchDriver类属于net.floodlightcontroller.core包,在下文中一共展示了IOFSwitchDriver类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSwitchDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
@Override
public synchronized void addSwitchDriver(String manufacturerDescPrefix,
IOFSwitchDriver driver) {
if (manufacturerDescPrefix == null) {
throw new NullPointerException("manufacturerDescrptionPrefix" +
" must not be null");
}
if (driver == null) {
throw new NullPointerException("driver must not be null");
}
IOFSwitchDriver existingDriver = switchBindingMap.get(manufacturerDescPrefix);
if (existingDriver != null ) {
throw new IllegalStateException("Failed to add OFSwitch driver for "
+ manufacturerDescPrefix + "already registered");
}
switchBindingMap.put(manufacturerDescPrefix, driver);
switchDescSorted.add(manufacturerDescPrefix);
}
示例2: addOFSwitchDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
@Override
public void addOFSwitchDriver(String description, IOFSwitchDriver driver) {
IOFSwitchDriver existingDriver = switchBindingMap.get(description);
if (existingDriver != null) {
log.warn("Failed to add OFSwitch driver for {}, " +
"already registered", description);
return;
}
switchBindingMap.put(description, driver);
// Sort so we match the longest string first
int index = -1;
for (String desc : switchDescSortedList) {
if (description.compareTo(desc) > 0) {
index = switchDescSortedList.indexOf(desc);
switchDescSortedList.add(index, description);
break;
}
}
if (index == -1) { // append to list
switchDescSortedList.add(description);
}
}
示例3: init
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
/**
* Initialize internal data structures
*/
public void init(Map<String, String> configParams) {
// These data structures are initialized here because other
// module's startUp() might be called before ours
this.messageListeners =
new ConcurrentHashMap<OFType,
ListenerDispatcher<OFType,
IOFMessageListener>>();
this.switchListeners = new CopyOnWriteArraySet<IOFSwitchListener>();
this.haListeners = new CopyOnWriteArraySet<IHAListener>();
this.switchBindingMap =
new ConcurrentHashMap<String, IOFSwitchDriver>();
this.switchDescSortedList = new ArrayList<String>();
this.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();
this.connectedSwitches = new HashSet<IOFSwitch>();
this.controllerNodeIPsCache = new HashMap<String, String>();
this.updates = new LinkedBlockingQueue<IUpdate>();
this.factory = new BasicFactory();
this.providerMap = new HashMap<String, List<IInfoProvider>>();
setConfigParams(configParams);
this.role = getInitialRole(configParams);
this.notifiedRole = this.role;
this.roleChanger = new RoleChanger(this);
initVendorMessages();
this.systemStartTime = System.currentTimeMillis();
}
示例4: addSwitchDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
@Override
public synchronized void addSwitchDriver(@Nonnull String manufacturerDescPrefix,
@Nonnull IOFSwitchDriver driver) {
Preconditions.checkNotNull(manufacturerDescPrefix, "manufactererDescProfix");
Preconditions.checkNotNull(driver, "driver");
IOFSwitchDriver existingDriver = switchBindingMap.get(manufacturerDescPrefix);
if (existingDriver != null ) {
throw new IllegalStateException("Failed to add OFSwitch driver for "
+ manufacturerDescPrefix + "already registered");
}
switchBindingMap.put(manufacturerDescPrefix, driver);
switchDescSorted.add(manufacturerDescPrefix);
}
示例5: testSwitchDriverRegistryNoDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
/**
* Test SwitchDriverRegistry
* Test fallback to default if no switch driver is registered for a
* particular prefix
*/
@Test
public void testSwitchDriverRegistryNoDriver() {
IOFSwitchDriver driver = createMock(IOFSwitchDriver.class);
IOFSwitch returnedSwitch = null;
IOFSwitchBackend mockSwitch = createMock(IOFSwitchBackend.class);
switchManager.addOFSwitchDriver("test switch", driver);
replay(driver);
replay(mockSwitch);
SwitchDescription desc = new SwitchDescription("test switch", "version 0.9", "", "", "");
reset(driver);
reset(mockSwitch);
mockSwitch.setSwitchProperties(desc);
expectLastCall().once();
expect(driver.getOFSwitchImpl(desc, factory)).andReturn(mockSwitch).once();
replay(driver);
replay(mockSwitch);
returnedSwitch = switchManager.getOFSwitchInstance(new NullConnection(), desc, factory, DatapathId.of(1));
assertSame(mockSwitch, returnedSwitch);
verify(driver);
verify(mockSwitch);
desc = new SwitchDescription("Foo Bar test switch", "version 0.9", "", "", "");
reset(driver);
reset(mockSwitch);
replay(driver);
replay(mockSwitch);
returnedSwitch = switchManager.getOFSwitchInstance(new NullConnection(), desc,
OFFactories.getFactory(OFVersion.OF_10), DatapathId.of(1));
assertNotNull(returnedSwitch);
assertTrue("Returned switch should be OFSwitch",
returnedSwitch instanceof OFSwitch);
assertEquals(desc, returnedSwitch.getSwitchDescription());
verify(driver);
verify(mockSwitch);
}
示例6: init
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
/**
* Initialize internal data structures
*/
public void init(Map<String, String> configParams) {
// These data structures are initialized here because other
// module's startUp() might be called before ours
this.messageListeners =
new ConcurrentHashMap<OFType,
ListenerDispatcher<OFType,
IOFMessageListener>>();
this.switchListeners = new CopyOnWriteArraySet<IOFSwitchListener>();
this.haListeners = new CopyOnWriteArraySet<IHAListener>();
this.switchBindingMap =
new ConcurrentHashMap<String, IOFSwitchDriver>();
this.switchDescSortedList = new ArrayList<String>();
this.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();
this.connectedSwitches = new HashSet<IOFSwitch>();
this.controllerNodeIPsCache = new HashMap<String, String>();
this.updates = new LinkedBlockingQueue<IUpdate>();
this.factory = new BasicFactory();
this.providerMap = new HashMap<String, List<IInfoProvider>>();
setConfigParams(configParams);
this.role = getInitialRole(configParams);
this.notifiedRole = this.role;
this.roleChanger = new RoleChanger(this);
initVendorMessages();
String option = configParams.get("flushSwitchesOnReconnect");
if (option != null && option.equalsIgnoreCase("true")) {
this.setAlwaysClearFlowsOnSwAdd(true);
log.info("Flush switches on reconnect -- Enabled.");
} else {
this.setAlwaysClearFlowsOnSwAdd(false);
log.info("Flush switches on reconnect -- Disabled");
}
}
示例7: addOFSwitchDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
@Override
public void addOFSwitchDriver(String manufacturerDescriptionPrefix,
IOFSwitchDriver driver) {
// do nothing
}
示例8: NaiveSwitchDriverRegistry
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
public NaiveSwitchDriverRegistry(@Nonnull IOFSwitchManager switchManager) {
Preconditions.checkNotNull(switchManager, "switchManager must not be null");
this.switchManager = switchManager;
switchBindingMap = new HashMap<String, IOFSwitchDriver>();
switchDescSorted = new TreeSet<String>(Collections.reverseOrder());
}
示例9: addOFSwitchDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
@Override
public void addOFSwitchDriver(String manufacturerDescriptionPrefix,
IOFSwitchDriver driver) {
this.driverRegistry.addSwitchDriver(manufacturerDescriptionPrefix, driver);
}
示例10: addOFSwitchDriver
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
@Override
public void addOFSwitchDriver(String manufacturerDescriptionPrefix,
IOFSwitchDriver driver) {
driverRegistry.addSwitchDriver(manufacturerDescriptionPrefix, driver);
}
示例11: NaiiveSwitchDriverRegistry
import net.floodlightcontroller.core.IOFSwitchDriver; //导入依赖的package包/类
public NaiiveSwitchDriverRegistry() {
switchBindingMap = new HashMap<String, IOFSwitchDriver>();
switchDescSorted = new TreeSet<String>(Collections.reverseOrder());
}