0.预备知识

ryu控制器的API文档:ryu.app.ofctl_rest

根据博客基于RYU restful api实现的VLAN网络虚拟化完成最后的自动化脚本编写,实现RYU REST API的VLAN实现

1.实验内容

参加博客基于OVS命令的VLAN实现

启动RYU

~/ryu/ryu/app$ ryu-manager ofctl_rest.py

如果同时要看拓扑:

~/ryu/ryu/app$ ryu-manager ~/ryu/ryu/app/gui_topology/gui_topology.py --observe-links

gui_topology应用包含了ofctl_rest的功能,同时可以查看拓扑

2.编写脚本addflow.sh一步实现流表下发

 curl -X POST -d '{
"dpid": 1,
"match":{
"in_port": 1
},
"actions":[
{
"type": "PUSH_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "SET_FIELD",
"field": "vlan_vid", # Set VLAN ID
"value": 4096 # Describe sum of vlan_id(e.g. 6) | OFPVID_PRESENT(0x1000=4096)
},
{
"type": "OUTPUT",
"port": 4
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 1,
"match":{
"in_port": 2
},
"actions":[
{
"type": "PUSH_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "SET_FIELD",
"field": "vlan_vid", # Set VLAN ID
"value": 4097 # Describe sum of vlan_id(e.g. 6) | OFPVID_PRESENT(0x1000=4096)
},
{
"type": "OUTPUT",
"port": 4
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 1,
"match":{
"in_port": 3
},
"actions":[
{
"type": "PUSH_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "SET_FIELD",
"field": "vlan_vid", # Set VLAN ID
"value": 4098 # Describe sum of vlan_id(e.g. 6) | OFPVID_PRESENT(0x1000=4096)
},
{
"type": "OUTPUT",
"port": 4
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 1,
"match":{
"vlan_vid": 0
},
"actions":[
{
"type": "POP_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "OUTPUT",
"port": 1
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 1,
"match":{
"vlan_vid": 1
},
"actions":[
{
"type": "POP_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "OUTPUT",
"port": 2
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 1,
"match":{
"vlan_vid": 2
},
"actions":[
{
"type": "POP_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "OUTPUT",
"port": 3
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 2,
"match":{
"in_port": 1
},
"actions":[
{
"type": "PUSH_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "SET_FIELD",
"field": "vlan_vid", # Set VLAN ID
"value": 4096 # Describe sum of vlan_id(e.g. 6) | OFPVID_PRESENT(0x1000=4096)
},
{
"type": "OUTPUT",
"port": 4
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 2,
"match":{
"in_port": 2
},
"actions":[
{
"type": "PUSH_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "SET_FIELD",
"field": "vlan_vid", # Set VLAN ID
"value": 4097 # Describe sum of vlan_id(e.g. 6) | OFPVID_PRESENT(0x1000=4096)
},
{
"type": "OUTPUT",
"port": 4
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 2,
"match":{
"in_port": 3
},
"actions":[
{
"type": "PUSH_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "SET_FIELD",
"field": "vlan_vid", # Set VLAN ID
"value": 4098 # Describe sum of vlan_id(e.g. 6) | OFPVID_PRESENT(0x1000=4096)
},
{
"type": "OUTPUT",
"port": 4
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 2,
"match":{
"vlan_vid": 0
},
"actions":[
{
"type": "POP_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "OUTPUT",
"port": 1
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 2,
"match":{
"vlan_vid": 1
},
"actions":[
{
"type": "POP_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "OUTPUT",
"port": 2
}
]
}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{
"dpid": 2,
"match":{
"vlan_vid": 2
},
"actions":[
{
"type": "POP_VLAN", # Push a new VLAN tag if a input frame is non-VLAN-tagged
"ethertype": 33024 # Ethertype 0x8100(=33024): IEEE 802.1Q VLAN-tagged frame
},
{
"type": "OUTPUT",
"port": 3
}
]
}' http://localhost:8080/stats/flowentry/add

3.使用api查看流表

$ curl -X GET http://localhost:8080/stats/flow/<dpid>



4.实验结果



基于Ryu REST API的VLAN实现的更多相关文章

  1. 基于RYU restful api实现的VLAN网络虚拟化

    基于RYU restful api实现的VLAN网络虚拟化 前言 本次实验是基于OVS的VLAN虚拟化简易实践方案的进一步的实验,采用RYU restful api进行配置.本质上和上次实验没什么差, ...

  2. 基于RYU的拓扑发现

    基于RYU的拓扑发现 前言 本次实验是一个基于RYU的拓扑发现功能.参考了呈神的实现方式,并加了一些自己实现方式,做了一些数据结构的改动. 数据结构 link_to_port 字典 有两种关系: 一是 ...

  3. Resumable.js – 基于 HTML5 File API 的文件上传

    Resumable.js 是一个 JavaScript 库,通过 HTML5 文件 API 提供,稳定和可恢复的批量上传功能.在上传大文件的时候通过每个文件分割成小块,每块在上传失败的时候,上传会不断 ...

  4. 基于.NET Socket API 通信的综合应用

    闲谈一下,最近和客户进行对接Scoket 本地的程序作为请求方以及接受方,对接Scoket 的难度实在比较大,因为涉及到响应方返回的报文的不一致性,对于返回的报文的格式我需要做反序列化的难度增大了不少 ...

  5. 基于ArcGIS JS API的在线专题地图实现

    0 引言     专题地图是突出而深入的表示一种或几种要素或现象,即按照地图主题的要求,集中表示与主题有关内容的地图.专题地图的专题要素多种多样,分类方法也多种多样,根据专题地图表现数据的特点可分为定 ...

  6. atitit.基于http json api 接口设计 最佳实践 总结o7

    atitit.基于http  json  api 接口设计 最佳实践 总结o7 1. 需求:::服务器and android 端接口通讯 2 2. 接口开发的要点 2 2.1. 普通参数 meth,p ...

  7. 基于 ArcGIS Silverlight API开发的WebGIS应用程序的部署

    部署流程概述 在微软的iis服务器上部署基于ArcGIS  Silverlight API的应用程序,主要包括以下几个步骤: 1)(可选)部署GIS服务 如果需要将GIS服务也部署在Web服务器上,则 ...

  8. 基于百度地图api + AngularJS 的入门地图

    转载请注明地址:http://www.cnblogs.com/enzozo/p/4368081.html 简介: 此入门地图为简易的“广州大学城”公交寻路地图,采用很少量的AngularJS进行inp ...

  9. PHP:基于百度大脑api实现OCR文字识别

    有个项目要用到文字识别,网上找了很多资料,效果不是很好,偶然的机会,接触到百度大脑.百度大脑提供了很多解决方案,其中一个就是文字识别,百度提供了三种文字识别,分别是银行卡识别.身份证识别和通用文字识别 ...

随机推荐

  1. default(Nullable(type)) vs default(type)

    default(Nullable<long>) == null default(long?) == null default(long) == 0L

  2. Java后端HttpClient Post提交文件流 及服务端接收文件流

    客户端将文件转换为流发送: 依赖的包: <dependency> <groupId>org.apache.httpcomponents</groupId> < ...

  3. 7.Redis的发布订阅

    Redis消息的订阅/发布 a)是什么 进程间的一种消息通信模式:发送者(pub)发送消息,订阅者(sub)接收消息. b)命令 SUBSCRIBE订阅 PUBLISH发布 c)案例 先订阅后发布后才 ...

  4. Linux报错排解

    1.Loaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registe ...

  5. require.js 加载 js 文件 404 处理(配置无效)

    main.js 是 配置文件,data-main 是异步加载,如果在main.js未加载完成的时候,使用了require去加载文件,就会导致配置无效  main.js

  6. Linux下文档与目录结构

    目录分类 Linux目录结构的组织形式和Windows有很大的不同.首先Linux没有“盘(C盘.D盘.E盘)”的概念.已经建立文件系统的硬盘分区被挂载到某一个目录下,用户通过操作目录来实现磁盘读写. ...

  7. idou老师教你学Istio 22 : 如何用istio实现调用链跟踪

    大家都知道istio可以帮助我们实现灰度发布.流量监控.流量治理等一些功能. 每一个功能都帮助我们在不同场景中实现不同的业务.那么其中比如流量监控这种复杂的功能Istio是如何让我们在不同的应用中实现 ...

  8. MySQl 进阶一 基本查询及练习

    知识点及练习 USE myemployees; #.查询表中的单个字段 SELECT last_name FROM employees; #.查询表中多个字段 #.查询全部 SELECT * FROM ...

  9. [转载]yarn的安装和使用

    yarn的安装和使用 2018-08-02 10:45:41 yw00yw 阅读数 50696 文章标签: yarn 更多 分类专栏: 工具   版权声明:本文为博主原创文章,遵循CC 4.0 BY- ...

  10. python_面向对象——对象之间的关联关系

    1.将类中的对象关联起来(简单的方法) class Person: def __init__(self,name,age,sex): self.name = name self.age = age s ...