def handle_port_desc_request(self, req): port_list = yield self.rpc.get_port_list(self.device_id) self.cxn.send(ofp.message.port_desc_stats_reply( xid=req.xid, #flags=None, entries=[to_loxi(port.ofp_port) for port in port_list] ))
def forward_packet_in(self, ofp_packet_in): if self.role == ofp.OFPCR_ROLE_MASTER or self.role == ofp.OFPCR_ROLE_EQUAL: log.info('sending-packet-in', ofp_packet_in=ofp_packet_in) self.cxn.send(to_loxi(ofp_packet_in)) self.count_pkt_in += 1 log.debug('counters of_protocol_handler IN - {}'.format( self.count_pkt_in))
def handle_flow_stats_request(self, req): try: flow_stats = yield self.rpc.list_flows(self.device_id) self.cxn.send(ofp.message.flow_stats_reply( xid=req.xid, entries=[to_loxi(f) for f in flow_stats])) except Exception, e: log.exception('failed-flow-stats-request', req=req)
def handle_meter_stats_request(self, req): try: meter_stats = yield self.rpc.get_meter_stats(self.device_id) meter_stats = [to_loxi(m) for m in meter_stats] of_message = ofp.message.meter_stats_reply(xid=req.xid, entries=meter_stats) self.cxn.send(of_message) except Exception, e: log.exception("failed-meter-stats-request", req=req, e=e)
def handle_port_stats_request(self, req): try: ports = yield self.rpc.list_ports(self.device_id) port_stats = [to_loxi(p.ofp_port_stats) for p in ports] of_message = ofp.message.port_stats_reply( xid=req.xid,entries=port_stats) self.cxn.send(of_message) except: log.exception('failed-port_stats-request', req=req)
def handle_meter_stats_request(self, req): log.info('Received handle_meter_stats_request', request=req) try: meters = yield self.rpc.list_meters(self.device_id) self.cxn.send( ofp.message.meter_stats_reply( xid=req.xid, entries=[to_loxi(m.stats) for m in meters])) except Exception, e: log.exception("failed-meter-stats-request", req=req, e=e)
def handle_port_desc_request(self, req): port_list = yield self.rpc.get_port_list(self.device_id) try: self.cxn.send( ofp.message.port_desc_stats_reply( xid=req.xid, #flags=None, entries=[to_loxi(port.ofp_port) for port in port_list])) except Exception as err: log.exception('failed-port-desc-reply', err=err)
def forward_port_status(self, ofp_port_status): self.cxn.send(to_loxi(ofp_port_status))
def forward_packet_in(self, ofp_packet_in): if self.role == ofp.OFPCR_ROLE_MASTER or self.role == ofp.OFPCR_ROLE_EQUAL: log.info('sending-packet-in', ofp_packet_in=ofp_packet_in) self.cxn.send(to_loxi(ofp_packet_in))
def handle_group_descriptor_request(self, req): group_stats = yield self.rpc.list_groups(self.device_id) self.cxn.send(ofp.message.group_desc_stats_reply( xid=req.xid, entries=[to_loxi(g.desc) for g in group_stats]))
def forward_packet_in(self, ofp_packet_in): log.info('sending-packet-in', ofp_packet_in=ofp_packet_in) self.cxn.send(to_loxi(ofp_packet_in))
def forward_flow_removed(self, ofp_flow_removed): self.cxn.send(to_loxi(ofp_flow_removed))