一、基本要求
1.编写Python程序,调用OpenDaylight的北向接口实现以下功能
1)利用Mininet搭建拓扑,并连接OpenDaylight
OpenDaylight连接拓扑
2)下发指令删除s1上的流表数据
展开源码(请用火狐或者谷歌打开)
#!/usr/bin/python import requests from requests.auth import HTTPBasicAuth def http_delete(url): url = url headers = {'Content-Type':'application/json'} resp = requests.delete(url,headers=headers,auth=HTTPBasicAuth('admin', 'admin')) return resp
if name == "main":
url = 'http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/'
resp = http_delete(url)
print (resp.content)