SDN

如何用postman控制ODL对queue做限速配置

2016-08-23  本文已影响490人  ljyfree

OVS的QoS配置和queue的配置存储在OVSDB中。利用OpenDaylight提供的OVSDB南向接口,可以对OVSDB配置QoS/Queue策略,并应用到接口上

准备工作

>feature:install odl-ovsdb-southbound-impl-ui

实验步骤

Mininet OVSDB连接到ODL

# ovs-vsctl set-manager ptcp:6640

ODL上添加node信息

{
  "network-topology:node":[
        {
                "node-id": "ovsdb://10.10.11.220:6640",
                "connection-info": {
                        "ovsdb:remote-port": 6640,
                        "ovsdb:remote-ip": "10.10.11.220"
                }
        }
  ]
}

查看连接状态

# netstat -apn | grep 6640
tcp6       0      0 :::6640                 :::*                    LISTEN      22598/java      
tcp6       0      0 10.10.33.239:44982      10.10.11.220:6640       ESTABLISHED 22598/java   
# ovs-vsctl show
32db576f-cfb5-401a-b061-1acb912b997e
    Manager "ptcp:6640"
         is_connected:true
....

查看获取的bridge的信息

向queue-entries中添加QUEUE-1

{
  "ovsdb:queues": [
    {
      "queue-id": "QUEUE-1",
      "queues-other-config": [
        {
          "queue-other-config-key": "max-rate",
          "queue-other-config-value": "10"
        }
      ]
    }
  ]
}

类似地再添加QUEUE-2

{
  "ovsdb:queues": [
    {
      "queue-id": "QUEUE-2",
      "queues-other-config": [
        {
          "queue-other-config-key": "max-rate",
          "queue-other-config-value": "20"
        }
      ]
    }
  ]
}

获取分配给两个queue的uuid

{
    "ovsdb:queues": [
        {
            "queue-id": "QUEUE-1",
            "queues-external-ids": [
                {
                    "queues-external-id-key": "opendaylight-iid",
                    "queues-external-id-value": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://10.10.11.220:6640']/ovsdb:queues[ovsdb:queue-id='QUEUE-1']"
                }
            ],
            "queues-other-config": [
                {
                    "queue-other-config-key": "max-rate",
                    "queue-other-config-value": "10"
                }
            ],
            "queue-uuid": "e7c01279-c27b-4d4a-ae24-bbd61f9b721d"
        }
    ]
}

将两条queue的配置加到QoS entry

{
  "ovsdb:qos-entries": [
    {
      "qos-id": "QOS-1",
      "queue-list": [
          {
              "queue-number": "1",
              "queue-uuid": "e7c01279-c27b-4d4a-ae24-bbd61f9b721d"
          },
        {
              "queue-number": "2",
              "queue-uuid": "e6b797c6-6759-454a-bee8-c67d54e23990"
          }
        ]
    }
  ]
}

获取QOS的uuid

{
    "ovsdb:qos-entries": [
        {
            "qos-id": "QOS-1",
            "qos-type": "ovsdb:qos-type-base",
            "queue-list": [
                {
                    "queue-number": 2,
                    "queue-uuid": "e6b797c6-6759-454a-bee8-c67d54e23990",
                    "queue-ref": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://10.10.11.220:6640']/ovsdb:queues[ovsdb:queue-id='QUEUE-2']"
                },
                {
                    "queue-number": 1,
                    "queue-uuid": "e7c01279-c27b-4d4a-ae24-bbd61f9b721d",
                    "queue-ref": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://10.10.11.220:6640']/ovsdb:queues[ovsdb:queue-id='QUEUE-1']"
                }
            ],
            "qos-uuid": "6d2df68d-7f9d-4ff1-912c-dbac7e6bcec4",
            "qos-external-ids": [
                {
                    "qos-external-id-key": "opendaylight-iid",
                    "qos-external-id-value": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://10.10.11.220:6640']/ovsdb:qos-entries[ovsdb:qos-id='QOS-1']"
                }
            ]
        }
    ]
}

将QOS-1应用到termination-point s1-eth1上

{
  "network-topology:termination-point": [
        {
                        "ovsdb:name": "s1-eth1",
                        "tp-id": "s1-eth1",
                        "qos": "6d2df68d-7f9d-4ff1-912c-dbac7e6bcec4"
                }
    ]
}

获取s1-eth1的信息

{
    "termination-point": [
        {
            "tp-id": "s1-eth1",
            "ovsdb:ingress-policing-burst": 0,
            "ovsdb:port-uuid": "3327f25e-d329-41bc-8128-001e4f9222c5",
            "ovsdb:name": "s1-eth1",
            "ovsdb:interface-uuid": "72bcdcaf-1c64-4b03-b4e0-4d02e49020cd",
            "ovsdb:ifindex": 20,
            "ovsdb:ofport": 1,
            "ovsdb:ingress-policing-rate": 0,
            "ovsdb:port-external-ids": [
                {
                    "external-id-key": "opendaylight-iid",
                    "external-id-value": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://10.10.11.220:6640/bridge/s1']/network-topology:termination-point[network-topology:tp-id='s1-eth1']"
                }
            ],
            "ovsdb:qos-entry": [
                {
                    "qos-key": 1,
                    "qos-ref": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://10.10.11.220:6640']/ovsdb:qos-entries[ovsdb:qos-id='QOS-1']"
                }
            ],
            "ovsdb:qos": "6d2df68d-7f9d-4ff1-912c-dbac7e6bcec4"
        }
    ]
}

从s1-eth1去掉QOS-1

{
  "network-topology:termination-point": [
        {
                        "ovsdb:name": "s1-eth1",
                        "tp-id": "s1-eth1"
                }
    ]
}

删除queue entry

删除QOS entry

一些说明

关于queue rate

ovs-vsctl set port s1-eth1 qos=@newqos -- --id=@newqos create qos \
  type=linux-htb queues:1=@newqueue1 queues:2=@newqueue2 \
  -- --id=@newqueue1 create queue other-config:max-rate=10 \
  -- --id=@newqueue2 create queue other-config:max-rate=20 
/* Max-Rate queue property description. */
struct ofp_queue_desc_prop_max_rate {
uint16_t type; /* OFPQDPT_MAX_RATE. */
uint16_t length; /* Length is 8. */
uint16_t rate; /* In 1/10 of a percent; >1000 -> disabled. */
uint8_t pad[2]; /* 64-bit alignment */
};

关于queue-get-config命令的说明

# ovs-ofctl queue-get-config s1 s1-eth1
OFPT_QUEUE_GET_CONFIG_REPLY (xid=0x4): port=1
# 

本文首发与SDNLAB http://www.sdnlab.com/17601.html

上一篇下一篇

猜你喜欢

热点阅读