标签:weight help ror The .com forward ppa python模块 err
1.安装python模块networkx
pip install networkx
2.给Network_Awareness.py加修改权限
chmod 777 Network_Awareness.py
3.下载安装ryu
git clone git://github.com/osrg/ryu.git
cd ryu sudo python
./setup.py install
#若已安装ryu,删了再装, pip uninstall ryu
4.修改“***/ryu/ryu/flags.py"文件,在实例“CONF”调用的方法“register_cli_opts”的字典里添加:
CONF.register_cli_opts([
# k_shortest_forwarding
cfg.IntOpt(‘k-paths‘, default=1, help=‘number for k shortest paths‘),
cfg.StrOpt(‘weight‘, default=‘hop‘,
help=‘weight type of computing shortest path.‘)])
如图:
self.delay = 0
在“@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)”下添加:
def packet_in_handler(self, ev):
# add code for getting LLDP packet receiving timestamp
recv_timestamp = time.time()
if not self.link_discovery:
return
msg = ev.msg
try:
src_dpid, src_port_no = LLDPPacket.lldp_parse(msg.data)
except LLDPPacket.LLDPUnknownFormat as e:
# This handler can receive all the packtes which can be
# not-LLDP packet. Ignore it silently
return
dst_dpid = msg.datapath.id
if msg.datapath.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
dst_port_no = msg.in_port
elif msg.datapath.ofproto.OFP_VERSION >= ofproto_v1_2.OFP_VERSION:
dst_port_no = msg.match[‘in_port‘]
else:
LOG.error(‘cannot accept LLDP. unsupported version. %x‘,
msg.datapath.ofproto.OFP_VERSION)
# get the lldp delay, and save it into port_data.
for port in self.ports.keys():
if src_dpid == port.dpid and src_port_no == port.port_no:
send_timestamp = self.ports[port].timestamp
if send_timestamp:
self.ports[port].delay = recv_timestamp - send_timestamp
cd ***/ryu
python setup.py install
7.启动ryu控制器
ryu-manager shortest_forwarding.py --observe-links --k-paths=2 --weight=bw
8.开启mininet并连接控制器
mn --controller=remote,ip=192.168.1.197,port=6653
注:“ip”填写的是启动ryu控制器的那台主机的ip
标签:weight help ror The .com forward ppa python模块 err
原文地址:https://www.cnblogs.com/ownhp/p/9094912.html