Skip to content

RYU Openstack Grizzly environment HOWTO

ykaneko edited this page Apr 21, 2013 · 5 revisions

==================================== Instructions for construction of Openstack grizzly environment with Ryu using devstack

This document explains how to construct OpenStack grizzly environment with Ryu using devstack.

1. System structure

Assuming the following systems as a goal.

+--------+
| Client |
+----+---+
     |     Public Network
-----+----+----------
          |                   Private Network
          |      ---+--------------+---------
          |         |              |
      +---+---------+---+  +-------+--------+
      | Controller Node |  | Compute Node   |
      |  Ryu            |  |  Quantum       |
      |  Nova           |  |   ryu-agent    |
      |  Keystone       |  |  Nova          |
      |  Glance         |  |   nova-compute |
      |  Quantum        |  +----------------+
      |  Cinder         |
      |  Horizon        |
      +-----------------+
  • Controller Node:

    Ryu and OpenStack components are run on this node. It is including nova-compute, so VM is run on this node too. Besides a traffic to the outside network from VM on compute node goes via this node.

  • Compute Node:

    The nova-compute and the agent for Quantum Ryu plugin are run on this node.

  • Client:

    This host is used for confirmation of communication of VM and a remote host on an external network.

  • Public Network:

    This network is used by communication between VM and the external network, and client access to VM via Floating IP.

  • Private Network:

    This network is used by communication between Ryu and OVS, each OpenStack components. Besides, GRE tunnel that connects OVS on both node through this network.

We use Ubuntu 12.04 Server on both node.

On this document, the following addresses are used in each network and host.

  • Networks

    • Public Network: 192.168.100.0/24
    • Private Network: 192.168.0.0/24
  • Hosts

    • Controller Node:

      • Host name: controller
      • IP address: 192.168.0.10
    • Compute Node:

      • Host name: compute
      • IP address: 192.168.0.11
    • Client:

      • Host name: client
      • IP address: 192.168.100.200

This picture illustrates network components of the inside of each node.

Public Network
----+---------
    |                      Private Network
    |       --+---------------------+-----
    |         |                     |
    |         |                     |
+---|---------|----+  +-------------|----+
| (eth1)    (eth0) |  |           (eth0) |
|   |              |  |                  |
| [br-ex]  ______________                |
|   :     /      GRE  |  \               |
| [br-int]--<qbr>  |  | [br-int]--<qbr>  |
|             |    |  |             |    |
|            VM    |  |            VM    |
+------------------+  +------------------+
    Controller Node          Compute Node

[] OVS bridge
<> Linux bridge
() Network interface
.. IP Routing

2. Getting and setting

We assume installation of Ubutnu 12.04 Server was completed.

Install git package to get software.

$ sudo apt-get install git

Download devstack.

$ cd
$ git clone https://github.com/openstack-dev/devstack.git -b stable/grizzly

2.1 Controller Node

Configure network interface.

$ sudo vi /etc/network/interfaces

/etc/network/interfaces:

auto lo

auto eth0
iface eth0 inet static
        address 192.168.0.10
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1

auto eth1
iface eth1 inet manual
        up ifconfig $IFACE 0.0.0.0 up
        up ip link set $IFACE promisc on
        down ip link set $IFACE promisc off
        down ifconfig $IFACE down

Restart networking.

$ sudo /etc/init.d/networking restart

Configure devstack.

$ cd ~/devstack
$ vi localrc
$ vi local.sh
$ chmod +x local.sh

localrc:

SERVICE_HOST=192.168.0.10
disable_service n-net
enable_service quantum q-svc q-agt q-l3 q-dhcp q-meta q-lbaas
enable_service ryu
FLOATING_RANGE=192.168.100.0/24
Q_PLUGIN=ryu

Q_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
RYU_API_HOST=$SERVICE_HOST
RYU_OFP_HOST=$SERVICE_HOST

MYSQL_PASSWORD=mysql
RABBIT_PASSWORD=rabbit
SERVICE_TOKEN=service
SERVICE_PASSWORD=admin
ADMIN_PASSWORD=admin

RYU_APPS=ryu.app.gre_tunnel,ryu.app.quantum_adapter,ryu.app.rest,ryu.app.rest_conf_switch,ryu.app.rest_tunnel,ryu.app.tunnel_port_updater,ryu.app.rest_quantum

local.sh:

sudo ovs-vsctl --no-wait -- --may-exist add-port br-ex eth1

2.2 Compute Node

Configure network interface.

$ sudo vi /etc/network/interfaces

/etc/network/interfaces:

auto lo

auto eth0
iface eth0 inet static
        address 192.168.0.11
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1

Restart networking.

$ sudo /etc/init.d/networking restart

Configure devstack.

$ cd ~/devstack
$ vi localrc

localrc:

SERVICE_HOST=192.168.0.10
disable_all_services
enable_service n-cpu quantum q-agt
Q_PLUGIN=ryu

Q_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
RYU_API_HOST=$SERVICE_HOST
RYU_OFP_HOST=$SERVICE_HOST

MYSQL_PASSWORD=mysql
RABBIT_PASSWORD=rabbit
SERVICE_TOKEN=service
SERVICE_PASSWORD=admin
ADMIN_PASSWORD=admin

3. Play Ryu and OpenStack

3.1 Starting devstack

Start devstack on controller node first.

Controller Node:

$ cd ~/devstack
$ ./stack.sh
[snip]

Horizon is now available at http://192.168.0.10/
Keystone is serving at http://192.168.0.10:5000/v2.0/
Examples on using novaclient command line is in exercise.sh
The default users are: admin and demo
The password: admin
This is your host ip: 192.168.0.10
stack.sh completed in 2459 seconds.
$

Then start devstack on compute node.

Compute Node:

$ cd ~/devstack
$ ./stack.sh

Confirm the status of services.

$ cd ~/devstack
$ . ./openrc admin admin
$ nova-manage service list 2>/dev/null
Binary           Host                                 Zone             Status     State Updated_At
nova-conductor   ryu1                                 internal         enabled    :-)   2013-04-21 07:53:01
nova-compute     ryu1                                 nova             enabled    :-)   2013-04-21 07:53:05
nova-cert        ryu1                                 internal         enabled    :-)   2013-04-21 07:53:04
nova-scheduler   ryu1                                 internal         enabled    :-)   2013-04-21 07:53:05
nova-consoleauth ryu1                                 internal         enabled    :-)   2013-04-21 07:53:01
nova-compute     ryu2                                 nova             enabled    :-)   2013-04-21 07:53:08
$

3.2 Run VM

Launch VM by the following command.

nova boot --flavor <flavor-id> --image <image-id> --nic net-id=<net-id> <VM-name>

Example:

$ . ./openrc demo demo
$ nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1  | m1.tiny   | 512       | 0    | 0         |      | 1     | 1.0         | True      | {}          |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      | {}          |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      | {}          |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      | {}          |
| 42 | m1.nano   | 64        | 0    | 0         |      | 1     | 1.0         | True      | {}          |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      | {}          |
| 84 | m1.micro  | 128       | 0    | 0         |      | 1     | 1.0         | True      | {}          |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
$ nova image-list
+--------------------------------------+---------------------------------+--------+--------+
| ID                                   | Name                            | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| d3991edc-5481-459a-ace2-d3a821e66996 | cirros-0.3.1-x86_64-uec         | ACTIVE |        |
| bfb451e5-23fc-4221-b139-b60528c7c823 | cirros-0.3.1-x86_64-uec-kernel  | ACTIVE |        |
| d968be6c-ba60-477f-9abc-67e96c26ff0d | cirros-0.3.1-x86_64-uec-ramdisk | ACTIVE |        |
+--------------------------------------+---------------------------------+--------+--------+
$ quantum net-list
+--------------------------------------+---------+--------------------------------------------------+
| id                                   | name    | subnets                                          |
+--------------------------------------+---------+--------------------------------------------------+
| 489b9cbc-2cb4-455c-be88-01c60680158d | public  | 3d438a4f-fd94-4fcb-9b4a-068d50eb119d             |
| e57b0e48-4b95-432b-b4c5-d50a51d81329 | private | 2f8f8886-2ebc-4fb3-b355-bc76d5f633ed 10.0.0.0/24 |
+--------------------------------------+---------+--------------------------------------------------+
$ nova boot --flavor m1.tiny --image d3991edc-5481-459a-ace2-d3a821e66996 --nic net-id=e57b0e48-4b95-432b-b4c5-d50a51d81329 vm1

$ nova list
+--------------------------------------+------+--------+------------------+
| ID                                   | Name | Status | Networks         |
+--------------------------------------+------+--------+------------------+
| 41d16d84-e45a-42cb-9800-a2ccfac7f6c8 | vm1  | ACTIVE | private=10.0.0.3 |
+--------------------------------------+------+--------+------------------+

3.3 Security Groups

Setting up Security Groups by the following commands.

quantum security-group-rule-create --protocol icmp <group id>
quantum security-group-rule-create --protocol tcp --port-range-min <from-port> --port-range-max <to-port> <group id>
quantum security-group-rule-create --protocol udp --port-range-min <from-port> --port-range-max <to-port> <group id>

Example:

$ cd devstack
$ . ./openrc demo demo
$ quantum security-group-list
+--------------------------------------+---------+-------------+
| id                                   | name    | description |
+--------------------------------------+---------+-------------+
| a699094b-18e6-437f-97f8-754244bac679 | default | default     |
+--------------------------------------+---------+-------------+
$ quantum security-group-rule-create --protocol icmp a699094b-18e6-437f-97f8-754244bac679
$ quantum security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 a699094b-18e6-437f-97f8-754244bac679

3.4 Associate Floating IP

Associate Floating IP with VM.

quantum floatingip-create <net-id>
quantum floatingip-associate <float-id> <port-id>

Example:

$ quantum floatingip-create public
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 192.168.100.3                        |
| floating_network_id | 489b9cbc-2cb4-455c-be88-01c60680158d |
| id                  | 57f641bc-7a58-488b-8f49-6905df949921 |
| port_id             |                                      |
| router_id           |                                      |
| tenant_id           | 67c2261a332349c28a81c7fc6700b781     |
+---------------------+--------------------------------------+
$ quantum port-list
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                       |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
| 3c2e640e-8274-4d59-ba7f-9f926d4f5fcc |      | fa:16:3e:20:6f:19 | {"subnet_id": "2f8f8886-2ebc-4fb3-b355-bc76d5f633ed", "ip_address": "10.0.0.4"} |
| 4fc9ce34-2b91-45d5-b266-b8b41b199f7f |      | fa:16:3e:d6:25:25 | {"subnet_id": "2f8f8886-2ebc-4fb3-b355-bc76d5f633ed", "ip_address": "10.0.0.3"} |
| 62e83796-67ce-416c-b25b-5340ebfad39b |      | fa:16:3e:d1:df:e5 | {"subnet_id": "2f8f8886-2ebc-4fb3-b355-bc76d5f633ed", "ip_address": "10.0.0.1"} |
| a06db3e1-62d5-408f-b8a5-d3b6c90533c8 |      | fa:16:3e:79:e8:f4 | {"subnet_id": "2f8f8886-2ebc-4fb3-b355-bc76d5f633ed", "ip_address": "10.0.0.2"} |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
$ quantum floatingip-associate 57f641bc-7a58-488b-8f49-6905df949921 4fc9ce34-2b91-45d5-b266-b8b41b199f7f
Associated floatingip 57f641bc-7a58-488b-8f49-6905df949921
$ quantum floatingip-list
+--------------------------------------+------------------+---------------------+--------------------------------------+
| id                                   | fixed_ip_address | floating_ip_address | port_id                              |
+--------------------------------------+------------------+---------------------+--------------------------------------+
| 57f641bc-7a58-488b-8f49-6905df949921 | 10.0.0.3         | 192.168.100.3       | 4fc9ce34-2b91-45d5-b266-b8b41b199f7f |
+--------------------------------------+------------------+---------------------+--------------------------------------+

3.5 Access to VM from client host

Run ping and ssh login to VM via Floating IP from client.

$ ping -c 10 192.168.100.3
PING 192.168.100.3 (192.168.100.3) 56(84) bytes of data.
64 bytes from 192.168.100.3: icmp_req=1 ttl=63 time=13.2 ms
64 bytes from 192.168.100.3: icmp_req=2 ttl=63 time=0.718 ms
64 bytes from 192.168.100.3: icmp_req=3 ttl=63 time=0.843 ms
64 bytes from 192.168.100.3: icmp_req=4 ttl=63 time=0.838 ms
64 bytes from 192.168.100.3: icmp_req=5 ttl=63 time=0.892 ms
64 bytes from 192.168.100.3: icmp_req=6 ttl=63 time=0.798 ms
64 bytes from 192.168.100.3: icmp_req=7 ttl=63 time=0.803 ms
64 bytes from 192.168.100.3: icmp_req=8 ttl=63 time=0.765 ms
64 bytes from 192.168.100.3: icmp_req=9 ttl=63 time=0.858 ms
64 bytes from 192.168.100.3: icmp_req=10 ttl=63 time=0.824 ms

--- 192.168.100.3 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9008ms
rtt min/avg/max/mdev = 0.718/2.055/13.216/3.720 ms
$
$ ssh cirros@192.168.100.3
cirros@192.168.100.3's password: cubswin:)
$ ifconfig
eth0      Link encap:Ethernet  HWaddr FA:16:3E:27:2E:9E
          inet addr:10.0.0.3  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::f816:3eff:fe27:2e9e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:105 errors:0 dropped:0 overruns:0 frame:0
          TX packets:183 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13582 (13.2 KiB)  TX bytes:21578 (21.0 KiB)
          Interrupt:11 Base address:0xa000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

$ exit
Connection to 192.168.100.3 closed.

Clone this wiki locally