Hi,
I've been struggling with a problem on my application. I need to use HP Controller Service getFlowStats function to get all the flow entries that I install on a specific switch.
The problem is that I can get all the flow entries on the switch except the flow that I really want to retrieve: it's a flow where I want to push a Vlan Header to the packets that match, set it's VlanId to 100 and send it to a specific port.
Using ovs-ofctl dump-flows we can see the the flow was correctly installed:
cookie=0x64, duration=115.19s, table=1, n_packets=0, n_bytes=0, priority=50000,ip actions=push_vlan:0x8100,set_field:100->vlan_vid,NORMAL
I'll attach screen shoots of Wireshark logs to show the flow-add message with the flow that I created and the of_flow_stats_reply logs. They both show the correct flow entry being added and being sent to the controller.
The strange part is that using tools like Wireshark and Mininets ovs-ofct dump-flows I can see that the flow is correctly installed on the datapath and packets that hit it get marked with the appropriate Vlan tag, but when I try to retrieve it using ControllerService.getFlowStats( DataPathId , TableId ), the return message shows:
MySdnLab: PacketListener: flow stats -> {fstats:tid=null,pri=0,match=null,...}
Trying to solve this problem I included a Flow Remove Flag on the flow entry to see if the switch would send it back when it's idle Timeout expires and it did and return message was correct.
So I would like to ask if someone could help me with this issue, I'll even put the code I used to build the flow and send it to the controller and the code to get it's stats.
Thank you,
PM
/**************//***********************/
private void setPushVlanFlow (DataPathId dpId){
OfmMutableFlowMod smallflowMod = (OfmMutableFlowMod) MessageFactory.create(PV, MessageType.FLOW_MOD);
MutableMatch match = MatchFactory.createMatch(PV)
.addField(FieldFactory.createBasicField(PV, OxmBasicFieldType.ETH_TYPE, EthernetType.IPv4));
smallflowMod.match((Match) match.toImmutable());
int lowLabel = 100;
Action vlanActionPush = ActionFactory.createAction(PV, ActionType.PUSH_VLAN, EthernetType.VLAN );
Action vlanActionSetField = ActionFactory.createActionSetField(PV, OxmBasicFieldType.VLAN_VID, VlanId.valueOf(lowLabel));
Action outputAction = ActionFactory.createAction(PV, ActionType.OUTPUT, Port.NORMAL);
InstrMutableAction write = InstructionFactory.createMutableInstruction( PV, InstructionType.APPLY_ACTIONS);
write.addAction(vlanActionPush)
.addAction(vlanActionSetField)
.addAction(outputAction);
smallflowMod.addInstruction( (Instruction) write.toImmutable() ) ;
smallflowMod.command(FlowModCommand.ADD)
.hardTimeout( 0 )
.idleTimeout( 10 )
.cookie(lowLabel)
.tableId( TableId.valueOf( 1 ) )
.priority( 50000 )
.bufferId( BufferId.NO_BUFFER );
try {
mControllerService.sendFlowMod( (OfmFlowMod)smallflowMod.toImmutable(), dpId );
LOG.info("MySdnLab: SwitchListener handleSmallFlows: successfully for src node " + dpId.toString());
} catch (OpenflowException e) {
// TODO Auto-generated catch block
LOG.info("MySdnLab: SwitchListener Set Initial Flows: DNS exception {}", e);
}
}
/*************************//**************************/
public void run() {
// TODO Auto-generated method stub
LOG.info("MySdnLab: PacketListener: Print Flow entries on device -> " + auxDpId.toString());
List<MBodyFlowStats> Statslist = mControllerService.getFlowStats( auxDaId , TableId.ALL);
for(MBodyFlowStats flowStats : Statslist){
LOG.info("MySdnLab: PacketListener: flow stats -> " + flowStats.toString());
}
}