OVS 精确删除流表

OVS 精确删除流表

前言

今天看了sdnlab小姐姐的mininet教程之后,看到有一个下流表的操作,优先级没能下成功,然后回来实验一下,这个问题是解决了,不过遇到了一个小问题,ovs如何精确删除流表

OVS精确删除流表

查找了若干文献、文档均无果

  • 问题描述

以下是我的流表

OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=50.313s, table=0, n_packets=55, n_bytes=3878, priority=0 actions=CONTROLLER:65535
cookie=0x0, duration=2.921s, table=0, n_packets=0, n_bytes=0, priority=100,in_port=1 actions=drop
cookie=0x0, duration=42.320s, table=0, n_packets=167, n_bytes=10020, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=2746.808s, table=0, n_packets=20, n_bytes=1400, priority=1,in_port=3,dl_dst=de:34:d2:d3:1b:1e actions=output:2
cookie=0x0, duration=2746.809s, table=0, n_packets=20, n_bytes=1400, priority=1,in_port=2,dl_dst=72:11:da:8b:c8:6e actions=output:3
cookie=0x0, duration=2746.814s, table=0, n_packets=20, n_bytes=1400, priority=1,in_port=3,dl_dst=66:6b:6d:d1:97:cc actions=output:1
cookie=0x0, duration=2746.820s, table=0, n_packets=28, n_bytes=2128, priority=1,in_port=2,dl_dst=66:6b:6d:d1:97:cc actions=output:1
cookie=0x0, duration=47.854s, table=0, n_packets=3, n_bytes=182, priority=1,in_port=1,dl_dst=72:11:da:8b:c8:6e actions=output:3
cookie=0x0, duration=47.865s, table=0, n_packets=3, n_bytes=182, priority=1,in_port=1,dl_dst=de:34:d2:d3:1b:1e actions=output:2

目的是为了删除上面的第二条流表

cookie=0x0, duration=2.921s, table=0, n_packets=0, n_bytes=0, priority=100,in_port=1 actions=drop

试了各种,优先级匹配,动作匹配均发现这不是其关键字,无法做到,稍稍得到OVS命令行的缺陷无法精确删除流表(希望大家打脸)~~ 想了想堂堂一个OVS不支持精确删除流表,我以前做的那些控制器删除流表的实验是怎么实现的,其本质不是也是调用底层吗?以前ODL是根据table-id,flow-id,我通过命令行查看的流表其中并无flow-id该关键字。

后来还是向控制器求助了,查看了RYU的官方RestFul接口,其删除流表可以用到优先级以及对应的匹配域得到

# delete flow entry strictly matching wildcards and priority
# POST /stats/flowentry/delete_strict

于是我就用POSTMAN搞了

OVS 精确删除流表

然后就删除了

OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=62.799s, table=0, n_packets=55, n_bytes=3878, priority=0 actions=CONTROLLER:65535
cookie=0x0, duration=54.806s, table=0, n_packets=169, n_bytes=10140, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=CONTROLLER:65535
cookie=0x0, duration=2759.294s, table=0, n_packets=20, n_bytes=1400, priority=1,in_port=3,dl_dst=de:34:d2:d3:1b:1e actions=output:2
cookie=0x0, duration=2759.295s, table=0, n_packets=20, n_bytes=1400, priority=1,in_port=2,dl_dst=72:11:da:8b:c8:6e actions=output:3
cookie=0x0, duration=2759.300s, table=0, n_packets=20, n_bytes=1400, priority=1,in_port=3,dl_dst=66:6b:6d:d1:97:cc actions=output:1
cookie=0x0, duration=2759.306s, table=0, n_packets=28, n_bytes=2128, priority=1,in_port=2,dl_dst=66:6b:6d:d1:97:cc actions=output:1
cookie=0x0, duration=60.340s, table=0, n_packets=3, n_bytes=182, priority=1,in_port=1,dl_dst=72:11:da:8b:c8:6e actions=output:3
cookie=0x0, duration=60.351s, table=0, n_packets=3, n_bytes=182, priority=1,in_port=1,dl_dst=de:34:d2:d3:1b:1e actions=output:2

结论

与其说是结论,我觉得更适合说是我的猜想,OVS依旧也是向上层提供相应的OpenFlow的接口,供与控制器交互,我们使用命令行去对OVS进行操纵,其实本身也有利用一些OVS的接口,只是我们命令行的接口封装得并不是那么全面,所有有些操作还是得通过控制器层面去进行,命令行可以作为一种辅助的工具。

上一篇:【JSON】Ajax获得JSON字符串的处理方法


下一篇:[转]Web Api系列教程第2季(OData篇)(二)——使用Web Api创建只读的OData服务