7. simple_monitor.py
• View the Code
# vi ./simple_monitor,py
@set_ev_cls(ofp_event.EventOFPPortStatsReply, MAIN_DISPATCHER)
def _port_stats_reply_handler(self, ev): # 스위치의 응답받는 이벤트핸들러, port_stats_reply 수신
body = ev.msg.body # body, OFPPortStatsReply의 속성
self.logger.info('datapath port '
'rx-pkts rx-bytes rx-error '
'tx-pkts tx-bytes tx-error')
self.logger.info('---------------- -------- '
'-------- -------- -------- '
'-------- -------- --------')
for stat in sorted(body, key=attrgetter('port_no')):
self.logger.info('%016x %8x %8d %8d %8d %8d %8d %8d',
ev.msg.datapath.id, stat.port_no, #포트 번호별로 정렬
stat.rx_packets, stat.rx_bytes, stat.rx_errors, # 수신 패킷 개수, 수신된 바이트 수신 오류 개수,
stat.tx_packets, stat.tx_bytes, stat.tx_errors) # 전송 패킷 수, 송신 바이트 수, 전송 오류 개수 출력
Port 관련 통계정보
: 포트 번호, 송수신 각각의 패킷 수, 바이트 수, 드롭 개수, 오류 개수, 프레임 오류 개수, 오버런 개수, CRC 오류 개수, 충돌 개수 등 통계 정보
8. Ryubook Practice
• 이번엔,
Ryu응용 프로그램에서 Thread생성 방법
DataPath의 상태변화 확인
FlowStats 및 PortStats 수집 및 방법
• 호스트에서 Midinet 실행
# mn --topo single,3 --mac --switch ovsk --controller remote –x
• 스위치에서 OpenFlow 프로토콜 설정
# ovs-vsctl set Bridge s1 protocols=OpenFlow13
확인
# ovs-ofctl -O OpenFlow13 dump-flows s1
OFPST_FLOW reply (OF1.3) (xid=0x2):
#
9. TEST
• 트래픽 모니터 실행
Controller, c0:
# ryu-manager –verbose /usr/local/lib/python2.7/disk-package/tyu/simple_monitor.py
……
10. TEST
• 트래픽 모니터 실행
Table-miss(0)은 표시되지 않음으로 아무
내용도 없음
: 플로우 및 포트 정보 모두 없음