- public void setFlowService(SalFlowService flowService) {
- this.flowService = flowService;
- }
-
- private static MatchBuilder createMatchBld() {
- MatchBuilder match = new MatchBuilder();
- Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
- Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
- ipv4Match.setIpv4Destination(prefix);
- Ipv4Match i4m = ipv4Match.build();
- match.setLayer3Match(i4m);
-
- EthernetMatchBuilder eth = new EthernetMatchBuilder();
- EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder.setType(new EtherType(0x0800L));
- eth.setEthernetType(ethTypeBuilder.build());
- match.setEthernetMatch(eth.build());
-
-// AugmentTuple<Match> extAugmentWrapper = createNxMatchAugment();
-// match.addAugmentation(extAugmentWrapper.getAugmentationClass(), extAugmentWrapper.getAugmentationObject());
-
- return match;
- }
-
- private static AugmentTuple<Match> createNxMatchAugment() {
- // TODO add example
- return null;
- }
-
- private static InstructionsBuilder createDecNwTtlInstructionsBld() {
- // Add our drop action to a list
- List<Action> actionList = new ArrayList<>();
- actionList.add(createOFAction(0).build());
- actionList.add(createNxActionBld(1).build());
-
- // Create an Apply Action
- ApplyActionsBuilder aab = new ApplyActionsBuilder();
- aab.setAction(actionList);
-
- // Wrap our Apply Action in an Instruction
- InstructionBuilder ib = new InstructionBuilder();
- ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
- ib.setKey(new InstructionKey(0));
- ib.setOrder(0);
-
- // Put our Instruction in a list of Instructions
- InstructionsBuilder isb = new InstructionsBuilder();
- List<Instruction> instructions = new ArrayList<>();
- instructions.add(ib.build());
- ib.setKey(new InstructionKey(0));
- isb.setInstruction(instructions);
- return isb;
- }
-
- private static ActionBuilder createOFAction(int actionKeyVal) {
- DecNwTtlBuilder ta = new DecNwTtlBuilder();
- DecNwTtl decNwTtl = ta.build();
- ActionBuilder ab = new ActionBuilder();
- ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
- ab.setKey(new ActionKey(actionKeyVal));
- return ab;
- }
-
- private static ActionBuilder createNxActionBld(int actionKeyVal) {
- // vendor part
- DstNxRegCaseBuilder nxRegCaseBld = new DstNxRegCaseBuilder().setNxReg(NxmNxReg0.class);
- DstBuilder dstBld = new DstBuilder()
- .setDstChoice(nxRegCaseBld.build())
- .setStart(0)
- .setEnd(5);
- NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
- nxRegLoadBuilder.setDst(dstBld.build());
- nxRegLoadBuilder.setValue(BigInteger.valueOf(55L));
- NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder topNxActionCaseBld =
- new NxActionRegLoadNodesNodeTableFlowApplyActionsCaseBuilder();
- topNxActionCaseBld.setNxRegLoad(nxRegLoadBuilder.build());
-
- // base part
- ActionBuilder abExt = new ActionBuilder();
- abExt.setKey(new ActionKey(actionKeyVal));
- abExt.setAction(topNxActionCaseBld.build());
- return abExt;