org.opendaylight.controller.sal.flowprogrammer.Flow.getActions()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(110)

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

Flow.getActions介绍

[英]Returns a copy of the actions list of this flow
[中]返回此流的操作列表的副本

代码示例

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

@Override
public Flow clone() {
  Flow cloned = null;
  try {
    cloned = (Flow) super.clone();
    cloned.match = this.getMatch();
    cloned.actions = this.getActions();
  } catch (CloneNotSupportedException e) {
    logger.error("", e);
  }
  return cloned;
}

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

/**
 * remove ALL actions of type actionType from the list of actions of this
 * flow
 *
 * @param actionType
 * @return false if an action of that type is present and it fails to remove
 *         it
 */
public boolean removeAction(ActionType actionType) {
  Iterator<Action> actionIter = this.getActions().iterator();
  while (actionIter.hasNext()) {
    Action action = actionIter.next();
    if (action.getType() == actionType) {
      if (!this.removeAction(action)) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源: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

String destMac1 = HexString.toHexString((byte[])fieldDlSrc1.getValue());
Action action1 = flow1.getActions().get(0);
if(flow1.getActions().size() > 1) {
  log.trace("flow1.getActions() > 1, the Action are:");
  for(int i = 0; i < flow1.getActions().size(); i++)
    log.trace("{}", flow1.getActions().get(i));
String destMac2 = HexString.toHexString((byte[])fieldDlSrc2.getValue());
Action action2 = flow2.getActions().get(0);
if(flow2.getActions().size() > 1) {
  log.trace("flow2.getActions() > 1, the Action are:");
  for(int i = 0; i < flow1.getActions().size(); i++)
    log.trace("{}", flow1.getActions().get(i));

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

private static FlowBuilder internalToMDFlow(final Flow sourceFlow) {
  Preconditions.checkArgument(sourceFlow != null);
  // Instruct switch to let controller know when flow is removed.
  FlowModFlags flags = new FlowModFlags(false, false, false, false, true);
  return new FlowBuilder()
  .setHardTimeout(Integer.valueOf(sourceFlow.getHardTimeout()))
  .setIdleTimeout(Integer.valueOf(sourceFlow.getIdleTimeout()))
  .setCookie(new FlowCookie(BigInteger.valueOf(sourceFlow.getId())))
  .setPriority(Integer.valueOf((sourceFlow.getPriority())))
  .setFlags(flags)
  .setInstructions(MDFlowMapping.toApplyInstruction(toMDActions(sourceFlow.getActions())))
  .setMatch(FromSalConversionsUtils.toMatch(sourceFlow.getMatch()));
}

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

public static FlowAdded flowAdded(final Flow sourceFlow) {
  Preconditions.checkArgument(sourceFlow != null);
  return new FlowAddedBuilder()
  .setHardTimeout(Integer.valueOf(sourceFlow.getHardTimeout()))
  .setIdleTimeout(Integer.valueOf(sourceFlow.getIdleTimeout()))
  .setCookie(new FlowCookie(BigInteger.valueOf(sourceFlow.getId())))
  .setPriority(Integer.valueOf(sourceFlow.getPriority()))
  .setInstructions(MDFlowMapping.toApplyInstruction(toMDActions(sourceFlow.getActions())))
  .setMatch(FromSalConversionsUtils.toMatch(sourceFlow.getMatch()))
  .setTableId((short)0)
  .build();
}

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

for (Action action : newFlowEntry.getFlow().getActions()) {
  if (action.getType() == ActionType.OUTPUT) {
    target = action;

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

short vlan = ((Short)(fieldVlan.getValue())).shortValue();
Action action = flow.getActions().get(0);
if(flow.getActions().size() > 1) {
  logger.debug("ERROR: sendBySNMP(): flow.getActions() > 1");
  return new Status(StatusCode.NOTALLOWED, "SNMPHandler.sendBySNMP(): flow.getActions() > 1");

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

for (Action action : flow.getActions()) {
  if (action instanceof Flood && !GlobalConstants.DEFAULT.toString().equals(getContainerName())) {
    return new Status(StatusCode.BADREQUEST, String.format("Flood is only allowed in default container"));

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

if (flow.getActions() == null) {
  return true;
for (Action action : flow.getActions()) {
  switch (action.getType()) {
  case SET_VLAN_ID:

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

for (Action action : flow.getActions()) {

代码示例来源: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.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.snmp4sdn/snmp4sdn

for (Action action : flow.getActions()) {
  if (action.getType() == ActionType.OUTPUT) {
    NodeConnector outPort = (NodeConnector) ((Output) action)

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

if (this.actionsList == null) {
  actionsList = new ArrayList<OFAction>();
  for (Action action : flow.getActions()) {
    if (action.getType() == ActionType.OUTPUT) {
      Output a = (Output) action;
logger.trace("SAL Actions: {} Openflow Actions: {}", flow.getActions(),
    actionsList);
return actionsList;

相关文章