安装OpenDayLight控制器

配置JAVA环境

https://www.opendaylight.org/

在官网进行下载OpenDayLight控制器

启动OpenDayLight控制器和安装插件

启动OpenDayLight控制器:

在命令行中打开OpenDayLight控制器



启动OpenDayLight 0.4.4-Beryllium-SR4:

安装插件:

输入以下命令,进行插件安装

feature:install odl-restconf
feature:install odl-l2switch-switch-ui
feature:install odl-openflowplugin-all
feature:install odl-mdsal-apidocs
feature:install odl-dlux-core
feature:install odl-dlux-node
feature:install odl-dlux-yangui

搭建拓扑

使用MiniEdit进行图形化搭建拓扑:

设置如下:

在网址内输入:http://127.0.0.1:8181/index.html#/login

进入OpenDayLight Dlux

#!/usr/bin/python

from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call def myNetwork(): net = Mininet( topo=None,
build=False,
ipBase='10.0.0.0/8') info( '*** Adding controller\n' )
c0=net.addController(name='c0',
controller=RemoteController,
ip='127.0.0.1',
protocol='tcp',
port=6633) info( '*** Add switches\n')
s1 = net.addSwitch('s1', cls=OVSKernelSwitch) info( '*** Add hosts\n')
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None) info( '*** Add links\n')
net.addLink(s1, h1)
net.addLink(s1, h2)
net.addLink(s1, h3) info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start() info( '*** Starting switches\n')
net.get('s1').start([c0]) info( '*** Post configure switches and hosts\n') CLI(net)
net.stop() if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()

运行PY文件,并且PINGALL

在ODL进行reload

展示生成的拓扑图像

使用控制器发送下发流表

在控制器提供的WEB UI中下发流表使h2 20s内ping不通h3,10s后恢复

查看拓扑的端口连接:

可见

h2 连接 s1 端口 2

h3 连接 s1 端口 3

ODL内部设置:

具体设置如下:

按图中设置后

终端内输入命令

h2 ping h3

在ODL中点击发送

实验现象:h2 20s内ping不通h3,20s后恢复

浏览具体报文:

http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/1

{
"flow": [
{
"id": "1",
"match": {
"in-port": "2",
"ethernet-match": {
"ethernet-type": {
"type": "0x0800"
}
},
"ipv4-destination": "10.0.0.3/32"
},
"instructions": {
"instruction": [
{
"order": "0",
"apply-actions": {
"action": [
{
"order": "0",
"drop-action": {}
}
]
}
}
]
},
"priority": "65535",
"hard-timeout": "10",
"cookie": "2",
"table_id": "0"
}
]
}

用Postman进行测试

将浏览里的URL复制到地址栏,讲选择改为PUT,输入用户名与密码

http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/1

将JSON报文复制到Body内,将其Send

出现了在ODL内调试一样的效果

由URL获取刚才发送的报文

最新文章

  1. Makefile 使用总结
  2. Android入门(十八)服务
  3. CGAffineTransformMakeRotation 实现旋转
  4. thinkphp5命名规范
  5. Azure 删除VHD时报错:There is currently a lease on the blob and no lease ID was specified in the request
  6. 非归档模式下使用Rman进行备份和恢复
  7. 解决: Can’t connect to local MySQL server through socket /var/lib/mysql/mysql.sock
  8. 一个简单且丑陋的js切换背景图片基础示例
  9. Spring笔记(三)AOP前篇之动态代理
  10. 4071: [Apio2015]巴邻旁之桥
  11. 基于Visual C++2013拆解世界五百强面试题--题13-找最大公共子字符串
  12. 使用ROW_NUMBER()查询:列名 'RowNumber' 无效。
  13. KingbaseES的standby搭建
  14. Java体系结构---垃圾回收
  15. OpenCV进行图像相似度对比的几种办法
  16. np.mgrid 用法
  17. python语言的基本要素
  18. CentOS 6.9/7通过yum安装指定版本的MySQL
  19. 看jQuery的这几天
  20. [转帖] Kubernetes如何使用ReplicationController、Replica Set、Deployment管理Pod ----文章很好 但是还没具体操作实践 也还没记住.

热门文章

  1. java中异常的抛出:throw throws
  2. webpack-dev-server提示css模块解析失败,但已经装了css-loader
  3. linux查看log软件
  4. Android为TV端助力记录EditText.setInputType的坑
  5. suoermap的object.net循环遍历属性表,从数据库取数据进行更新属性字段值
  6. MySQL Case--优化OR语句踩坑记录
  7. win10 提示该文件没有与之关联的应用来执行该操作
  8. 设置Linux 程序lib搜索目录
  9. Linux 磁盘配额(XFS & EXT4)
  10. MySQL创建用户和加限权