本文整理汇总了Java中org.opendaylight.controller.sal.action.Action.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Action.getType方法的具体用法?Java Action.getType怎么用?Java Action.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.sal.action.Action
的用法示例。
在下文中一共展示了Action.getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionsAreIPv6
import org.opendaylight.controller.sal.action.Action; //导入方法依赖的package包/类
/**
* Returns true if it finds at least one action which is for IPv6 in the
* list of actions for this Flow
*
* @return
*/
private boolean actionsAreIPv6() {
if (this.actions != null) {
for (Action action : actions) {
switch (action.getType()) {
case SET_NW_SRC:
if (((SetNwSrc) action).getAddress() instanceof Inet6Address) {
return true;
}
break;
case SET_NW_DST:
if (((SetNwDst) action).getAddress() instanceof Inet6Address) {
return true;
}
break;
case SET_DL_TYPE:
if (((SetDlType) action).getDlType() == EtherTypes.IPv6.intValue()) {
return true;
}
break;
default:
}
}
}
return false;
}
示例2: flowPortsBelongToContainer
import org.opendaylight.controller.sal.action.Action; //导入方法依赖的package包/类
/**
* 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;
}
示例3: getOutputPort
import org.opendaylight.controller.sal.action.Action; //导入方法依赖的package包/类
@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;
}
示例4: removeAction
import org.opendaylight.controller.sal.action.Action; //导入方法依赖的package包/类
/**
* 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;
}
示例5: replaceOutputPort
import org.opendaylight.controller.sal.action.Action; //导入方法依赖的package包/类
@Override
public void replaceOutputPort(Node node, String flowName, NodeConnector outPort) {
FlowEntry currentFlowEntry = null;
FlowEntry newFlowEntry = null;
// Find the flow
for (FlowEntryInstall index : this.nodeFlows.get(node)) {
FlowEntryInstall flow = this.installedSwView.get(index);
if (flow.getFlowName().equals(flowName)) {
currentFlowEntry = flow.getOriginal();
break;
}
}
if (currentFlowEntry == null) {
log.warn("Failed to replace output port for flow {} on node {}: Entry Not Found", flowName, node);
return;
}
// Create a flow copy with the new output port
newFlowEntry = currentFlowEntry.clone();
Action target = null;
for (Action action : newFlowEntry.getFlow().getActions()) {
if (action.getType() == ActionType.OUTPUT) {
target = action;
break;
}
}
newFlowEntry.getFlow().removeAction(target);
newFlowEntry.getFlow().addAction(new Output(outPort));
// Modify on network node
Status status = modifyEntry(currentFlowEntry, newFlowEntry, false);
if (status.isSuccess()) {
log.info("Output port replaced with {} for flow {} on node {}", outPort, flowName, node);
} else {
log.warn("Failed to replace output port for flow {} on node {}. The failure is: {}", flowName, node,
status.getDescription());
}
return;
}
示例6: allowsFlow
import org.opendaylight.controller.sal.action.Action; //导入方法依赖的package包/类
/**
* Returns whether the specified flow is allowed
*
* @return true if the flow is allowed, false otherwise
*/
public boolean allowsFlow(Flow flow) {
Match target = flow.getMatch();
// Check if flow's match is allowed
if (!this.allowsMatch(target)) {
return false;
}
// Now check if the flow's actions are not allowed
// Create a Match which summarizes the list of actions
if (flow.getActions() == null) {
return true;
}
Match actionMatch = new Match();
for (Action action : flow.getActions()) {
switch (action.getType()) {
case SET_DL_TYPE:
actionMatch.setField(MatchType.DL_TYPE,
((Integer) ((SetDlType) action).getDlType())
.shortValue());
break;
case SET_NW_SRC:
actionMatch.setField(MatchType.NW_SRC, ((SetNwSrc) action)
.getAddress());
break;
case SET_NW_DST:
actionMatch.setField(MatchType.NW_DST, ((SetNwDst) action)
.getAddress());
break;
case SET_TP_SRC:
actionMatch.setField(MatchType.TP_SRC,
((Integer) ((SetTpSrc) action).getPort()).shortValue());
break;
case SET_TP_DST:
actionMatch.setField(MatchType.TP_DST,
((Integer) ((SetTpDst) action).getPort()).shortValue());
break;
default:
// This action cannot conflict
}
}
return this.allowsMatch(actionMatch);
}