当前位置: 首页>>代码示例>>Java>>正文


Java IOFSwitch.getEnabledPortNumbers方法代码示例

本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitch.getEnabledPortNumbers方法的典型用法代码示例。如果您正苦于以下问题:Java IOFSwitch.getEnabledPortNumbers方法的具体用法?Java IOFSwitch.getEnabledPortNumbers怎么用?Java IOFSwitch.getEnabledPortNumbers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.floodlightcontroller.core.IOFSwitch的用法示例。


在下文中一共展示了IOFSwitch.getEnabledPortNumbers方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchActivated

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void switchActivated(final DatapathId switchId) {
    final IOFSwitch sw = switchService.getSwitch(switchId);

    Message message = buildSwitchMessage(sw, SwitchState.ACTIVATED);
    kafkaProducer.postMessage(TOPO_EVENT_TOPIC, message);

    ImmutablePair<Long, Boolean> metersDeleted;
    metersDeleted = switchManager.deleteMeter(switchId, ALL_VAL);
    if (!metersDeleted.getRight()) {
        logger.error("Could not delete meters from switch={} xid={}", switchId, metersDeleted.getLeft());
    }

    boolean defaultRulesInstalled = switchManager.installDefaultRules(switchId);
    if (!defaultRulesInstalled) {
        logger.error("Could not install default rules on switch={}", switchId);
    }

    if (sw.getEnabledPortNumbers() != null) {
        for (OFPort p : sw.getEnabledPortNumbers()) {
            kafkaProducer.postMessage(TOPO_EVENT_TOPIC, buildPortMessage(sw.getId(), p, PortChangeType.UP));
        }
    }
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:28,代码来源:SwitchEventCollector.java

示例2: discoverOnAllPorts

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * Send LLDPs to all switch-ports
 */
protected void discoverOnAllPorts() {
	log.info("Sending LLDP packets out of all the enabled ports");
	// Send standard LLDPs
	for (DatapathId sw : switchService.getAllSwitchDpids()) {
		IOFSwitch iofSwitch = switchService.getSwitch(sw);
		if (iofSwitch == null) continue;
		if (!iofSwitch.isActive()) continue; /* can't do anything if the switch is SLAVE */
		Collection<OFPort> c = iofSwitch.getEnabledPortNumbers();
		if (c != null) {
			for (OFPort ofp : c) {
				if (isLinkDiscoverySuppressed(sw, ofp)) {			
					continue;
				}
				log.trace("Enabled port: {}", ofp);
				sendDiscoveryMessage(sw, ofp, true, false);

				// If the switch port is not already in the maintenance
				// queue, add it.
				NodePortTuple npt = new NodePortTuple(sw, ofp);
				addToMaintenanceQueue(npt);
			}
		}
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:28,代码来源:LinkDiscoveryManager.java

示例3: getPorts

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 *  Switch methods
 */
@Override
public Set<OFPort> getPorts(DatapathId sw) {
	IOFSwitch iofSwitch = switchService.getSwitch(sw);
	if (iofSwitch == null) return Collections.emptySet();

	Collection<OFPort> ofpList = iofSwitch.getEnabledPortNumbers();
	if (ofpList == null) return Collections.emptySet();

	Set<OFPort> ports = new HashSet<OFPort>(ofpList);
	Set<OFPort> qPorts = linkDiscoveryService.getQuarantinedPorts(sw);
	if (qPorts != null)
		ports.removeAll(qPorts);

	return ports;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:19,代码来源:TopologyManager.java

示例4: switchActivated

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
@Override
public void switchActivated(DatapathId switchId) {
	IOFSwitch sw = switchService.getSwitch(switchId);
	if (sw == null)       //fix dereference violation in case race conditions
		return;
	if (sw.getEnabledPortNumbers() != null) {
		for (OFPort p : sw.getEnabledPortNumbers()) {
			processNewPort(sw.getId(), p);
		}
	}
	LDUpdate update = new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH, UpdateOperation.SWITCH_UPDATED);
	updates.add(update);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:14,代码来源:LinkDiscoveryManager.java

示例5: switchActivated

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
@Override
public void switchActivated(DatapathId switchId) {
	IOFSwitch sw = switchService.getSwitch(switchId);
	if (sw.getEnabledPortNumbers() != null) {
		for (OFPort p : sw.getEnabledPortNumbers()) {
			processNewPort(sw.getId(), p);
		}
	}
	LDUpdate update = new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH, UpdateOperation.SWITCH_UPDATED);
	updates.add(update);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:12,代码来源:LinkDiscoveryManager.java

示例6: doFloodBDDP

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * The BDDP packets are forwarded out of all the ports out of an
 * openflowdomain.  Get all the switches in the same openflow
 * domain as the sw (disabling tunnels).  Then get all the
 * external switch ports and send these packets out.
 * @param sw
 * @param pi
 * @param cntx
 */
protected void doFloodBDDP(DatapathId pinSwitch, OFPacketIn pi,
		FloodlightContext cntx) {

	TopologyInstance ti = getCurrentInstance(false);

	Set<DatapathId> switches = ti.getSwitchesInOpenflowDomain(pinSwitch);

	if (switches == null)
	{
		// indicates no links are connected to the switches
		switches = new HashSet<DatapathId>();
		switches.add(pinSwitch);
	}

	for (DatapathId sid : switches) {
		IOFSwitch sw = switchService.getSwitch(sid);
		if (sw == null) continue;
		Collection<OFPort> enabledPorts = sw.getEnabledPortNumbers();
		if (enabledPorts == null)
			continue;
		Set<OFPort> ports = new HashSet<OFPort>();
		ports.addAll(enabledPorts);

		// all the ports known to topology // without tunnels.
		// out of these, we need to choose only those that are
		// broadcast port, otherwise, we should eliminate.
		Set<OFPort> portsKnownToTopo = ti.getPortsWithLinks(sid);

		if (portsKnownToTopo != null) {
			for (OFPort p : portsKnownToTopo) {
				NodePortTuple npt =
						new NodePortTuple(sid, p);
				if (ti.isBroadcastDomainPort(npt) == false) {
					ports.remove(p);
				}
			}
		}

		Set<OFPort> portsToEliminate = getPortsToEliminateForBDDP(sid);
		if (portsToEliminate != null) {
			ports.removeAll(portsToEliminate);
		}

		// remove the incoming switch port
		if (pinSwitch == sid) {
			ports.remove((pi.getVersion().compareTo(OFVersion.OF_12) < 0 ? pi.getInPort() : pi.getMatch().get(MatchField.IN_PORT)));
		}

		// we have all the switch ports to which we need to broadcast.
		doMultiActionPacketOut(pi.getData(), sw, ports, cntx);
	}

}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:63,代码来源:TopologyManager.java

示例7: doFloodBDDP

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * The BDDP packets are forwarded out of all the ports out of an
 * openflowdomain.  Get all the switches in the same openflow
 * domain as the sw (disabling tunnels).  Then get all the
 * external switch ports and send these packets out.
 * @param sw
 * @param pi
 * @param cntx
 */
protected void doFloodBDDP(DatapathId pinSwitch, OFPacketIn pi,
		FloodlightContext cntx) {

	TopologyInstance ti = getCurrentInstance(false);

	Set<DatapathId> switches = ti.getSwitchesInOpenflowDomain(pinSwitch);

	if (switches == null)
	{
		// indicates no links are connected to the switches
		switches = new HashSet<DatapathId>();
		switches.add(pinSwitch);
	}

	for(DatapathId sid: switches) {
		IOFSwitch sw = switchService.getSwitch(sid);
		if (sw == null) continue;
		Collection<OFPort> enabledPorts = sw.getEnabledPortNumbers();
		if (enabledPorts == null)
			continue;
		Set<OFPort> ports = new HashSet<OFPort>();
		ports.addAll(enabledPorts);

		// all the ports known to topology // without tunnels.
		// out of these, we need to choose only those that are
		// broadcast port, otherwise, we should eliminate.
		Set<OFPort> portsKnownToTopo = ti.getPortsWithLinks(sid);

		if (portsKnownToTopo != null) {
			for(OFPort p: portsKnownToTopo) {
				NodePortTuple npt =
						new NodePortTuple(sid, p);
				if (ti.isBroadcastDomainPort(npt) == false) {
					ports.remove(p);
				}
			}
		}

		Set<OFPort> portsToEliminate = getPortsToEliminateForBDDP(sid);
		if (portsToEliminate != null) {
			ports.removeAll(portsToEliminate);
		}

		// remove the incoming switch port
		if (pinSwitch == sid) {
			ports.remove((pi.getVersion().compareTo(OFVersion.OF_12) < 0 ? pi.getInPort() : pi.getMatch().get(MatchField.IN_PORT)));
		}

		// we have all the switch ports to which we need to broadcast.
		doMultiActionPacketOut(pi.getData(), sw, ports, cntx);
	}

}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:63,代码来源:TopologyManager.java


注:本文中的net.floodlightcontroller.core.IOFSwitch.getEnabledPortNumbers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。