use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.
the class FlowNotificationSupplierImpl method createNotification.
@Override
public FlowAdded createNotification(final Flow dataTreeItemObject, final InstanceIdentifier<Flow> path) {
Preconditions.checkArgument(dataTreeItemObject != null);
Preconditions.checkArgument(path != null);
final FlowAddedBuilder builder = new FlowAddedBuilder(dataTreeItemObject);
builder.setFlowRef(new FlowRef(path));
builder.setNode(createNodeRef(path));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project openflowplugin by opendaylight.
the class FlowUtilTest method testBuildFlowPath.
@Test
public void testBuildFlowPath() throws Exception {
final InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(DUMMY_NODE_ID));
final FlowRef flowRef = FlowUtil.buildFlowPath(nodePath, DUMMY_TABLE_ID, DUMMY_FLOW_ID);
final InstanceIdentifier<?> flowRefValue = flowRef.getValue();
Assert.assertEquals(DUMMY_NODE_ID, flowRefValue.firstKeyOf(Node.class).getId());
Assert.assertEquals(DUMMY_TABLE_ID, flowRefValue.firstKeyOf(Table.class).getId());
Assert.assertEquals(DUMMY_FLOW_ID, flowRefValue.firstKeyOf(Flow.class).getId());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project genius by opendaylight.
the class FlowBasedServicesUtils method removeEgressDispatcherFlow.
private static void removeEgressDispatcherFlow(BigInteger dpId, String iface, WriteTransaction writeTransaction, short currentServiceIndex) {
// build the flow and install it
String flowRef = getFlowRef(dpId, NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, iface, currentServiceIndex);
FlowKey flowKey = new FlowKey(new FlowId(flowRef));
Node nodeDpn = buildInventoryDpnNode(dpId);
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE)).child(Flow.class, flowKey).build();
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project genius by opendaylight.
the class FlowBasedServicesUtils method installEgressDispatcherSplitHorizonFlow.
public static void installEgressDispatcherSplitHorizonFlow(BigInteger dpId, BoundServices boundService, String interfaceName, WriteTransaction writeTransaction, int interfaceTag, short currentServiceIndex, Interface iface) {
// only install split horizon drop flows for external interfaces
if (!isExternal(iface)) {
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Installing split horizon drop flow for external interface {} on dpId {}", interfaceName, dpId);
}
// BigInteger.ONE is used for
BigInteger shFlagSet = BigInteger.ONE;
// checking the Split-Horizon
// flag
List<MatchInfoBase> shMatches = FlowBasedServicesUtils.getMatchInfoForEgressDispatcherTable(interfaceTag, currentServiceIndex);
shMatches.add(new MatchMetadata(shFlagSet, MetaDataUtil.METADATA_MASK_SH_FLAG));
List<InstructionInfo> shInstructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionDrop());
shInstructions.add(new InstructionApplyActions(actionsInfos));
String flowRef = getSplitHorizonFlowRef(dpId, NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, interfaceName, shFlagSet);
String serviceRef = boundService.getServiceName();
// This must be higher priority than the egress flow
int splitHorizonFlowPriority = boundService.getServicePriority() + 1;
StypeOpenflow stypeOpenFlow = boundService.getAugmentation(StypeOpenflow.class);
Flow egressSplitHorizonFlow = MDSALUtil.buildFlow(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, flowRef, splitHorizonFlowPriority, serviceRef, 0, 0, stypeOpenFlow.getFlowCookie(), shMatches, shInstructions);
installFlow(dpId, egressSplitHorizonFlow, writeTransaction);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef in project genius by opendaylight.
the class FlowBasedServicesUtils method installLportIngressFlow.
public static void installLportIngressFlow(BigInteger dpId, long portNo, Interface iface, List<ListenableFuture<Void>> futures, ManagedNewTransactionRunner txRunner, int lportTag) {
int vlanId = 0;
boolean isVlanTransparent = false;
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
if (l2vlan != null) {
vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
isVlanTransparent = l2vlan.getL2vlanMode() == IfL2vlan.L2vlanMode.Transparent;
}
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
final SplitHorizon splitHorizon = iface.getAugmentation(SplitHorizon.class);
boolean overrideSplitHorizonProtection = splitHorizon != null && splitHorizon.isOverrideSplitHorizonProtection();
int actionKey = -1;
List<Action> actions = new ArrayList<>();
if (vlanId != 0 && !isVlanTransparent) {
actions.add(MDSALUtil.createPopVlanAction(++actionKey));
}
if (overrideSplitHorizonProtection) {
actions.add(MDSALUtil.createNxOfInPortAction(++actionKey, 0));
}
if (!actions.isEmpty()) {
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, instructionKey++));
}
BigInteger metadata = MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, (short) 0, BigInteger.ZERO, isExternal(iface));
BigInteger metadataMask = MetaDataUtil.getMetaDataMaskForLPortDispatcher(MetaDataUtil.METADATA_MASK_LPORT_TAG_SH_FLAG);
instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, instructionKey++));
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.LPORT_DISPATCHER_TABLE, instructionKey++));
int priority = isVlanTransparent ? 1 : vlanId == 0 ? IfmConstants.FLOW_PRIORITY_FOR_UNTAGGED_VLAN : IfmConstants.FLOW_HIGH_PRIORITY;
String flowRef = getFlowRef(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, dpId, iface.getName());
List<MatchInfo> matches = getMatchInfoForVlanPortAtIngressTable(dpId, portNo, iface);
Flow ingressFlow = MDSALUtil.buildFlowNew(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, flowRef, priority, flowRef, 0, 0, NwConstants.VLAN_TABLE_COOKIE, matches, instructions);
LOG.debug("Installing ingress flow {} for {}", flowRef, iface.getName());
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> installFlow(dpId, ingressFlow, tx)));
}
Aggregations