/** * Using L2agent, get the output port toward this IP from this * node (switch). */ public Output getOutputPortL2Agent(Node node, InetAddress ip) { Output op = null; if (l2agent != null) { /* Look up the output port leading to the waypoint. */ HostNodeConnector host = (HostNodeConnector) hostTracker.hostFind(ip); log.info("output port on node {} toward host {}", node, host); NodeConnector dst_connector = l2agent.lookup_output_port(node, host.getDataLayerAddressBytes()); if (dst_connector != null) { op = new Output(dst_connector); } } else { log.info("l2agent is not set!!!"); } return op; }
private List<FlowOnNode> forwardingTableEntriesToFlows(Map<String, Integer> entries, Node node){ List<FlowOnNode> list = new ArrayList<FlowOnNode>(); for(Map.Entry<String, Integer> entry : entries.entrySet()){ Match match = new Match(); String str = entry.getKey(); short vlan = Short.parseShort(str.substring(0, str.indexOf("."))); byte[] macAddrBytes = OIDToMacAddrBytes(str.substring(str.indexOf(".") + 1)); if(macAddrBytes == null){ logger.debug("ERROR: forwardingTableEntriesToFlows(): nodeID is {}, call OIDToMacAddrBytes() fail", (Long)node.getID()); return null; } match.setField(MatchType.DL_VLAN, vlan); match.setField(MatchType.DL_DST, macAddrBytes); List<Action> actions = new ArrayList<Action>(); NodeConnector oport = NodeConnectorCreator.createNodeConnector("SNMP", Short.parseShort(entry.getValue().toString()), node); actions.add(new Output(oport)); Flow flow = new Flow(match, actions); list.add(new FlowOnNode(flow)); } return list; }
@Override public void removeOutputPort(Node node, String flowName, List<NodeConnector> portList) { for (FlowEntryInstall index : this.nodeFlows.get(node)) { FlowEntryInstall flow = this.installedSwView.get(index); if (flow.getFlowName().equals(flowName)) { FlowEntry currentFlowEntry = flow.getOriginal(); FlowEntry newFlowEntry = currentFlowEntry.clone(); for (NodeConnector dstPort : portList) { Action action = new Output(dstPort); newFlowEntry.getFlow().removeAction(action); } Status status = modifyEntry(currentFlowEntry, newFlowEntry, false); if (status.isSuccess()) { log.trace("Ports {} removed from FlowEntry {}", portList, flowName); } else { log.warn("Failed to remove ports {} from Flow entry {}. The failure is: {}", portList, currentFlowEntry.toString(), status.getDescription()); } return; } } log.warn("Failed to remove ports from Flow {} on Node {}: Entry Not Found", flowName, node); }
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)); }
@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.trace("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); }
if (t != null) { String nc = String.format("%s|%s@%s", node.getType(), t, node.toString()); actionList.add(new Output(NodeConnector.fromString(nc)));
actions.add(new Output(dst_connector));
newFlowEntry.getFlow().addAction(new Output(outPort));
actionList.add(new HwPath()); try { actionList.add(new Output(new NodeConnector("STUB", 0xCAFE, node))); } catch (ConstructionException e) {
actions.add(new Output(oport)); Flow flown = new Flow(flow.getMatch(), actions); return new FlowOnNode(flown);
actions.add(new Output(oport)); actions.add(new PopVlan()); actions.add(new Flood());
actions.add(new Output(oport)); actions.add(new PopVlan()); actions.add(new Flood());
actions.add(new Output(outPort));
actions.add(new Output(oport)); actions.add(new PopVlan()); actions.add(new Flood());
actions.add(new Output(outport));
targetAction.add(new Output(fromNodeConnectorRef(fullNodeConnector, node)));
salAction = new Output( NodeConnectorCreator.createOFNodeConnector( ofPort, node));