use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project openflowplugin by opendaylight.
the class DropTestCommiter method processPacket.
@Override
protected void processPacket(final InstanceIdentifier<Node> node, final Match match, final Instructions instructions) {
// Finally build our flow
final FlowBuilder fb = BUILDER.get();
fb.setMatch(match);
fb.setInstructions(instructions);
fb.setId(new FlowId(String.valueOf(fb.hashCode()) + "." + ID_COUNTER.getAndIncrement()));
// Construct the flow instance id
final InstanceIdentifier<Flow> flowInstanceId = node.builder().augmentation(FlowCapableNode.class).child(Table.class, ZERO_TABLE).child(Flow.class, new FlowKey(fb.getId())).build();
final Flow flow = fb.build();
final ReadWriteTransaction transaction = dataService.newReadWriteTransaction();
if (LOG.isDebugEnabled()) {
LOG.debug("onPacketReceived - About to write flow {}", flow);
}
transaction.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow, true);
transaction.submit();
LOG.debug("onPacketReceived - About to write flow commited");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project genius by opendaylight.
the class FlowEntity method getFlowBuilder.
public FlowBuilder getFlowBuilder() {
FlowBuilder flowBuilder = new FlowBuilder();
flowBuilder.setKey(new FlowKey(new FlowId(getFlowId())));
flowBuilder.setTableId(getTableId());
flowBuilder.setPriority(getPriority());
flowBuilder.setFlowName(getFlowName());
flowBuilder.setIdleTimeout(getIdleTimeOut());
flowBuilder.setHardTimeout(getHardTimeOut());
flowBuilder.setCookie(new FlowCookie(getCookie()));
flowBuilder.setMatch(MDSALUtil.buildMatches(getMatchInfoList()));
flowBuilder.setInstructions(MDSALUtil.buildInstructions(getInstructionInfoList()));
flowBuilder.setStrict(getStrictFlag());
// TODO flowBuilder.setResyncFlag(getResyncFlag());
if (getSendFlowRemFlag()) {
flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true));
}
flowBuilder.setBarrier(false);
flowBuilder.setInstallHw(true);
return flowBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project genius by opendaylight.
the class MDSALManager method batchedAddFlowInternal.
public void batchedAddFlowInternal(BigInteger dpId, Flow flow) {
FlowKey flowKey = new FlowKey(new FlowId(flow.getId()));
InstanceIdentifier<Flow> flowInstanceId = buildFlowInstanceIdentifier(dpId, flow.getTableId(), flowKey);
flowBatchingUtils.write(flowInstanceId, flow);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project genius by opendaylight.
the class MDSALManager method deleteFlowInternal.
public void deleteFlowInternal(BigInteger dpId, Flow flow, WriteTransaction tx) {
FlowKey flowKey = new FlowKey(flow.getId());
short tableId = flow.getTableId();
deleteFlow(dpId, tableId, flowKey, tx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project genius by opendaylight.
the class MDSALManager method syncSetUpFlowInternal.
public void syncSetUpFlowInternal(FlowEntity flowEntity, boolean isRemove) {
if (LOG.isTraceEnabled()) {
LOG.trace("syncSetUpFlow for flowEntity {} ", flowEntity);
}
Flow flow = flowEntity.getFlowBuilder().build();
String flowId = flowEntity.getFlowId();
short tableId = flowEntity.getTableId();
BigInteger dpId = flowEntity.getDpnId();
FlowKey flowKey = new FlowKey(new FlowId(flowId));
InstanceIdentifier<Flow> flowInstanceId = buildFlowInstanceIdentifier(dpId, tableId, flowKey);
if (isRemove) {
synchronized (getFlowKey(dpId, tableId, flowKey)) {
if (flowExists(dpId, tableId, flowKey)) {
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, flowInstanceId);
} else {
LOG.debug("Flow {} does not exist for dpn {}", flowKey, dpId);
}
}
} else {
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow);
}
}
Aggregations