org.opendaylight.controller.sal.action.Output类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.opendaylight.controller.sal.action.Output类的一些代码示例,展示了Output类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output类的具体详情如下:
包路径:org.opendaylight.controller.sal.action.Output
类名称:Output

Output介绍

[英]Represents the action of sending the packet out of a physical port
[中]表示从物理端口发送数据包的操作

代码示例

代码示例来源:origin: org.opendaylight.affinity/flatl2

/** 
 * 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;
}

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation

@Override
public NodeConnector getOutputPort(Node node, String flowName) {
  for (FlowEntryInstall index : this.nodeFlows.get(node)) {
    FlowEntryInstall flow = this.installedSwView.get(index);
    if (flow.getFlowName().equals(flowName)) {
      for (Action action : flow.getOriginal().getFlow().getActions()) {
        if (action.getType() == ActionType.OUTPUT) {
          return ((Output) action).getPort();
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: org.opendaylight.snmp4sdn/snmp4sdn

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;
}

代码示例来源:origin: org.opendaylight.openflowplugin.legacy/sal-compatibility

private static OutputActionCase _toAction(final Output sourceAction) {
  return new OutputActionCaseBuilder()
  .setOutputAction(
      new OutputActionBuilder().setOutputNodeConnector(MDFlowMapping.toUri(sourceAction.getPort())).build()
      ).build();
}

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation

@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);
}

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation

NodeConnector outputPort = out.getPort();
if (!switchManager.getNodeConnectors(node).contains(outputPort)) {
  String msg = String.format("Output port %s is not present on this container", outputPort);

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation

@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);
}

代码示例来源:origin: org.opendaylight.snmp4sdn/snmp4sdn

return new Status(StatusCode.NOTALLOWED, "SNMPHandler.sendBySNMP(): flow's action is not to set OUTPUT port!");
NodeConnector oport = ((Output)action).getPort();

代码示例来源:origin: org.opendaylight.affinity/flatl2

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));
}

代码示例来源:origin: org.opendaylight.controller/troubleshoot.web

outPorts.append(" ");
  actions.append(action.getType().toString()).append(" = ").append(ao.getPort().getNodeConnectorIdAsString()).append("<br>");
} else if (action instanceof SetVlanId) {
  SetVlanId av = (SetVlanId) action;

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager

if (t != null) {
  String nc = String.format("%s|%s@%s", node.getType(), t, node.toString());
  actionList.add(new Output(NodeConnector.fromString(nc)));

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation

private boolean doesFlowContainNodeConnector(Flow flow, NodeConnector nc) {
  if (nc == null) {
    return false;
  }
  Match match = flow.getMatch();
  if (match.isPresent(MatchType.IN_PORT)) {
    NodeConnector matchPort = (NodeConnector) match.getField(MatchType.IN_PORT).getValue();
    if (matchPort.equals(nc)) {
      return true;
    }
  }
  List<Action> actionsList = flow.getActions();
  if (actionsList != null) {
    for (Action action : actionsList) {
      if (action instanceof Output) {
        NodeConnector actionPort = ((Output) action).getPort();
        if (actionPort.equals(nc)) {
          return true;
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.opendaylight.affinity/l2agent

actions.add(new Output(dst_connector));

代码示例来源:origin: org.opendaylight.controller/protocol_plugins.openflow

/**
 * Check whether the ports in the flow match and flow actions for
 * the specified node belong to the container
 *
 * @param container
 * @param node
 * @param flow
 * @return
 */
private boolean flowPortsBelongToContainer(String container, Node node,
    Flow flow) {
  Match m = flow.getMatch();
  if (m.isPresent(MatchType.IN_PORT)) {
    NodeConnector inPort = (NodeConnector) m.getField(MatchType.IN_PORT).getValue();
    // If the incoming port is specified, check if it belongs to
    if (!containerOwnsNodeConnector(container, inPort)) {
      return false;
    }
  }
  // If an outgoing port is specified, it must belong to this container
  for (Action action : flow.getActions()) {
    if (action.getType() == ActionType.OUTPUT) {
      NodeConnector outPort = ((Output) action).getPort();
      if (!containerOwnsNodeConnector(container, outPort)) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation

newFlowEntry.getFlow().addAction(new Output(outPort));

代码示例来源:origin: org.opendaylight.snmp4sdn/snmp4sdn

if (action.getType() == ActionType.OUTPUT) {
  NodeConnector outPort = (NodeConnector) ((Output) action)
      .getPort();
  if (!containerOwnsNodeConnector(container, outPort)) {
    return false;

代码示例来源:origin: org.opendaylight.controller/protocol_plugins.stub

actionList.add(new HwPath());
try {
  actionList.add(new Output(new NodeConnector("STUB", 0xCAFE, node)));
} catch (ConstructionException e) {

代码示例来源:origin: org.opendaylight.controller/protocol_plugins.openflow

OFActionOutput ofAction = new OFActionOutput();
ofAction.setMaxLength((short) 0xffff);
ofAction.setPort(PortConverter.toOFPort(a.getPort()));
actionsList.add(ofAction);
actionsLength += OFActionOutput.MINIMUM_LENGTH;

代码示例来源:origin: org.opendaylight.snmp4sdn/snmp4sdn

actions.add(new Output(oport));
Flow flown = new Flow(flow.getMatch(), actions);
return new FlowOnNode(flown);

代码示例来源:origin: org.opendaylight.controller/sal.implementation

actions.add(new Output(oport));
actions.add(new PopVlan());
actions.add(new Flood());

相关文章