本文整理汇总了Java中org.opendaylight.controller.sal.core.NodeConnector.getID方法的典型用法代码示例。如果您正苦于以下问题:Java NodeConnector.getID方法的具体用法?Java NodeConnector.getID怎么用?Java NodeConnector.getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.sal.core.NodeConnector
的用法示例。
在下文中一共展示了NodeConnector.getID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readNodeConnector
import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public NodeConnectorStatistics readNodeConnector(String containerName, NodeConnector connector, boolean cached) {
if (!containerOwnsNodeConnector(containerName, connector)) {
return null;
}
Node node = connector.getNode();
long sid = (Long) node.getID();
short portId = (Short) connector.getID();
List<OFStatistics> ofList = (cached == true) ? statsMgr
.getOFPortStatistics(sid, portId) : statsMgr.queryStatistics(
sid, OFStatisticsType.PORT, portId);
List<NodeConnectorStatistics> ncStatistics = new PortStatisticsConverter(sid, ofList)
.getNodeConnectorStatsList();
return (ncStatistics.isEmpty()) ? new NodeConnectorStatistics() : ncStatistics.get(0);
}
示例2: toOFPort
import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
private static short toOFPort(NodeConnector salPort) {
if (salPort.getType().equals(NodeConnectorIDType.SWSTACK)) {
return OFPort.OFPP_LOCAL.getValue();
} else if (salPort.getType().equals(NodeConnectorIDType.HWPATH)) {
return OFPort.OFPP_NORMAL.getValue();
} else if (salPort.getType().equals(NodeConnectorIDType.CONTROLLER)) {
return OFPort.OFPP_CONTROLLER.getValue();
}
return (Short) salPort.getID();
}
示例3: getTransmitRate
import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public long getTransmitRate(String containerName, NodeConnector connector) {
if (!containerOwnsNodeConnector(containerName, connector)) {
return 0;
}
long switchId = (Long) connector.getNode().getID();
short port = (Short) connector.getID();
return statsMgr.getTransmitRate(switchId, port);
}
示例4: toOFPort
import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
* Converts the NodeConnector to the equivalent Openflow port number
*/
public static short toOFPort(NodeConnector salPort) {
log.trace("SAL Port", salPort);
if (salPort.getType().equals(NodeConnectorIDType.SWSTACK)) {
return OFPort.OFPP_LOCAL.getValue();
} else if (salPort.getType().equals(NodeConnectorIDType.HWPATH)) {
return OFPort.OFPP_NORMAL.getValue();
} else if (salPort.getType().equals(NodeConnectorIDType.CONTROLLER)) {
return OFPort.OFPP_CONTROLLER.getValue();
}
return (Short) salPort.getID();
}
示例5: transmitDataPacket
import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public void transmitDataPacket(RawPacket outPkt) {
// Sanity check area
if (outPkt == null) {
logger.debug("outPkt is null!");
return;
}
NodeConnector outPort = outPkt.getOutgoingNodeConnector();
if (outPort == null) {
logger.debug("outPort is null! outPkt: {}", outPkt);
return;
}
if (!connectionOutService.isLocal(outPort.getNode())) {
logger.debug("data packets will not be sent to {} in a non-master controller", outPort.toString());
return;
}
if (!outPort.getType().equals(
NodeConnector.NodeConnectorIDType.OPENFLOW)) {
// The output Port is not of type OpenFlow
logger.debug("outPort is not OF Type! outPort: {}", outPort);
return;
}
Short port = (Short) outPort.getID();
Long swID = (Long) outPort.getNode().getID();
ISwitch sw = this.swID2ISwitch.get(swID);
if (sw == null) {
// If we cannot get the controller descriptor we cannot even
// send out the frame
logger.debug("swID: {} - sw is null!", swID);
return;
}
byte[] data = outPkt.getPacketData();
// build action
OFActionOutput action = new OFActionOutput().setPort(port);
// build packet out
OFPacketOut po = new OFPacketOut()
.setBufferId(OFPacketOut.BUFFER_ID_NONE)
.setInPort(OFPort.OFPP_NONE)
.setActions(Collections.singletonList((OFAction) action))
.setActionsLength((short) OFActionOutput.MINIMUM_LENGTH);
po.setLengthU(OFPacketOut.MINIMUM_LENGTH + po.getActionsLength()
+ data.length);
po.setPacketData(data);
// send PACKET_OUT at high priority
sw.asyncFastSend(po);
logger.trace("Transmitted a frame of size: {}", data.length);
}
示例6: pollTxBitRates
import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
* Continuously polls the transmit bit rate for all the node connectors from
* statistics manager and trigger the warning notification upward when the
* transmit rate is above a threshold which is a percentage of the edge
* bandwidth
*/
protected void pollTxBitRates() {
Map<NodeConnector, Pair<Edge, Set<Property>>> globalContainerEdges = edgeMap
.get(GlobalConstants.DEFAULT.toString());
if (globalContainerEdges == null) {
return;
}
for (NodeConnector connector : globalContainerEdges.keySet()) {
// Skip if node connector belongs to production switch
if (connector.getType().equals(
NodeConnector.NodeConnectorIDType.PRODUCTION)) {
continue;
}
// Get edge for which this node connector is head
Pair<Edge, Set<Property>> props = this.edgeMap.get(
GlobalConstants.DEFAULT.toString()).get(connector);
// On switch mgr restart the props get reset
if (props == null) {
continue;
}
Set<Property> propSet = props.getRight();
if (propSet == null) {
continue;
}
float bw = 0;
for (Property prop : propSet) {
if (prop instanceof Bandwidth) {
bw = ((Bandwidth) prop).getValue();
break;
}
}
// Skip if agent did not provide a bandwidth info for the edge
if (bw == 0) {
continue;
}
// Compare bandwidth usage
Long switchId = (Long) connector.getNode().getID();
Short port = (Short) connector.getID();
float rate = statsMgr.getTransmitRate(switchId, port);
if (rate > bwThresholdFactor * bw) {
if (!connectorsOverUtilized.contains(connector)) {
connectorsOverUtilized.add(connector);
this.bwUtilNotifyQ.add(new UtilizationUpdate(connector,
UpdateType.ADDED));
}
} else {
if (connectorsOverUtilized.contains(connector)) {
connectorsOverUtilized.remove(connector);
this.bwUtilNotifyQ.add(new UtilizationUpdate(connector,
UpdateType.REMOVED));
}
}
}
}