Re: [openflowplugin-dev] OF1.0 to OF1.3 no flow insertion

2018-02-15 Thread Anil Vishnoi
On Wed, Feb 14, 2018 at 4:27 AM, Jacob Steadman 
wrote:

> Hi,
>
>
>
> I had code that inserts flow rules in the switches once the feature is
> installed at the controller. It was and still is working fine for OF1.0 but
> I had to upgrade to OF1.3 to make use of multible flow tables.
>
>
>
> If I replace the match so that the flow matches everything, the rule is
> inserted fine so I’m assuming the match is what creates the issue.
>
>
>
> private Flow blockFlow(Short tableId, int priority) {
>
>  FlowBuilder Flow = new FlowBuilder() // /**Flow to hold
> DNS rule*/ //
>
> .setTableId(tableId) //
>
> .setFlowName("DropDNSx");
>
>
>
> Flow.setId(new FlowId(Long.toString(137))); /**Set flow
> ID*/
>
>
>
> // Match on port  and ip
>
> UdpMatch dnsPort = new UdpMatchBuilder().setUdpSourcePort(new
> PortNumber(portNum)).build();
>
>
>
>
> ​​
> Ipv4MatchArbitraryBitMask SrcIp = new Ipv4MatchArbitraryBitMaskBuilder().
> setIpv4SourceAddressNoMask(SrcIP).build();
>
> ​I believe in case of openflow 1.0 , plugin should be ignoring
Ipv4MatchArbitraryBitMask​, as it's only supported for openflow 1.3 only,
as openflow 1.0 don't have mask constraints for ip address. So in case of
openflow 1.0, it should be installing only UDP match based flow. I think if
you comment this Ipv4Match, it might work with openflow 1.3 as well. Which
switch are you using for the test? Do that switch support  arbitrary bit
mask for ip addresses?

>
>
> Match Match = new MatchBuilder().setLayer4Match(
> Port).setLayer3Match(SrcIp).build();
>
>
>
> List actions = new ArrayList<>();
>
>
>
> actions.add(getDropAction());
>
>
>
> // Create an Apply Action
>
> ApplyActions applyActions = new ApplyActionsBuilder() //
>
> .setAction(ImmutableList.copyOf(actions)) //
>
> .build();
>
>
>
> // Wrap our Apply Action in an Instruction
>
> Instruction applyActionsInstruction = new InstructionBuilder()
> //
>
> .setOrder(0)
>
> .setInstruction(new ApplyActionsCaseBuilder()//
>
> .setApplyActions(applyActions) //
>
> .build()) //
>
> .build();
>
>
>
> // Put our Instruction in a list of Instructions
>
> Flow
>
> .setMatch(Match) //
>
> .setInstructions(new InstructionsBuilder() //
>
> .setInstruction(ImmutableList.of(applyActionsInstruction))
> //
>
> .build()) //
>
> .setPriority(priority) //
>
> .setBufferId(OFConstants.OFP_NO_BUFFER) //
>
> .setHardTimeout(flowHardTimeout) //
>
> .setIdleTimeout(flowIdleTimeout) //
>
> .setCookie(new FlowCookie(BigInteger.valueOf(
> flowCookieInc.getAndIncrement(
>
> .setFlags(new FlowModFlags(false, false, false, false, false));
>
>
>
> LOG.info("Jacob, flow blocked...");
>
>
>
> return dnsxFlow.build();
>
> }
>
> ___
> openflowplugin-dev mailing list
> openflowplugin-dev@lists.opendaylight.org
> https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev
>
>


-- 
Thanks
Anil
___
openflowplugin-dev mailing list
openflowplugin-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev


Re: [openflowplugin-dev] OF1.0 to OF1.3 no flow insertion

2018-02-15 Thread Jamo Luhrsen
(adding back ofp-dev)

I'm inclined to think you have a bug, Jacob, but the OFP devs can
confirm that. The switch is rejecting the flow and openflowjava
is having trouble with deserializing (whatever that means).


Either way, you could open a jira ticket for this and
give the details you've already shared via email. That will hopefully
get someone to take a deeper look. And, btw, if you keep digging and
figure out a fix, you could push a patch for your own jira :)

https://jira.opendaylight.org/projects/OPNFLWPLUG/

JamO

On 2/15/18 6:06 AM, Jacob Steadman wrote:
> Hi guys thanks for the replies.
> 
>  
> 
> I’ve had a look where you suggested and tried playing around with things, but 
> still no luck. I get the following
> OFPT_ERROR returning from the OVS And I can see a warning in the 
> karaf.log just before the “Jacob, flow blocked”
> statement is displayed (attached).
> 
>  
> 
>  
> 
> *From:*Shuva Kar [mailto:shuva.jyoti.kar...@gmail.com]
> *Sent:* 15 February 2018 03:16
> *To:* Jacob Steadman ; 
> openflowplugin-dev@lists.opendaylight.org
> *Cc:* Jamo Luhrsen 
> *Subject:* Re: [openflowplugin-dev] OF1.0 to OF1.3 no flow insertion
> 
>  
> 
> Overall the structure looks fine to me except that I could not find 
> definition of some variables, which I am sure you
> would have taken care.
> 
> Apart from looking at the logs what JamO mentioned, it would be great if you 
> could attach a Wireshark onto the 6653 port
> and see if the flow is sent over the wire, and possibly why the ovs(I assume) 
> is rejecting it.
> 
>  
> 
> Eg restconf xml : 
> https://wiki.opendaylight.org/view/OpenDaylight_OpenFlow_Plugin::End_to_End_Inventory
> 
>  
> 
> thanks
> 
> Shuva
> 
>  
> 
> On 15-Feb-2018, at 12:53 AM, Jamo Luhrsen  <mailto:jluhr...@gmail.com>> wrote:
> 
>  
> 
> Jacob,
> 
> I wont really be able to help debug this at the java level, but what
> do you see on the switch side and in karaf.log? Wondering if the flow
> is being sent down to the switch, which is rejecting it for some
> reason? Or possibly, the internal work hits some condition which
> would throw an Exception in karaf.log.
> 
> just some places to check for more clues.
> 
> Thanks,
> JamO
> 
> On 2/14/18 4:27 AM, Jacob Steadman wrote:
> 
> Hi,
> 
>  
> 
> I had code that inserts flow rules in the switches once the feature 
> is installed at the controller. It was and
> still is
> working fine for OF1.0 but I had to upgrade to OF1.3 to make use of 
> multible flow tables.
> 
>  
> 
> If I replace the match so that the flow matches everything, the rule 
> is inserted fine so I’m assuming the match
> is what
> creates the issue.
> 
>  
> 
> private Flow blockFlow(Short tableId, int priority) {
> 
>      FlowBuilder Flow = new FlowBuilder() // /**Flow to 
> hold DNS rule*/ //
> 
>     .setTableId(tableId) //
> 
>     .setFlowName("DropDNSx");
> 
>  
> 
>     Flow.setId(new FlowId(Long.toString(137))); /**Set 
> flow ID*/
> 
>    
> 
> // Match on port  and ip  
> 
> UdpMatch dnsPort = new 
> UdpMatchBuilder().setUdpSourcePort(new PortNumber(portNum)).build();
> 
>    
> 
> Ipv4MatchArbitraryBitMask SrcIp = new
> 
> Ipv4MatchArbitraryBitMaskBuilder().setIpv4SourceAddressNoMask(SrcIP).build();
> 
>    
> 
> Match Match = new 
> MatchBuilder().setLayer4Match(Port).setLayer3Match(SrcIp).build();
> 
>    
> 
> List actions = new ArrayList<>();
> 
>   
> 
> actions.add(getDropAction());
> 
>    
> 
> // Create an Apply Action
> 
>     ApplyActions applyActions = new ApplyActionsBuilder() //
> 
>     .setAction(ImmutableList.copyOf(actions)) //
> 
>     .build();
> 
>  
> 
>     // Wrap our Apply Action in an Instruction
> 
>     Instruction applyActionsInstruction = new 
> InstructionBuilder() //
> 
>     .setOrder(0)
> 
>     .setInstruction(new ApplyActionsCaseBuilder()//
> 
>     .setApplyActions(applyActions) //

Re: [openflowplugin-dev] OF1.0 to OF1.3 no flow insertion

2018-02-14 Thread Shuva Kar
Overall the structure looks fine to me except that I could not find definition 
of some variables, which I am sure you would have taken care.
Apart from looking at the logs what JamO mentioned, it would be great if you 
could attach a Wireshark onto the 6653 port and see if the flow is sent over 
the wire, and possibly why the ovs(I assume) is rejecting it.

Eg restconf xml : 
https://wiki.opendaylight.org/view/OpenDaylight_OpenFlow_Plugin::End_to_End_Inventory
 


thanks
Shuva
 
> On 15-Feb-2018, at 12:53 AM, Jamo Luhrsen  wrote:
> 
> Jacob,
> 
> I wont really be able to help debug this at the java level, but what
> do you see on the switch side and in karaf.log? Wondering if the flow
> is being sent down to the switch, which is rejecting it for some
> reason? Or possibly, the internal work hits some condition which
> would throw an Exception in karaf.log.
> 
> just some places to check for more clues.
> 
> Thanks,
> JamO
> 
> On 2/14/18 4:27 AM, Jacob Steadman wrote:
>> Hi,
>> 
>>  
>> 
>> I had code that inserts flow rules in the switches once the feature is 
>> installed at the controller. It was and still is
>> working fine for OF1.0 but I had to upgrade to OF1.3 to make use of multible 
>> flow tables.
>> 
>>  
>> 
>> If I replace the match so that the flow matches everything, the rule is 
>> inserted fine so I’m assuming the match is what
>> creates the issue.
>> 
>>  
>> 
>> private Flow blockFlow(Short tableId, int priority) {
>> 
>>  FlowBuilder Flow = new FlowBuilder() // /**Flow to hold DNS 
>> rule*/ //
>> 
>> .setTableId(tableId) //
>> 
>> .setFlowName("DropDNSx");
>> 
>>  
>> 
>> Flow.setId(new FlowId(Long.toString(137))); /**Set flow ID*/
>> 
>>
>> 
>> // Match on port  and ip  
>> 
>> UdpMatch dnsPort = new UdpMatchBuilder().setUdpSourcePort(new 
>> PortNumber(portNum)).build();
>> 
>>
>> 
>> Ipv4MatchArbitraryBitMask SrcIp = new
>> Ipv4MatchArbitraryBitMaskBuilder().setIpv4SourceAddressNoMask(SrcIP).build();
>> 
>>
>> 
>> Match Match = new 
>> MatchBuilder().setLayer4Match(Port).setLayer3Match(SrcIp).build();
>> 
>>
>> 
>> List actions = new ArrayList<>();
>> 
>>   
>> 
>> actions.add(getDropAction());
>> 
>>
>> 
>> // Create an Apply Action
>> 
>> ApplyActions applyActions = new ApplyActionsBuilder() //
>> 
>> .setAction(ImmutableList.copyOf(actions)) //
>> 
>> .build();
>> 
>>  
>> 
>> // Wrap our Apply Action in an Instruction
>> 
>> Instruction applyActionsInstruction = new InstructionBuilder() //
>> 
>> .setOrder(0)
>> 
>> .setInstruction(new ApplyActionsCaseBuilder()//
>> 
>> .setApplyActions(applyActions) //
>> 
>> .build()) //
>> 
>> .build();
>> 
>>  
>> 
>> // Put our Instruction in a list of Instructions
>> 
>> Flow
>> 
>> .setMatch(Match) //
>> 
>> .setInstructions(new InstructionsBuilder() //
>> 
>> 
>> .setInstruction(ImmutableList.of(applyActionsInstruction)) //
>> 
>> .build()) //
>> 
>> .setPriority(priority) //
>> 
>> .setBufferId(OFConstants.OFP_NO_BUFFER) //
>> 
>> .setHardTimeout(flowHardTimeout) //
>> 
>> .setIdleTimeout(flowIdleTimeout) //
>> 
>> .setCookie(new 
>> FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement(
>> 
>> .setFlags(new FlowModFlags(false, false, false, false, false));
>> 
>>
>> 
>> LOG.info("Jacob, flow blocked...");
>> 
>>
>> 
>> return dnsxFlow.build();
>> 
>> }
>> 
>> 
>> ___
>> openflowplugin-dev mailing list
>> openflowplugin-dev@lists.opendaylight.org
>> https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev
>> 
> ___
> openflowplugin-dev mailing list
> openflowplugin-dev@lists.opendaylight.org
> https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev

___
openflowplugin-dev mailing list
openflowplugin-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev


Re: [openflowplugin-dev] OF1.0 to OF1.3 no flow insertion

2018-02-14 Thread Jamo Luhrsen
Jacob,

I wont really be able to help debug this at the java level, but what
do you see on the switch side and in karaf.log? Wondering if the flow
is being sent down to the switch, which is rejecting it for some
reason? Or possibly, the internal work hits some condition which
would throw an Exception in karaf.log.

just some places to check for more clues.

Thanks,
JamO

On 2/14/18 4:27 AM, Jacob Steadman wrote:
> Hi,
> 
>  
> 
> I had code that inserts flow rules in the switches once the feature is 
> installed at the controller. It was and still is
> working fine for OF1.0 but I had to upgrade to OF1.3 to make use of multible 
> flow tables.
> 
>  
> 
> If I replace the match so that the flow matches everything, the rule is 
> inserted fine so I’m assuming the match is what
> creates the issue.
> 
>  
> 
> private Flow blockFlow(Short tableId, int priority) {
> 
>      FlowBuilder Flow = new FlowBuilder() // /**Flow to hold DNS 
> rule*/ //
> 
>     .setTableId(tableId) //
> 
>     .setFlowName("DropDNSx");
> 
>  
> 
>     Flow.setId(new FlowId(Long.toString(137))); /**Set flow ID*/
> 
>    
> 
> // Match on port  and ip  
> 
> UdpMatch dnsPort = new UdpMatchBuilder().setUdpSourcePort(new 
> PortNumber(portNum)).build();
> 
>    
> 
> Ipv4MatchArbitraryBitMask SrcIp = new
> Ipv4MatchArbitraryBitMaskBuilder().setIpv4SourceAddressNoMask(SrcIP).build();
> 
>    
> 
> Match Match = new 
> MatchBuilder().setLayer4Match(Port).setLayer3Match(SrcIp).build();
> 
>    
> 
> List actions = new ArrayList<>();
> 
>   
> 
> actions.add(getDropAction());
> 
>    
> 
> // Create an Apply Action
> 
>     ApplyActions applyActions = new ApplyActionsBuilder() //
> 
>     .setAction(ImmutableList.copyOf(actions)) //
> 
>     .build();
> 
>  
> 
>     // Wrap our Apply Action in an Instruction
> 
>     Instruction applyActionsInstruction = new InstructionBuilder() //
> 
>     .setOrder(0)
> 
>     .setInstruction(new ApplyActionsCaseBuilder()//
> 
>     .setApplyActions(applyActions) //
> 
>     .build()) //
> 
>     .build();
> 
>  
> 
>     // Put our Instruction in a list of Instructions
> 
>     Flow
> 
>     .setMatch(Match) //
> 
>     .setInstructions(new InstructionsBuilder() //
> 
>     
> .setInstruction(ImmutableList.of(applyActionsInstruction)) //
> 
>     .build()) //
> 
>     .setPriority(priority) //
> 
>     .setBufferId(OFConstants.OFP_NO_BUFFER) //
> 
>     .setHardTimeout(flowHardTimeout) //
> 
>     .setIdleTimeout(flowIdleTimeout) //
> 
>     .setCookie(new 
> FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement(
> 
>     .setFlags(new FlowModFlags(false, false, false, false, false));
> 
>    
> 
> LOG.info("Jacob, flow blocked...");
> 
>    
> 
> return dnsxFlow.build();
> 
>     }
> 
> 
> ___
> openflowplugin-dev mailing list
> openflowplugin-dev@lists.opendaylight.org
> https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev
> 
___
openflowplugin-dev mailing list
openflowplugin-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev


[openflowplugin-dev] OF1.0 to OF1.3 no flow insertion

2018-02-14 Thread Jacob Steadman
Hi,

I had code that inserts flow rules in the switches once the feature is 
installed at the controller. It was and still is working fine for OF1.0 but I 
had to upgrade to OF1.3 to make use of multible flow tables.

If I replace the match so that the flow matches everything, the rule is 
inserted fine so I'm assuming the match is what creates the issue.

private Flow blockFlow(Short tableId, int priority) {
 FlowBuilder Flow = new FlowBuilder() // /**Flow to hold DNS 
rule*/ //
.setTableId(tableId) //
.setFlowName("DropDNSx");

Flow.setId(new FlowId(Long.toString(137))); /**Set flow ID*/

// Match on port  and ip
UdpMatch dnsPort = new UdpMatchBuilder().setUdpSourcePort(new 
PortNumber(portNum)).build();

Ipv4MatchArbitraryBitMask SrcIp = new 
Ipv4MatchArbitraryBitMaskBuilder().setIpv4SourceAddressNoMask(SrcIP).build();

Match Match = new 
MatchBuilder().setLayer4Match(Port).setLayer3Match(SrcIp).build();

List actions = new ArrayList<>();

actions.add(getDropAction());

// Create an Apply Action
ApplyActions applyActions = new ApplyActionsBuilder() //
.setAction(ImmutableList.copyOf(actions)) //
.build();

// Wrap our Apply Action in an Instruction
Instruction applyActionsInstruction = new InstructionBuilder() //
.setOrder(0)
.setInstruction(new ApplyActionsCaseBuilder()//
.setApplyActions(applyActions) //
.build()) //
.build();

// Put our Instruction in a list of Instructions
Flow
.setMatch(Match) //
.setInstructions(new InstructionsBuilder() //
.setInstruction(ImmutableList.of(applyActionsInstruction)) 
//
.build()) //
.setPriority(priority) //
.setBufferId(OFConstants.OFP_NO_BUFFER) //
.setHardTimeout(flowHardTimeout) //
.setIdleTimeout(flowIdleTimeout) //
.setCookie(new 
FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement(
.setFlags(new FlowModFlags(false, false, false, false, false));

LOG.info("Jacob, flow blocked...");

return dnsxFlow.build();
}
___
openflowplugin-dev mailing list
openflowplugin-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev