SDN实验

一:推文

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

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

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

(一)Ryu的RESTAPI

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

1.所提供的样例API接口

1# REST API 2# 3 4# Retrieve the switch stats 5# 6# get the list of all switches 7# GET /stats/switches 8# 9# get the desc stats of the switch 10# GET /stats/desc/<dpid> 11# 12# get flows desc stats of the switch 13# GET /stats/flowdesc/<dpid> 14# 15# get flows desc stats of the switch filtered by the fields 16# POST /stats/flowdesc/<dpid> 17# 18# get flows stats of the switch 19# GET /stats/flow/<dpid> 20# 21# get flows stats of the switch filtered by the fields 22# POST /stats/flow/<dpid> 23# 24# get aggregate flows stats of the switch 25# GET /stats/aggregateflow/<dpid> 26# 27# get aggregate flows stats of the switch filtered by the fields 28# POST /stats/aggregateflow/<dpid> 29# 30# get table stats of the switch 31# GET /stats/table/<dpid> 32# 33# get table features stats of the switch 34# GET /stats/tablefeatures/<dpid> 35# 36# get ports stats of the switch 37# GET /stats/port/<dpid>[/<port>] 38# Note: Specification of port number is optional 39# 40# get queues stats of the switch 41# GET /stats/queue/<dpid>[/<port>[/<queue_id>]] 42# Note: Specification of port number and queue id are optional 43# If you want to omitting the port number and setting the queue id, 44# please specify the keyword "ALL" to the port number 45# e.g. GET /stats/queue/1/ALL/1 46# 47# get queues config stats of the switch 48# GET /stats/queueconfig/<dpid>[/<port>] 49# Note: Specification of port number is optional 50# 51# get queues desc stats of the switch 52# GET /stats/queuedesc/<dpid>[/<port>[/<queue_id>]] 53# Note: Specification of port number and queue id are optional 54# If you want to omitting the port number and setting the queue id, 55# please specify the keyword "ALL" to the port number 56# e.g. GET /stats/queuedesc/1/ALL/1 57# 58# get meter features stats of the switch 59# GET /stats/meterfeatures/<dpid> 60# 61# get meter config stats of the switch 62# GET /stats/meterconfig/<dpid>[/<meter_id>] 63# Note: Specification of meter id is optional 64# 65# get meter desc stats of the switch 66# GET /stats/meterdesc/<dpid>[/<meter_id>] 67# Note: Specification of meter id is optional 68# 69# get meters stats of the switch 70# GET /stats/meter/<dpid>[/<meter_id>] 71# Note: Specification of meter id is optional 72# 73# get group features stats of the switch 74# GET /stats/groupfeatures/<dpid> 75# 76# get groups desc stats of the switch 77# GET /stats/groupdesc/<dpid>[/<group_id>] 78# Note: Specification of group id is optional (OpenFlow 1.5 or later) 79# 80# get groups stats of the switch 81# GET /stats/group/<dpid>[/<group_id>] 82# Note: Specification of group id is optional 83# 84# get ports description of the switch 85# GET /stats/portdesc/<dpid>[/<port_no>] 86# Note: Specification of port number is optional (OpenFlow 1.5 or later) 87 88# Update the switch stats 89# 90# add a flow entry 91# POST /stats/flowentry/add 92# 93# modify all matching flow entries 94# POST /stats/flowentry/modify 95# 96# modify flow entry strictly matching wildcards and priority 97# POST /stats/flowentry/modify_strict 98# 99# delete all matching flow entries 100# POST /stats/flowentry/delete 101# 102# delete flow entry strictly matching wildcards and priority 103# POST /stats/flowentry/delete_strict 104# 105# delete all flow entries of the switch 106# DELETE /stats/flowentry/clear/<dpid> 107# 108# add a meter entry 109# POST /stats/meterentry/add 110# 111# modify a meter entry 112# POST /stats/meterentry/modify 113# 114# delete a meter entry 115# POST /stats/meterentry/delete 116# 117# add a group entry 118# POST /stats/groupentry/add 119# 120# modify a group entry 121# POST /stats/groupentry/modify 122# 123# delete a group entry 124# POST /stats/groupentry/delete 125# 126# modify behavior of the physical port 127# POST /stats/portdesc/modify 128# 129# modify role of controller 130# POST /stats/role 131# 132# 133# send a experimeter message 134# 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,2,2

 

(三)使用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.获取交换机信息

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )