• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NodeConnector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opendaylight.controller.sal.core.NodeConnector的典型用法代码示例。如果您正苦于以下问题:Java NodeConnector类的具体用法?Java NodeConnector怎么用?Java NodeConnector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NodeConnector类属于org.opendaylight.controller.sal.core包,在下文中一共展示了NodeConnector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: floodPacket

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
/**
 *The function is a modification of an another function. The original
 *is property of SDNHUB.org and it's used under a GPLv3 License. All the credits for SDNHUB.org
 *The original code can be find in
 *https://github.com/sdnhub/SDNHub_Opendaylight_Tutorial/blob/master/adsal_L2_forwarding/src/main/java/org/opendaylight/tutorial/tutorial_L2_forwarding/internal/TutorialL2Forwarding.java
 * Función utilizada para inundar en caso de no tener la dirección destino
 * @param inPkt: paquete entrante al nodo
 */
private void floodPacket(RawPacket inPkt) {
	log.info("flooding packet");
    NodeConnector incoming_connector = inPkt.getIncomingNodeConnector();
    Node incoming_node = incoming_connector.getNode();
    Set<NodeConnector> nodeConnectors = this.switchManager.getUpNodeConnectors(incoming_node);
    for (NodeConnector p : nodeConnectors) {
        if (!p.equals(incoming_connector)) {
            try {
                RawPacket destPkt = new RawPacket(inPkt);
                destPkt.setOutgoingNodeConnector(p);
                this.dataPacketService.transmitDataPacket(destPkt);
                //log.info("Datos de paquete transmitido dentro de floodpacket: "+this.dataPacketService.decodeDataPacket(destPkt).toString());
            } catch (ConstructionException e2) {
                continue;
            }
        }
    }
}
 
开发者ID:pahharo,项目名称:dissectorapp,代码行数:27,代码来源:DissectorHandler.java


示例2: edgeUpdate

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
private boolean edgeUpdate(Edge e, UpdateType type, Set<Property> props,
        boolean local) {
    if ((e == null) || (type == null)) {
        System.out.print("Edge or Update type are null!");
        return false;
    }

    String srcType = e.getTailNodeConnector().getType();
    String dstType = e.getHeadNodeConnector().getType();

    if (srcType.equals(NodeConnector.NodeConnectorIDType.PRODUCTION) 
        || dstType.equals(NodeConnector.NodeConnectorIDType.PRODUCTION)) {
        log.debug("Skip updates for {}", e);
        return false;
    }

    return !updateTopo(e, type);
}
 
开发者ID:imcmy,项目名称:ODLJumpIP,代码行数:19,代码来源:JumpIP.java


示例3: addEdge

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
private void addEdge(Edge edge, Set<Property> props) {
    if (edge == null) {
        return;
    }

    NodeConnector src = edge.getTailNodeConnector();
    NodeConnector dst = edge.getHeadNodeConnector();
    if (!src.getType().equals(NodeConnector.NodeConnectorIDType.PRODUCTION)) {
        holdTime.put(dst, 0);
    } else {
        agingMap.put(dst, 0);
    }
    elapsedTime.remove(src);

    // notify
    updateEdge(edge, UpdateType.ADDED, props);
    logger.trace("Add edge {}", edge);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:DiscoveryService.java


示例4: createOFNodeConnectorSet

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
public static Set<NodeConnector> createOFNodeConnectorSet(
        Set<Short> portIds, Node n) {
    try {
        Set<NodeConnector> nodeConnectors = new HashSet<NodeConnector>();
        for (Short ofPortID : portIds) {
            NodeConnector p = new NodeConnector(
                    NodeConnector.NodeConnectorIDType.OPENFLOW, Short
                            .valueOf(ofPortID), n);
            nodeConnectors.add(p);
        }
        return nodeConnectors;
    } catch (ConstructionException e1) {
        logger.error("",e1);
        return null;
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:NodeConnectorCreator.java


示例5: getPropMap

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
public Map<String, Property> getPropMap(NodeConnector nodeConnector) {
    if (nodeConnector == null) {
        return null;
    }

    if (inventoryProvider == null) {
        return null;
    }

    Map<NodeConnector, Map<String, Property>> props = inventoryProvider.getNodeConnectorProps(false);
    if (props == null) {
        return null;
    }

    return props.get(nodeConnector);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:DiscoveryService.java


示例6: getEdgeContainers

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
private List<String> getEdgeContainers(Edge edge) {
    NodeConnector src = edge.getTailNodeConnector(), dst = edge
            .getHeadNodeConnector();

    if (!src.getType().equals(NodeConnector.NodeConnectorIDType.PRODUCTION)) {
        /* Find the common containers for both ends */
        List<String> srcContainers = this.containerMap.get(src), dstContainers = this.containerMap
                .get(dst), cmnContainers = null;
        if ((srcContainers != null) && (dstContainers != null)) {
            cmnContainers = new ArrayList<String>(srcContainers);
            cmnContainers.retainAll(dstContainers);
        }
        return cmnContainers;
    } else {
        /*
         * If the neighbor is part of a monitored production network, get
         * the containers that the edge port belongs to
         */
        return this.containerMap.get(dst);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:22,代码来源:TopologyServiceShim.java


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


示例8: testNodeConnectorPCEPOfWrongType

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Test
public void testNodeConnectorPCEPOfWrongType() {
    try {
        Node n1 = new Node(Node.NodeIDType.PCEP, new UUID(0L, 0L));
        NodeConnector pcep1 = new NodeConnector(
                NodeConnector.NodeConnectorIDType.PCEP, new Long(
                        0xDEADBEEFCAFE0001L), n1);

        // If we reach this point the exception was not raised
        // which should have been the case
        Assert.assertTrue(false);
    } catch (ConstructionException e) {
        // If we reach this point the exception has been raised
        // and so test passed
        System.out.println("Got exception as expected!:" + e);
        Assert.assertTrue(true);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:NodeConnectorTest.java


示例9: OFSwitchToProps

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
public static Map<NodeConnector, Set<Property>> OFSwitchToProps(ISwitch sw) {
    Map<NodeConnector, Set<Property>> ncProps = new HashMap<NodeConnector, Set<Property>>();

    if (sw == null) {
        return ncProps;
    }

    Node node = NodeCreator.createOFNode(sw.getId());
    if (node == null) {
        return ncProps;
    }

    Set<Property> props;
    NodeConnector nodeConnector;
    OFPhysicalPort port;
    Map<Short, OFPhysicalPort> ports = sw.getPhysicalPorts();
    for (Map.Entry<Short, OFPhysicalPort> entry : ports.entrySet()) {
        nodeConnector = PortConverter.toNodeConnector(entry.getKey(), node);
        port = entry.getValue();
        props = InventoryServiceHelper.OFPortToProps(port);
        ncProps.put(nodeConnector, props);
    }

    return ncProps;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:26,代码来源:InventoryServiceHelper.java


示例10: getSwitchByNode

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
public Switch getSwitchByNode(Node node) {
    Switch sw = new Switch(node);
    sw.setNode(node);
    MacAddress mac = (MacAddress) this.getNodeProp(node,
            MacAddress.name);
    if (mac != null) {
        sw.setDataLayerAddress(mac.getMacAddress());
    }
    Set<NodeConnector> ncSet = getPhysicalNodeConnectors(node);
    sw.setNodeConnectors(ncSet);

    List<NodeConnector> ncList = new ArrayList<NodeConnector>();
    for (NodeConnector nodeConnector : ncSet) {
        if (spanNodeConnectors.contains(nodeConnector)) {
            ncList.add(nodeConnector);
        }
    }
    sw.addSpanPorts(ncList);

    return sw;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:22,代码来源:SwitchManagerImpl.java


示例11: testNodeConnectorOpenFlowOfWrongType

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Test
public void testNodeConnectorOpenFlowOfWrongType() {
    try {
        Node n1 = new Node(Node.NodeIDType.OPENFLOW, new Long(110L));
        NodeConnector of1 = new NodeConnector(
                NodeConnector.NodeConnectorIDType.OPENFLOW, new String(
                        "0xDEADBEEFCAFE0001L"), n1);

        // If we reach this point the exception was not raised
        // which should have been the case
        Assert.assertTrue(false);
    } catch (ConstructionException e) {
        // If we reach this point the exception has been raised
        // and so test passed
        System.out.println("Got exception as expected!:" + e);
        Assert.assertTrue(true);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:NodeConnectorTest.java


示例12: testTwoONEPKNodeConnectorDifferents

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Test
public void testTwoONEPKNodeConnectorDifferents() {
    try {
        Node n1 = new Node(Node.NodeIDType.ONEPK, new String("Router1"));
        NodeConnector onepk1 = new NodeConnector(
                NodeConnector.NodeConnectorIDType.ONEPK, new String(
                        "Gi1/0/1"), n1);
        NodeConnector onepk2 = new NodeConnector(
                NodeConnector.NodeConnectorIDType.ONEPK, new String(
                        "Gi1/0/2"), n1);

        Assert.assertTrue(!onepk1.equals(onepk2));
    } catch (ConstructionException e) {
        // If we reach this point the exception was raised
        // which is not expected
        Assert.assertTrue(false);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:NodeConnectorTest.java


示例13: uninstallPerNodeRules

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
/**
 * Cleanup all the host rules for a given node, triggered when the
 * switch disconnects, so there is no reason for Hw cleanup
 * because it's disconnected anyhow
 * TBD - Revisit above stmt in light of CSCus88743
 * @param targetNode Node for which we want to do cleanup
 *
 */
private void uninstallPerNodeRules(Node targetNode) {
    //RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
    Map<NodeConnector, FlowEntry> pos;
    FlowEntry po;

    // Now program every single switch
    for (HostNodePair key : this.rulesDB.keySet()) {
        Node node = key.getNode();
        if (targetNode == null || node.equals(targetNode)) {
            log.debug("Work on {} host {}", node, key.getHost());
            pos = this.rulesDB.get(key);
            for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
                po = e.getValue();
                if (po != null) {
                    // Uninstall the policy
                    this.frm.uninstallFlowEntry(po);
                }
            }
            log.debug("Remove {}", key);
            this.rulesDB.remove(key);
        }
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:32,代码来源:SimpleForwardingImpl.java


示例14: testTwoPCEPNodeConnectorEquals

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Test
public void testTwoPCEPNodeConnectorEquals() {
    try {
        Node n1 = new Node(Node.NodeIDType.PCEP, new UUID(0L, 0L));
        NodeConnector pcep1 = new NodeConnector(
                NodeConnector.NodeConnectorIDType.PCEP, new Integer(
                        0xDEADBEEF), n1);
        NodeConnector pcep2 = new NodeConnector(
                NodeConnector.NodeConnectorIDType.PCEP, new Integer(
                        0xDEADBEEF), n1);

        Assert.assertTrue(pcep1.equals(pcep2));
    } catch (ConstructionException e) {
        // If we reach this point the exception was raised
        // which is not expected
        Assert.assertTrue(false);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:19,代码来源:NodeConnectorTest.java


示例15: isPortValid

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
public boolean isPortValid(Switch sw, Short port) {
    if (port < 1) {
        log.debug("port {} is not valid", port);
        return false;
    }

    if (sw == null) {
        log.debug("switch info is not available. Skip checking if port is part of a switch or not.");
        return true;
    }

    Set<NodeConnector> nodeConnectorSet = sw.getNodeConnectors();
    for (NodeConnector nodeConnector : nodeConnectorSet) {
        if (((Short) nodeConnector.getID()).equals(port)) {
            return true;
        }
    }
    log.debug("port {} is not a valid port of node {}", port, sw.getNode());
    return false;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:21,代码来源:FlowConfig.java


示例16: addOutputPort

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Override
public void addOutputPort(Node node, String flowName, List<NodeConnector> portList) {

    for (FlowEntryInstall flow : this.nodeFlows.get(node)) {
        if (flow.getFlowName().equals(flowName)) {
            FlowEntry currentFlowEntry = flow.getOriginal();
            FlowEntry newFlowEntry = currentFlowEntry.clone();
            for (NodeConnector dstPort : portList) {
                newFlowEntry.getFlow().addAction(new Output(dstPort));
            }
            Status error = modifyEntry(currentFlowEntry, newFlowEntry, false);
            if (error.isSuccess()) {
                log.info("Ports {} added to FlowEntry {}", portList, flowName);
            } else {
                log.warn("Failed to add ports {} to Flow entry {}. The failure is: {}", portList,
                        currentFlowEntry.toString(), error.getDescription());
            }
            return;
        }
    }
    log.warn("Failed to add ports to Flow {} on Node {}: Entry Not Found", flowName, node);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:23,代码来源:ForwardingRulesManager.java


示例17: readNodeConnector

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Override
public NodeConnectorStatistics readNodeConnector(NodeConnector connector,
        boolean cached) {
    NodeConnectorStatistics stats = new NodeConnectorStatistics();
    stats.setNodeConnector(connector);
    stats.setCollisionCount(4);
    stats.setReceiveByteCount(1000);
    stats.setReceiveCRCErrorCount(1);
    stats.setReceiveDropCount(2);
    stats.setReceiveErrorCount(3);
    stats.setReceiveFrameErrorCount(5);
    stats.setReceiveOverRunErrorCount(6);
    stats.setReceivePacketCount(250);
    stats.setTransmitByteCount(5000);
    stats.setTransmitDropCount(50);
    stats.setTransmitErrorCount(10);
    stats.setTransmitPacketCount(500);

    return stats;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:21,代码来源:ReadService.java


示例18: sendARPReply

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
public static void sendARPReply(IDataPacketService dataPacketService, NodeConnector p,
    byte[] sMAC, InetAddress sIP, byte[] tMAC, InetAddress tIP, short vlan) {
    byte[] senderIP = sIP.getAddress();
    byte[] targetIP = tIP.getAddress();
    ARP arp = createARP(ARP.REPLY, sMAC, senderIP, tMAC, targetIP);

    Ethernet ethernet = createEthernet(sMAC, tMAC, arp, vlan);

    RawPacket destPkt = dataPacketService.encodeDataPacket(ethernet);
    destPkt.setOutgoingNodeConnector(p);

    dataPacketService.transmitDataPacket(destPkt);
}
 
开发者ID:imcmy,项目名称:ODLJumpIP,代码行数:14,代码来源:SimpleARP.java


示例19: 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();
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:11,代码来源:ControllerServiceAdaptor.java


示例20: updateNodeConnector

import org.opendaylight.controller.sal.core.NodeConnector; //导入依赖的package包/类
@Override
public void updateNodeConnector(NodeConnector nodeConnector,
        UpdateType type, Set<Property> props) {
    logger.debug("updateNodeConnector: {} type {} props {}", nodeConnector, type, props);
    AbstractScheme scheme = schemes.get(activeScheme);
    if (scheme == null) return;
    switch (type) {
    case ADDED:
        scheme.addNode(nodeConnector.getNode());
        break;
    default:
            break;
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:15,代码来源:ConnectionManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultTileFactory类代码示例发布时间:2022-05-23
下一篇:
Java SecurityContextHolderAwareRequestWrapper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap