import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
+import org.opendaylight.openflowplugin.openflow.md.OFConstants;
import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.session.PortFeaturesUtil;
import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
OFSessionUtil.registerSession(this, featureOutput, negotiatedVersion);
requestDesc();
requestPorts();
- requestGroupFeatures();
- requestMeterFeatures();
+ if(version == OFConstants.OFP_VERSION_1_3){
+ requestGroupFeatures();
+ requestMeterFeatures();
+ }
}
/*
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.PortStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.TableUpdated;
import org.opendaylight.yangtools.yang.binding.DataObject;
addMessagePopListener(MeterFeaturesUpdated.class, notificationPopListener);
//Notification registration for port-statistics
- addMessagePopListener(PortStatisticsUpdate.class, notificationPopListener);
+ addMessagePopListener(NodeConnectorStatisticsUpdate.class, notificationPopListener);
//Notification registration for flow-table statistics
addMessagePopListener(FlowTableStatisticsUpdate.class, notificationPopListener);
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetPortStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetPortStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetPortStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
}
@Override
- public Future<RpcResult<GetAllPortsStatisticsOutput>> getAllPortsStatistics(GetAllPortsStatisticsInput arg0) {
+ public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(GetAllNodeConnectorsStatisticsInput arg0) {
//Generate xid to associate it with the request
Long xid = this.getSessionContext().getNextXid();
this.messageService.multipartRequest(mprInput.build(), null);
// Prepare rpc return output. Set xid and send it back.
- GetAllPortsStatisticsOutputBuilder output = new GetAllPortsStatisticsOutputBuilder();
+ GetAllNodeConnectorsStatisticsOutputBuilder output = new GetAllNodeConnectorsStatisticsOutputBuilder();
output.setTransactionId(generateTransactionId(xid));
Collection<RpcError> errors = Collections.emptyList();
- RpcResult<GetAllPortsStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ RpcResult<GetAllNodeConnectorsStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
return Futures.immediateFuture(rpcResult);
}
@Override
- public Future<RpcResult<GetPortStatisticsOutput>> getPortStatistics(GetPortStatisticsInput arg0) {
+ public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(GetNodeConnectorStatisticsInput arg0) {
//Generate xid to associate it with the request
Long xid = this.getSessionContext().getNextXid();
this.messageService.multipartRequest(mprInput.build(), null);
// Prepare rpc return output. Set xid and send it back.
- GetPortStatisticsOutputBuilder output = new GetPortStatisticsOutputBuilder();
+ GetNodeConnectorStatisticsOutputBuilder output = new GetNodeConnectorStatisticsOutputBuilder();
output.setTransactionId(generateTransactionId(xid));
Collection<RpcError> errors = Collections.emptyList();
- RpcResult<GetPortStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ RpcResult<GetNodeConnectorStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
return Futures.immediateFuture(rpcResult);
}
//Generate xid to associate it with the request
Long xid = this.getSessionContext().getNextXid();
- LOG.debug("Prepare agregate statistics request to get aggregate stats for flows matching {} and installed in flow tables {} - Transaction id - {}"
+ LOG.debug("Prepare aggregate statistics request to get aggregate stats for flows matching {} and installed in flow tables {} - Transaction id - {}"
,arg0.getMatch().toString(),arg0.getTableId(),xid);
// Create multipart request header
return Futures.immediateFuture(rpcResult);
}
- @Override
- public Future<RpcResult<GetAllFlowStatisticsOutput>> getAllFlowStatistics(GetAllFlowStatisticsInput arg0) {
- //TODO: Depricated, need to clean it up. Sal-Compatibility layes is dependent on it.
- // Once sal-compatibility layer is fixed this rpc call can be removed from yang file
- return null;
- }
-
- @Override
- public Future<RpcResult<GetAllNodeConnectorStatisticsOutput>> getAllNodeConnectorStatistics(
- GetAllNodeConnectorStatisticsInput arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput arg0) {
- //TODO: Depricated, need to clean it up. Sal-Compatibility layes is dependent on it.
- // Once sal-compatibility layer is fixed this rpc call can be removed from yang file
- return null;
- }
-
- @Override
- public Future<RpcResult<GetFlowTableStatisticsOutput>> getFlowTableStatistics(GetFlowTableStatisticsInput arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
- GetNodeConnectorStatisticsInput arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
}
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.controller.sal.action.SetNwTos;
import org.opendaylight.openflowjava.protocol.api.util.BinContent;
import org.opendaylight.openflowplugin.openflow.md.OFConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorImpl;
* @param actionList
* @return List of converted SAL Actions.
*/
- public static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> toSALBucketActions(
+ public static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> toMDSalActions(
List<ActionsList> actionList) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> bucketActions = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>();
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
import java.util.ArrayList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
salFlowStatsBuilder.setMatch(MatchConvertorImpl.fromOFMatchToSALMatch(flowStats.getMatch()));
}
if(flowStats.getInstructions()!= null){
- salFlowStatsBuilder.setInstructions(toSALInstruction(flowStats.getInstructions()));
+ salFlowStatsBuilder.setInstructions(OFToMDSalFlowConvertor.toSALInstruction(flowStats.getInstructions()));
}
return salFlowStatsBuilder.build();
}
-
- /**
- * Method convert Openflow 1.3+ specific instructions to MD-SAL format
- * flow instruction
- * Note: MD-SAL won't augment this data directly to the data store,
- * so key setting is not required. If user wants to augment this data
- * directly to the data store, key setting is required for each instructions.
- * @param instructions
- * @return
- */
- public Instructions toSALInstruction(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions> instructions) {
-
- InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
-
- List<Instruction> salInstructionList = new ArrayList<Instruction>();
-
- for(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions switchInst : instructions){
- if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions){
- InstructionBuilder instBuilder = new InstructionBuilder();
- instBuilder.setInstruction(new ApplyActionsCaseBuilder().build());
- salInstructionList.add(instBuilder.build());
- }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions){
- InstructionBuilder instBuilder = new InstructionBuilder();
- instBuilder.setInstruction(new ClearActionsCaseBuilder().build());
- salInstructionList.add(instBuilder.build());
- }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable){
- InstructionBuilder instBuilder = new InstructionBuilder();
- instBuilder.setInstruction(new GoToTableCaseBuilder().build());
- salInstructionList.add(instBuilder.build());
- }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions){
- InstructionBuilder instBuilder = new InstructionBuilder();
- instBuilder.setInstruction(new WriteActionsCaseBuilder().build());
- salInstructionList.add(instBuilder.build());
- }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata){
- InstructionBuilder instBuilder = new InstructionBuilder();
- instBuilder.setInstruction(new WriteMetadataCaseBuilder().build());
- salInstructionList.add(instBuilder.build());
- }
- }
- instructionsBuilder.setInstruction(salInstructionList);
- return instructionsBuilder.build();
- }
}
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
import java.util.ArrayList;
for(BucketsList bucketDetails : bucketDescStats){
BucketBuilder bucketDesc = new BucketBuilder();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convertedSalActions =
- ActionConvertor.toSALBucketActions (bucketDetails.getActionsList());
+ ActionConvertor.toMDSalActions (bucketDetails.getActionsList());
List<Action> actions = new ArrayList<>();
int actionKey = 0;
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
import java.util.ArrayList;
--- /dev/null
+/*
+ * Copyright IBM Corporation, 2013. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+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.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.clear.actions._case.ClearActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.actions._case.WriteActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+
+public class OFToMDSalFlowConvertor {
+
+ /**
+ * Method convert Openflow 1.3+ specific instructions to MD-SAL format
+ * flow instruction
+ * Note: MD-SAL won't augment this data directly to the data store,
+ * so key setting is not required. If user wants to augment this data
+ * directly to the data store, key setting is required for each instructions.
+ * @param instructions
+ * @return
+ */
+ public static Instructions toSALInstruction(
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions> instructions) {
+
+ InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
+
+ List<Instruction> salInstructionList = new ArrayList<Instruction>();
+
+ for(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions switchInst : instructions){
+ if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions){
+
+ ActionsInstruction actionsInstruction = (ActionsInstruction)switchInst.getAugmentation(ActionsInstruction.class);
+ ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
+ ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
+
+
+ applyActionsBuilder.setAction(
+ wrapActionList(
+ ActionConvertor.toMDSalActions(actionsInstruction.getActionsList()
+ )
+ ));
+
+ applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
+
+ InstructionBuilder instBuilder = new InstructionBuilder();
+ instBuilder.setInstruction(new ApplyActionsCaseBuilder().build());
+ salInstructionList.add(instBuilder.build());
+ }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions){
+ InstructionBuilder instBuilder = new InstructionBuilder();
+
+ ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
+ ClearActionsBuilder clearActionsBuilder = new ClearActionsBuilder();
+ clearActionsCaseBuilder.setClearActions(clearActionsBuilder.build());
+
+ instBuilder.setInstruction(clearActionsCaseBuilder.build());
+ salInstructionList.add(instBuilder.build());
+ }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable){
+
+ TableIdInstruction tableIdInstruction = (TableIdInstruction)switchInst.getAugmentation(TableIdInstruction.class);
+
+ GoToTableCaseBuilder goToTableCaseBuilder = new GoToTableCaseBuilder();
+ GoToTableBuilder goToTableBuilder = new GoToTableBuilder();
+ goToTableBuilder.setTableId(tableIdInstruction.getTableId());
+ goToTableCaseBuilder.setGoToTable(goToTableBuilder.build());
+
+ InstructionBuilder instBuilder = new InstructionBuilder();
+ instBuilder.setInstruction(goToTableCaseBuilder.build());
+ salInstructionList.add(instBuilder.build());
+ }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter){
+
+ MeterIdInstruction meterIdInstruction = (MeterIdInstruction) switchInst.getAugmentation(MeterIdInstruction.class);
+
+ InstructionBuilder instBuilder = new InstructionBuilder();
+
+ MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
+ MeterBuilder meterBuilder = new MeterBuilder();
+ meterBuilder.setMeterId(new MeterId(meterIdInstruction.getMeterId()));
+ meterCaseBuilder.setMeter(meterBuilder.build());
+
+ instBuilder.setInstruction(meterCaseBuilder.build());
+ salInstructionList.add(instBuilder.build());
+ }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions){
+
+ ActionsInstruction actionsInstruction = (ActionsInstruction)switchInst.getAugmentation(ActionsInstruction.class);
+
+ WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
+ WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
+ writeActionsBuilder.setAction(wrapActionList(ActionConvertor.toMDSalActions(actionsInstruction.getActionsList())));
+ writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
+
+ InstructionBuilder instBuilder = new InstructionBuilder();
+ instBuilder.setInstruction(writeActionsCaseBuilder.build());
+ salInstructionList.add(instBuilder.build());
+
+ }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata){
+
+ MetadataInstruction metadataInstruction = (MetadataInstruction)switchInst.getAugmentation(MetadataInstruction.class);
+
+ WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
+ WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
+ writeMetadataBuilder.setMetadata(new BigInteger(metadataInstruction.getMetadata()));
+ writeMetadataBuilder.setMetadataMask(new BigInteger(metadataInstruction.getMetadataMask()));
+ writeMetadataCaseBuilder.setWriteMetadata(writeMetadataBuilder.build());
+
+ InstructionBuilder instBuilder = new InstructionBuilder();
+ instBuilder.setInstruction(writeMetadataCaseBuilder.build());
+ salInstructionList.add(instBuilder.build());
+ }
+ }
+ instructionsBuilder.setInstruction(salInstructionList);
+ return instructionsBuilder.build();
+ }
+
+ /*
+ * Method wrapping all the actions org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
+ * in org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action, to set appropriate keys
+ * for actions.
+ */
+ private static List<Action> wrapActionList(List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> actionList){
+ List<Action> actions = new ArrayList<>();
+
+ int actionKey = 0;
+ for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action : actionList){
+ ActionBuilder wrappedAction = new ActionBuilder();
+ wrappedAction.setAction(action);
+ wrappedAction.setKey(new ActionKey(actionKey));
+ wrappedAction.setOrder(actionKey);
+ actions.add(wrappedAction.build());
+ actionKey++;
+ }
+
+ return actions;
+ }
+
+
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.PortStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey;
NodeId node = this.nodeIdFromDatapathId(sc.getFeatures().getDatapathId());
switch (mpReply.getType()){
case OFPMPFLOW: {
- logger.debug("Received flow statistics reponse from openflow {} switch",msg.getVersion()==1?"1.0":"1.3+");
+ logger.info("Received flow statistics reponse from openflow {} switch",msg.getVersion()==1?"1.0":"1.3+");
FlowsStatisticsUpdateBuilder message = new FlowsStatisticsUpdateBuilder();
message.setId(node);
message.setMoreReplies(mpReply.getFlags().isOFPMPFREQMORE());
}
case OFPMPPORTSTATS: {
- logger.debug("Received port statistics multipart response");
+ logger.info("Received port statistics multipart response");
- PortStatisticsUpdateBuilder message = new PortStatisticsUpdateBuilder();
+ NodeConnectorStatisticsUpdateBuilder message = new NodeConnectorStatisticsUpdateBuilder();
message.setId(node);
message.setMoreReplies(mpReply.getFlags().isOFPMPFREQMORE());
message.setTransactionId(generateTransactionId(mpReply.getXid()));