public NodeBean(Node node, String description) { this.node = node.toString(); this.description = description; } }
public Node getNode() { return Node.fromString(nodeId); }
/** * Generic NodeConnector creator * The nodeConnector type is inferred from the node type * * @param portId The string representing the port id * @param node The network node as {@link org.opendaylight.controller.sal.core.Node Node} object * @return The corresponding {@link org.opendaylight.controller.sal.core.NodeConnector NodeConnector} object */ public static NodeConnector createNodeConnector(String portId, Node node) { return NodeConnector.fromString(String.format("%s|%s@%s", node.getType(), portId, node.toString())); }
private static StringBuilder nodeIdBulder(final org.opendaylight.controller.sal.core.Node node) { final StringBuilder sb = new StringBuilder(); sb.append("ad-sal:"); sb.append(node.getType()); sb.append(NODE_TYPE_STRING); sb.append(node.getNodeIDString()); return sb; }
private Node handleNodeAvailability(String containerName, String nodeType, String nodeId) { Node node = Node.fromString(nodeType, nodeId); if (node == null) { throw new ResourceNotFoundException(nodeId + " : " + RestMessages.NONODE.toString()); } ISwitchManager sm = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName, this); if (sm == null) { throw new ServiceUnavailableException("Switch Manager " + RestMessages.SERVICEUNAVAILABLE.toString()); } if (!sm.getNodes().contains(node)) { throw new ResourceNotFoundException(node.toString() + " : " + RestMessages.NONODE.toString()); } return node; }
public boolean onNode(Node node) { return this.node.equals(node); }
@Override public List<FlowOnNode> nonCachedReadAllFlows(Node node) { if (pluginReader != null) { ProtocolService<IPluginInReadService> service = this.pluginReader.get(node.getType()); if (service != null) { return service.getService().readAllFlow(node, false); } } logger.warn("Plugin {} unavailable", node.getType()); return Collections.emptyList(); }
public Output getOutputPort(Node node, InetAddress wp) { IHostId id = HostIdFactory.create(wp, null); HostNodeConnector hnConnector = this.hostTracker.hostFind(id); Node destNode = hnConnector.getnodeconnectorNode(); log.debug("from node: {}", node.toString()); log.debug("dest node: {}", destNode.toString()); // Get path between both the nodes NodeConnector forwardPort = null; if (node.getNodeIDString().equals(destNode.getNodeIDString())) { forwardPort = hnConnector.getnodeConnector(); log.info("Both source and destination are connected to same switch nodes. output port is {}", forwardPort); } else { Path route = this.routing.getRoute(node, destNode); log.info("Path between source and destination switch nodes : {}", route.toString()); forwardPort = route.getEdges().get(0).getTailNodeConnector(); } return(new Output(forwardPort)); }
handleResourceCongruence(nodeType, flowConfig.getNode().getType()); handleResourceCongruence(nodeId, flowConfig.getNode().getID() == null ? null : flowConfig.getNode().getNodeIDString()); handleDefaultDisabled(containerName);
/** * @return the NodeId */ public Long getnodeconnectornodeId() { return (Long) this.nodeConnector.getNode().getID(); }
public static Node createOFNode(Long switchId) { try { return new Node(NodeIDType.OPENFLOW, switchId); } catch (ConstructionException e1) { logger.error("",e1); return null; } } }
public static NodeRef toNodeRef(final org.opendaylight.controller.sal.core.Node node) { Preconditions.checkArgument(NodeIDType.OPENFLOW.equals(node.getType())); final Long nodeId = Arguments.<Long>checkInstanceOf(node.getID(), Long.class); final NodeKey nodeKey = new NodeKey(new NodeId(OPENFLOW_ID_PREFIX + nodeId)); final InstanceIdentifier<Node> nodePath = InstanceIdentifier.builder(Nodes.class).child(NODE_CLASS, nodeKey).toInstance(); return new NodeRef(nodePath); }
public static boolean getNodeAndNcIdString(Edge edge, String headNodeIdStr, String tailNodeIdStr, String headNcIdStr, String tailNcIdStr){ NodeConnector headNC = edge.getHeadNodeConnector(); NodeConnector tailNC = edge.getTailNodeConnector(); if(headNC == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's head nodeconnector is null!"); return false; } if(tailNC == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's tail nodeconnector is null!"); return false; } Node headNode = headNC.getNode(); Node tailNode = tailNC.getNode(); if(headNode == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's head node is null!"); return false; } if(tailNode == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's tail node is null!"); return false; } headNodeIdStr = headNode.getNodeIDString(); tailNodeIdStr = tailNode.getNodeIDString(); headNcIdStr = headNC.getNodeConnectorIDString(); tailNcIdStr = tailNC.getNodeConnectorIDString(); return true; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(dataLayerAddress); result = prime * result + ((node == null) ? 0 : node.hashCode()); result = prime * result + ((nodeConnectors == null) ? 0 : nodeConnectors.hashCode()); result = prime * result + ((spanPorts == null) ? 0 : spanPorts.hashCode()); return result; }
private Node handleNodeAvailability(String containerName, String nodeType, String nodeId) { Node node = Node.fromString(nodeType, nodeId); if (node == null) { throw new ResourceNotFoundException(nodeId + " : " + RestMessages.NONODE.toString()); } ISwitchManager sm = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName, this); if (sm == null) { throw new ServiceUnavailableException("Switch Manager " + RestMessages.SERVICEUNAVAILABLE.toString()); } if (!sm.getNodes().contains(node)) { throw new ResourceNotFoundException(node.toString() + " : " + RestMessages.NONODE.toString()); } return node; }
public boolean equalsByNodeAndName(Node node, String flowName) { return this.node.equals(node) && this.flowName.equals(flowName); }
@Override public NodeDescription readDescription(Node node) { if (pluginReader != null) { ProtocolService<IPluginInReadService> service = this.pluginReader.get(node.getType()); if (service != null) { return service.getService().readDescription(node, true); } } logger.warn("Plugin {} unavailable", node.getType()); return null; }
.toString()); IPv4 ipv4Pkt = (IPv4) ipPkt; if (IPProtocols.getProtocolName(ipv4Pkt.getProtocol()).equals(IPProtocols.TCP.toString()) lbsLogger.debug("Client is connected to switch : {}", clientNode.toString()); lbsLogger .debug("Destination pool machine is connected to switch : {}", destNode.toString()); if (clientNode.getNodeIDString().equals(destNode.getNodeIDString())) {
/** * A NodeConnector may have been categorized as of type Production by Discovery Service. * But at the time when this determination was made, only OF nodes were known to Discovery * Service. This method checks if the node of nodeConnector is known to SwitchManager. If * so, then it returns a new NodeConnector with correct type. * * @param nc * NodeConnector as passed on in the edge * @return * If Node of the NodeConnector is in SwitchManager, then return a new NodeConnector * with correct type, null otherwise */ private NodeConnector updateNCTypeFromSwitchMgr(NodeConnector nc) { for (Node node : switchManager.getNodes()) { String nodeName = node.getNodeIDString(); log.trace("Switch Manager Node Name: {}, NodeConnector Node Name: {}", nodeName, nc.getNode().getNodeIDString()); if (nodeName.equals(nc.getNode().getNodeIDString())) { NodeConnector nodeConnector = NodeConnectorCreator .createNodeConnector(node.getType(), nc.getID(), node); return nodeConnector; } } return null; }
/** * Node Disconnected from the node's master controller. */ @Override public void notifyNodeDisconnectFromMaster(Node node) { ISwitch sw = switches.get((Long)node.getID()); if (sw != null) notifySwitchAdded(sw); } }