of13: use text address for OFPPort.hw_addr and OFPPortMod.hw_addr
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
ec23d73770
commit
1a3adadca4
@ -17,6 +17,7 @@
|
|||||||
import struct
|
import struct
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
from ryu.lib import addrconv
|
||||||
from ryu.lib import mac
|
from ryu.lib import mac
|
||||||
from ryu import utils
|
from ryu import utils
|
||||||
from ofproto_parser import StringifyMixin, MsgBase, msg_pack_into, msg_str_attr
|
from ofproto_parser import StringifyMixin, MsgBase, msg_pack_into, msg_str_attr
|
||||||
@ -1748,6 +1749,9 @@ class OFPPort(ofproto_parser.namedtuple('OFPPort', (
|
|||||||
@classmethod
|
@classmethod
|
||||||
def parser(cls, buf, offset):
|
def parser(cls, buf, offset):
|
||||||
port = struct.unpack_from(ofproto_v1_3.OFP_PORT_PACK_STR, buf, offset)
|
port = struct.unpack_from(ofproto_v1_3.OFP_PORT_PACK_STR, buf, offset)
|
||||||
|
i = cls._fields.index('hw_addr')
|
||||||
|
port = list(port)
|
||||||
|
port[i] = addrconv.mac.bin_to_text(port[i])
|
||||||
ofpport = cls(*port)
|
ofpport = cls(*port)
|
||||||
ofpport._length = ofproto_v1_3.OFP_PORT_SIZE
|
ofpport._length = ofproto_v1_3.OFP_PORT_SIZE
|
||||||
return ofpport
|
return ofpport
|
||||||
@ -2416,7 +2420,8 @@ class OFPPortMod(MsgBase):
|
|||||||
def _serialize_body(self):
|
def _serialize_body(self):
|
||||||
msg_pack_into(ofproto_v1_3.OFP_PORT_MOD_PACK_STR, self.buf,
|
msg_pack_into(ofproto_v1_3.OFP_PORT_MOD_PACK_STR, self.buf,
|
||||||
ofproto_v1_3.OFP_HEADER_SIZE,
|
ofproto_v1_3.OFP_HEADER_SIZE,
|
||||||
self.port_no, self.hw_addr, self.config,
|
self.port_no, addrconv.mac.text_to_bin(self.hw_addr),
|
||||||
|
self.config,
|
||||||
self.mask, self.advertise)
|
self.mask, self.advertise)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user