id = MIN_FLOW_ID;
}
+ VtnFlowId nextId = new VtnFlowId(BigInteger.valueOf(id));
if (!fopt.isPresent()) {
// Update the next-flow-id for the next allocation.
- VtnFlowId nextId = new VtnFlowId(BigInteger.valueOf(id));
NextFlowId nfid = new NextFlowIdBuilder().
setNextId(nextId).build();
tx.put(oper, NEXT_FLOW_ID_PATH, nfid, true);
return flowId;
}
+ flowId = nextId;
} while (id != start);
flowPath = null;
*/
public VtnDataFlow createVtnDataFlow(VtnFlowId fid) {
if (dataFlow == null) {
- // Configure flow entries.
- int order = MiscUtils.ORDER_MIN;
- FlowCookie cookie = FlowUtils.createCookie(fid);
- List<VtnFlowEntry> entries = new ArrayList<>(flowEntries.size());
- for (VtnFlowEntryBuilder flow: flowEntries) {
- entries.add(flow.setCookie(cookie).setOrder(order).build());
- order++;
- }
+ // Configure virtual node hop.
+ flowBuilder.setVirtualRoute(
+ VNodeHop.toVirtualRouteList(virtualRoute));
+ }
- // Configure VTN data flow.
- flowBuilder.setFlowId(fid).
- setVirtualRoute(VNodeHop.toVirtualRouteList(virtualRoute)).
- setVtnFlowEntry(entries);
+ // Configure flow entries.
+ int order = MiscUtils.ORDER_MIN;
+ FlowCookie cookie = FlowUtils.createCookie(fid);
+ List<VtnFlowEntry> entries = new ArrayList<>(flowEntries.size());
+ for (VtnFlowEntryBuilder flow: flowEntries) {
+ entries.add(flow.setCookie(cookie).setOrder(order).build());
+ order++;
}
- // Update the creation time.
+ // Configure VTN data flow.
Long created = Long.valueOf(System.currentTimeMillis());
- dataFlow = flowBuilder.setCreationTime(created).build();
+ dataFlow = flowBuilder.setFlowId(fid).
+ setVtnFlowEntry(entries).
+ setCreationTime(created).
+ build();
return dataFlow;
}