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


Java Bandwidth.getValue方法代码示例

本文整理汇总了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;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:21,代码来源:Topology.java

示例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());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:37,代码来源:SwitchManagerImpl.java

示例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;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:35,代码来源:InventoryServiceHelper.java

示例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;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:44,代码来源:DijkstraImplementation.java

示例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());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:73,代码来源:TopologyManagerImplTest.java


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