- public static class RegMatch {
-
- final Class<? extends NxmNxReg> reg;
- final Long value;
-
- public RegMatch(Class<? extends NxmNxReg> reg, Long value) {
- super();
- this.reg = reg;
- this.value = value;
- }
-
- public static RegMatch of(Class<? extends NxmNxReg> reg, Long value) {
- return new RegMatch(reg, value);
- }
- }
-
- public static void addNxRegMatch(MatchBuilder match, RegMatch... matches) {
- ArrayList<ExtensionList> extensions = new ArrayList<>();
- for (RegMatch rm : matches) {
- Class<? extends ExtensionKey> key;
- if (NxmNxReg0.class.equals(rm.reg)) {
- key = NxmNxReg0Key.class;
- } else if (NxmNxReg1.class.equals(rm.reg)) {
- key = NxmNxReg1Key.class;
- } else if (NxmNxReg2.class.equals(rm.reg)) {
- key = NxmNxReg2Key.class;
- } else if (NxmNxReg3.class.equals(rm.reg)) {
- key = NxmNxReg3Key.class;
- } else if (NxmNxReg4.class.equals(rm.reg)) {
- key = NxmNxReg4Key.class;
- } else if (NxmNxReg5.class.equals(rm.reg)) {
- key = NxmNxReg5Key.class;
- } else if (NxmNxReg6.class.equals(rm.reg)) {
- key = NxmNxReg6Key.class;
- } else {
- key = NxmNxReg7Key.class;
- }
- NxAugMatchNodesNodeTableFlow am = new NxAugMatchNodesNodeTableFlowBuilder().setNxmNxReg(
- new NxmNxRegBuilder().setReg(rm.reg).setValue(rm.value).build()).build();
- extensions.add(new ExtensionListBuilder().setExtensionKey(key)
- .setExtension(new ExtensionBuilder().addAugmentation(NxAugMatchNodesNodeTableFlow.class, am).build())
- .build());
- }
- GeneralAugMatchNodesNodeTableFlow m = new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(
- extensions).build();
- match.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, m);
-
- }
-
-
- private List<InstructionInfo> getInstructionsInPortForOutGroup(
- long GroupId) {
- List<InstructionInfo> mkInstructions = new ArrayList<InstructionInfo>();
- List <ActionInfo> actionsInfos = new ArrayList <ActionInfo> ();
- actionsInfos.add(new ActionInfo(ActionType.nx_resubmit, new String[]{ "123"}));
- actionsInfos.add(new ActionInfo(ActionType.group, new String[]{Long.toString(GroupId)}));
- mkInstructions.add(new InstructionInfo(InstructionType.write_actions, actionsInfos));
- return mkInstructions;
- }
-