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


Java NodeConnector.getNode方法代码示例

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


在下文中一共展示了NodeConnector.getNode方法的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: edgeIgnore

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Check if this edge shouldn't appear in the visual topology
 *
 * @param edge
 * @return
 */
private boolean edgeIgnore(Edge edge) {
    NodeConnector headNodeConnector = edge.getHeadNodeConnector();
    Node headNode = headNodeConnector.getNode();
    if (nodeIgnore(headNode)) {
        return true;
    }

    NodeConnector tailNodeConnector = edge.getTailNodeConnector();
    Node tailNode = tailNodeConnector.getNode();
    if (nodeIgnore(tailNode)) {
        return true;
    }

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

示例3: getNodesWithNodeConnectorHost

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public Map<Node, Set<NodeConnector>> getNodesWithNodeConnectorHost() {
    if (this.hostsDB == null) {
        return null;
    }
    HashMap<Node, Set<NodeConnector>> res = new HashMap<Node, Set<NodeConnector>>();
    Node node;
    Set<NodeConnector> portSet;
    for (NodeConnector nc : this.hostsDB.keySet()) {
        node = nc.getNode();
        portSet = res.get(node);
        if (portSet == null) {
            // Create the HashSet if null
            portSet = new HashSet<NodeConnector>();
            res.put(node, portSet);
        }

        // Keep updating the HashSet, given this is not a
        // clustered map we can just update the set without
        // worrying to update the hashmap.
        portSet.add(nc);
    }

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

示例4: 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

示例5: removeNodeConnectorAllProps

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Removes all the properties of a node connector
 *
 * @param nodeConnector
 *            {@link org.opendaylight.controller.sal.core.NodeConnector}
 * @return success or failed reason
 */
@Override
public Status removeNodeConnectorAllProps(NodeConnector nodeConnector) {
    if (nodeConnectorNames != null) {
        Name name = ((Name) getNodeConnectorProp(nodeConnector, Name.NamePropName));
        if (name != null) {
            Node node = nodeConnector.getNode();
            Map<String, NodeConnector> mapCurr = nodeConnectorNames.get(node);
            if (mapCurr != null) {
                Map<String, NodeConnector> map = new HashMap<String, NodeConnector>();
                for (String s : mapCurr.keySet()) {
                    try {
                        map.put(s, new NodeConnector(mapCurr.get(s)));
                    } catch (ConstructionException e) {
                        e.printStackTrace();
                    }
                }
                map.remove(name.getValue());
                if (!nodeConnectorNames.replace(node, mapCurr, map)) {
                    log.warn("Cluster conflict: Unable remove Name property of nodeconnector {}, skip.",
                            nodeConnector.getID());
                }
            }

        }
    }
    nodeConnectorProps.remove(nodeConnector);

    return new Status(StatusCode.SUCCESS);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:37,代码来源:SwitchManagerImpl.java

示例6: readNodeConnector

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public NodeConnectorStatistics readNodeConnector(NodeConnector connector) {
    Node node = connector.getNode();
    if (pluginReader != null && node != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .readNodeConnector(connector, true);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:13,代码来源:ReadService.java

示例7: nonCachedReadNodeConnector

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public NodeConnectorStatistics nonCachedReadNodeConnector(
        NodeConnector connector) {
    Node node = connector.getNode();
    if (pluginReader != null && node != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .readNodeConnector(connector, false);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:14,代码来源:ReadService.java

示例8: getTransmitRate

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public long getTransmitRate(NodeConnector connector) {
    Node node = connector.getNode();
    if (pluginReader != null && node != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .getTransmitRate(connector);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return 0;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:13,代码来源:ReadService.java

示例9: pktToJSON

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Converts a packet to JSON representation.
 * 
 * @param pkt the packet to be converted
 * @return JSON representation.
 */
private JSONObject pktToJSON(RawPacket rawPkt) {
    log.trace("Received packet-in event.");
    
    JSONObject json = new JSONObject();
    
    // Add incoming node
    
    // The connector, the packet came from ("port")
    NodeConnector ingressConnector = rawPkt.getIncomingNodeConnector();
    // The node that received the packet ("switch")
    Node node = ingressConnector.getNode();

    JSONObject nodeJson = new JSONObject();
    nodeJson.put(NodeAttributes.Keys.ID.toJSON(), node.getNodeIDString());
    nodeJson.put(NodeAttributes.Keys.TYPE.toJSON(), node.getType());
    json.put(PacketInAttributes.Keys.NODE.toJSON(), nodeJson);
    
    // Add inport
    
    json.put(PacketInAttributes.Keys.INGRESS_PORT.toJSON(), ingressConnector.getNodeConnectorIDString());
    
    // Add raw packet data
    
    // Use DataPacketService to decode the packet.
    Packet pkt = dataPacketService.decodeDataPacket(rawPkt);

    while (pkt != null) {
        if (pkt instanceof Ethernet) {
            Ethernet ethernet = (Ethernet) pkt;
            ethernetToJSON(ethernet, json);
        } else if(pkt instanceof IEEE8021Q) {
            IEEE8021Q ieee802q = (IEEE8021Q) pkt;
            ieee8021qToJSON(ieee802q, json);
        } else if (pkt instanceof IPv4) {
            IPv4 ipv4 = (IPv4) pkt;
            ipv4ToJSON(ipv4, json);
        } else if (pkt instanceof TCP) {
            TCP tcp = (TCP) pkt;
            tcpToJSON(tcp, json);
        } else if (pkt instanceof UDP) {
            UDP udp = (UDP) pkt;
            udpToJSON(udp, json);
        }
        
        pkt = pkt.getPayload();
    }
    
    json.put(PacketInAttributes.Keys.PACKET.toJSON(), DatatypeConverter.printBase64Binary(rawPkt.getPacketData()));
    
    return json;
}
 
开发者ID:duerrfk,项目名称:sdn-mq,代码行数:58,代码来源:PacketHandler.java

示例10: getNodeConnectorDescription

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
private String getNodeConnectorDescription(NodeConnector nodeConnector, ISwitchManager switchManager) {
    Node node = nodeConnector.getNode();
    String name = this.getDescription(getNodeDesc(node, switchManager), node);
    return name;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:6,代码来源:Topology.java

示例11: addNodeConnectorProp

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Adds a node connector and its property if any
 *
 * @param nodeConnector
 *            {@link org.opendaylight.controller.sal.core.NodeConnector}
 * @param propName
 *            name of {@link org.opendaylight.controller.sal.core.Property}
 * @return success or failed reason
 */
@Override
public Status addNodeConnectorProp(NodeConnector nodeConnector,
        Property prop) {
    Map<String, Property> propMapCurr = getNodeConnectorProps(nodeConnector);
    Map<String, Property> propMap = (propMapCurr == null) ? new HashMap<String, Property>()
            : new HashMap<String, Property>(propMapCurr);

    String msg = "Cluster conflict: Unable to add NodeConnector Property.";
    // Just add the nodeConnector if prop is not available (in a non-default
    // container)
    if (prop == null) {
        if (propMapCurr == null) {
            if (nodeConnectorProps.putIfAbsent(nodeConnector, propMap) != null) {
                return new Status(StatusCode.CONFLICT, msg);
            }
        } else {
            if (!nodeConnectorProps.replace(nodeConnector, propMapCurr, propMap)) {
                return new Status(StatusCode.CONFLICT, msg);
            }
        }
        return new Status(StatusCode.SUCCESS);
    }

    propMap.put(prop.getName(), prop);
    if (propMapCurr == null) {
        if (nodeConnectorProps.putIfAbsent(nodeConnector, propMap) != null) {
            return new Status(StatusCode.CONFLICT, msg);
        }
    } else {
        if (!nodeConnectorProps.replace(nodeConnector, propMapCurr, propMap)) {
            return new Status(StatusCode.CONFLICT, msg);
        }
    }

    if (prop.getName().equals(Name.NamePropName)) {
        if (nodeConnectorNames != null) {
            Node node = nodeConnector.getNode();
            Map<String, NodeConnector> mapCurr = nodeConnectorNames.get(node);
            Map<String, NodeConnector> map = new HashMap<String, NodeConnector>();
            if (mapCurr != null) {
                for (String s : mapCurr.keySet()) {
                    try {
                        map.put(s, new NodeConnector(mapCurr.get(s)));
                    } catch (ConstructionException e) {
                        e.printStackTrace();
                    }
                }
            }

            map.put(((Name) prop).getValue(), nodeConnector);
            if (mapCurr == null) {
                if (nodeConnectorNames.putIfAbsent(node, map) != null) {
                    // TODO: recovery using Transactionality
                    return new Status(StatusCode.CONFLICT, msg);
                }
            } else {
                if (!nodeConnectorNames.replace(node, mapCurr, map)) {
                    // TODO: recovery using Transactionality
                    return new Status(StatusCode.CONFLICT, msg);
                }
            }
        }
    }

    return new Status(StatusCode.SUCCESS);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:76,代码来源:SwitchManagerImpl.java

示例12: removeNodeConnectorProp

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
/**
 * Removes one property of a node connector
 *
 * @param nodeConnector
 *            {@link org.opendaylight.controller.sal.core.NodeConnector}
 * @param propName
 *            name of {@link org.opendaylight.controller.sal.core.Property}
 * @return success or failed reason
 */
@Override
public Status removeNodeConnectorProp(NodeConnector nodeConnector, String propName) {
    Map<String, Property> propMapCurr = getNodeConnectorProps(nodeConnector);

    if (propMapCurr == null) {
        /* Nothing to remove */
        return new Status(StatusCode.SUCCESS);
    }

    Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
    propMap.remove(propName);
    boolean result = nodeConnectorProps.replace(nodeConnector, propMapCurr, propMap);
    String msg = "Cluster conflict: Unable to remove NodeConnector property.";
    if (!result) {
        return new Status(StatusCode.CONFLICT, msg);
    }

    if (propName.equals(Name.NamePropName)) {
        if (nodeConnectorNames != null) {
            Name name = ((Name) getNodeConnectorProp(nodeConnector, Name.NamePropName));
            if (name != null) {
                Node node = nodeConnector.getNode();
                Map<String, NodeConnector> mapCurr = nodeConnectorNames.get(node);
                if (mapCurr != null) {
                    Map<String, NodeConnector> map = new HashMap<String, NodeConnector>();
                    for (String s : mapCurr.keySet()) {
                        try {
                            map.put(s, new NodeConnector(mapCurr.get(s)));
                        } catch (ConstructionException e) {
                            e.printStackTrace();
                        }
                    }
                    map.remove(name.getValue());
                    if (!nodeConnectorNames.replace(node, mapCurr, map)) {
                        // TODO: recovery using Transactionality
                        return new Status(StatusCode.CONFLICT, msg);
                    }
                }
            }
        }
    }

    return new Status(StatusCode.SUCCESS);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:54,代码来源:SwitchManagerImpl.java

示例13: _pdm

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
public void _pdm(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;
    }

    Switch sw = getSwitchByNode(node);

    ci.println("          NodeConnector                        Name");
    if (sw == null) {
        return;
    }
    Set<NodeConnector> nodeConnectorSet = sw.getNodeConnectors();
    String nodeConnectorName;
    if (nodeConnectorSet != null && nodeConnectorSet.size() > 0) {
        for (NodeConnector nodeConnector : nodeConnectorSet) {
            Map<String, Property> propMap = getNodeConnectorProps(nodeConnector);
            nodeConnectorName = (propMap == null) ? null : ((Name) propMap
                    .get(Name.NamePropName)).getValue();
            if (nodeConnectorName != null) {
                Node nd = nodeConnector.getNode();
                if (!nd.equals(node)) {
                    log.debug("node not match {} {}", nd, node);
                }
                Map<String, NodeConnector> map = nodeConnectorNames
                        .get(node);
                if (map != null) {
                    NodeConnector nc = map.get(nodeConnectorName);
                    if (nc == null) {
                        log.debug("no nodeConnector named {}",
                                nodeConnectorName);
                    } else if (!nc.equals(nodeConnector)) {
                        log.debug("nodeConnector not match {} {}", nc,
                                nodeConnector);
                    }
                }
            }

            ci.println(nodeConnector
                    + "            "
                    + ((nodeConnectorName == null) ? "" : nodeConnectorName)
                    + "(" + nodeConnector.getID() + ")");
        }
        ci.println("Total number of NodeConnectors: "
                + nodeConnectorSet.size());
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:55,代码来源:SwitchManagerImpl.java

示例14: nodeConnectorUpdated

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public void nodeConnectorUpdated(String containerName, NodeConnector p, UpdateType type) {

    switch (type) {
    case ADDED:
        if (!containerToNc.containsKey(containerName)) {
            containerToNc.put(containerName,
                Collections.newSetFromMap(new ConcurrentHashMap<NodeConnector,Boolean>()));
        }
        containerToNc.get(containerName).add(p);
        if (!containerToNode.containsKey(containerName)) {
            containerToNode.put(containerName, new HashSet<Node>());
        }
        containerToNode.get(containerName).add(p.getNode());
        break;
    case REMOVED:
        Set<NodeConnector> ncSet = containerToNc.get(containerName);
        if (ncSet != null) {
            //remove this nc from container map
            ncSet.remove(p);

            //check if there are still ports of this node in this container
            //and if not, remove its mapping
            boolean nodeInContainer = false;
            Node node = p.getNode();
            for (NodeConnector nodeConnector : ncSet) {
                if (nodeConnector.getNode().equals(node)){
                    nodeInContainer = true;
                    break;
                }
            }
            if (! nodeInContainer) {
                Set<Node> nodeSet = containerToNode.get(containerName);
                if (nodeSet != null) {
                    nodeSet.remove(node);
                }
            }
        }
        break;
    case CHANGED:
    default:
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:44,代码来源:ReadServiceFilter.java

示例15: nodeConnectorUpdated

import org.opendaylight.controller.sal.core.NodeConnector; //导入方法依赖的package包/类
@Override
public void nodeConnectorUpdated(String containerName, NodeConnector nc, UpdateType t) {
    logger.debug("nodeConnectorUpdated: {} type {} for container {}", new Object[] { nc, t, containerName });
    Node node = nc.getNode();
    Set<String> ncContainers = this.nodeConnectorContainerMap.get(nc);
    Set<String> nodeContainers = this.nodeContainerMap.get(node);
    if (ncContainers == null) {
        ncContainers = new CopyOnWriteArraySet<String>();
    }
    if (nodeContainers == null) {
        nodeContainers = new CopyOnWriteArraySet<String>();
    }
    boolean notifyNodeUpdate = false;

    switch (t) {
    case ADDED:
        if (ncContainers.add(containerName)) {
            this.nodeConnectorContainerMap.put(nc, ncContainers);
        }
        if (nodeContainers.add(containerName)) {
            this.nodeContainerMap.put(node, nodeContainers);
            notifyNodeUpdate = true;
        }
        break;
    case REMOVED:
        if (ncContainers.remove(containerName)) {
            if (ncContainers.isEmpty()) {
                // Do cleanup to reduce memory footprint if no
                // elements to be tracked
                this.nodeConnectorContainerMap.remove(nc);
            } else {
                this.nodeConnectorContainerMap.put(nc, ncContainers);
            }
        }
        boolean nodeContainerUpdate = true;
        for (NodeConnector ncContainer : nodeConnectorContainerMap.keySet()) {
            if ((ncContainer.getNode().equals(node)) && (nodeConnectorContainerMap.get(ncContainer).contains(containerName))) {
                nodeContainerUpdate = false;
                break;
            }
        }
        if (nodeContainerUpdate) {
            nodeContainers.remove(containerName);
            notifyNodeUpdate = true;
            if (nodeContainers.isEmpty()) {
                this.nodeContainerMap.remove(node);
            } else {
                this.nodeContainerMap.put(node, nodeContainers);
            }
        }
        break;
    case CHANGED:
        break;
    }

    Set<Property> nodeProp = nodeProps.get(node);
    if (nodeProp == null) {
        return;
    }
    Set<Property> ncProp = nodeConnectorProps.get(nc);
    // notify InventoryService
    notifyInventoryShimInternalListener(containerName, nc, t, ncProp);

    if (notifyNodeUpdate) {
        notifyInventoryShimInternalListener(containerName, node, t, nodeProp);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:68,代码来源:InventoryServiceShim.java


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