use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.
the class ArpResponderUtil method installFlow.
/**
* Install ARP Responder FLOW.
*
* @param mdSalManager
* Reference of MDSAL API RPC that provides API for installing
* flow
* @param dpnId
* DPN on which flow to be installed
* @param flowId
* Uniquely Identifiable Arp Responder Table flow Id
* @param flowName
* Readable flow name
* @param priority
* Flow Priority
* @param cookie
* Flow Cookie
* @param matches
* List of Match Criteria for the flow
* @param instructions
* List of Instructions for the flow
*/
public static void installFlow(IMdsalApiManager mdSalManager, BigInteger dpnId, String flowId, String flowName, int priority, BigInteger cookie, List<MatchInfo> matches, List<Instruction> instructions) {
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.ARP_RESPONDER_TABLE, flowId, priority, flowName, 0, 0, cookie, matches, instructions);
mdSalManager.installFlow(dpnId, flowEntity);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.
the class ArpResponderUtil method getExtInterfaceInstructions.
/**
* Get instruction list for ARP responder flows originated from ext-net e.g.
* router-gw/fip.<br>
* The split-horizon bit should be reset in order to allow traffic from
* provider network to be routed back to flat/VLAN network and override the
* egress table drop flow.<br>
* In order to allow write-metadata in the ARP responder table the resubmit
* action needs to be replaced with goto instruction.
*/
public static List<Instruction> getExtInterfaceInstructions(IInterfaceManager ifaceMgrRpcService, String extInterfaceName, String ipAddress, String macAddress) {
AtomicInteger tableId = new AtomicInteger(-1);
List<Instruction> instructions = new ArrayList<>();
List<Action> actions = getActions(ifaceMgrRpcService, extInterfaceName, ipAddress, macAddress);
actions.removeIf(v -> {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v.getAction();
if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable());
return true;
} else {
return false;
}
});
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, 0));
if (tableId.get() != -1) {
// write-metadata
if ((short) tableId.get() > NwConstants.ARP_RESPONDER_TABLE) {
instructions.add(new InstructionGotoTable((short) tableId.get()).buildInstruction(2));
} else {
LOG.warn("Failed to insall responder flow for interface {}. Resubmit to {} can't be replaced with goto", extInterfaceName, tableId);
}
}
return instructions;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.
the class VPNServiceChainHandler method bindScfOnVpnInterface.
public void bindScfOnVpnInterface(String ifName, int scfTag) {
LOG.debug("bind SCF tag {} on iface {}", scfTag, ifName);
if (isServiceBoundOnInterface(NwConstants.SCF_SERVICE_INDEX, ifName)) {
LOG.info("SCF is already bound on Interface {} for Ingress. Binding aborted", ifName);
return;
}
Action loadReg2Action = new ActionRegLoad(1, NxmNxReg2.class, 0, 31, scfTag).buildAction();
List<Instruction> instructions = Arrays.asList(MDSALUtil.buildApplyActionsInstruction(Collections.singletonList(loadReg2Action)), MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE, 1));
BoundServices boundServices = InterfaceServiceUtil.getBoundServices(ifName, NwConstants.SCF_SERVICE_INDEX, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, CloudServiceChainConstants.COOKIE_SCF_BASE, instructions);
interfaceManager.bindService(ifName, ServiceModeIngress.class, boundServices);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.
the class QosNeutronUtils method bindservice.
public void bindservice(String ifName) {
int priority = QosConstants.QOS_DEFAULT_FLOW_PRIORITY;
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.QOS_DSCP_TABLE, ++instructionKey));
short qosServiceIndex = ServiceIndex.getIndex(NwConstants.QOS_SERVICE_NAME, NwConstants.QOS_SERVICE_INDEX);
BoundServices serviceInfo = getBoundServices(String.format("%s.%s", "qos", ifName), qosServiceIndex, priority, NwConstants.COOKIE_QOS_TABLE, instructions);
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, buildServiceId(ifName, qosServiceIndex), serviceInfo);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project netvirt by opendaylight.
the class TunnelStateChangeListener method bindService.
private void bindService(String tunnelInterfaceName) {
coordinator.enqueueJob(tunnelInterfaceName, () -> {
LOG.info("Bind egress policy service on tunnel {}", tunnelInterfaceName);
List<Instruction> instructions = Collections.singletonList(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_POLICY_CLASSIFIER_TABLE, 0));
BoundServices boundServices = getBoundServices(tunnelInterfaceName, instructions);
interfaceManager.bindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
return null;
});
}
Aggregations