OpenDaylight-Boron学习笔记:1 实验环境搭建说明

物理环境说明

CPU: Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz * 8

RAM: 32GB

Disk: 224G (SSD)

Operating System: Ubuntu 14.04.1

Virsh : 1.2.12

SN-Controller

虚拟机,用于安装OpenDaylight。其配置如下:

CPU: 2 Cores

RAM: 4GB

Disk: 32GB

Operating System: CentOS7 x86_64 1611(Linux 3.10.0-514) Infrastructure Server

IP1: 10.0.3.100/24 (Public Network)

IP2: 172.16.3.100/24 (SDN Network)

构建软件环境

构建外部网桥

在物理机上构建网桥,主要用于模拟外部普通交换机。网络拓扑图中的br2为物理机原有的网桥,为Public Network。网络拓扑图中的brsdn1和brsdn2为自定义网桥,通过以下方式创建:

下面是定义brsdn1网络的brsdn1.xml文件:

<network>
  <name>brsdn1</name>
  <bridge name='brsdn1' stp='off' delay='0'/>
</network>

下面是定义brsdn2网络的brsdn2.xml文件:

<network>
  <name>brsdn2</name>
  <bridge name='brsdn2' stp='off' delay='0'/>
</network>

通过virsh创建网络:

root@UbuntuServer:~$ virsh net-define ./brsdn1.xml
root@UbuntuServer:~$ virsh net-define ./brsdn2.xml
root@UbuntuServer:~$ virsh net-start brsdn1
root@UbuntuServer:~$ virsh net-start brsdn2
root@UbuntuServer:~$ virsh net-autostart brsdn1
root@UbuntuServer:~$ virsh net-autostart brsdn2

构建实验虚拟机

创建实验存储池

通过virsh创建存储池:

root@UbuntuServer:~$ virsh pool-define-as SDNNFV dir --target /mnt/SDNNFV/SDNNFV/
root@UbuntuServer:~$ virsh pool-build SDNNFV
root@UbuntuServer:~$ virsh pool-start SDNNFV
root@UbuntuServer:~$ virsh pool-autostart SDNNFV
创建SN-Controller

创建存储卷:

root@UbuntuServer:~$ virsh vol-create-as --name SN-Controller.qcow2 --capacity 32G --pool SDNNFV --format qcow2
root@UbuntuServer:~$ chmod 777 /mnt/SDNNFV/SDNNFV/SN-Controller.qcow2

下面是定义SN-Controller虚拟机的SN-Controller.xml文件:

<domain type='kvm'>
  <name>SN-Controller</name>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-utopic'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='2' cores='2' threads='2'/>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/SDNNFV/SDNNFV/SN-Controller.qcow2'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/home/hcp/iso/CentOS-7-x86_64-DVD-1611.iso'/>
      <backingStore/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <source bridge='br2'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <source bridge='brsdn1'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/9'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/9'>
      <source path='/dev/pts/9'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5903' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

通过virsh创建虚拟机:

root@UbuntuServer:~$ virsh define ./SN-Controller.xml

安装时,Software Selection 选择 Infrastructure Server。安装完毕后,通过 virsh edit SN-Controller,将下面语句去掉:

<boot dev='cdrom'/>

重新启动虚拟机,安装完成。

此时对SN-Controller进行以下设置:

[root@SN-Controller ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@SN-Controller ~]# sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/sshd_config
[root@SN-Controller ~]# sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
[root@SN-Controller ~]# systemctl restart sshd
[root@SN-Controller ~]# systemctl disable firewalld
[root@SN-Controller ~]# systemctl stop firewalld
[root@SN-Controller ~]# systemctl disable NetworkManager
[root@SN-Controller ~]# systemctl stop NetworkManager
[root@SN-Controller ~]# cat > /etc/sysconfig/network-scripts/ifcfg-ens3 << EOF
> TYPE=Ethernet
> BOOTPROTO=static
> DEFROUTE=yes
> IPV4_FAILURE_FATAL=no
> NAME=ens3
> DEVICE=ens3
> ONBOOT=yes
> IPADDR=10.0.3.100
> PREFIX=24
> GATEWAY=10.0.3.1
> DNS1=114.114.114.114
> EOF
[root@SN-Controller ~]# cat > /etc/sysconfig/network-scripts/ifcfg-ens5 << EOF
> TYPE=Ethernet
> BOOTPROTO=static
> IPADDR=172.16.3.100
> NETMASK=255.255.255.0
> NAME=ens5
> DEVICE=ens5
> ONBOOT=yes
> NM_CONTROLLERD=no
> EOF
[root@SN-Controller ~]# shutdown -r 0

安装OpenDaylight

下面在SN-Controller上安装OpenDaylight控制器。

参考资料

OpenDaylight官网

OpenDaylight git源

OpenDaylight 控制器git源

OpenDaylight说明文档

安装依赖
[root@SN-Controller ~]# cat > /etc/yum.repos.d/CentOS-Base.repo << EOF
> # CentOS-Base.repo
> #
> # The mirror system uses the connecting IP address of the client and the
> # update status of each mirror to pick mirrors that are updated to and
> # geographically close to the client.  You should use this for CentOS updates
> # unless you are manually picking other mirrors.
> #
> # If the mirrorlist= does not work for you, as a fall back you can try the
> # remarked out baseurl= line instead.
> #
> #
>
> [base]
> name=CentOS-\$releasever - Base
> #mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=os
> baseurl=https://mirrors.ustc.edu.cn/centos/\$releasever/os/\$basearch/
> gpgcheck=1
> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
>
> #released updates
> [updates]
> name=CentOS-\$releasever - Updates
> # mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=updates
> baseurl=https://mirrors.ustc.edu.cn/centos/\$releasever/updates/\$basearch/
> gpgcheck=1
> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
>
> #additional packages that may be useful
> [extras]
> name=CentOS-\$releasever - Extras
> # mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=extras
> baseurl=https://mirrors.ustc.edu.cn/centos/\$releasever/extras/\$basearch/
> gpgcheck=1
> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
>
> #additional packages that extend functionality of existing packages
> [centosplus]
> name=CentOS-\$releasever - Plus
> # mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=centosplus
> baseurl=https://mirrors.ustc.edu.cn/centos/\$releasever/centosplus/\$basearch/
> gpgcheck=1
> enabled=0
> gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
>
> EOF
[root@SN-Controller ~]# yum makecache
[root@sn-controller ~]# yum install java-1.8.0-openjdk-devel
[root@sn-controller ~]# cat > /etc/profile.d/environment-settings.sh << EOF
> #!/bin/bash
>
> export JAVA_HOME=/usr/lib/jvm/java
> export JRE_HOME=${JAVA_HOME}/jre
> export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
>
> export PATH=${PATH}:${JAVA_HOME}/bin:${JRE_HOME}/bin
> EOF
[root@sn-controller ~]# source /etc/profile.d/environment-settings.sh
下载OpenDaylight安装包
[root@SN-Controller ~]# wget https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.5.1-Boron-SR1/distribution-karaf-0.5.1-Boron-SR1.tar.gz

下面进行开始安装:

[root@SN-Controller ~]# tar xvf ./distribution-karaf-0.5.1-Boron-SR1.tar.gz
[root@SN-Controller ~]# mv ./distribution-karaf-0.5.1-Boron-SR1 /usr/local/opendaylight-boron
[root@SN-Controller ~]# cd /usr/local/opendaylight-boron/bin

根据
OpenDaylight DLUX介绍及解决Web界面无法显示Nodes问题
的说明,需要执行以下补丁,解决web无法显示nodes的问题:

  1. 根据链接下载restangular.min.js
  2. 进入解压好的opendaylight-boron下的system/org/opendaylight/dlux/loader.implementation/0.4.1-Boron-SR1目录,将看到loader.implementation-0.4.1-Boron-SR1.jar文件,使用压缩工具将其打开看到dlux文件夹,进入该文件夹下的vendor/restangular/dist文件夹子将看到restangular.min.js文件,将其删除。并加入下载的restangular.min.js。
  3. 删除opendaylight-boron下的data文件夹。

安装features:

[root@SN-Controller bin]# ./karaf
opendaylight-user@root>feature:install odl-dlux-all
opendaylight-user@root>feature:install odl-l2switch-switch
opendaylight-user@root>feature:install odl-l2switch-switch-ui
opendaylight-user@root>feature:install odl-mdsal-xsql
opendaylight-user@root>logout

安装完成。启动OpenDaylight:

[root@SN-Controller bin]# ./start

阶段测试

打开 http://10.0.3.100:8181/index.html ,可以进入管理平台的网页。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值