import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.Meter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
public class FRMUtil {
protected static final Logger logger = LoggerFactory.getLogger(FRMUtil.class);
for (Action curaction : actions) {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = curaction
.getAction();
- if (action instanceof ControllerAction) {
- Integer length = ((ControllerAction) action).getMaxLength();
+ if (action instanceof ControllerActionCase) {
+ Integer length = ((ControllerActionCase) action).getControllerAction().getMaxLength();
if (length < 0 || length > 65294) {
logger.error("Controller: MaxLength is not valid");
return false;
}
- } else if (action instanceof OutputAction) {
- Integer length = ((OutputAction) action).getMaxLength();
- Uri outputnodeconnector = ((OutputAction) action).getOutputNodeConnector();
+ } else if (action instanceof OutputActionCase) {
+ Integer length = ((OutputActionCase) action).getOutputAction().getMaxLength();
+ Uri outputnodeconnector = ((OutputActionCase) action).getOutputAction().getOutputNodeConnector();
if (length < 0 || length > 65294) {
logger.error("OutputAction: MaxLength is not valid");
return false;
}
}
- } else if (action instanceof PushMplsAction) {
- Integer ethertype = ((PushMplsAction) action).getEthernetType();
+ } else if (action instanceof PushMplsActionCase) {
+ Integer ethertype = ((PushMplsActionCase) action).getPushMplsAction().getEthernetType();
if (ethertype != null && ethertype != 0x8847 && ethertype != 0x8848) {
logger.error("Ether Type is not valid for PushMplsAction");
return false;
}
- } else if (action instanceof PushPbbAction) {
- Integer ethertype = ((PushPbbAction) action).getEthernetType();
+ } else if (action instanceof PushPbbActionCase) {
+ Integer ethertype = ((PushPbbActionCase) action).getPushPbbAction().getEthernetType();
if (ethertype != null && ethertype != 0x88E7) {
logger.error("Ether type is not valid for PushPbbAction");
return false;
}
- } else if (action instanceof PushVlanAction) {
- Integer ethertype = ((PushVlanAction) action).getEthernetType();
+ } else if (action instanceof PushVlanActionCase) {
+ Integer ethertype = ((PushVlanActionCase) action).getPushVlanAction().getEthernetType();
if (ethertype != null && ethertype != 0x8100 && ethertype != 0x88a8) {
logger.error("Ether Type is not valid for PushVlanAction");
return false;
}
- } else if (action instanceof SetDlDstAction) {
- MacAddress address = ((SetDlDstAction) action).getAddress();
+ } else if (action instanceof SetDlDstActionCase || action instanceof SetDlSrcActionCase) {
+ MacAddress address = ((SetDlDstActionCase) action).getSetDlDstAction().getAddress();
if (address != null && !isL2AddressValid(address.getValue())) {
logger.error("SetDlDstAction: Address not valid");
return false;
}
- } else if (action instanceof SetDlSrcAction) {
- MacAddress address = ((SetDlSrcAction) action).getAddress();
+ } else if (action instanceof SetDlSrcActionCase) {
+ MacAddress address = ((SetDlSrcActionCase) action).getSetDlSrcAction().getAddress();
if (address != null && !isL2AddressValid(address.getValue())) {
logger.error("SetDlSrcAction: Address not valid");
return false;
}
- } else if (action instanceof SetQueueAction) {
- String queue = ((SetQueueAction) action).getQueue();
+ } else if (action instanceof SetQueueActionCase) {
+ String queue = ((SetQueueActionCase) action).getSetQueueAction().getQueue();
if (queue != null && !isQueueValid(queue)) {
logger.error("Queue Id not valid");
return false;
}
- } else if (action instanceof SetTpDstAction) {
- PortNumber port = ((SetTpDstAction) action).getPort();
+ } else if (action instanceof SetTpDstActionCase) {
+ PortNumber port = ((SetTpDstActionCase) action).getSetTpDstAction().getPort();
if (port != null && !isPortValid(port)) {
logger.error("Port not valid");
}
- } else if (action instanceof SetTpSrcAction) {
- PortNumber port = ((SetTpSrcAction) action).getPort();
+ } else if (action instanceof SetTpSrcActionCase) {
+ PortNumber port = ((SetTpSrcActionCase) action).getSetTpSrcAction().getPort();
if (port != null && !isPortValid(port)) {
logger.error("Port not valid");
}
- } else if (action instanceof SetVlanIdAction) {
- VlanId vlanid = ((SetVlanIdAction) action).getVlanId();
- if (vlanid != null && !isVlanIdValid(vlanid.getValue().toString())) {
- logger.error("Vlan ID is not in the range 0 - 4095");
+ } else if (action instanceof SetVlanIdActionCase) {
+ VlanId vlanid = ((SetVlanIdActionCase) action).getSetVlanIdAction().getVlanId();
+ if (vlanid != null && !isVlanIdValid(vlanid.toString())) {
+ logger.error("Vlan ID %s is not in the range 0 - 4095");
return false;
}
- } else if (action instanceof SetVlanPcpAction) {
- VlanPcp vlanpcp = ((SetVlanPcpAction) action).getVlanPcp();
- if (vlanpcp != null && !isVlanPriorityValid(vlanpcp.getValue().toString())) {
- logger.error("Vlan priority is not in the range 0 - 7");
+ } else if (action instanceof SetVlanPcpActionCase) {
+ VlanPcp vlanpcp = ((SetVlanPcpActionCase) action).getSetVlanPcpAction().getVlanPcp();
+ if (vlanpcp != null && !isVlanPriorityValid(vlanpcp.toString())) {
+ logger.error("Vlan priority %s is not in the range 0 - 7");
return false;
}
}
for (Instruction instruction : instructionsList) {
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction
.getInstruction();
- if (curInstruction instanceof GoToTable) {
+ if (curInstruction instanceof GoToTableCase) {
- Short tableid = ((GoToTable) curInstruction).getTableId();
+ Short tableid = ((GoToTableCase) curInstruction).getGoToTable().getTableId();
if (tableid < 0) {
logger.error("table id is not valid");
return false;
}
}
- else if (curInstruction instanceof WriteActions) {
+ else if (curInstruction instanceof WriteActionsCase) {
- List<Action> action = ((WriteActions) curInstruction).getAction();
+ List<Action> action = ((WriteActionsCase) curInstruction).getWriteActions().getAction();
validateActions(action);
}
- else if (curInstruction instanceof ApplyActions) {
- List<Action> action = ((ApplyActions) curInstruction).getAction();
+ else if (curInstruction instanceof ApplyActionsCase) {
+ List<Action> action = ((ApplyActionsCase) curInstruction).getApplyActions().getAction();
validateActions(action);
}
- else if (curInstruction instanceof ClearActions) {
- List<Action> action = ((ClearActions) curInstruction).getAction();
+ else if (curInstruction instanceof ClearActionsCase) {
+ List<Action> action = ((ClearActionsCase) curInstruction).getClearActions().getAction();
validateActions(action);
}
- else if (curInstruction instanceof Meter) {
+ else if (curInstruction instanceof MeterCase) {
- String meter = ((Meter) curInstruction).getMeter();
+ MeterId meter = ((MeterCase) curInstruction).getMeter().getMeterId();
if (meter != null && !isValidMeter(meter)) {
logger.error("Meter Id is not valid");
return false;
return true;
}
- public static boolean isValidMeter(String meter) {
+ public static boolean isValidMeter(MeterId meter) {
// TODO
return true;
}