Hi,

"ab:cd:11:22:33:41:52:68" looks like a ":" separated hexadecimal number.
On the other hand, ofctl_rest.py returns Datapath ID as a decimal number.

"ab:cd:11:22:33:41:52:68" means ...
  abcd112233415268 ... hexadecimal
  12379569789297840744 ... decimal <-- ofctl_rest.py returns this

So, if ofctl_rest.py returns 12379569789297840744, you can translate it like ...

>>> import re
>>> dpid = 12379569789297840744
>>> ":".join(re.findall(r'..?', '%016x' % dpid))
'ab:cd:11:22:33:41:52:68'

Thanks,
Iwase

On 2015年12月16日 11:58, Sergio Andrés Rivera Polanco wrote:
> That works fine with mininet dpids ... What would happen with arbritary 
> datapaths like say ab:cd:11:22:33:41:52:68. Will they receive a random 
> number???
> 
> On Tue, Dec 15, 2015 at 9:52 PM, Yusuke Iwase <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     Hi,
> 
>     Currently, ofctl_rest.py does not provide the way to display the datapath 
> IDs like 00:00:00:00:00:00:00:01.
> 
>     But you can calculate it easily as followings.
> 
>     e.g.)
>     >>> import re
>     >>> dpid = 1
>     >>> ":".join(re.findall(r'..?', '%016x' % dpid))
>     '00:00:00:00:00:00:00:01'
> 
>     Thanks,
>     Iwase
> 
>     On 2015年12月09日 04:59, Sergio Andrés Rivera Polanco wrote:
>     > Hi, I want to fetch the real datapath ids of the switches instead of 
> the "easy-to-read" ones displayed by the rest API.
>     >
>     > Something like:
>     >
>     > curl -X GET http://localhost:8080/stats/switches
>     >
>     > [00:00:00:00:00:00:00:01, 00:00:00:00:00:00:00:02, ... ]
>     >
>     > instead of retrieving just "1", "2", etc. I would like to use these 
> dpids for calls to the other APIs as well. Is it possible to achieve that?
>     >
>     > Sergio.
>     >
>     >
>     > 
> ------------------------------------------------------------------------------
>     > Go from Idea to Many App Stores Faster with Intel(R) XDK
>     > Give your users amazing mobile app experiences with Intel(R) XDK.
>     > Use one codebase in this all-in-one HTML5 development environment.
>     > Design, debug & build mobile apps & 2D/3D high-impact games for 
> multiple OSs.
>     > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
>     >
>     >
>     >
>     > _______________________________________________
>     > Ryu-devel mailing list
>     > [email protected] <mailto:[email protected]>
>     > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>     >
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to