一:推文

软件定义网络基础---REST API概述

软件定义网络基础---REST API的设计规范

二:掌握Ryu基本RESTAPI使用方法

(一)Ryu的RESTAPI

(二) REST应用样例:app/ofctl_rest.py

1.所提供的样例API接口

# REST API
# # Retrieve the switch stats
#
# get the list of all switches
# GET /stats/switches
#
# get the desc stats of the switch
# GET /stats/desc/<dpid>
#
# get flows desc stats of the switch
# GET /stats/flowdesc/<dpid>
#
# get flows desc stats of the switch filtered by the fields
# POST /stats/flowdesc/<dpid>
#
# get flows stats of the switch
# GET /stats/flow/<dpid>
#
# get flows stats of the switch filtered by the fields
# POST /stats/flow/<dpid>
#
# get aggregate flows stats of the switch
# GET /stats/aggregateflow/<dpid>
#
# get aggregate flows stats of the switch filtered by the fields
# POST /stats/aggregateflow/<dpid>
#
# get table stats of the switch
# GET /stats/table/<dpid>
#
# get table features stats of the switch
# GET /stats/tablefeatures/<dpid>
#
# get ports stats of the switch
# GET /stats/port/<dpid>[/<port>]
# Note: Specification of port number is optional
#
# get queues stats of the switch
# GET /stats/queue/<dpid>[/<port>[/<queue_id>]]
# Note: Specification of port number and queue id are optional
# If you want to omitting the port number and setting the queue id,
# please specify the keyword "ALL" to the port number
# e.g. GET /stats/queue//ALL/
#
# get queues config stats of the switch
# GET /stats/queueconfig/<dpid>[/<port>]
# Note: Specification of port number is optional
#
# get queues desc stats of the switch
# GET /stats/queuedesc/<dpid>[/<port>[/<queue_id>]]
# Note: Specification of port number and queue id are optional
# If you want to omitting the port number and setting the queue id,
# please specify the keyword "ALL" to the port number
# e.g. GET /stats/queuedesc//ALL/
#
# get meter features stats of the switch
# GET /stats/meterfeatures/<dpid>
#
# get meter config stats of the switch
# GET /stats/meterconfig/<dpid>[/<meter_id>]
# Note: Specification of meter id is optional
#
# get meter desc stats of the switch
# GET /stats/meterdesc/<dpid>[/<meter_id>]
# Note: Specification of meter id is optional
#
# get meters stats of the switch
# GET /stats/meter/<dpid>[/<meter_id>]
# Note: Specification of meter id is optional
#
# get group features stats of the switch
# GET /stats/groupfeatures/<dpid>
#
# get groups desc stats of the switch
# GET /stats/groupdesc/<dpid>[/<group_id>]
# Note: Specification of group id is optional (OpenFlow 1.5 or later)
#
# get groups stats of the switch
# GET /stats/group/<dpid>[/<group_id>]
# Note: Specification of group id is optional
#
# get ports description of the switch
# GET /stats/portdesc/<dpid>[/<port_no>]
# Note: Specification of port number is optional (OpenFlow 1.5 or later) # Update the switch stats
#
# add a flow entry
# POST /stats/flowentry/add
#
# modify all matching flow entries
# POST /stats/flowentry/modify
#
# modify flow entry strictly matching wildcards and priority
# POST /stats/flowentry/modify_strict
#
# delete all matching flow entries
# POST /stats/flowentry/delete
#
# delete flow entry strictly matching wildcards and priority
# POST /stats/flowentry/delete_strict
#
# delete all flow entries of the switch
# DELETE /stats/flowentry/clear/<dpid>
#
# add a meter entry
# POST /stats/meterentry/add
#
# modify a meter entry
# POST /stats/meterentry/modify
#
# delete a meter entry
# POST /stats/meterentry/delete
#
# add a group entry
# POST /stats/groupentry/add
#
# modify a group entry
# POST /stats/groupentry/modify
#
# delete a group entry
# POST /stats/groupentry/delete
#
# modify behavior of the physical port
# POST /stats/portdesc/modify
#
# modify role of controller
# POST /stats/role
#
#
# send a experimeter message
# POST /stats/experimenter/<dpid>

(三)Ryu官方文档:https://ryu.readthedocs.io/en/latest/app/ofctl_rest.html

三:实验开始

(一)开启Ryu控制器

ryu-manager ofctl_rest.py simple_switch_13.py --observe-links --verbose  #除了使用RESTAPI之外,我们还要保证ryu控制器正常处理交换机逻辑

(二)开启Mininet

sudo mn --controller=remote --mac --topo=tree,,

(三)使用Curl发送URL请求

1.获取到所有交换机Get the list of all switches which connected to the controller.

$ curl -X GET http://localhost:8080/stats/switches

2.获取交换机的描述信息Get the desc stats of the switch which specified with Datapath ID in URI.

$ curl -X GET http://localhost:8080/stats/desc/1

3.其他类似

(四)Postman实验(更美观)

1.安装postman

2.获取交换机信息

SDN实验---Ryu的应用开发(四)北向接口RESTAPI的更多相关文章

  1. SDN实验---Ryu的应用开发(二)Learning Switch

    一:自学习交换机(二层MAC交换机)的编程思路 (一)明确问题 如何实现软件定义的自学习交换机? (二)设计解决方案 通过控制器来实现自学习交换算法,然后指导数据平面实现交换机操作 (三)确定具体的技 ...

  2. SDN实验---Ryu的应用开发(三)流量监控

    一:实现流量监控 (一)流量监控原理 其中控制器向交换机周期下发获取统计消息,请求交换机消息------是主动下发过程 流速公式:是(t1时刻的流量-t0时刻的流量)/(t1-t0) 剩余带宽公式:链 ...

  3. SDN实验---Ryu的应用开发(四)基于跳数的最短路径转发原理

    一:实现最短跳数转发 (一)原理 推文:迪杰斯特拉算法和弗洛伊德算法 二:代码实现 (一)全部代码 from ryu.base import app_manager from ryu.controll ...

  4. SDN实验---Ryu的应用开发(一)Hub实现

    补充: (一)Ubuntu下安装Notepadqq 背景:为什么安装Notepadqq Notepad++ 不仅有语法高亮度显示,也有语法折叠功能,并且支持宏以及扩充基本功能的外挂模组.但是可惜的是N ...

  5. SDN实验---Ryu的源码分析

    一:安装Pycharm https://www.cnblogs.com/huozf/p/9304396.html(有可取之处) https://www.jetbrains.com/idea/buy/# ...

  6. SDN实验---Ryu的安装

    一:Ryu是主流SDN开源控制器之一 (一)推文(摘录自) https://ryu.readthedocs.io/en/latest/ https://www.sdnlab.com/1785.html ...

  7. SDN实验---Mininet实验(玩转流表)

    一:实验目的 (一)案例目的 (二)实验内容 (三)网络拓扑结构 二:OpenFlow流表实验准备 (一)使用Python设置网络拓扑 --- tree_topo.py from mininet.to ...

  8. 实验四实验报告————Android基础开发

    实验四实验报告----Android基础开发 任务一 关于R类 关于apk文件 实验成果 任务二 活动声明周期 实验成果 任务三 关于PendingIntent类 实验成果 任务四 关于布局 实验成果 ...

  9. 20162308 实验一《Java开发环境的熟悉》实验报告

    a 20162308 实验一<Java开发环境的熟悉>实验报告 实验内容 使用JDK编译.运行简单的Java程序. 使用IDEA 编辑.编译.运行.调试Java程序. 实验要求 没有Lin ...

随机推荐

  1. nohup 、&、 2>&1 命令分析

    nohup的意思是不间断的运行,&的意思是后台运行,2>&1的意思是标准输出和错误输出都重定向到同一个文件. 简单地说nohup运行时即使关掉控制台,它该运行还是运行. http ...

  2. Unity 渲染教程(四):第一个光源

    将法线从物体空间转换到世界空间. 使用方向光. 计算漫反射和镜面高光反射. 实现能量守恒. 使用金属的工作流程. 利用Unity的基于物理规则渲染的算法. 这是关于渲染基础的系列教程的第四部分.前面的 ...

  3. 2019年杭电多校第三场 1008题Game(HDU6610+带修改莫队+Nim博弈)

    题目链接 传送门 题意 给你\(n\)堆石子,每堆有\(a_i\)堆石子,\(q\)次操作: 在\([L,R]\)内有多少个子区间使得\(Alice\)(先手)在\(Nim\)博弈中获胜: 交换\(a ...

  4. python与设计模式--单例模式

    https://zhuanlan.zhihu.com/p/31675841 设计模式分类 创建类 单例模式.工厂模式.抽象工厂模式.原型模式.建造者模式 结构类 装饰器模式.适配器模式.门面模式.组合 ...

  5. 为什么使用正则RegExp.test( )方法时第一次是 true,第二次是false?

    今天朋友问我一个问题,我现在需要多次匹配同一个内容,但是为什么我第一次匹配,直接是 true,而第二次匹配确实 false 呢? var s1 = "MRLP"; var s2 = ...

  6. python基础笔记-列表

    列表是最常用的Python数据类型,它可以作为一个方括号内的逗号分隔值出现. 列表的数据项不需要具有相同的类型 创建一个列表,只要把逗号分隔的不同的数据项使用方括号括起来即可. def main(): ...

  7. python应用-跑马灯

    import os import time def main(): str1='欢迎来到前锋学习Python' while True: os.system('cls') print(str1) tim ...

  8. IDEA 注释模板

    类.接口.等文件注释: /** * @Description: * @author: tangsw * @date: ${DATE} ${TIME} * */ 方法上注释: /** * @Descri ...

  9. python基础语法13 内置模块 subprocess,re模块,logging日志记录模块,防止导入模块时自动执行测试功能,包的理论

    subprocess模块: - 可以通过python代码给操作系统终端发送命令, 并且可以返回结果. sub: 子    process: 进程 import subprocess while Tru ...

  10. wordpress获取当前页面链接

    我们知道wordpress的<?php the_permalink(); ?>和<?php echo get_permalink(); ?>可以获取页面链接,但是有些比较复杂的 ...