Stanford OpenFlow Forums: API and question about wildcard - Stanford OpenFlow Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

API and question about wildcard Rate Topic: -----

#1 User is offline   Ryan White 

  • Member
  • PipPip
  • Group: Members
  • Posts: 17
  • Joined: 11-June 12

Posted 02 October 2012 - 12:11 PM

Hi,

I have a question about Beacon. Specifically, I want to install a flow mod where the OFMatch is based on a range of dest IP addresses, maybe a subnet with a mask.

Is there a definitive API users manual? I was looking through the javadoc that came with the beacon tutorial, and there was no entry for OFMatch. And I would assume the OFMatch.setWildcards method would require some explanation on how to use it but I couldnt find any. Is there an essential document that I'm missing? It seems like every time I go to do something in beacon I end up back here, which is fine with me, but as to not have you (David) answering a thousand questions I'm asking if maybe theres a document I'm missing.

This post is written with the assumption that I can achieve what I am trying to do somehow through the use of the setWildcard method. That is what this is for, right? Or is it for something else. Can you please explain it and point me in the right direction?

Thanks, Ryan White.
0

#2 User is offline   David Erickson 

  • Developer
  • Group: Administrators
  • Posts: 653
  • Joined: 28-June 11

Posted 02 October 2012 - 04:32 PM

View PostRyan White, on 02 October 2012 - 12:11 PM, said:

Hi,

I have a question about Beacon. Specifically, I want to install a flow mod where the OFMatch is based on a range of dest IP addresses, maybe a subnet with a mask.

Is there a definitive API users manual? I was looking through the javadoc that came with the beacon tutorial, and there was no entry for OFMatch. And I would assume the OFMatch.setWildcards method would require some explanation on how to use it but I couldnt find any. Is there an essential document that I'm missing? It seems like every time I go to do something in beacon I end up back here, which is fine with me, but as to not have you (David) answering a thousand questions I'm asking if maybe theres a document I'm missing.

This post is written with the assumption that I can achieve what I am trying to do somehow through the use of the setWildcard method. That is what this is for, right? Or is it for something else. Can you please explain it and point me in the right direction?

Thanks, Ryan White.


Hey Ryan
Good questions. There are two Javadocs, one for Beacon proper, and one for OpenFlowJ which contains OFMatch. You can get to OpenFlowJ's from the resources link on the left side of the Wiki, or directly here. Perhaps it is too buried on the Resources page, if you have an alternative suggestions where it should be linked from I'd love to hear it.

The descriptions of the elements within the OFJ Javadoc are somewhat sparse, there is an inherent assumption when using this that you have at least looked at the OpenFlow 1.0 spec, or if not, that you can go look at it to find answers. What you are trying to do is actually one of the trickier elements of the 1.0 spec, it is easier in versions 1.2+. The wildcards field is described on page 20/21 of the OF 1.0 spec. In essence what you want to do is figure out how many bits of the IP you want wildcarded, then take the lowest 6 bits of that number and shift it by OFMatch.OFPFW_NW_DST_SHIFT and set that on the wildcard field.

Let me know if you need more clarification.
0

#3 User is offline   Ryan White 

  • Member
  • PipPip
  • Group: Members
  • Posts: 17
  • Joined: 11-June 12

Posted 03 October 2012 - 07:03 AM

Thanks, so basically for a netmask of 255.255.255.0 (8 bits wild) it's
int wildcard = 0;
wildcard &= ((8 & 0x3F) << OFMatch.OFPFW_NW_DST_SHIFT);
right?

Also, I'm trying to specify that what I'm working with is IP.
I couldnt figure it out based on the javadoc and OpenFlow spec.
Is it OFMatch.setNetworkProtocol(byte)? If so, what parameter?
0

#4 User is offline   David Erickson 

  • Developer
  • Group: Administrators
  • Posts: 653
  • Joined: 28-June 11

Posted 03 October 2012 - 07:53 AM

View PostRyan White, on 03 October 2012 - 07:03 AM, said:

Thanks, so basically for a netmask of 255.255.255.0 (8 bits wild) it's
int wildcard = 0;
wildcard &= ((8 & 0x3F) << OFMatch.OFPFW_NW_DST_SHIFT);
right?

Also, I'm trying to specify that what I'm working with is IP.
I couldnt figure it out based on the javadoc and OpenFlow spec.
Is it OFMatch.setNetworkProtocol(byte)? If so, what parameter?


You can grab that from the packet package in Beacon, Ethernet.TYPE_IPv4. Also if you intend to only match on the dest ip range, make sure you wildcard everything else except ethernet type.
0

#5 User is offline   linchong 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 27-March 15

Posted 27 March 2015 - 02:58 AM

View PostRyan White, on 03 October 2012 - 07:03 AM, said:

Thanks, so basically for a netmask of 255.255.255.0 (8 bits wild) it's
int wildcard = 0;
wildcard &= ((8 & 0x3F) << OFMatch.OFPFW_NW_DST_SHIFT);
right?

Also, I'm trying to specify that what I'm working with is IP.
I couldnt figure it out based on the javadoc and OpenFlow spec.
Is it OFMatch.setNetworkProtocol(byte)? If so, what parameter?


Sorry I still do not understand.
int wildcard=0;
wildcard &= ((8 & 0x3F) << OFMatch.OFPFW_NW_DST_SHIFT); this is equivalent to wildcard = 0&((8 & 0x3F) << OFMatch.OFPFW_NW_DST_SHIFT);
and therefore, wildcard still equals 0, right?

Could you give an example on how to match a destination ip address? for example 192.168.1.1; I mean, How to set the wildcard.

I tried to use match.setWildcards(OFMatch.OFPFW_ALL ^ (OFMatch.OFPFW_NW_DST_ALL)); found in https://openflow.sta...ch__1#entry1751 , but It doesn't seem to work. That can not be the problem of other parts of my code, because I tried to set
match.setWildcards(OFMatch.OFPFW_ALL&OFMatch.OFPFW_IN_PORT), which matches a specific input port, and my code works. But when it comes to setting wildcard for the destination
ip address, I can not figure out how to do it.

Really appriciate your help,
Best regards!

after two days of tests, Now I can set the wildcards correctly, Thank you very much.
0

#6 User is offline   joyetech_tr 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 27-August 16
  • Locationistanbul

Posted 27 August 2016 - 03:22 AM

I do not understand this issue at all. It should be more understandable expression
0

#7 User is offline   joblessnanny388 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 21-July 17

Posted 20 August 2017 - 07:56 AM

I think it's not clear to all and also me too.
0

#8 User is offline   Travel MAP 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 21-September 17
  • LocationUSA

Posted 03 October 2017 - 05:57 AM

Thanks to admin for quite good answer. I cant even add smth!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users