本文整理匯總了Java中org.opendaylight.controller.sal.core.Bandwidth.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Bandwidth.getValue方法的具體用法?Java Bandwidth.getValue怎麽用?Java Bandwidth.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.opendaylight.controller.sal.core.Bandwidth
的用法示例。
在下文中一共展示了Bandwidth.getValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bandwidthColor
import org.opendaylight.controller.sal.core.Bandwidth; //導入方法依賴的package包/類
private String bandwidthColor(Bandwidth bandwidth) {
String color = null;
long bandwidthValue = bandwidth.getValue();
if (bandwidthValue == 0) {
color = "#000";
} else if (bandwidthValue < Bandwidth.BW1Kbps) {
color = "#148AC6";
} else if (bandwidthValue < Bandwidth.BW1Mbps) {
color = "#2858A0";
} else if (bandwidthValue < Bandwidth.BW1Gbps) {
color = "#009393";
} else if (bandwidthValue < Bandwidth.BW1Tbps) {
color = "#C6C014";
} else if (bandwidthValue < Bandwidth.BW1Pbps) {
color = "#F9F464";
}
return color;
}
示例2: _pncs
import org.opendaylight.controller.sal.core.Bandwidth; //導入方法依賴的package包/類
public void _pncs(CommandInterpreter ci) {
String st = ci.nextArgument();
if (st == null) {
ci.println("Please enter node id");
return;
}
Node node = Node.fromString(st);
if (node == null) {
ci.println("Please enter node id");
return;
}
ci.println(" NodeConnector BandWidth(Gbps) Admin State");
Set<NodeConnector> nodeConnectorSet = getNodeConnectors(node);
if (nodeConnectorSet == null) {
return;
}
for (NodeConnector nodeConnector : nodeConnectorSet) {
if (nodeConnector == null) {
continue;
}
Map<String, Property> propMap = getNodeConnectorProps(nodeConnector);
Bandwidth bw = (Bandwidth) propMap.get(Bandwidth.BandwidthPropName);
Config config = (Config) propMap.get(Config.ConfigPropName);
State state = (State) propMap.get(State.StatePropName);
String out = nodeConnector + " ";
out += (bw != null) ? bw.getValue() / Math.pow(10, 9) : " ";
out += " ";
out += (config != null) ? config.getValue() : " ";
out += " ";
out += (state != null) ? state.getValue() : " ";
ci.println(out);
}
ci.println("Total number of NodeConnectors: " + nodeConnectorSet.size());
}
示例3: OFPortToProps
import org.opendaylight.controller.sal.core.Bandwidth; //導入方法依賴的package包/類
public static Set<Property> OFPortToProps(OFPhysicalPort port) {
Set<Property> props = new HashSet<Property>();
Bandwidth bw = InventoryServiceHelper.OFPortToBandWidth(port
.getCurrentFeatures());
if (bw != null) {
props.add(bw);
}
Bandwidth abw = InventoryServiceHelper.OFPortToBandWidth(port.getAdvertisedFeatures());
if (abw != null) {
AdvertisedBandwidth a = new AdvertisedBandwidth(abw.getValue());
if (a != null) {
props.add(a);
}
}
Bandwidth sbw = InventoryServiceHelper.OFPortToBandWidth(port.getSupportedFeatures());
if (sbw != null) {
SupportedBandwidth s = new SupportedBandwidth(sbw.getValue());
if (s != null) {
props.add(s);
}
}
Bandwidth pbw = InventoryServiceHelper.OFPortToBandWidth(port.getPeerFeatures());
if (pbw != null) {
PeerBandwidth p = new PeerBandwidth(pbw.getValue());
if (p != null) {
props.add(p);
}
}
props.add(new Name(port.getName()));
props.add(InventoryServiceHelper.OFPortToConfig(port.getConfig()));
props.add(InventoryServiceHelper.OFPortToState(port.getState()));
return props;
}
示例4: edgeUpdate
import org.opendaylight.controller.sal.core.Bandwidth; //導入方法依賴的package包/類
private boolean edgeUpdate(Edge e, UpdateType type, Set<Property> props) {
String srcType = null;
String dstType = null;
if (e == null || type == null) {
log.error("Edge or Update type are null!");
return false;
} else {
srcType = e.getTailNodeConnector().getType();
dstType = e.getHeadNodeConnector().getType();
if (srcType.equals(NodeConnector.NodeConnectorIDType.PRODUCTION)) {
log.debug("Skip updates for {}", e);
return false;
}
if (dstType.equals(NodeConnector.NodeConnectorIDType.PRODUCTION)) {
log.debug("Skip updates for {}", e);
return false;
}
}
Bandwidth bw = new Bandwidth(0);
boolean newEdge = false;
if (props != null)
props.remove(bw);
if (log.isDebugEnabled()) {
log.debug("edgeUpdate: {} bw: {}", e, bw.getValue());
}
Short baseBW = Short.valueOf((short) 0);
boolean add = (type == UpdateType.ADDED) ? true : false;
// Update base topo
newEdge = !updateTopo(e, baseBW, add);
if (newEdge == true) {
if (bw.getValue() != baseBW) {
// Update BW topo
updateTopo(e, (short) bw.getValue(), add);
}
}
return newEdge;
}
示例5: testGetEdges
import org.opendaylight.controller.sal.core.Bandwidth; //導入方法依賴的package包/類
@Test
public void testGetEdges() throws ConstructionException {
TopologyManagerImpl topoManagerImpl = new TopologyManagerImpl();
setNodeEdges(topoManagerImpl);
Map<Edge, Set<Property>> edgeProperty = topoManagerImpl.getEdges();
for (Iterator<Map.Entry<Edge, Set<Property>>> i = edgeProperty
.entrySet().iterator(); i.hasNext();) {
Map.Entry<Edge, Set<Property>> entry = i.next();
Edge e = entry.getKey();
NodeConnector headnc = e.getHeadNodeConnector();
NodeConnector tailnc = e.getTailNodeConnector();
Long headNodeId = (Long) headnc.getNode().getID();
Long headNcId = ((Short) headnc.getID()).longValue();
Long tailNcId = ((Short) tailnc.getID()).longValue();
if (headNodeId == 1 || headNodeId == 3 || headNodeId == 5) {
Assert.assertTrue((headNcId.equals(headNodeId) && tailNcId
.equals(headNodeId + 10))
|| (headNcId.equals(headNodeId + 10) && tailNcId
.equals(headNodeId))
|| (headNcId.equals(headNodeId + 1) && tailNcId
.equals(headNodeId + 11))
|| (headNcId.equals(headNodeId + 11) && tailNcId
.equals(headNodeId + 1)));
} else if (headNodeId == 11 || headNodeId == 13 || headNodeId == 15) {
Assert.assertTrue((headNcId.equals(headNodeId) && tailNcId
.equals(headNodeId - 10))
|| (headNcId.equals(headNodeId) && tailNcId
.equals(headNodeId - 10))
|| (headNcId.equals(headNodeId - 9) && tailNcId
.equals(headNodeId + 1))
|| (headNcId.equals(headNodeId + 1) && tailNcId
.equals(headNodeId - 9)));
}
Set<Property> prop = entry.getValue();
for (Property p : prop) {
String pName;
long pValue;
if (p instanceof Bandwidth) {
Bandwidth b = (Bandwidth) p;
pName = Bandwidth.BandwidthPropName;
pValue = b.getValue();
Assert.assertTrue(pName.equals(p.getName())
&& pValue == Bandwidth.BW100Gbps);
continue;
}
if (p instanceof Latency) {
Latency l = (Latency) p;
pName = Latency.LatencyPropName;
pValue = l.getValue();
Assert.assertTrue(pName.equals(p.getName())
&& pValue == Latency.LATENCY100ns);
continue;
}
if (p instanceof State) {
State state = (State) p;
pName = State.StatePropName;
pValue = state.getValue();
Assert.assertTrue(pName.equals(p.getName())
&& pValue == State.EDGE_UP);
continue;
}
}
i.remove();
}
Assert.assertTrue(edgeProperty.isEmpty());
}