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


Java NodeConnector类代码示例

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


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


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