Re: [Ryu-devel] DHCP server

2017-08-07 Thread Mahmoud Elzoghbi
Thank you Iwas


 I gonna try and I will tell you what happen


On Aug 7, 2017 2:52 AM, "Iwase Yusuke"  wrote:

> Hi Mahmoud,
>
> Excuse me for cutting in.
>
>
> This app seems to be developed on out-side of Ryu-devel, and I don't know
> the details...
> How about contacting to the author of this app?
>
>
> FYI, from source code, this app supposes the topology with a single switch.
> I've tried as the following, and it seemed to work.
>
> $ sudo mn --controller remote
> ...(snip)...
> ### Manually install "table-miss" flow entry
> mininet> sh ovs-ofctl add-flow s1 actions=CONTROLLER
> mininet> sh ovs-ofctl dump-flows s1
> NXST_FLOW reply (xid=0x4):
>  cookie=0x0, duration=1.112s, table=0, n_packets=0, n_bytes=0, idle_age=1,
> actions=CONTROLLER:65535
> ...(snip)...
>
> $ ryu-manager dhcp.py
> ...(snip)...
> loading app dhcp.py
> loading app ryu.controller.ofp_handler
> instantiating app ryu.controller.ofp_handler of OFPHandler
> instantiating app dhcp.py of SimpleDHCPServer
> ...(snip)...
>
> ### Remove all address which Mininet automatically assigned
> h1> ip address flush h1-eth0
> h1> ip address
> ...(snip)...
> 2: h1-eth0@if21:  mtu 1500 qdisc noqueue
> state UP group default qlen 1000
> link/ether fe:94:14:05:6b:9a brd ff:ff:ff:ff:ff:ff link-netnsid 0
> ### Run DHCP client
> h1> dhclient h1-eth0
> h1> ip address
> ...(snip)...
> 2: h1-eth0@if21:  mtu 1500 qdisc noqueue
> state UP group default qlen 1000
> link/ether fe:94:14:05:6b:9a brd ff:ff:ff:ff:ff:ff link-netnsid 0
> inet 192.168.8.254/24 brd 192.168.8.255 scope global h1-eth0
>valid_lft forever preferred_lft forever
> ...(snip)...
>
>
> Thanks,
> Iwase
>
>
> On 2017年08月07日 07:39, Mahmoud Elzoghbi wrote:
>
>> I found someone implemented DHCP server application and share source code
>> in  Github site but i can't  create topology in mininet deal with this
>> application.
>>
>> source code : https://github.com/John-Lin/nat/blob/master/dhcp.py
>>
>> thank you,,
>>
>> On Tue, Aug 1, 2017 at 2:16 AM, Fujimoto Satoshi <
>> satoshi.fujimo...@gmail.com > wrote:
>>
>> Hi, Mahmoud
>>
>> Ryu has the packet library for DHCP, so it may be possible to make
>> your own DHCP server in Ryu
>> application.
>> However it will be very difficult work. Ryu does not provide any DHCP
>> server features.
>>
>> I don't know what you want to do with DHCP,
>> but how about running DHCP server independently from Ryu?
>> I assume you have the topology like below:
>>
>>   ┌-c0-┐
>>   |  |
>> h1--s1-s2-h2
>>
>> (h1 and h2 means hosts, and s1 and s2 means OVS)
>>
>> I suggest you to run DHCP server in c0 besides Ryu application,
>> and install flows to forward DHCP packets to DHCP server.
>> Then the DHCP server can receive DHCP packets in the topology.
>>
>> In this case, how to get the binding table depends on the DHCP server
>> you use.
>>
>>
>> Thanks,
>> Fujimoto
>>
>>
>>
>> On 2017年07月31日 23:57, Mahmoud Elzoghbi wrote:
>>
>>> hi
>>>  i need to implement DHCP server in RYU controller and topology file
>>> in  mininet to deal with dhcp
>>>
>>> and how to get binding table of DHCP server
>>>
>>> any help to accomplish this task
>>>
>>>
>>>
>>> 
>>> --
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>>
>>>
>>> ___
>>> Ryu-devel mailing list
>>> Ryu-devel@lists.sourceforge.net >> forge.net>
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>> 
>>>
>>
>>
>>
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> ___
>> Ryu-devel mailing list
>> Ryu-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] DHCP server

2017-08-06 Thread Iwase Yusuke

Hi Mahmoud,

Excuse me for cutting in.


This app seems to be developed on out-side of Ryu-devel, and I don't know the 
details...
How about contacting to the author of this app?


FYI, from source code, this app supposes the topology with a single switch.
I've tried as the following, and it seemed to work.

$ sudo mn --controller remote
...(snip)...
### Manually install "table-miss" flow entry
mininet> sh ovs-ofctl add-flow s1 actions=CONTROLLER
mininet> sh ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=1.112s, table=0, n_packets=0, n_bytes=0, idle_age=1, 
actions=CONTROLLER:65535
...(snip)...

$ ryu-manager dhcp.py
...(snip)...
loading app dhcp.py
loading app ryu.controller.ofp_handler
instantiating app ryu.controller.ofp_handler of OFPHandler
instantiating app dhcp.py of SimpleDHCPServer
...(snip)...

### Remove all address which Mininet automatically assigned
h1> ip address flush h1-eth0
h1> ip address
...(snip)...
2: h1-eth0@if21:  mtu 1500 qdisc noqueue state UP group default 
qlen 1000

link/ether fe:94:14:05:6b:9a brd ff:ff:ff:ff:ff:ff link-netnsid 0
### Run DHCP client
h1> dhclient h1-eth0
h1> ip address
...(snip)...
2: h1-eth0@if21:  mtu 1500 qdisc noqueue state UP group default 
qlen 1000

link/ether fe:94:14:05:6b:9a brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.8.254/24 brd 192.168.8.255 scope global h1-eth0
   valid_lft forever preferred_lft forever
...(snip)...


Thanks,
Iwase


On 2017年08月07日 07:39, Mahmoud Elzoghbi wrote:
I found someone implemented DHCP server application and share source code in  Github site but i 
can't  create topology in mininet deal with this application.


source code : https://github.com/John-Lin/nat/blob/master/dhcp.py

thank you,,

On Tue, Aug 1, 2017 at 2:16 AM, Fujimoto Satoshi > wrote:


Hi, Mahmoud

Ryu has the packet library for DHCP, so it may be possible to make your own 
DHCP server in Ryu
application.
However it will be very difficult work. Ryu does not provide any DHCP 
server features.

I don't know what you want to do with DHCP,
but how about running DHCP server independently from Ryu?
I assume you have the topology like below:

  ┌-c0-┐
  |  |
h1--s1-s2-h2

(h1 and h2 means hosts, and s1 and s2 means OVS)

I suggest you to run DHCP server in c0 besides Ryu application,
and install flows to forward DHCP packets to DHCP server.
Then the DHCP server can receive DHCP packets in the topology.

In this case, how to get the binding table depends on the DHCP server you 
use.


Thanks,
Fujimoto



On 2017年07月31日 23:57, Mahmoud Elzoghbi wrote:

hi
 i need to implement DHCP server in RYU controller and topology file in  
mininet to deal with dhcp

and how to get binding table of DHCP server

any help to accomplish this task




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!http://sdm.link/slashdot


___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/ryu-devel






--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot



___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] DHCP server

2017-08-06 Thread Mahmoud Elzoghbi
I found someone implemented DHCP server application and share source code
in  Github site but i can't  create topology in mininet deal with this
application.

source code : https://github.com/John-Lin/nat/blob/master/dhcp.py

thank you,,

On Tue, Aug 1, 2017 at 2:16 AM, Fujimoto Satoshi <
satoshi.fujimo...@gmail.com> wrote:

> Hi, Mahmoud
>
> Ryu has the packet library for DHCP, so it may be possible to make your
> own DHCP server in Ryu application.
> However it will be very difficult work. Ryu does not provide any DHCP
> server features.
>
> I don't know what you want to do with DHCP,
> but how about running DHCP server independently from Ryu?
> I assume you have the topology like below:
>
>  ┌-c0-┐
>  |  |
> h1--s1-s2-h2
>
> (h1 and h2 means hosts, and s1 and s2 means OVS)
>
> I suggest you to run DHCP server in c0 besides Ryu application,
> and install flows to forward DHCP packets to DHCP server.
> Then the DHCP server can receive DHCP packets in the topology.
>
> In this case, how to get the binding table depends on the DHCP server you
> use.
>
>
> Thanks,
> Fujimoto
>
>
>
> On 2017年07月31日 23:57, Mahmoud Elzoghbi wrote:
>
> hi
>  i need to implement DHCP server in RYU controller and topology file in
>  mininet to deal with dhcp
>
> and how to get binding table of DHCP server
>
> any help to accomplish this task
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> ___
> Ryu-devel mailing 
> listRyu-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] DHCP server

2017-07-31 Thread Fujimoto Satoshi

Hi, Mahmoud

Ryu has the packet library for DHCP, so it may be possible to make your 
own DHCP server in Ryu application.
However it will be very difficult work. Ryu does not provide any DHCP 
server features.


I don't know what you want to do with DHCP,
but how about running DHCP server independently from Ryu?
I assume you have the topology like below:

 ┌-c0-┐
 |  |
h1--s1-s2-h2

(h1 and h2 means hosts, and s1 and s2 means OVS)

I suggest you to run DHCP server in c0 besides Ryu application,
and install flows to forward DHCP packets to DHCP server.
Then the DHCP server can receive DHCP packets in the topology.

In this case, how to get the binding table depends on the DHCP server 
you use.



Thanks,
Fujimoto


On 2017年07月31日 23:57, Mahmoud Elzoghbi wrote:

hi
 i need to implement DHCP server in RYU controller and topology file 
in  mininet to deal with dhcp


and how to get binding table of DHCP server

any help to accomplish this task



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


Re: [Ryu-devel] dhcp server with ryu controller

2017-01-10 Thread Luis Zárate
Something like this dhcp rest responder.

The api is:

Set dhcp in a switch PUT /dhcp/add/{dpid}  params
'ipaddress': '192.168.1.1'
'netmask': '255.255.255.0'
'address': '0a:e4:1c:d1:3e:44'
'dns': '8.8.8.8'
'startip':'192.168.1.100'
'endip': '192.168.1.200'
Set static ip in a host PUT /dhcp/host/{dpid} params
'address': '00:00:00:d3:fc:57'
'ipaddress':  '192.168.1.2'
'hostname': 'huehuehue'
'dns': '8.8.8.8' * optional

This file is not complete (needs delete functions) but you will get so util.

2016-12-15 22:34 GMT-06:00 Munther Numan :

> Greeting ,
>
> Dear all,
>
>
>
> I just would like to ask you if I need to add dhcp server in my
> experiment, is any example code for it or there is already  code for dhcp
> server with Ryu controller?
>
> Best Regards
>
> Munther Numan
> Master Student
> Faculty of Engineering
> University Putra Malaysia
>
>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>


-- 
"La utopía sirve para caminar" Fernando Birri
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 YAMAMOTO Takashi 
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# a simple ICMP Echo Responder


import json

from ryu.app.wsgi import ControllerBase, WSGIApplication, route
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.lib import addrconv, dpid as dpid_lib
from ryu.lib.packet import dhcp
from ryu.lib.packet import ethernet
from ryu.lib.packet import ipv4
from ryu.lib.packet import packet
from ryu.lib.packet import udp
from ryu.ofproto import ofproto_v1_3
from webob import Response


class DHCPResponder(app_manager.RyuApp):
"""
use example
self.switches = {
'81474781969487': {
'ipaddress': '192.168.1.1',
'netmask': '255.255.255.0',
'address': '0a:e4:1c:d1:3e:44',
'dns': '8.8.8.8',
'hosts': {
'00:00:00:d3:fc:57': {
'hostname': 'huehuehue',
'dns': '8.8.8.8',
'ipaddress':  '192.168.1.2',
}
},
'available_address': [
'192.168.1.10',
'192.168.1.20'
]

}}
"""

OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
_CONTEXTS = {'wsgi': WSGIApplication}

def __init__(self, *args, **kwargs):
super(DHCPResponder, self).__init__(*args, **kwargs)
self.acks = {}
self.switches = {}
wsgi = kwargs['wsgi']
wsgi.register(DHCPController,
  {'dhcp_server': self})

def get_server_info(self, datapath):
if datapath in self.switches:
ipaddress = addrconv.ipv4.text_to_bin(
self.switches[datapath]['ipaddress'])
netmask = addrconv.ipv4.text_to_bin(
self.switches[datapath]['netmask'])
address = str(self.switches[datapath]['address'])
return ipaddress, netmask, address, str(self.switches[datapath]['ipaddress'])
return None, None, None, None

def get_host_info(self, datapath, hostaddress):
ipaddress = hostname = dns = None
if datapath in self.switches:
if hostaddress in self.acks:
info = self.acks[hostaddress]
return str(info['ipaddress']), str(info['hostname']), info['dns']

if hostaddress in self.switches[datapath]['hosts']:
confhost = self.switches[datapath]['hosts'][hostaddress]
ipaddress = str(confhost['ipaddress'])
hostname = str(confhost['hostname'])
dns = addrconv.ipv4.text_to_bin(confhost['dns'])
if not ipaddress and self.switches[datapath]['available_address']:
ipaddress = str(
self.switches[datapath]['available_address'].pop())
num = ipaddress.split('.')[-1]
hostname =