本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie类的典型用法代码示例。如果您正苦于以下问题:Java FlowCookie类的具体用法?Java FlowCookie怎么用?Java FlowCookie使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FlowCookie类属于org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026包,在下文中一共展示了FlowCookie类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFlowBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
public static FlowBuilder createFlowBuilder(final short table, final int priority, final BigInteger cookieValue,
final String flowName, final String flowIdStr, MatchBuilder match,
InstructionsBuilder isb) {
FlowBuilder flow = new FlowBuilder();
flow.setId(new FlowId(flowIdStr));
flow.setKey(new FlowKey(new FlowId(flowIdStr)));
flow.setTableId(table);
flow.setFlowName(flowName);
flow.setCookie(new FlowCookie(cookieValue));
flow.setCookieMask(new FlowCookie(cookieValue));
flow.setContainerName(null);
flow.setStrict(false);
flow.setMatch(match.build());
flow.setInstructions(isb.build());
flow.setPriority(priority);
flow.setHardTimeout(0);
flow.setIdleTimeout(0);
flow.setFlags(new FlowModFlags(false, false, false, false, false));
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
return flow;
}
示例2: createFlowOnTable
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
public static Flow createFlowOnTable(Match match, int priority, short tableId, BigInteger cookie,
boolean isCreateFlowIdFromMatch, Integer timeout) {
FlowBuilder fb = new FlowBuilder();
if (match != null) {
fb.setMatch(match);
}
FlowId flowId = createFlowId();
fb.setTableId(tableId);
fb.setIdleTimeout(0).setHardTimeout(0);
fb.setId(flowId);
if (timeout != null) {
fb.setHardTimeout(timeout);
}
if (cookie != null) {
fb.setCookie(new FlowCookie(cookie));
}
fb.setPriority(priority);
Flow flow = fb.build();
return flow;
}
示例3: createArpReplyToControllerFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
protected FlowBuilder createArpReplyToControllerFlow() {
final FlowBuilder arpFlow = new FlowBuilder()
.setPriority(OFRendererConstants.ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY)
.setIdleTimeout(0)
.setHardTimeout(0)
.setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet())))
.setFlags(new FlowModFlags(false, false, false, false, false));
final EthernetMatch ethernetMatch = FlowUtils.createEthernetMatch();
/** NOTE:
* Setting layer 3 match seems to be messing with the flow ID
* check for possible bug on openflow plugin side.
* Use following code for specific ARP REQUEST or REPLY packet capture
* ArpMatch arpMatch = FlowUtils.createArpMatch();
*/
final Match match = new MatchBuilder().setEthernetMatch(ethernetMatch).build();//.setLayer3Match(arpMatch).build();
arpFlow.setMatch(match);
final Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER, OutputPortValues.NORMAL);
arpFlow.setInstructions(instructions);
final String flowName = createFlowName();
arpFlow.setFlowName(flowName);
final FlowId flowId = new FlowId(flowName);
arpFlow.setId(flowId);
arpFlow.setKey(new FlowKey(flowId));
return arpFlow;
}
示例4: createFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
public FlowBuilder createFlow(final Dataflow dataFlow) throws DataflowCreationException {
FlowBuilder flowBuilder = new FlowBuilder();
try {
final FlowModFlags flowModFlags = new FlowModFlags(false, false, false, false, false);
final FlowId flowId = new FlowId(dataFlow.getId().toString());
final FlowKey flowKey = new FlowKey(flowId);
final MeterId meterId = new MeterId(dataFlow.getMeterId().longValue());
flowBuilder.setFlowName("NIC_METER" + meterId.getValue());
flowBuilder.setId(new FlowId(Long.toString(flowBuilder.hashCode())));
flowBuilder.setMatch(createMatch(dataFlow.getSourceIpAddress()));
flowBuilder.setInstructions(createInstruction(meterId));
flowBuilder.setPriority(OFRendererConstants.DEFAULT_PRIORITY);
flowBuilder.setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())));
flowBuilder.setBufferId(OFP_NO_BUFFER);
flowBuilder.setHardTimeout((int) dataFlow.getTimeout());
flowBuilder.setIdleTimeout((int) dataFlow.getTimeout());
flowBuilder.setFlags(flowModFlags);
flowBuilder.setKey(flowKey);
} catch (Exception e) {
throw new DataflowCreationException(e.getMessage());
}
return flowBuilder;
}
示例5: createFlowBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
private FlowBuilder createFlowBuilder(final MatchBuilder matchBuilder, final FlowId flowId) {
final Match match = matchBuilder.build();
final FlowKey key = new FlowKey(flowId);
final FlowBuilder flowBuilder = new FlowBuilder();
final BigInteger cookieId = new BigInteger("20", RADIX);
flowBuilder.setId(flowId);
flowBuilder.setKey(key);
flowBuilder.setFlowName(flowName);
flowBuilder.setCookie(new FlowCookie(cookieId));
flowBuilder.setCookieMask(new FlowCookie(cookieId));
flowBuilder.setContainerName(null);
flowBuilder.setStrict(false);
flowBuilder.setMatch(match);
flowBuilder.setFlags(new FlowModFlags(false, false, false, false, false));
flowBuilder.setBarrier(true);
flowBuilder.setPriority(OFRendererConstants.DEFAULT_PRIORITY);
flowBuilder.setHardTimeout(OFRendererConstants.DEFAULT_HARD_TIMEOUT);
flowBuilder.setIdleTimeout(OFRendererConstants.DEFAULT_IDLE_TIMEOUT);
return flowBuilder;
}
示例6: createLldpReplyToControllerFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
private FlowBuilder createLldpReplyToControllerFlow() {
FlowBuilder lldpFlow = new FlowBuilder().setFlowName(createFlowName())
.setIdleTimeout(0)
.setHardTimeout(0)
.setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet())))
.setFlags(new FlowModFlags(false, false, false, false, false))
.setPriority(OFRendererConstants.LLDP_REPLY_TO_CONTROLLER_FLOW_PRIORITY);
EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder()
.setEthernetType(new EthernetTypeBuilder()
.setType(new EtherType(Long.valueOf(OFRendererConstants.LLDP_ETHER_TYPE))).build());
Match match = new MatchBuilder().setEthernetMatch(ethernetMatchBuilder.build()).build();
lldpFlow.setMatch(match);
Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER);
lldpFlow.setInstructions(instructions);
FlowId flowId = new FlowId(createFlowName());
lldpFlow.setId(flowId);
lldpFlow.setKey(new FlowKey(flowId));
return lldpFlow;
}
示例7: createFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie; //导入依赖的package包/类
/**
* Adds an application flow by using the REST API.
*/
private Flow createFlow(String edge_nodeconnector) {
FlowBuilder flowBuilder = new FlowBuilder() //
.setTableId((short) 0) //
.setFlowName("random");
//
flowBuilder.setId(new FlowId(Long.toString(flowBuilder.hashCode())));
Ipv4Prefix srcIp = new Ipv4Prefix("10.0.0.1/32");
Ipv4Prefix dstIp = new Ipv4Prefix("10.0.0.2/32");
Match match = new MatchBuilder()
.setLayer3Match(new Ipv4MatchBuilder()
.setIpv4Source(srcIp)
.setIpv4Destination(dstIp)
.build())
.setEthernetMatch(new EthernetMatchBuilder()
.setEthernetType(new EthernetTypeBuilder()
.setType(new EtherType(0x0800L))
.build())
.build())
.build();
ActionBuilder actionBuilder = new ActionBuilder();
List<Action> actions = new ArrayList<Action>();
//Actions
//currently changing tos and sending to output connector
Action queueAction = actionBuilder
.setOrder(0).setAction(new SetQueueActionCaseBuilder()
.setSetQueueAction(new SetQueueActionBuilder()
.setQueueId((long)1)
.build())
.build())
.build();
actions.add(queueAction);
Action outputNodeConnectorAction = actionBuilder
.setOrder(1).setAction(new OutputActionCaseBuilder()
.setOutputAction(new OutputActionBuilder()
.setOutputNodeConnector(new Uri(edge_nodeconnector.split(":")[2]))
.build())
.build())
.build();
actions.add(outputNodeConnectorAction);
//ApplyActions
ApplyActions applyActions = new ApplyActionsBuilder().setAction(actions).build();
//Instruction
Instruction applyActionsInstruction = new InstructionBuilder() //
.setOrder(0).setInstruction(new ApplyActionsCaseBuilder()//
.setApplyActions(applyActions) //
.build()) //
.build();
Instructions applyInstructions = new InstructionsBuilder()
.setInstruction(ImmutableList.of(applyActionsInstruction))
.build();
// Put our Instruction in a list of Instructions
flowBuilder
.setMatch(match)
.setBufferId(OFConstants.OFP_NO_BUFFER)
.setInstructions(applyInstructions)
.setPriority(1000)
.setHardTimeout((int)300)
.setIdleTimeout(0)
.setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())))
.setFlags(new FlowModFlags(false, false, false, false, false));
return flowBuilder.build();
}